feat: improve navigation and add security scans
Security / Secrets (gitleaks) (push) Successful in 1m29s
Lint / Lint (push) Successful in 1m43s
Security / Dependencies (Trivy) (push) Successful in 1m59s
Security / Code (Semgrep) (push) Successful in 3m34s
Tests / Dashboard checks (push) Successful in 1m2s
Tests / Go backend (push) Successful in 3m13s
Docker / Docker Build & Push (push) Successful in 8m15s

- Hide the lone navigation tab and show mobile menus as overlays
- Add secret, code, and dependency scanning to CI
- Update test workflows and remove an unused frontend dependency
This commit is contained in:
Gabriel20xx committed 2026-10-27 09:54:10 +00:00
1 parent 85e6db67b5
commit 817236f349
23 files changed
+299 -74

No files matched your search

@@ -74,6 +74,21 @@ function mixHex(hex: string, towards: number, weight: number): string {
return `#${channels.map((c) => Math.round(c + (towards - c) * weight).toString(16).padStart(2, '0')).join('')}`
}
// WCAG relative luminance of a #rrggbb color, from 0 (black) to 1 (white).
function luminance(hex: string): number {
const [red, green, blue] = [1, 3, 5].map((start) => {
const channel = parseInt(hex.slice(start, start + 2), 16) / 255
return channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4
})
return 0.2126 * red + 0.7152 * green + 0.0722 * blue
}
// WCAG contrast ratio between two #rrggbb colors, from 1 (no contrast) to 21 (black on white).
function contrastRatio(a: string, b: string): number {
const [lighter, darker] = [luminance(a), luminance(b)].sort((x, y) => y - x)
return (lighter + 0.05) / (darker + 0.05)
}
// The color is written to a stylesheet rather than inline on <html>. Shared and app CSS re-declare these
// tokens on every [data-theme] element (the AppShell root, for one), and that declaration hides the value
// <html> would pass down, so the choice never reached the app's UI. Targeting [data-theme] elements with
@@ -83,7 +98,9 @@ function primaryDeclarations(color: PaletteColor, dark: boolean): string {
// Hover is lighter on dark and darker on light, as in the shared theme. It is a hex value, not color-mix(),
// because consumers such as the terminal read these tokens as plain colors.
const hover = dark ? mixHex(primary, 255, 0.15) : mixHex(primary, 0, 0.15)
const foreground = dark ? color.darkFg : '#ffffff'
// Text on the primary is white or the palette's dark text, whichever reads better. Mid-tone light colors
// are too light for white text, so the choice follows the color rather than the theme.
const foreground = contrastRatio(primary, '#ffffff') >= contrastRatio(primary, color.darkFg) ? '#ffffff' : color.darkFg
return [
...primaryVars.map((name) => `${name}: ${primary} !important;`),
`--sc-primary-hover: ${hover} !important;`,
+14 -4
View File
@@ -1,4 +1,4 @@
@import "@gabriel20xx/design-tokens/theme.css";
@import '../../../design-tokens/theme.css';
:where(.sc-root, .sc-root *) {
box-sizing: border-box;
@@ -1111,13 +1111,23 @@ html[data-wide-layout='true'] .sc-main {
transform: translateX(-50%);
}
/* Overlay the page below the header instead of wrapping onto a new row, so opening the menu
doesn't push the content down. */
.sc-nav {
display: none;
flex-basis: 100%;
order: 4;
position: absolute;
top: 100%;
right: 0;
left: 0;
z-index: 20;
flex-direction: column;
align-items: stretch;
padding-bottom: 0.25rem;
max-height: calc(100dvh - 4rem);
padding: 0.5rem 1rem 0.75rem;
overflow-y: auto;
background: var(--sc-surface);
border-bottom: 1px solid var(--sc-border);
box-shadow: var(--sc-shadow-lg);
}
.sc-nav[data-open="true"] {