Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions frontend/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ import type { Preview } from '@storybook/vue3-vite';
import { setup } from '@storybook/vue3-vite';
import { createPinia } from 'pinia';
import { createMemoryHistory, createRouter } from 'vue-router';
import { applyTheme, onSystemThemeChange, systemPrefersDark } from '../src/lib/color-theme';
import { type AuthParams, buildRoutes, type RouterParams } from './decorators';

// The app sets `data-theme` from the account setting. Stories have no account, so they follow the OS.
applyTheme(systemPrefersDark());
onSystemThemeChange(applyTheme);

/**
* Installs a fresh Pinia + router on every story's app. This runs before mount, which is why it
* lives here rather than in a decorator: components calling a store or useRouter() at setup time
Expand Down
12 changes: 10 additions & 2 deletions frontend/biome.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.0/schema.json",
"$schema": "https://biomejs.dev/schemas/2.6.6/schema.json",
"root": false,
"extends": "//",
"files": {
"includes": ["**", "!**/dist", "!**/src/version.ts", "!**/index.saas.html", "!**/storybook-static"]
"includes": [
"**",
"!**/dist",
"!**/src/version.ts",
"!**/index.saas.html",
"!**/storybook-static",
"!**/dist-e2e",
"!**/public/assets"
]
},
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@biomejs/biome": "2.4.0",
"@biomejs/biome": "2.6.6",
"@playwright/test": "^1.64.1",
"@storybook/addon-a11y": "^10.6.3",
"@storybook/addon-docs": "^10.6.3",
Expand Down
96 changes: 58 additions & 38 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions frontend/src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ button:focus-visible {

/* A black single-colour image with no white variant (the GitHub mark): inverted on the dark theme
so it does not vanish into the page. */
@media (prefers-color-scheme: dark) {
.invert-on-dark {
filter: invert(1);
}
:root[data-theme="dark"] .invert-on-dark {
filter: invert(1);
}

/* Honour a reduced-motion preference globally rather than per-animation. The skeleton shimmer and
Expand Down
93 changes: 46 additions & 47 deletions frontend/src/assets/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* with a hot cyan-white highlight for glow.
*/
:root {
/* The prefers-color-scheme block at the end of this file flips this to `dark`, together with the
aliases. Native controls and scrollbars must never claim dark ahead of the aliases. */
/* The dark theme block at the end of this file changes it to `dark` together with the aliases.
Native controls and scrollbars must not show dark before the aliases do. */
color-scheme: light;

/* ===================================================================================
Expand Down Expand Up @@ -247,51 +247,50 @@
--width-auth-card: 26rem; /* auth page content column */
}

/* ===================================================================================

Check warning on line 250 in frontend/src/assets/theme.css

View workflow job for this annotation

GitHub Actions / quality

ste/paragraph-length

7 sentences in one paragraph, the limit is 6. Start a new paragraph for the next topic. Text: "=================================================================================== DAR..."
DARK THEME: Layer 2 re-pointed at the dark ramp. Follows the OS setting, as the Angular app
does; there is no in-app toggle. Only aliases change here: the scales above are theme-neutral.
DARK THEME. Layer 2 points at the dark ramp here. The ui-settings store sets `data-theme` on
<html> from the account setting. The setting can follow the OS. Only aliases change here.
The scales above do not depend on the theme.
=================================================================================== */
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;

/* Surfaces: unlike the light theme, a surface is lighter than the page, and raised lighter still. */
--color-paper: var(--palette-navy-900);
--color-paper-2: var(--palette-navy-750);
--color-surface: var(--palette-navy-850);
--color-surface-raised: var(--palette-navy-800);
--color-overlay: rgb(0 0 0 / 0.6);

--color-ink: var(--palette-slate-50);
--color-ink-soft: var(--palette-slate-100);
--color-muted: var(--palette-slate-200);
--color-muted-soft: var(--palette-slate-300);

--color-line: var(--palette-navy-650);
--color-line-strong: var(--palette-slate-400);

/* accent-ink is the pressed/emphasis step, so on dark it goes lighter rather than darker. */
--color-accent: var(--palette-blue-400);
--color-accent-ink: var(--palette-blue-250);
--color-hot: var(--palette-blue-300);
--color-on-accent: var(--palette-navy-900);

--color-danger: var(--palette-red-300);
--color-danger-strong: var(--palette-red-400);
--color-danger-bg: var(--palette-red-950);
--color-danger-border: var(--palette-red-900);
--color-warning: var(--palette-amber-400);
--color-warning-bg: var(--palette-amber-950);
--color-warning-border: var(--palette-amber-900);
--color-success: var(--palette-green-400);
--color-success-bg: var(--palette-green-950);
--color-success-border: var(--palette-green-900);

/* A navy drop shadow vanishes on a navy page. Depth comes from a black shadow plus a faint
top highlight, and the glow keeps its accent tint. */
--shadow-card: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 20px 50px -30px rgb(0 0 0 / 0.7);
--shadow-lift: 0 24px 50px -30px rgb(113 150 255 / 0.45);
--shadow-focus: 0 0 0 3px rgb(113 150 255 / 0.35);
--ring-danger: 0 0 0 3px rgb(249 112 102 / 0.3);
}
:root[data-theme="dark"] {
color-scheme: dark;

/* Surfaces: unlike the light theme, a surface is lighter than the page, and raised lighter still. */
--color-paper: var(--palette-navy-900);
--color-paper-2: var(--palette-navy-750);
--color-surface: var(--palette-navy-850);
--color-surface-raised: var(--palette-navy-800);
--color-overlay: rgb(0 0 0 / 0.6);

--color-ink: var(--palette-slate-50);
--color-ink-soft: var(--palette-slate-100);
--color-muted: var(--palette-slate-200);
--color-muted-soft: var(--palette-slate-300);

--color-line: var(--palette-navy-650);
--color-line-strong: var(--palette-slate-400);

/* accent-ink is the pressed/emphasis step, so on dark it goes lighter rather than darker. */
--color-accent: var(--palette-blue-400);
--color-accent-ink: var(--palette-blue-250);
--color-hot: var(--palette-blue-300);
--color-on-accent: var(--palette-navy-900);

--color-danger: var(--palette-red-300);
--color-danger-strong: var(--palette-red-400);
--color-danger-bg: var(--palette-red-950);
--color-danger-border: var(--palette-red-900);
--color-warning: var(--palette-amber-400);
--color-warning-bg: var(--palette-amber-950);
--color-warning-border: var(--palette-amber-900);
--color-success: var(--palette-green-400);
--color-success-bg: var(--palette-green-950);
--color-success-border: var(--palette-green-900);

/* A navy drop shadow vanishes on a navy page. Depth comes from a black shadow plus a faint
top highlight, and the glow keeps its accent tint. */
--shadow-card: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 20px 50px -30px rgb(0 0 0 / 0.7);
--shadow-lift: 0 24px 50px -30px rgb(113 150 255 / 0.45);
--shadow-focus: 0 0 0 3px rgb(113 150 255 / 0.35);
--ring-danger: 0 0 0 3px rgb(249 112 102 / 0.3);
}
14 changes: 14 additions & 0 deletions frontend/src/components/app/AppHeader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ const connections = reactive({
const user = reactive({
currentUser: { email: 'ada@example.com', isActive: true } as { email: string; isActive: boolean } | null,
});
const uiSettings = reactive({ isDarkMode: false });

vi.mock('@/stores/connections', () => ({ useConnectionsStore: () => connections }));
vi.mock('@/stores/user', () => ({ useUserStore: () => user }));
vi.mock('@/stores/ui-settings', () => ({ useUiSettingsStore: () => uiSettings }));
vi.mock('@/environment', () => ({ environment: { saas: false } }));

function makeRouter() {
Expand All @@ -39,6 +41,18 @@ describe('AppHeader', () => {
connections.connectionID = null;
connections.ownConnectionsList = [];
user.currentUser = { email: 'ada@example.com', isActive: true };
uiSettings.isDarkMode = false;
});

it('shows the logo variant for the current theme', async () => {
const wrapper = await mountHeader();
const logo = () => wrapper.find('.app-header__logo-image').attributes('src');
expect(logo()).toBe('/assets/rocketadmin_logo_black.svg');

uiSettings.isDarkMode = true;
await flushPromises();
expect(logo()).toBe('/assets/rocketadmin_logo_white.svg');
wrapper.unmount();
});

it('links the logo to rocketadmin.com when signed out, with no account menu', async () => {
Expand Down
Loading
Loading