Skip to content

Commit c3b94ea

Browse files
authored
feat(ui): Add dark app loading theme (#81611)
1 parent a7387f1 commit c3b94ea

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

src/sentry/templates/sentry/base-react.html

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
</div>
1919
</div>
2020
{% endblock %}
21+
22+
{% block wrapperclass %}{{ user_theme }}{% endblock %}

src/sentry/web/frontend/react_page.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ def dns_prefetch(self) -> list[str]:
8888

8989
def handle_react(self, request: Request, **kwargs) -> HttpResponse:
9090
org_context = getattr(self, "active_organization", None)
91+
react_config = get_client_config(request, org_context)
92+
93+
user_theme = ""
94+
if react_config.get("user", None) and react_config["user"].get("options", {}).get(
95+
"theme", None
96+
):
97+
user_theme = f"theme-{react_config['user']['options']['theme']}"
98+
9199
context = {
92100
"CSRF_COOKIE_NAME": settings.CSRF_COOKIE_NAME,
93101
"meta_tags": [
@@ -100,7 +108,8 @@ def handle_react(self, request: Request, **kwargs) -> HttpResponse:
100108
# Since we already have it here from the OrganizationMixin, we can
101109
# save some work and render it faster.
102110
"org_context": org_context,
103-
"react_config": get_client_config(request, org_context),
111+
"react_config": react_config,
112+
"user_theme": user_theme,
104113
}
105114

106115
# Force a new CSRF token to be generated and set in user's

static/less/base.less

+16
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ body {
3232
min-height: 100vh;
3333
}
3434

35+
// Applied to body
36+
body.theme-dark {
37+
// theme.surface200
38+
background: #1A141F;
39+
// theme.gray400
40+
color: #D6D0DC;
41+
}
42+
body.theme-system {
43+
@media (prefers-color-scheme: dark) {
44+
// theme.surface200
45+
background: #1A141F;
46+
// theme.gray400
47+
color: #D6D0DC;
48+
}
49+
}
50+
3551
h1,
3652
h2,
3753
h3,

static/less/shared-components.less

+18
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ table.table.key-value {
438438
}
439439
}
440440

441+
.theme-dark .loading .loading-indicator {
442+
// theme.surface200
443+
background: #1A141F;
444+
}
445+
441446
@-webkit-keyframes loading {
442447
0% {
443448
-webkit-transform: rotate(0deg);
@@ -519,6 +524,19 @@ table.table.key-value {
519524
}
520525
}
521526

527+
.theme-dark .loading.triangle .loading-indicator {
528+
filter: invert(100%);
529+
opacity: 0.8;
530+
}
531+
body.theme-system {
532+
@media (prefers-color-scheme: dark) {
533+
.loading.triangle .loading-indicator {
534+
filter: invert(100%);
535+
opacity: 0.8;
536+
}
537+
}
538+
}
539+
522540
/**
523541
* Box
524542
* ============================================================================

0 commit comments

Comments
 (0)