From 6f5df6db6eb99066ecfdf6b53cd51f797cd1e2f5 Mon Sep 17 00:00:00 2001 From: Juan Denis Date: Thu, 11 Jun 2026 02:11:49 -0400 Subject: [PATCH] refactor(styles): promote .sk-state primitive + final design-system sweeps (1) New %sk-state placeholder + .sk-state class in _design-system.scss (mono uppercase state chip, 7 tone modifiers); the 5 page-local copies (.mon-state/.sec-state/.inc-state+.inc-impact/.git-chip/.bk-type) now @extend it - class names and JSX untouched, compiled output verified equivalent. (2) Dead connectionColors export removed from connectionRules.js (zero consumers). (3) _email.scss globals evicted: .status-badge deleted (its unique content was dead variants + a phantom ::before dot artifact in two text badges - strict improvement), .empty-state moved to _empty-state.scss via an html-prefixed bridge that preserves the cascade over page-partial copies. (4) TokenModal blocks in _servers.scss re-tokened (--bg-code scripts/connection string, eyebrow labels, green status dot) - no other selectors in the file changed. Co-Authored-By: Claude Fable 5 --- .../src/styles/components/_design-system.scss | 35 +++++++++ .../src/styles/components/_empty-state.scss | 18 +++++ frontend/src/styles/pages/_backups.scss | 10 +-- frontend/src/styles/pages/_email.scss | 53 ------------- frontend/src/styles/pages/_git.scss | 12 +-- frontend/src/styles/pages/_monitoring.scss | 13 +--- frontend/src/styles/pages/_security.scss | 14 +--- frontend/src/styles/pages/_servers.scss | 77 +++++++++++-------- frontend/src/styles/pages/_status-pages.scss | 12 +-- frontend/src/utils/connectionRules.js | 14 +--- 10 files changed, 114 insertions(+), 144 deletions(-) diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss index 210e9c1a..912b4c31 100644 --- a/frontend/src/styles/components/_design-system.scss +++ b/frontend/src/styles/components/_design-system.scss @@ -36,6 +36,41 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet'); &--gray { background: var(--surface-3); color: var(--text-faint); .sk-pill__dot { background: var(--text-faint); } } } +// ------------------------------------------------------------ +// State chip — mono uppercase micro-label on a semantic wash +// (alert/incident states, severities, kind/type tags). One source of +// truth for the shape: page-local chip classes (.mon-state, .sec-state, +// .inc-state/.inc-impact, .git-chip, .bk-type) keep their names and +// `@extend %sk-state;`, layering their own tone modifiers / sizing +// deviations on top. New consumers use `.sk-state` directly (style +// class like .sk-dtable, no ds/ component). +// ------------------------------------------------------------ +%sk-state { + display: inline-flex; + align-items: center; + padding: 3px 9px; + border-radius: 6px; + font-family: var(--mono); + font-size: 10px; + font-weight: 600; + letter-spacing: 0.05em; + text-transform: uppercase; + white-space: nowrap; + flex-shrink: 0; +} + +.sk-state { + @extend %sk-state; + + &--red { color: var(--red); background: var(--red-bg); } + &--amber { color: var(--amber); background: var(--amber-bg); } + &--green { color: var(--green); background: var(--green-bg); } + &--cyan { color: var(--cyan); background: var(--cyan-bg); } + &--violet { color: var(--violet); background: var(--violet-bg); } + &--accent { color: var(--accent-bright); background: var(--accent-bg); } + &--gray { color: var(--text-faint); background: var(--surface-3); } +} + // ------------------------------------------------------------ // EnvTag — environment / category tag (PROD / DEV / STAGING …) // ------------------------------------------------------------ diff --git a/frontend/src/styles/components/_empty-state.scss b/frontend/src/styles/components/_empty-state.scss index 789ef2f4..87963646 100644 --- a/frontend/src/styles/components/_empty-state.scss +++ b/frontend/src/styles/components/_empty-state.scss @@ -61,3 +61,21 @@ margin-bottom: $spacing-md; } } + +// Effective global overrides (moved verbatim from pages/_email.scss, where a +// legacy unscoped `.empty-state` block used to win the cascade app-wide). +// Top-level `.empty-state` copies still exist in pages/_security.scss and +// pages/_servers.scss, which import AFTER this partial — at equal specificity +// they would re-widen the padding and restore `

` bottom margins. The `html` +// prefix (0,1,1) outranks those (0,1,0)/(0,1,1) blocks, while still losing to +// the intentional higher-specificity rules (`.card .empty-state` padding from +// _cards.scss, `--lg` child overrides, page-scoped copies). Fold this into the +// base block above once the page-partial copies are consolidated here. +html .empty-state { + padding: $space-8; + color: $text-secondary; + + p { + margin: 0; + } +} diff --git a/frontend/src/styles/pages/_backups.scss b/frontend/src/styles/pages/_backups.scss index b9e5b015..2da8d83a 100644 --- a/frontend/src/styles/pages/_backups.scss +++ b/frontend/src/styles/pages/_backups.scss @@ -116,17 +116,13 @@ &--files { background: var(--amber-bg); color: var(--amber); } } - // mono type chip (application / database / files) + // mono type chip (application / database / files) — %sk-state shape + // (_design-system.scss) with local sizing + bordered per-type tints kept .bk-type { - display: inline-flex; - align-items: center; + @extend %sk-state; padding: 2px 7px; border-radius: 5px; - font-family: var(--mono); font-size: 10.5px; - font-weight: $font-weight-semibold; - letter-spacing: 0.05em; - text-transform: uppercase; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); diff --git a/frontend/src/styles/pages/_email.scss b/frontend/src/styles/pages/_email.scss index 81e3e37b..f0fb1aea 100644 --- a/frontend/src/styles/pages/_email.scss +++ b/frontend/src/styles/pages/_email.scss @@ -557,56 +557,3 @@ } } } - -// ── Legacy unscoped leftovers ──────────────────────────────── -// Not used by the Email page itself, but `.status-badge` / `.empty-state` -// are rendered by other pages (Git deployments, security/settings tabs) -// and — because pages import after components in main.scss — these blocks -// currently win the cascade app-wide. Kept verbatim to avoid cross-page -// regressions; a follow-up should consolidate them into the component -// partials (_status-badge.scss / _empty-state.scss) and delete these. - -.status-badge { - display: inline-flex; - align-items: center; - gap: $space-1; - padding: 2px $space-2; - border-radius: $radius-sm; - font-size: $font-size-xs; - font-weight: $font-weight-medium; - - &::before { - content: ''; - width: 6px; - height: 6px; - border-radius: 50%; - } - - &.online { - color: $success; - background: $bg-elevated; - - &::before { - background: $success; - } - } - - &.offline { - color: $danger; - background: $bg-elevated; - - &::before { - background: $danger; - } - } -} - -.empty-state { - text-align: center; - padding: $space-8; - color: $text-secondary; - - p { - margin: 0; - } -} diff --git a/frontend/src/styles/pages/_git.scss b/frontend/src/styles/pages/_git.scss index 52320982..39694a85 100644 --- a/frontend/src/styles/pages/_git.scss +++ b/frontend/src/styles/pages/_git.scss @@ -192,20 +192,14 @@ letter-spacing: 0; } - // Mono category chip (private / fork / default / protected / rollback) + // Mono category chip (private / fork / default / protected / rollback) — + // %sk-state shape (_design-system.scss) with smaller local sizing kept .git-chip { - display: inline-flex; - align-items: center; + @extend %sk-state; vertical-align: middle; margin-left: 7px; padding: 1px 6px; border-radius: 5px; - font-family: var(--mono); - font-size: 10px; - font-weight: $font-weight-semibold; - letter-spacing: 0.05em; - text-transform: uppercase; - white-space: nowrap; color: var(--text-faint); background: var(--surface-3); diff --git a/frontend/src/styles/pages/_monitoring.scss b/frontend/src/styles/pages/_monitoring.scss index 4fd1b1cc..77368b8c 100644 --- a/frontend/src/styles/pages/_monitoring.scss +++ b/frontend/src/styles/pages/_monitoring.scss @@ -279,17 +279,10 @@ &--info { background: var(--cyan); } } - // State chip (prototype .alert-state: st-firing / st-resolved) + // State chip (prototype .alert-state: st-firing / st-resolved) — + // shape from the shared %sk-state primitive (_design-system.scss) .mon-state { - padding: 3px 9px; - border-radius: 6px; - font-family: var(--mono); - font-size: 10px; - font-weight: $font-weight-semibold; - text-transform: uppercase; - letter-spacing: 0.05em; - white-space: nowrap; - flex-shrink: 0; + @extend %sk-state; &--red { color: var(--red); background: var(--red-bg); } &--amber { color: var(--amber); background: var(--amber-bg); } diff --git a/frontend/src/styles/pages/_security.scss b/frontend/src/styles/pages/_security.scss index 0cb38629..b052eed3 100644 --- a/frontend/src/styles/pages/_security.scss +++ b/frontend/src/styles/pages/_security.scss @@ -113,18 +113,10 @@ letter-spacing: 0; } - // Severity / state chip (mono uppercase on a semantic wash) + // Severity / state chip (mono uppercase on a semantic wash) — + // shape from the shared %sk-state primitive (_design-system.scss) .sec-state { - display: inline-block; - padding: 3px 9px; - border-radius: 6px; - font-family: var(--mono); - font-size: 10px; - font-weight: $font-weight-semibold; - text-transform: uppercase; - letter-spacing: 0.05em; - white-space: nowrap; - flex-shrink: 0; + @extend %sk-state; &--red { color: var(--red); background: var(--red-bg); } &--amber { color: var(--amber); background: var(--amber-bg); } diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss index f49a34f2..a3749b62 100644 --- a/frontend/src/styles/pages/_servers.scss +++ b/frontend/src/styles/pages/_servers.scss @@ -1966,8 +1966,9 @@ display: flex; align-items: center; gap: $space-2; - font-size: $font-size-sm; - color: $text-secondary; + font-family: var(--mono); + font-size: 11.5px; + color: var(--text-dim); margin-bottom: $space-5; } @@ -1976,10 +1977,11 @@ height: 8px; border-radius: $radius-full; flex-shrink: 0; + background: var(--text-ghost); &.active { - background: $success; - box-shadow: 0 0 6px fade($success, 40%); + background: var(--green); + box-shadow: 0 0 6px var(--green); } } @@ -2137,9 +2139,9 @@ } .install-tab { - background: $bg-elevated; - border: 1px solid $border-subtle; - border-radius: $radius-lg; + background: var(--surface); + border: 1px solid var(--border-soft); + border-radius: var(--radius); overflow: hidden; } @@ -2148,11 +2150,11 @@ align-items: center; gap: $space-3; padding: $space-3 $space-4; - background: $bg-hover; - border-bottom: 1px solid $border-subtle; + background: var(--surface-2); + border-bottom: 1px solid var(--border-soft); > svg { - color: $text-tertiary; + color: var(--text-faint); flex-shrink: 0; } } @@ -2163,28 +2165,31 @@ > span:first-child { display: block; - font-size: $font-size-sm; - font-weight: $font-weight-medium; - color: $text-primary; + font-family: var(--mono); + font-size: 10.5px; + font-weight: $font-weight-semibold; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--text-dim); } } .install-tab-description { display: block; - font-size: $font-size-xs; - color: $text-tertiary; + font-size: 11px; + color: var(--text-faint); font-weight: $font-weight-normal; - margin-top: 1px; + margin-top: 2px; } .install-script { padding: $space-4 $space-5; margin: 0; - font-family: $font-mono; - font-size: $font-size-xs; - line-height: $line-height-relaxed; - color: $text-secondary; - background: $bg-body; + font-family: var(--mono); + font-size: 11.5px; + line-height: 1.6; + color: var(--text-dim); + background: var(--bg-code); overflow-x: auto; white-space: pre-wrap; word-break: break-all; @@ -2195,9 +2200,9 @@ // scripts (which are now an "I haven't installed the agent yet" fallback). .connection-string-field { margin-top: $space-5; - border: 1px solid $border-subtle; - border-radius: $radius-lg; - background: $bg-elevated; + border: 1px solid var(--border); + border-radius: var(--radius); + background: var(--surface); overflow: hidden; } @@ -2206,25 +2211,33 @@ align-items: center; gap: $space-3; padding: $space-3 $space-4; - background: $bg-card; - border-bottom: 1px solid $border-subtle; + background: var(--surface-2); + border-bottom: 1px solid var(--border-soft); + + > svg { + color: var(--accent-bright); + flex-shrink: 0; + } > span { flex: 1; - font-size: $font-size-sm; + font-family: var(--mono); + font-size: 10.5px; font-weight: $font-weight-semibold; - color: $text-primary; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--text-dim); } } .connection-string-field__value { padding: $space-4 $space-5; margin: 0; - font-family: $font-mono; - font-size: $font-size-sm; + font-family: var(--mono); + font-size: 12.5px; line-height: $line-height-relaxed; - color: $text-primary; - background: $bg-body; + color: var(--text); + background: var(--bg-code); overflow-x: auto; white-space: pre-wrap; word-break: break-all; diff --git a/frontend/src/styles/pages/_status-pages.scss b/frontend/src/styles/pages/_status-pages.scss index b2ae78cc..f65684b1 100644 --- a/frontend/src/styles/pages/_status-pages.scss +++ b/frontend/src/styles/pages/_status-pages.scss @@ -407,17 +407,11 @@ } } - // Incident state + impact chips (prototype .inc-state) + // Incident state + impact chips (prototype .inc-state) — shape from + // the shared %sk-state primitive (_design-system.scss) .inc-state, .inc-impact { - padding: 3px 9px; - border-radius: 6px; - font-family: var(--mono); - font-size: 10px; - font-weight: $font-weight-semibold; - text-transform: uppercase; - letter-spacing: 0.05em; - white-space: nowrap; + @extend %sk-state; } .inc-state { diff --git a/frontend/src/utils/connectionRules.js b/frontend/src/utils/connectionRules.js index 0f40fffc..c7accd4d 100644 --- a/frontend/src/utils/connectionRules.js +++ b/frontend/src/utils/connectionRules.js @@ -77,17 +77,6 @@ export const connectionLabels = { 'logic_if-notification': 'If so notify' }; -// Colors for connection types -export const connectionColors = { - 'domain-dockerApp': '#10b981', - 'domain-service': '#10b981', - 'dockerApp-dockerApp': '#2496ed', - 'dockerApp-database': '#f59e0b', - 'service-dockerApp': '#6366f1', - 'service-database': '#f59e0b', - 'service-service': '#6366f1' -}; - /** * Find a node by ID from the nodes array */ @@ -219,6 +208,5 @@ export default { isValidConnection, getConnectionError, getConnectionType, - connectionLabels, - connectionColors + connectionLabels };