Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Add dark app loading theme #81611

Merged
merged 9 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sentry/templates/sentry/base-react.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
</div>
</div>
{% endblock %}

{% block wrapperclass %}{{ user_theme }}{% endblock %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

9 changes: 8 additions & 1 deletion src/sentry/web/frontend/react_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def dns_prefetch(self) -> list[str]:

def handle_react(self, request: Request, **kwargs) -> HttpResponse:
org_context = getattr(self, "active_organization", None)
react_config = get_client_config(request, org_context)

user_theme = ""
if react_config.get("user", {}).get("options", {}).get("theme", None):
user_theme = f"theme-{react_config['user']['options']['theme']}"

context = {
"CSRF_COOKIE_NAME": settings.CSRF_COOKIE_NAME,
"meta_tags": [
Expand All @@ -100,7 +106,8 @@ def handle_react(self, request: Request, **kwargs) -> HttpResponse:
# Since we already have it here from the OrganizationMixin, we can
# save some work and render it faster.
"org_context": org_context,
"react_config": get_client_config(request, org_context),
"react_config": react_config,
"user_theme": user_theme,
}

# Force a new CSRF token to be generated and set in user's
Expand Down
16 changes: 16 additions & 0 deletions static/less/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ body {
min-height: 100vh;
}

// Applied to body
body.theme-dark {
// theme.surface200
background: #1A141F;
// theme.gray400
color: #D6D0DC;
}
body.theme-system {
@media (prefers-color-scheme: dark) {
// theme.surface200
background: #1A141F;
// theme.gray400
color: #D6D0DC;
}
}

h1,
h2,
h3,
Expand Down
18 changes: 18 additions & 0 deletions static/less/shared-components.less
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ table.table.key-value {
}
}

.theme-dark .loading .loading-indicator {
// theme.surface200
background: #1A141F;
}

@-webkit-keyframes loading {
0% {
-webkit-transform: rotate(0deg);
Expand Down Expand Up @@ -519,6 +524,19 @@ table.table.key-value {
}
}

.theme-dark .loading.triangle .loading-indicator {
filter: invert(100%);
opacity: 0.8;
}
body.theme-system {
@media (prefers-color-scheme: dark) {
.loading.triangle .loading-indicator {
filter: invert(100%);
opacity: 0.8;
}
}
}

/**
* Box
* ============================================================================
Expand Down
Loading