Skip to content

Commit

Permalink
feat(ui): Add dark app loading theme (#81611)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored Dec 10, 2024
1 parent a7387f1 commit c3b94ea
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
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 %}
11 changes: 10 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,14 @@ 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", None) and react_config["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 +108,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

0 comments on commit c3b94ea

Please sign in to comment.