fix: dark mode for form controls, lyric preview buttons, sidebar toggle

- theme-overrides.css: add !important to form control dark mode rules
  (background/color/border-color) — MetroUI's un-layered select rule
  was winning the cascade regardless of inline styles; color-scheme: dark
  forces OS-native chrome (dropdown arrow) to dark theme

- ProjectDetail.tsx: add fieldStyle const with CSS vars for all
  select/input/textarea elements; fix standalone inline-style selects
  and container divs (log body, ABC header, Sheet/Text toggles)

- Separator.tsx: update ctrl style to use var(--background/foreground)
  and colorScheme: inherit

- LyricsLivePreview.tsx: replace dark:bg-gray-800 / dark:text-gray-400
  Tailwind dark-mode classes with inline CSS var styles on tab bar
  container and all tab/icon buttons; add lp-btn hover rule

- Sidebar.tsx: fix toggle button clipped by aside overflow:hidden —
  change aside to overflow:visible, wrap collapsed strip in own
  overflow:hidden div

- ThemeContext.tsx: set root.style.colorScheme = r for OS chrome theming

- index.html: add <meta name="color-scheme" content="light dark">

- index.css: Phase 7 — replace @layer base + @apply and @layer utilities
  + theme() with plain CSS (height: 100%, rem values for sidebar widths)
This commit is contained in:
translator committed 2026-03-12 09:18:53 +09:00
1 parent a4da97b2f3
commit eae0787725
17 files changed
+1038 -85

No files matched your search

+157
View File
@@ -1042,3 +1042,160 @@ Three regressions introduced in Phase 6 corrected:
2. **Dark mode not switching** — Components now rely on `var(--body-background)`, `var(--border-color)` etc. instead of Tailwind `dark:` classes. These CSS custom properties were only being set if MetroUI's own CSS defined them under `[data-theme="dark"]`. `ThemeContext.tsx` updated to explicitly set all required CSS variables via `root.style.setProperty(...)` in the `apply()` function, guaranteeing correct values for both themes regardless of MetroUI's internal CSS. Light values: `--body-background: #ffffff`, `--border-color: #e2e8f0`, etc. Dark values: `--body-background: #0f172a`, `--border-color: #334155`, etc. Semantic colors (`--color-green`, `--color-red`, `--color-amber`, `--color-blue`, `--color-violet`, `--color-teal`) set once (theme-neutral).
3. **VRAM tier card text overflow** — Card `<button>` elements in PowerSettings had no width constraint or overflow control, causing description text to bleed across adjacent cards. Added `width: '100%'`, `minWidth: 0`, `overflow: 'hidden'`, `boxSizing: 'border-box'` to the button, and `overflowWrap: 'break-word'`, `wordBreak: 'break-word'`, `width: '100%'` to the description `<span>`.
---
### UI Fix plan — created `StemEngine UI Fix.md`
Full audit of remaining Tailwind/dark-mode/mobile issues. Plan file saved at `/home/translator/docker/appdata/stemengine/StemEngine UI Fix.md`.
### UI Fix #1 — `MaintenanceCard` accent colours (`Settings.tsx`)
Replaced the unused `iconBg` / `iconColor` Tailwind string props with a single `accent` prop (`'blue' | 'purple' | 'amber' | 'cyan' | 'green' | 'red'`). Added `MAINTENANCE_ACCENT` map using RGBA tokens (theme-neutral — same tint works on both light and dark backgrounds). Fixed a second latent bug: the outer card `<div>` was using bare `sCard` (no flex), so the icon and content were stacked vertically instead of side-by-side. Changed to `{ ...sCard, display: 'flex', gap: 12, alignItems: 'flex-start' }`. Updated all six `<MaintenanceCard>` call-sites to pass `accent="..."`. Zero Tailwind or `dark:` references remain in `MaintenanceSettings`.
### UI Fix #2 — `index.css` scrollbar + range input
Replaced all `@apply dark:*` blocks with plain CSS reading from ThemeContext custom properties. Scrollbar thumb: `background: var(--border-color)` + `color-mix()` hover darkening. Range inputs: kept `appearance: none` (full cross-browser thumb control); added explicit `height: 6px` — without it the track collapses to ~0 px tall under `appearance: none`. Thumb 14 × 14 px, `background: rgb(var(--brand-500))`. No `accent-color` found anywhere in components (confirmed via grep) so nothing to remove.
### UI Fix #4 — Settings mobile nav (`Settings.tsx`)
Added `isMobile` state (`window.innerWidth < 640`) with a `resize` event listener in the main `Settings` export. The component now renders two distinct layouts:
- **Mobile (< 640 px):** outer div is `flex-col, height: 100%`. A horizontally scrollable `<nav>` strip sits at the top (`overflowX: auto`, `scrollbarWidth: none`, `borderBottom`). Each tab button is `flex-col` (icon above label), `flexShrink: 0`, `whiteSpace: nowrap`, to prevent wrapping and allow horizontal scroll. Below it, a `flex: 1, overflowY: auto` div holds the content at `padding: 16px`.
- **Desktop (≥ 640 px):** original two-column layout (176 px vertical nav + card-bordered content panel) unchanged.
The active style object (`activeStyle`) and the `content` JSX block are extracted once and shared between both render paths to avoid duplication. No Tailwind classes used.
### UI Fix #3 — `GlobalAudioBar` dark mode background
`ThemeContext.tsx`: added `--bar-background` CSS var — `rgba(15,23,42,0.92)` dark / `rgba(255,255,255,0.92)` light. This is the semi-transparent variant needed so `backdropFilter: blur()` actually produces a frosted-glass effect (blur has no visible effect on a fully opaque background). `GlobalAudioBar.tsx`: swapped `background: var(--body-background)` → `var(--bar-background)`, increased blur radius to 12 px. Also removed two dead `accentColor` inline properties from the seek and volume `<input type="range">` elements — `accent-color` is silently ignored when `appearance: none` is set (fixed in #2).
### Phase 7 plan — created `StemEngine WebUI Phase 7.md`
Full audit of `Sidebar.tsx` and `AutoPipelineDialog.tsx`. Both are already fully on inline styles and MetroUI classes — zero Tailwind utility classes in their JSX. The remaining Phase 7 work is 3 edits across 2 files: (1) `index.css` `@layer base` → plain CSS; (2) `index.css` sidebar `@layer utilities` + `@apply w-72/w-14` + `theme()` calls → plain rem values; (3) `ThemeContext.tsx` add `--label-color` and `--color-gray` vars (referenced in Sidebar but not previously set). `@tailwind` directives remain until Phase 11 (Separator/KaraokeEditor/etc. still depend on them).
### `start.sh` + `vite.config.ts` — WSL2 watch polling fix (corrected)
**Problem:** `vite build --watch` uses chokidar inotify-based watching, which does not receive events from WSL2 host → Docker bind-mount writes. Source edits were silently ignored; the frontend never rebuilt.
**First attempt (reverted):** Added `build.watch: { chokidar: { usePolling: true } }` to `vite.config.ts`. This was wrong: any non-null `build.watch` in the static config enables watch mode for ALL `vite build` runs, including the blocking initial build in `start.sh`. The initial build never exited, uvicorn never started, and the frontend became inaccessible.
**Correct fix:** Reverted `vite.config.ts` to its original state (no `build.watch`). Set `CHOKIDAR_USEPOLLING=1 CHOKIDAR_INTERVAL=800` as environment variables on only the background watch line in `start.sh`:
```sh
CHOKIDAR_USEPOLLING=1 CHOKIDAR_INTERVAL=800 npx vite build --watch 2>&1 &
```
Chokidar reads these env vars natively. The initial blocking `vite build` is unaffected. Requires one container restart to take effect.
### Dark mode text colour fix
**Root cause:** `ThemeContext` was setting background/border CSS vars explicitly, but not text colour. MetroUI's own `body { color: #333 }` (un-layered, loaded after index.css) was winning in the cascade, keeping text dark in dark mode.
**First attempt (didn't work):** Added `--foreground` CSS var to ThemeContext and `color: var(--foreground)` inside `@layer base` in index.css. Styles inside `@layer base` have lower cascade priority than un-layered MetroUI rules — MetroUI's body color kept winning.
**Correct fix:**
- `ThemeContext.tsx`: set `document.body.style.color` directly in `apply()`. An inline style on `<body>` beats all stylesheet rules regardless of load order. Also sets `--foreground` (`#e2e8f0` dark / `#1e293b` light) and `--foreground-muted` (`#94a3b8` dark / `#64748b` light) as CSS vars for components that need explicit colour references. Added `--label-color` and `--color-gray` to the same block.
- `index.css`: removed the `color: var(--foreground)` line from `@layer base` (redundant).
### Dark mode — MetroUI class overrides (theme-overrides.css)
**Root cause:** MetroUI CSS is un-layered and loaded after index.css. Un-layered rules beat `@layer utilities` (Tailwind dark: classes), so MetroUI's own light-mode `button`, `app-bar`, `input` etc. kept winning in the cascade. Result: MetroUI-classed elements and unmigrated Tailwind inputs stayed white in dark mode.
**Fix:** Created `frontend/src/theme-overrides.css`, imported in `main.tsx` immediately after `metro.css`. Its un-layered rules come last in the cascade, overriding MetroUI's own defaults for dark mode.
- `.dark .app-bar` / `[data-theme="dark"] .app-bar` → `background: var(--sidebar-background)`
- `.dark .button:not(.primary):not(.secondary)` → `background: var(--background)`, `border-color: var(--border-color)`, `color: var(--foreground)`
- `.dark .button.flat`, `.dark .button.cycle.flat` → `background: transparent`, hover tint `rgba(255,255,255,0.06)`
- `.dark input/select/textarea` → `background: var(--background)`, `color: var(--foreground)` (excludes range/checkbox/radio/color inputs; inline styles on already-migrated elements still win)
- `.dark .card` / `.dark .panel` → dark surface for any MetroUI card/panel elements
**App.tsx:** Added `style={{ background: 'var(--sidebar-background)', borderBottom: ... }}` directly on `div.app-bar` so it switches on first render before ThemeContext fires.
**Affected:** app bar, Reprocess buttons, collapse arrows (ProjectDetail), LiveLyric Preview buttons, transcript textarea.
### Dark mode — Tailwind bg-white / pre / text-slate-* overrides
**Problem:** `bg-white dark:bg-gray-900` on `div` and `pre` elements in unmigrated components (Live Preview headers, Transcript panel, Subsonic rows, ABC text view) was still rendering white in dark mode. Tailwind's `@layer utilities` has lower cascade priority than un-layered CSS, so even the `.dark .dark\:bg-gray-900` override (which has higher specificity than `.bg-white`) was losing to MetroUI's un-layered element resets.
**Fix:** Added un-layered rules to `theme-overrides.css` (loaded after MetroUI):
- `.dark .bg-white` → `background: var(--background)`
- `.dark .bg-slate-50` → `background: var(--body-background)`
- `.dark .bg-slate-100` → `background: var(--background)`
- `.dark pre` → `background: var(--body-background)`, `color: var(--foreground)`
- `.dark .text-slate-600/700/900` → `color: var(--foreground)`
- `.dark .text-slate-400/500` → `color: var(--foreground-muted)`
- `.dark .border-slate-200/300` → `border-color: var(--border-color)`
### Mobile Settings nav — icon-only, 20px
Mobile tab strip in `Settings.tsx` updated: removed text labels from mobile buttons (icon only), increased icon from 16×16 to 20×20 px, changed layout from `flex-col` to `flex` centered, added `title={label}` for accessibility. Desktop nav unchanged.
### Card padding increases
- VRAM tier cards (`PowerSettings`): `padding: 12` → `padding: '14px 16px'` — more horizontal breathing room
- Font picker tiles (`AppearanceSettings`): `padding: '8px 16px'` → `padding: '12px 16px'` — more vertical space above/below the Aa sample
---
## 2026-03-11
### Phase 7 — Remove Tailwind `@apply` / `theme()` from `index.css`
**Edit 1** (`@layer base` → plain CSS):
- Replaced `@layer base { html { @apply h-full } body { @apply h-full antialiased } #root { @apply h-full } }` with `html, body, #root { height: 100%; }` + explicit font-smoothing declarations
**Edit 2** (`@layer utilities` + `theme()` → plain rem):
- `.sidebar-open`: `@apply w-72` → `width: 18rem`
- `.sidebar-closed`: `@apply w-14` → `width: 3.5rem`
- Media query: `theme('spacing.72')` → `18rem`, `theme('spacing.10')` → `2.5rem`
**Edit 3** (ThemeContext — already done in prior session): `--label-color` and `--color-gray` CSS vars added
### Transcript panel dark mode fix (`ProjectDetail.tsx`)
- Speaker diarization container (line ~2114): removed `bg-white dark:bg-gray-950`, added `style={{ background: 'var(--body-background)', color: 'var(--foreground)' }}`
- Plain transcript `<pre>` (line ~2138): same treatment — inline CSS vars replace Tailwind dark-mode classes
### MetroUI button hover popup dark mode (`theme-overrides.css`)
Added rules for:
- `.dark .button.cycle:hover` — `rgba(255,255,255,0.06)` subtle highlight
- `.dark .button:hover::before/::after` — dark background on pseudo-element overlays
- `.dark .info-box`, `.dark .metro-dropdown`, `.dark .dropdown-menu` — dark surface for MetroUI popup panels
### Form fields dark mode (`ProjectDetail.tsx`)
- Added `fieldStyle` constant: `{ background: 'var(--background)', color: 'var(--foreground)', borderColor: 'var(--border-color)' }`
- Applied `style={fieldStyle}` to all 10 select/input/textarea elements with `bg-white dark:bg-gray-9xx` Tailwind classes — inline styles beat MetroUI/Tailwind cascade
- Converted container divs (log body, ABC header) to `style={{ background: 'var(--background/body-background)' }}`
- Converted Sheet/Text toggle buttons to use conditional `style=` objects instead of conditional Tailwind bg classes
### Browser native tooltip / OS chrome dark mode (`ThemeContext.tsx`)
- Added `root.style.colorScheme = r` — tells the browser to render native UI elements (title= tooltips, scrollbars, select arrows, checkboxes) in dark OS theme when dark mode is active
---
## 2026-03-12
### Form control dark mode — root cause found and fixed (`theme-overrides.css`)
- Root cause: MetroUI's un-layered `select { background: var(--input-background) }` (light: `#fff`, dark: `#2b2d30`) was winning over our CSS rules and in some cases over inline styles due to cascade position.
- Fix: added `!important` to the form control block in `theme-overrides.css`:
- `background: var(--background) !important` — forces ThemeContext's dark/light value regardless of MetroUI
- `color: var(--foreground) !important`
- `border-color: var(--border-color) !important`
- `color-scheme: dark` — forces OS-native chrome (dropdown arrow, scrollbar) to dark theme
- Added `colorScheme: 'inherit'` to `fieldStyle` in `ProjectDetail.tsx` and to `ctrl` in `Separator.tsx`
- Added `<meta name="color-scheme" content="light dark">` to `index.html`
### LyricsLivePreview tab bar dark mode (`LyricsLivePreview.tsx`)
- Tab bar container: replaced `dark:bg-gray-800/80 dark:border-gray-700/50` Tailwind classes with inline `style={{ background: 'var(--background)', borderColor: 'var(--border-color)' }}`
- All tab/icon buttons: replaced `dark:text-gray-400 dark:hover:bg-gray-700` Tailwind classes with inline `style={{ color: 'var(--foreground-muted)' }}` and added `lp-btn` CSS class
- Active state buttons: inline `style={{ background: 'rgb(var(--brand-500))', color: '#fff' }}`
- Added `.lp-btn:hover { background: rgba(128,128,128,0.15) }` to `theme-overrides.css`
### Sidebar toggle button visibility (`Sidebar.tsx`)
- Toggle button positioned at `right: -14` (half outside sidebar) was clipped by `overflow: hidden` on the `<aside>`
- Fix: changed aside `overflow: 'visible'`; wrapped the collapsed icon strip in its own `overflow: hidden` div (expanded content already had its own `overflow: hidden`)
+308
View File
@@ -0,0 +1,308 @@
# StemEngine UI Fix Plan
_Created: 2026-03-11_
This document tracks remaining MetroUI optimisations plus the two active regressions
(dark mode, mobile Settings layout). It is intentionally scoped — Separator.tsx,
KaraokeEditor.tsx, LyricsLivePreview.tsx, and DynamicMixPlayer.tsx are NOT in scope
here; they are still Tailwind-based by design and will be handled in a future plan.
---
## Context: what was already fixed this session
| Issue | Fix |
|---|---|
| Sidebar backdrop blocking desktop clicks | Restored `className="sm:hidden"` on backdrop div |
| Dark mode CSS vars not switching | `ThemeContext.apply()` now calls `root.style.setProperty()` for all custom vars |
| VRAM tier card text overflow | Button: `width:100%`, `minWidth:0`, `overflow:hidden`; span: `overflowWrap:break-word` |
---
## Active bugs still to fix
### 1 — Settings dark mode: `MaintenanceCard` icon props (`iconBg` / `iconColor`)
**File:** `frontend/src/pages/Settings.tsx`
**Problem:** `MaintenanceCard` accepts `iconBg` and `iconColor` props and the call-sites
pass Tailwind strings (`"bg-blue-100 dark:bg-blue-900/30"` / `"text-blue-600 dark:text-blue-400"`).
The component itself ignores those props (body is all inline-style), so the icon wrapper has
no background in light mode and no tint in dark mode.
**Lines:** 1441–1509 (five `<MaintenanceCard>` call-sites), plus the `MaintenanceCard`
definition above that shows the unused `iconBg`/`iconColor` parameters.
**Fix plan:**
1. Remove `iconBg` and `iconColor` from `MaintenanceCard`'s props interface and signature.
2. Replace them with a single `accent` prop (`'blue' | 'purple' | 'amber' | 'cyan' | 'green'`).
3. Inside the component's icon wrapper `<div>`, derive background from `accent` using a map
of MetroUI / plain CSS colour tokens (no Tailwind):
```tsx
const ACCENT_CSS: Record<string, { bg: string; color: string }> = {
blue: { bg: 'rgba(14, 165, 233, 0.12)', color: '#0ea5e9' },
purple: { bg: 'rgba(168, 85, 247, 0.12)', color: '#a855f7' },
amber: { bg: 'rgba(245, 158, 11, 0.12)', color: '#f59e0b' },
cyan: { bg: 'rgba(6, 182, 212, 0.12)', color: '#06b6d4' },
green: { bg: 'rgba(16, 185, 129, 0.12)', color: '#10b981' },
}
// icon wrapper:
<div style={{
width: 36, height: 36, borderRadius: 8, flexShrink: 0,
display: 'flex', alignItems: 'center', justifyContent: 'center',
background: ACCENT_CSS[accent].bg,
color: ACCENT_CSS[accent].color,
}}>
<Icon style={{ width: 18, height: 18 }} />
</div>
```
4. Update the five call-sites to pass `accent="blue"` / `"purple"` / `"amber"` / `"cyan"` / `"green"`.
These RGBA tints are theme-neutral (same opacity on dark or light backgrounds) so no
dark-mode conditional is needed.
---
### 2 — Settings mobile: vertical nav breaks at narrow widths
**File:** `frontend/src/pages/Settings.tsx`, main `Settings` export (≈ lines 1955–2015)
**Problem:** The layout is `display: flex, gap: 24` with a fixed-width `176px` nav column
and `flex: 1` content. On mobile (< 640 px) the nav column eats one-third of the screen,
labels wrap, and the content panel is too narrow to be usable.
**Fix plan:** Make the layout responsive without Tailwind by checking `window.innerWidth`
at mount time and updating on resize.
```tsx
// Add near the top of the Settings component:
const [isMobile, setIsMobile] = React.useState(() => window.innerWidth < 640)
React.useEffect(() => {
const handler = () => setIsMobile(window.innerWidth < 640)
window.addEventListener('resize', handler)
return () => window.removeEventListener('resize', handler)
}, [])
```
Then split the JSX into two layouts:
**Mobile layout** — horizontal scrolling tab strip above the content panel:
```tsx
// Outer wrapper: flex-col
<div style={{ display: 'flex', flexDirection: 'column', gap: 0 }}>
{/* Horizontal scrollable nav strip */}
<div style={{
display: 'flex', overflowX: 'auto', gap: 2, padding: '4px 0 8px',
borderBottom: '1px solid var(--border-color)',
scrollbarWidth: 'none', // hide scrollbar on Firefox
// WebkitOverflowScrolling: 'touch',
}}>
{TABS.map(({ id, label, Icon: TabIcon }) => {
const isActive = activeTab === id
return (
<button key={id} onClick={() => setActiveTab(id)} style={{
display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 3,
padding: '6px 12px', borderRadius: 8, flexShrink: 0, border: 'none',
background: isActive ? 'rgba(var(--brand-500, 59 130 246), 0.1)' : 'transparent',
color: isActive ? 'rgb(var(--brand-500, 59 130 246))' : 'inherit',
cursor: 'pointer', fontSize: 11, fontWeight: isActive ? 600 : 400,
}}>
<TabIcon style={{ width: 16, height: 16 }} />
{label}
</button>
)
})}
</div>
{/* Content panel: no border/rounded on mobile to use full width */}
<div style={{ padding: '16px 0' }}>
{/* active component */}
</div>
</div>
```
**Desktop layout** — the existing two-column flex (unchanged).
The `TABS` array should be defined once above the return, replacing the two
places where the nav items are currently rendered inline.
---
### 3 — `index.css`: replace `@apply dark:*` with plain CSS
**File:** `frontend/src/index.css`
**Problem:** Scrollbar styles and range input styles use `@apply dark:bg-*` which
requires Tailwind dark-mode processing. As we remove Tailwind these will break.
Also, `appearance: none` on range inputs conflicts with `accent-color` inline styles
set in components (accentColor is ignored when appearance is none).
**Fix plan:** Replace the relevant blocks with plain CSS that reads from our custom
properties defined by `ThemeContext`:
```css
/* Remove these @apply blocks and replace with: */
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
background: color-mix(in srgb, var(--border-color) 80%, black);
}
/* Range inputs: keep appearance-none (so we control the thumb), but
also set a height so the track is visible. */
input[type="range"] {
appearance: none;
-webkit-appearance: none;
background: var(--border-color);
height: 6px;
border-radius: 9999px;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px;
height: 14px;
border-radius: 50%;
background: rgb(var(--brand-500, 59 130 246));
cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
width: 14px;
height: 14px;
border-radius: 50%;
background: rgb(var(--brand-500, 59 130 246));
cursor: pointer;
border: none;
}
```
**Note:** With `appearance: none` active on all range inputs, any `accentColor` set
via inline style has no effect. Either keep `appearance: none` (use the CSS thumb
styling above) **or** remove `appearance: none` (use `accentColor` inline). Do not use
both. The plan is to keep `appearance: none` with the explicit thumb CSS since it
gives better cross-browser control and doesn't require per-element inline styles.
Remove the `accentColor` property from any inline styles in GlobalAudioBar.tsx and
DynamicMixPlayer.tsx if it was added there.
---
### 4 — GlobalAudioBar: dark mode background
**File:** `frontend/src/components/GlobalAudioBar.tsx`
**Problem:** The bar uses `backdropFilter: blur(8px)` but the background colour is
unset (transparent or inherited). In dark mode the blur has nothing to tint, so the
bar reads light text on a potentially light-coloured backdrop.
**Fix plan:** Add a semi-transparent `--body-background` background that reads from
our ThemeContext vars:
```tsx
// outer fixed div — change background property:
background: 'color-mix(in srgb, var(--body-background) 85%, transparent)',
// or a safe fallback:
background: 'rgba(var(--body-background-raw, 255 255 255), 0.85)',
```
Alternatively — the simplest approach without new CSS vars:
```tsx
background: 'var(--body-background)',
opacity: undefined, // remove any opacity
// add a top border instead of backdrop blur for a cleaner look:
borderTop: '1px solid var(--border-color)',
backdropFilter: 'blur(8px)',
```
Also add `--body-background` with a small alpha (e.g. `rgba(15,23,42,0.92)` in dark,
`rgba(255,255,255,0.92)` in light) to ThemeContext so `backdrop-filter` can work as
a frosted-glass effect rather than a full opaque bar.
---
## Future phases (out of scope for this plan)
| Phase | Scope | Key files |
|---|---|---|
| Phase 7 | Sidebar.tsx full MetroUI migration | `Sidebar.tsx` — already uses only MetroUI `button cycle flat` / `sidebar-open` / `sidebar-closed`; internal layout cards/badges still need inline-style conversion |
| Phase 8 | Separator.tsx | Heavy Tailwind; job submission form, file upload, model select |
| Phase 9 | KaraokeEditor + LyricsLivePreview | Hardcoded hex colour palette; canvas-based editor has special requirements |
| Phase 10 | DynamicMixPlayer | Range inputs, stem volume sliders, waveform vis |
| Phase 11 | Remove Tailwind entirely | Delete `tailwind.config.js`, `postcss.config.js`, remove devDep; replace remaining `@tailwind` directives and `@apply` in `index.css` |
---
## CSS variable reference (ThemeContext)
All vars are set on `document.documentElement` by `ThemeContext.apply()`:
| Variable | Light | Dark |
|---|---|---|
| `--body-background` | `#ffffff` | `#0f172a` |
| `--background` | `#f8fafc` | `#1e293b` |
| `--border-color` | `#e2e8f0` | `#334155` |
| `--sidebar-background` | `#f1f5f9` | `#0f172a` |
| `--color-green` | `#22c55e` | `#22c55e` |
| `--color-red` | `#ef4444` | `#ef4444` |
| `--color-amber` | `#f59e0b` | `#f59e0b` |
| `--color-blue` | `#0ea5e9` | `#0ea5e9` |
| `--color-violet` | `#8b5cf6` | `#8b5cf6` |
| `--color-teal` | `#14b8a6` | `#14b8a6` |
| `--brand-500` (raw) | `59 130 246` | (unchanged, set in index.css) |
Usage pattern in inline styles:
```tsx
// Solid brand colour:
rgb(var(--brand-500, 59 130 246))
// Brand with opacity:
rgba(var(--brand-500, 59 130 246), 0.12)
// Semantic colours:
var(--color-green)
var(--border-color)
var(--body-background)
```
---
## Shared style constants already in Settings.tsx
```tsx
const sHdr: CSSProperties = {
display: 'flex', alignItems: 'center', gap: 12,
paddingBottom: 16, borderBottom: '1px solid var(--border-color)',
}
const sFieldLabel: CSSProperties = {
display: 'block', fontSize: 13, fontWeight: 500, marginBottom: 6,
}
const sCtrl: CSSProperties = {
width: '100%', padding: '7px 10px', fontSize: 13, borderRadius: 6,
border: '1px solid var(--border-color)',
background: 'var(--body-background)', color: 'inherit',
boxSizing: 'border-box',
}
const sCard: CSSProperties = {
border: '1px solid var(--border-color)',
borderRadius: 10, padding: 16, background: 'var(--background)',
}
```
These should be reused everywhere in Settings.tsx rather than duplicated.
---
## Implementation order
1. **Fix #1** — `MaintenanceCard` accent props (small, safe, no layout change)
2. **Fix #3** — `index.css` range + scrollbar CSS (no JSX change, fixes slider rendering)
3. **Fix #4** — `GlobalAudioBar` dark background (2-line change in one file)
4. **Fix #2** — Settings mobile nav (larger change; test on narrow viewport first)
+195
View File
@@ -0,0 +1,195 @@
# StemEngine WebUI — Phase 7: Sidebar Full MetroUI Migration
_Created: 2026-03-11_
## Summary
`Sidebar.tsx` is already almost entirely on inline styles and MetroUI class names.
There is no Tailwind utility class left in the file itself — only `"sidebar-open"` and
`"sidebar-closed"`, which are _defined_ in `index.css` using Tailwind's `@apply` and
`theme()`. Phase 7 converts those two class definitions (and the global `@layer base`
block) to plain CSS, and adds two missing CSS custom properties to `ThemeContext`.
**`Tailwind` directives (`@tailwind base/components/utilities`) are NOT removed in this
phase** — unmigrated pages (Separator, KaraokeEditor, DynamicMixPlayer, LyricsLivePreview)
still depend on them. Tailwind removal is Phase 11.
---
## Current state
### What is already done (no changes needed)
| Component | Status |
|---|---|
| `StatusDot` | ✅ Inline styles + MetroUI vars |
| `ActiveJobItem` | ✅ Inline styles + MetroUI vars |
| `ProjectTile` | ✅ Inline styles + brand CSS vars |
| `SubsonicPanel` | ✅ Inline styles + MetroUI vars |
| `ImportedFileRow` | ✅ Inline styles + MetroUI vars |
| `Sidebar` (main) | ✅ Inline styles + MetroUI vars |
| `AutoPipelineDialog` | ✅ Inline styles + MetroUI vars |
All `className=` values remaining in `Sidebar.tsx` are MetroUI classes:
`"button cycle flat"`, `"button"`, and `"sidebar-open"` / `"sidebar-closed"`.
---
## Work to do (3 edits)
---
### Edit 1 — `index.css`: convert `@layer base` to plain CSS
**Current (lines 106–116):**
```css
@layer base {
html {
@apply h-full;
}
body {
@apply h-full antialiased;
}
#root {
@apply h-full;
}
}
```
**Replace with:**
```css
html, body, #root {
height: 100%;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
```
`h-full` = `height: 100%`. `antialiased` = the two font-smoothing properties above.
No behavioural change.
---
### Edit 2 — `index.css`: convert sidebar utility classes to plain CSS
**Current (lines 118–140):**
```css
@layer utilities {
.sidebar-open {
@apply w-72;
}
.sidebar-closed {
@apply w-14;
}
}
/* On small screens the sidebar overlays content instead of pushing it */
@media (max-width: 639px) {
.sidebar-open {
position: absolute;
top: 0;
bottom: 0;
left: 0;
z-index: 30;
width: theme('spacing.72');
}
.sidebar-closed {
width: theme('spacing.10');
}
}
```
**Replace with:**
```css
/* Sidebar width states */
.sidebar-open { width: 18rem; } /* Tailwind w-72 = 72 × 0.25rem = 18rem = 288px */
.sidebar-closed { width: 3.5rem; } /* Tailwind w-14 = 14 × 0.25rem = 3.5rem = 56px */
/* On small screens the sidebar overlays content instead of pushing it */
@media (max-width: 639px) {
.sidebar-open {
position: absolute;
top: 0;
bottom: 0;
left: 0;
z-index: 30;
width: 18rem; /* was: theme('spacing.72') */
}
.sidebar-closed {
width: 2.5rem; /* was: theme('spacing.10') = 10 × 0.25rem = 2.5rem = 40px */
}
}
```
**Tailwind spacing reference:**
| Tailwind token | Value |
|---|---|
| `spacing.72` / `w-72` | `18rem` (288 px) |
| `spacing.14` / `w-14` | `3.5rem` (56 px) |
| `spacing.10` | `2.5rem` (40 px) — mobile collapsed only |
Note: desktop collapsed (`w-14` = 56 px) vs mobile collapsed (`spacing.10` = 40 px) differ
intentionally — the narrower mobile value fits behind the touch toggle without wasting screen space.
---
### Edit 3 — `ThemeContext.tsx`: add missing CSS vars
Two CSS custom properties are referenced in `Sidebar.tsx` but not set by `ThemeContext`:
| Variable | Where used | Current fallback |
|---|---|---|
| `--label-color` | `sectionHeaderStyle` (section header text) | none — renders as `undefined` |
| `--color-gray` | Collapsed project-count badge background | `#64748b` inline fallback |
**Add to `ThemeContext.apply()`:**
```ts
root.style.setProperty('--label-color', dark ? '#94a3b8' : '#64748b') // slate-400 / slate-500
root.style.setProperty('--color-gray', '#64748b') // slate-500, theme-neutral
```
`--label-color` is used for the dimmed uppercase section headers ("IN PROGRESS",
"SUBSONIC IMPORT"). In dark mode it should be lighter (slate-400); in light mode darker
(slate-500). `--color-gray` is a neutral badge colour — same in both modes.
`--input-background` (also referenced in Sidebar) already falls back to `var(--background)`,
which IS set by ThemeContext. No change needed.
---
## Files changed
| File | Change |
|---|---|
| `frontend/src/index.css` | Remove `@layer base` + `@layer utilities`; replace `@apply` / `theme()` with plain CSS values |
| `frontend/src/context/ThemeContext.tsx` | Add `--label-color` and `--color-gray` to `apply()` |
`Sidebar.tsx` and `AutoPipelineDialog.tsx` — **no changes needed**.
---
## After Phase 7: `index.css` Tailwind dependency map
| Section | Tailwind after Phase 7 |
|---|---|
| `@tailwind base/components/utilities` | ✅ Still present (needed by Separator, KaraokeEditor, etc.) |
| `@layer base` | ❌ Removed — replaced with plain CSS |
| `@layer utilities` (sidebar) | ❌ Removed — replaced with plain CSS |
| Scrollbar styles | ❌ Already plain CSS (Phase 7 fix #2) |
| Range input styles | ❌ Already plain CSS (Phase 7 fix #2) |
After Phase 7, `index.css` no longer uses `@apply` or `theme()` anywhere. Tailwind
is still compiled (for Separator/KaraokeEditor/etc.) but no longer processes any of
our custom CSS blocks.
---
## Future phases
| Phase | Scope |
|---|---|
| Phase 8 | `Separator.tsx` — heavy Tailwind; job form, file upload, model select |
| Phase 9 | `KaraokeEditor.tsx` + `LyricsLivePreview.tsx` — hardcoded hex palette, canvas |
| Phase 10 | `DynamicMixPlayer.tsx` — stem volume sliders, waveform |
| Phase 11 | Remove Tailwind entirely — delete `tailwind.config.js`, `postcss.config.js`, remove `@tailwind` directives |
+5 -2
View File
@@ -14,13 +14,16 @@
<!-- Theme color (browser chrome on Android, tab bar tint) -->
<meta name="theme-color" content="#3B82F6" />
<!-- Supports both light and dark OS themes; JS will set the active scheme -->
<meta name="color-scheme" content="light dark" />
<!-- iOS PWA -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="StemEngine" />
<link rel="apple-touch-icon" href="/icon.svg" />
<script type="module" crossorigin src="/assets/index-CLGPiso6.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C8mDx5-m.css">
<script type="module" crossorigin src="/assets/index-CBWP_Huh.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-3eSjKY18.css">
</head>
<body>
<div id="root"></div>
+3
View File
@@ -14,6 +14,9 @@
<!-- Theme color (browser chrome on Android, tab bar tint) -->
<meta name="theme-color" content="#3B82F6" />
<!-- Supports both light and dark OS themes; JS will set the active scheme -->
<meta name="color-scheme" content="light dark" />
<!-- iOS PWA -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+1 -1
View File
@@ -157,7 +157,7 @@ function AppShell() {
background: `linear-gradient(90deg, rgb(var(--brand-500, 59 130 246)), #a855f7, #f43f5e)`,
}} />
<div className="app-bar">
<div className="app-bar" style={{ background: 'var(--sidebar-background)', borderBottom: '1px solid var(--border-color)' }}>
{/* Brand */}
<div className="app-bar-brand">
+4 -4
View File
@@ -31,8 +31,8 @@ export default function GlobalAudioBar() {
<div style={{
position: 'fixed', bottom: 0, left: 0, right: 0, zIndex: 50,
borderTop: '1px solid var(--border-color)',
background: 'var(--body-background, var(--background))',
backdropFilter: 'blur(8px)',
background: 'var(--bar-background)',
backdropFilter: 'blur(12px)',
boxShadow: '0 -2px 8px rgba(0,0,0,0.12)',
}}>
<div style={{
@@ -77,7 +77,7 @@ export default function GlobalAudioBar() {
step={0.1}
value={currentTime}
onChange={e => getActions().seek(parseFloat(e.target.value))}
style={{ flex: 1, minWidth: 0, cursor: 'pointer', accentColor: 'rgb(var(--brand-500, 59 130 246))' }}
style={{ flex: 1, minWidth: 0, cursor: 'pointer' }}
/>
{/* Duration */}
@@ -110,7 +110,7 @@ export default function GlobalAudioBar() {
step={0.05}
value={volume}
onChange={e => getActions().setVolume(parseFloat(e.target.value))}
style={{ width: 56, cursor: 'pointer', accentColor: 'rgb(var(--brand-500, 59 130 246))' }}
style={{ width: 56, cursor: 'pointer' }}
title="Volume"
/>
</div>
+27 -12
View File
@@ -2111,57 +2111,72 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
style={undefined}
>
{/* Visual style tabs + toolbar — scrollable on narrow screens */}
<div className={`flex items-center gap-1 px-2 py-1 border-b overflow-x-auto [&::-webkit-scrollbar]:hidden ${isFullscreen ? 'bg-black/40 border-white/10' : 'bg-slate-100/80 dark:bg-gray-800/80 border-slate-200/30 dark:border-gray-700/50'}`}>
<div
className="flex items-center gap-1 px-2 py-1 border-b overflow-x-auto [&::-webkit-scrollbar]:hidden"
style={isFullscreen
? { background: 'rgba(0,0,0,0.4)', borderColor: 'rgba(255,255,255,0.1)' }
: { background: 'var(--background)', borderColor: 'var(--border-color)' }}
>
{VISUAL_STYLES.map(s => (
<button
key={s.id}
onClick={() => { setVisualStyle(s.id); localStorage.setItem('stemengine-lyric-visual-style', s.id) }}
title={s.desc}
className={`shrink-0 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors ${
visualStyle === s.id
? 'bg-brand-500 text-white'
: 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'
}`}
className="lp-btn shrink-0 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors"
style={visualStyle === s.id
? { background: 'rgb(var(--brand-500, 59 130 246))', color: '#fff' }
: { color: 'var(--foreground-muted)' }}
>
{s.label}
</button>
))}
{hasElrc && (
<span className="ml-2 shrink-0 text-[10px] text-slate-400 dark:text-gray-600">ELRC</span>
<span className="ml-2 shrink-0 text-[10px]" style={{ color: 'var(--foreground-muted)', opacity: 0.6 }}>ELRC</span>
)}
<div className="ml-auto flex gap-0.5 shrink-0 pl-1">
<button
onClick={handleRecenter}
title="Recenter active line"
className={`p-1.5 rounded-md transition-colors ${isFullscreen ? 'text-slate-400 hover:bg-white/10' : 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'}`}
className="lp-btn p-1.5 rounded-md transition-colors"
style={{ color: 'var(--foreground-muted)' }}
>
<Crosshair className="w-3.5 h-3.5" />
</button>
<button
onClick={() => { setShowStylePicker(p => !p); setShowEditor(false) }}
title="Style picker"
className={`p-1.5 rounded-md transition-colors ${showStylePicker ? 'bg-brand-500 text-white' : isFullscreen ? 'text-slate-400 hover:bg-white/10' : 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'}`}
className="lp-btn p-1.5 rounded-md transition-colors"
style={showStylePicker
? { background: 'rgb(var(--brand-500, 59 130 246))', color: '#fff' }
: { color: 'var(--foreground-muted)' }}
>
<Palette className="w-3.5 h-3.5" />
</button>
<button
onClick={() => { setShowEditor(p => !p); setShowStylePicker(false); setShowAegisub(false) }}
title="Edit timing / lyrics"
className={`p-1.5 rounded-md transition-colors ${showEditor ? 'bg-brand-500 text-white' : isFullscreen ? 'text-slate-400 hover:bg-white/10' : 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'}`}
className="lp-btn p-1.5 rounded-md transition-colors"
style={showEditor
? { background: 'rgb(var(--brand-500, 59 130 246))', color: '#fff' }
: { color: 'var(--foreground-muted)' }}
>
<Pencil className="w-3.5 h-3.5" />
</button>
<button
onClick={() => { setShowAegisub(!showAegisub); setShowStylePicker(false); setShowEditor(false) }}
title="Waveform editor"
className={`p-1.5 rounded-md transition-colors ${showAegisub ? 'bg-brand-500 text-white' : isFullscreen ? 'text-slate-400 hover:bg-white/10' : 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'}`}
className="lp-btn p-1.5 rounded-md transition-colors"
style={showAegisub
? { background: 'rgb(var(--brand-500, 59 130 246))', color: '#fff' }
: { color: 'var(--foreground-muted)' }}
>
<Activity className="w-3.5 h-3.5" />
</button>
<button
onClick={toggleFullscreen}
title={isFullscreen ? 'Exit fullscreen' : 'Fullscreen'}
className={`p-1.5 rounded-md transition-colors ${isFullscreen ? 'text-slate-400 hover:bg-white/10' : 'text-slate-500 dark:text-gray-400 hover:bg-slate-200 dark:hover:bg-gray-700'}`}
className="lp-btn p-1.5 rounded-md transition-colors"
style={{ color: 'var(--foreground-muted)' }}
>
{isFullscreen ? <Minimize2 className="w-3.5 h-3.5" /> : <Maximize2 className="w-3.5 h-3.5" />}
</button>
+3 -1
View File
@@ -530,7 +530,7 @@ export default function Sidebar({ isOpen, onToggle, onOpenProject, onDeleteProje
borderRight: '1px solid var(--border-color)',
background: 'var(--sidebar-background, var(--body-background))',
transition: 'width 0.2s ease-in-out',
overflow: 'hidden',
overflow: 'visible',
}}
>
{/* Toggle tab — always visible */}
@@ -555,6 +555,7 @@ export default function Sidebar({ isOpen, onToggle, onOpenProject, onDeleteProje
{/* ── Collapsed indicator strip ──────────────────────────────────────── */}
{!isOpen && (
<div style={{ overflow: 'hidden', flex: 1 }}>
<div style={{
display: 'flex', flexDirection: 'column', alignItems: 'center',
gap: 12, paddingTop: 64, paddingLeft: 8, paddingRight: 8,
@@ -589,6 +590,7 @@ export default function Sidebar({ isOpen, onToggle, onOpenProject, onDeleteProje
</div>
)}
</div>
</div>
)}
{/* ── Expanded content ───────────────────────────────────────────────── */}
+12
View File
@@ -38,12 +38,24 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
}
// MetroUI dark mode
root.setAttribute('data-theme', r)
// color-scheme: tells the browser to use dark OS chrome (scrollbars, native tooltips, form controls)
root.style.colorScheme = r
// Explicit CSS custom properties — guaranteed regardless of MetroUI var availability
const dark = r === 'dark'
root.style.setProperty('--body-background', dark ? '#0f172a' : '#ffffff')
root.style.setProperty('--background', dark ? '#1e293b' : '#f8fafc')
root.style.setProperty('--border-color', dark ? '#334155' : '#e2e8f0')
root.style.setProperty('--sidebar-background', dark ? '#0f172a' : '#f1f5f9')
// Semi-transparent variant for frosted-glass bars (backdropFilter needs transparency)
root.style.setProperty('--bar-background', dark ? 'rgba(15,23,42,0.92)' : 'rgba(255,255,255,0.92)')
// Text colours — set directly on body (inline style beats MetroUI stylesheet)
// Also exposed as CSS vars for components that need to reference them explicitly
const fg = dark ? '#e2e8f0' : '#1e293b'
document.body.style.color = fg
root.style.setProperty('--foreground', fg)
root.style.setProperty('--foreground-muted', dark ? '#94a3b8' : '#64748b')
root.style.setProperty('--label-color', dark ? '#94a3b8' : '#64748b')
root.style.setProperty('--color-gray', '#64748b')
root.style.setProperty('--color-green', '#22c55e')
root.style.setProperty('--color-red', '#ef4444')
root.style.setProperty('--color-amber', '#f59e0b')
+40 -26
View File
@@ -103,25 +103,21 @@
--brand-950: 8 51 68;
}
@layer base {
html {
@apply h-full;
}
body {
@apply h-full antialiased;
}
#root {
@apply h-full;
}
/* Phase 7: converted from @layer base + @apply */
html, body, #root {
height: 100%;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@layer utilities {
.sidebar-open {
@apply w-72;
}
.sidebar-closed {
@apply w-14;
}
/* Phase 7: converted from @layer utilities + @apply / theme() */
.sidebar-open {
width: 18rem; /* was: @apply w-72 */
}
.sidebar-closed {
width: 3.5rem; /* was: @apply w-14 */
}
/* On small screens the sidebar overlays content instead of pushing it */
@@ -132,10 +128,10 @@
bottom: 0;
left: 0;
z-index: 30;
width: theme('spacing.72');
width: 18rem; /* was: theme('spacing.72') */
}
.sidebar-closed {
width: theme('spacing.10');
width: 2.5rem; /* was: theme('spacing.10') */
}
}
@@ -146,26 +142,44 @@
}
::-webkit-scrollbar-track {
@apply bg-transparent;
background: transparent;
}
::-webkit-scrollbar-thumb {
@apply bg-slate-300 dark:bg-gray-600 rounded-full;
background: var(--border-color, #cbd5e1);
border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
@apply bg-slate-400 dark:bg-gray-500;
background: color-mix(in srgb, var(--border-color, #94a3b8) 80%, #000);
}
/* Range input styling */
/* Range input styling — appearance: none so we fully control thumb shape.
Height must be set explicitly; without it the track collapses to ~0px.
accent-color is NOT used here because it is ignored when appearance: none is active. */
input[type="range"] {
@apply bg-slate-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer;
appearance: none;
-webkit-appearance: none;
background: var(--border-color, #e2e8f0);
height: 6px;
border-radius: 9999px;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
@apply appearance-none w-4 h-4 rounded-full bg-brand-500 cursor-pointer;
-webkit-appearance: none;
width: 14px;
height: 14px;
border-radius: 50%;
background: rgb(var(--brand-500, 59 130 246));
cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
@apply w-4 h-4 rounded-full bg-brand-500 cursor-pointer border-0;
width: 14px;
height: 14px;
border-radius: 50%;
background: rgb(var(--brand-500, 59 130 246));
cursor: pointer;
border: none;
}
+2
View File
@@ -6,6 +6,8 @@ import './index.css'
// MetroUI — Phase 1 shell redesign
import '@olton/metroui/lib/metro.css'
import '@olton/metroui/lib/icons.css'
// Dark-mode overrides — must come after metro.css so un-layered rules win
import './theme-overrides.css'
import '@fontsource/archivo'
import '@fontsource/eb-garamond'
import '@fontsource/inter'
+26 -7
View File
@@ -11,6 +11,14 @@ import type { ProjectDetail as PD, Job, JobFile } from '../types'
import DynamicMixPlayer from '../components/DynamicMixPlayer'
import LyricsLivePreview from '../components/LyricsLivePreview'
// ─── shared form-field style (overrides MetroUI/Tailwind bg in dark mode) ───
const fieldStyle = {
background: 'var(--background)',
color: 'var(--foreground)',
borderColor: 'var(--border-color)',
colorScheme: 'inherit' as const,
} as const
// ─── helpers ────────────────────────────────────────────────────────────────
function formatTime(s: number): string {
@@ -1038,7 +1046,7 @@ function MixesSection({
<select
value={staticOption}
onChange={(e) => setStaticOption(e.target.value)}
style={{ padding: '6px 10px', fontSize: 12, borderRadius: 4, border: '1px solid var(--border-color)', background: 'var(--input-background, var(--background))', color: 'inherit', outline: 'none' }}
style={{ padding: '6px 10px', fontSize: 12, borderRadius: 4, border: '1px solid var(--border-color)', background: 'var(--background)', color: 'var(--foreground)', outline: 'none', colorScheme: 'inherit' }}
>
{STATIC_OPTIONS.map((o) => (
<option key={o.id} value={o.id}>{o.label}</option>
@@ -1146,6 +1154,7 @@ function StemMidiRow({
value={mode}
onChange={(e) => setMode(e.target.value)}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-purple-400"
style={fieldStyle}
>
{TRANSCRIBE_MODES.map((m) => (
<option key={m.id} value={m.id}>{m.label}</option>
@@ -1325,6 +1334,7 @@ function StemAbcRow({
placeholder={`Title (default: ${projectName})`}
disabled={!canConvert}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 placeholder-slate-400 focus:outline-none focus:border-emerald-400 w-40 disabled:opacity-50"
style={fieldStyle}
/>
<button
onClick={handleConvert}
@@ -1496,7 +1506,7 @@ function AbcFileViewer({
return (
<div className="rounded-lg border border-slate-200 dark:border-gray-700 overflow-hidden">
{/* Header */}
<div className="flex items-center justify-between px-3 py-2 bg-white dark:bg-gray-900">
<div className="flex items-center justify-between px-3 py-2" style={{ background: 'var(--background)' }}>
<button
onClick={load}
className="flex items-center gap-1.5 text-xs font-medium text-slate-700 dark:text-gray-300 hover:text-emerald-600 dark:hover:text-emerald-400 transition-colors"
@@ -1511,11 +1521,13 @@ function AbcFileViewer({
<div className="flex rounded overflow-hidden border border-slate-200 dark:border-gray-700 text-[10px] font-medium">
<button
onClick={() => setView('sheet')}
className={`px-2 py-0.5 transition-colors ${view === 'sheet' ? 'bg-emerald-500 text-white' : 'bg-white dark:bg-gray-900 text-slate-500 dark:text-gray-400 hover:bg-slate-50 dark:hover:bg-gray-800'}`}
className="px-2 py-0.5 transition-colors"
style={view === 'sheet' ? { background: '#10b981', color: '#fff' } : { background: 'var(--background)', color: 'var(--foreground-muted)' }}
>Sheet</button>
<button
onClick={() => setView('text')}
className={`px-2 py-0.5 transition-colors ${view === 'text' ? 'bg-emerald-500 text-white' : 'bg-white dark:bg-gray-900 text-slate-500 dark:text-gray-400 hover:bg-slate-50 dark:hover:bg-gray-800'}`}
className="px-2 py-0.5 transition-colors"
style={view === 'text' ? { background: '#10b981', color: '#fff' } : { background: 'var(--background)', color: 'var(--foreground-muted)' }}
>Text</button>
</div>
)}
@@ -1677,7 +1689,7 @@ function TranscribeLog({ progress }: { progress: string }) {
<Loader2 className="w-3 h-3 text-slate-400 dark:text-gray-500 animate-spin" />
</div>
{/* log body */}
<div className="px-2.5 py-2 max-h-40 overflow-y-auto space-y-0.5 bg-white dark:bg-gray-950">
<div className="px-2.5 py-2 max-h-40 overflow-y-auto space-y-0.5" style={{ background: 'var(--body-background)', color: 'var(--foreground)' }}>
{lines.length === 0
? <span className="text-xs text-slate-400 dark:text-gray-500">Waiting for output…</span>
: lines.map((line, i) => (
@@ -1923,6 +1935,7 @@ function StemLyricsRow({
value={source}
onChange={(e) => setSource(e.target.value)}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-sky-400"
style={fieldStyle}
>
<option value="text">Paste lyrics</option>
<option value="auto">Auto (from file tags / LRC)</option>
@@ -1953,6 +1966,7 @@ function StemLyricsRow({
placeholder="Paste plain lyrics here, one line per lyric line…"
rows={5}
className="w-full rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-2 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-sky-400 resize-y font-mono"
style={fieldStyle}
/>
)}
</div>
@@ -1965,6 +1979,7 @@ function StemLyricsRow({
value={whisperModel}
onChange={(e) => setWhisperModel(e.target.value)}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-violet-400"
style={fieldStyle}
>
{WHISPER_MODELS.map((m) => (
<option key={m.id} value={m.id}>{m.label}</option>
@@ -1974,6 +1989,7 @@ function StemLyricsRow({
value={whisperLang}
onChange={(e) => setWhisperLang(e.target.value)}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-violet-400"
style={fieldStyle}
>
{WHISPER_LANGS.map((l) => (
<option key={l.id} value={l.id}>{l.label}</option>
@@ -1983,6 +1999,7 @@ function StemLyricsRow({
value={whisperTask}
onChange={(e) => setWhisperTask(e.target.value as 'transcribe' | 'translate')}
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-violet-400"
style={fieldStyle}
>
<option value="transcribe">Transcribe</option>
<option value="translate">Translate → English</option>
@@ -1992,6 +2009,7 @@ function StemLyricsRow({
onChange={(e) => setVocalStyle(e.target.value as 'general' | 'hiphop')}
title="Vocal style — tunes VAD thresholds and ASR priors for the genre"
className="rounded-lg bg-white dark:bg-gray-900 border border-slate-300 dark:border-gray-700 px-2.5 py-1.5 text-xs text-slate-900 dark:text-gray-100 focus:outline-none focus:border-violet-400"
style={fieldStyle}
>
<option value="general">General</option>
<option value="hiphop">Hip-hop / Rap</option>
@@ -2103,6 +2121,7 @@ function StemLyricsRow({
onChange={(e) => setSpeakerNames((prev) => ({ ...prev, [id]: e.target.value }))}
placeholder="Name…"
className="w-20 text-xs bg-white dark:bg-gray-800 border border-slate-300 dark:border-gray-700 rounded px-1.5 py-0.5 text-slate-700 dark:text-gray-200 focus:outline-none focus:border-violet-400"
style={fieldStyle}
/>
</div>
))}
@@ -2111,7 +2130,7 @@ function StemLyricsRow({
{/* Transcript body */}
{hasSpeakers && transcriptSegs ? (
<div className="px-2.5 py-2 space-y-0.5 max-h-48 overflow-y-auto bg-white dark:bg-gray-950">
<div className="px-2.5 py-2 space-y-0.5 max-h-48 overflow-y-auto" style={{ background: 'var(--body-background)', color: 'var(--foreground)' }}>
{(() => {
// Group consecutive segments by speaker
const groups: Array<{ speaker?: string; lines: string[] }> = []
@@ -2135,7 +2154,7 @@ function StemLyricsRow({
})()}
</div>
) : (
<pre className="px-2.5 py-2 text-xs text-slate-700 dark:text-gray-200 whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto bg-white dark:bg-gray-950 select-text">
<pre className="px-2.5 py-2 text-xs whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto select-text" style={{ background: 'var(--body-background)', color: 'var(--foreground)' }}>
{transcriptText}
</pre>
)}
+3 -2
View File
@@ -29,8 +29,9 @@ const fieldLabel: CSSProperties = {
const ctrl: CSSProperties = {
width: '100%', padding: '6px 10px', fontSize: 13, borderRadius: 4,
border: '1px solid var(--border-color)',
background: 'var(--input-background, var(--background))',
color: 'inherit', outline: 'none', boxSizing: 'border-box',
background: 'var(--background)',
color: 'var(--foreground)', outline: 'none', boxSizing: 'border-box',
colorScheme: 'inherit',
}
const card: CSSProperties = {
+88 -29
View File
@@ -221,7 +221,7 @@ function AppearanceSettings() {
onClick={() => handleFontChange(opt.id)}
style={{
display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4,
padding: '8px 16px', borderRadius: 8, fontSize: 13, fontWeight: 500,
padding: '12px 16px', borderRadius: 8, fontSize: 13, fontWeight: 500,
border: `1px solid ${font === opt.id ? 'rgb(var(--brand-500, 59 130 246))' : 'var(--border-color)'}`,
background: font === opt.id ? 'rgba(var(--brand-500, 59 130 246), 0.08)' : 'transparent',
color: font === opt.id ? 'rgb(var(--brand-500, 59 130 246))' : 'inherit',
@@ -951,18 +951,25 @@ interface OpResult {
details?: string[]
}
const MAINTENANCE_ACCENT: Record<string, { bg: string; color: string }> = {
blue: { bg: 'rgba(14, 165, 233, 0.12)', color: '#0ea5e9' },
purple: { bg: 'rgba(168, 85, 247, 0.12)', color: '#a855f7' },
amber: { bg: 'rgba(245, 158, 11, 0.12)', color: '#f59e0b' },
cyan: { bg: 'rgba(6, 182, 212, 0.12)', color: '#06b6d4' },
green: { bg: 'rgba(16, 185, 129, 0.12)', color: '#10b981' },
red: { bg: 'rgba(239, 68, 68, 0.12)', color: '#ef4444' },
}
function MaintenanceCard({
icon: Icon,
iconBg,
iconColor,
accent,
title,
description,
buttonLabel,
onRun,
}: {
icon: React.ElementType
iconBg: string
iconColor: string
accent: keyof typeof MAINTENANCE_ACCENT
title: string
description: string
buttonLabel: string
@@ -985,9 +992,11 @@ function MaintenanceCard({
}
}
const { bg, color } = MAINTENANCE_ACCENT[accent]
return (
<div style={sCard}>
<div style={{ padding: 8, borderRadius: 8, flexShrink: 0 }}>
<div style={{ ...sCard, display: 'flex', gap: 12, alignItems: 'flex-start' }}>
<div style={{ padding: 8, borderRadius: 8, flexShrink: 0, background: bg, color }}>
<Icon style={{ width: 20, height: 20 }} />
</div>
<div style={{ flex: 1, minWidth: 0 }}>
@@ -1438,8 +1447,7 @@ function MaintenanceSettings() {
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
<MaintenanceCard
icon={ShieldCheck}
iconBg="bg-blue-100 dark:bg-blue-900/30"
iconColor="text-blue-600 dark:text-blue-400"
accent="blue"
title="Verify file integrity"
description="Scan every project's stem files and report any that are missing from disk. No changes are made."
buttonLabel="Run check"
@@ -1456,8 +1464,7 @@ function MaintenanceSettings() {
<MaintenanceCard
icon={FileText}
iconBg="bg-purple-100 dark:bg-purple-900/30"
iconColor="text-purple-600 dark:text-purple-400"
accent="purple"
title="Write metadata files"
description="Generate or refresh project.json in every project folder using current database state."
buttonLabel="Write all"
@@ -1473,8 +1480,7 @@ function MaintenanceSettings() {
<MaintenanceCard
icon={Tag}
iconBg="bg-amber-100 dark:bg-amber-900/30"
iconColor="text-amber-600 dark:text-amber-400"
accent="amber"
title="Rename stems to new format"
description='Rename any stem files still using the old "filename - Vocals.ext" format to "Artist - Title (vocals).ext". Updates database paths.'
buttonLabel="Rename"
@@ -1490,8 +1496,7 @@ function MaintenanceSettings() {
<MaintenanceCard
icon={RefreshCw}
iconBg="bg-cyan-100 dark:bg-cyan-900/30"
iconColor="text-cyan-600 dark:text-cyan-400"
accent="cyan"
title="Restore Whisper GPU acceleration"
description="After a CUDA out-of-memory or unknown error, the transcriber falls back to CPU automatically. Click to re-enable GPU without restarting the container."
buttonLabel="Reset GPU"
@@ -1505,8 +1510,7 @@ function MaintenanceSettings() {
<MaintenanceCard
icon={Scissors}
iconBg="bg-emerald-100 dark:bg-emerald-900/30"
iconColor="text-emerald-600 dark:text-emerald-400"
accent="green"
title="Clean lyrics files"
description='Remove section markers ([Chorus], [Verse 1], etc.) from all saved ELRC/LRC files. New alignments are cleaned automatically.'
buttonLabel="Clean"
@@ -1522,8 +1526,7 @@ function MaintenanceSettings() {
<MaintenanceCard
icon={Ghost}
iconBg="bg-red-100 dark:bg-red-900/30"
iconColor="text-red-600 dark:text-red-400"
accent="red"
title="Purge orphaned jobs"
description="Remove separation job records that have no matching project. Frees up database space."
buttonLabel="Purge"
@@ -1731,7 +1734,7 @@ function PowerSettings() {
disabled={tooHeavy}
style={{
display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 6,
padding: 12, borderRadius: 8, textAlign: 'left',
padding: '14px 16px', borderRadius: 8, textAlign: 'left',
width: '100%', minWidth: 0, overflow: 'hidden',
border: `1px solid ${isActive ? 'rgb(var(--brand-500, 59 130 246))' : 'var(--border-color)'}`,
background: isActive ? 'rgba(var(--brand-500, 59 130 246), 0.08)' : 'var(--body-background, var(--background))',
@@ -1954,6 +1957,13 @@ export default function Settings() {
return 'subsonic'
})
const [isMobile, setIsMobile] = useState(() => window.innerWidth < 640)
useEffect(() => {
const handler = () => setIsMobile(window.innerWidth < 640)
window.addEventListener('resize', handler)
return () => window.removeEventListener('resize', handler)
}, [])
const NAV_ITEMS: { id: Tab; icon: ElementType; label: string }[] = [
{ id: 'appearance', icon: Sun, label: 'Appearance' },
{ id: 'subsonic', icon: Server, label: 'Subsonic' },
@@ -1964,6 +1974,62 @@ export default function Settings() {
{ id: 'integrations', icon: ShieldCheck,label: 'Integrations' },
]
const activeStyle = {
background: 'rgba(var(--brand-500, 59 130 246), 0.1)',
color: 'rgb(var(--brand-500, 59 130 246))',
}
const content = (
<>
{activeTab === 'appearance' && <AppearanceSettings />}
{activeTab === 'subsonic' && <SubsonicSettings />}
{activeTab === 'models' && <ModelDownloader />}
{activeTab === 'maintenance' && <MaintenanceSettings />}
{activeTab === 'power' && <PowerSettings />}
{activeTab === 'autopipeline' && <AutoPipelineSettings />}
{activeTab === 'integrations' && <IntegrationsSettings />}
</>
)
if (isMobile) {
return (
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
{/* Horizontal scrollable tab strip */}
<nav style={{
display: 'flex', overflowX: 'auto', gap: 2, padding: '8px 12px',
borderBottom: '1px solid var(--border-color)', flexShrink: 0,
// hide scrollbar visually while keeping it functional
scrollbarWidth: 'none',
}}>
{NAV_ITEMS.map(({ id, icon: Icon, label }) => {
const isActive = activeTab === id
return (
<button
key={id}
onClick={() => setActiveTab(id)}
title={label}
style={{
display: 'flex', alignItems: 'center', justifyContent: 'center',
padding: '8px 14px', borderRadius: 8, border: 'none', cursor: 'pointer',
flexShrink: 0,
transition: 'background 0.15s, color 0.15s',
...(isActive ? activeStyle : { background: 'transparent', color: 'inherit' }),
}}
>
<Icon style={{ width: 20, height: 20 }} />
</button>
)
})}
</nav>
{/* Scrollable content area */}
<div style={{ flex: 1, overflowY: 'auto', padding: 16 }}>
{content}
</div>
</div>
)
}
return (
<div style={{ maxWidth: 960, margin: '0 auto', padding: 24 }}>
{/* Page Header */}
@@ -1989,9 +2055,8 @@ export default function Settings() {
display: 'flex', alignItems: 'center', gap: 10,
padding: '8px 12px', borderRadius: 6, textAlign: 'left',
border: 'none', cursor: 'pointer', fontSize: 13, fontWeight: isActive ? 600 : 400,
background: isActive ? 'rgba(var(--brand-500, 59 130 246), 0.1)' : 'transparent',
color: isActive ? 'rgb(var(--brand-500, 59 130 246))' : 'inherit',
transition: 'background 0.15s, color 0.15s',
...(isActive ? activeStyle : { background: 'transparent', color: 'inherit' }),
}}
>
<Icon style={{ width: 16, height: 16, flexShrink: 0 }} />
@@ -2003,13 +2068,7 @@ export default function Settings() {
{/* Content panel */}
<div style={{ flex: 1, minWidth: 0, border: '1px solid var(--border-color)', borderRadius: 12, padding: 24 }}>
{activeTab === 'appearance' && <AppearanceSettings />}
{activeTab === 'subsonic' && <SubsonicSettings />}
{activeTab === 'models' && <ModelDownloader />}
{activeTab === 'maintenance' && <MaintenanceSettings />}
{activeTab === 'power' && <PowerSettings />}
{activeTab === 'autopipeline' && <AutoPipelineSettings />}
{activeTab === 'integrations' && <IntegrationsSettings />}
{content}
</div>
</div>
+161
View File
@@ -0,0 +1,161 @@
/*
* theme-overrides.css — imported in main.tsx AFTER metro.css
*
* MetroUI's un-layered CSS rules win over Tailwind's @layer utilities rules
* (cascade order: un-layered beats layered). By importing this file after
* MetroUI, these un-layered dark-mode rules come last in the cascade and
* therefore override MetroUI's own un-layered light-mode defaults.
*
* No !important used — cascade position alone is sufficient.
*/
/* ── App bar ──────────────────────────────────────────────────────────────── */
.dark .app-bar,
[data-theme="dark"] .app-bar {
background: var(--sidebar-background);
border-bottom: 1px solid var(--border-color);
}
/* ── MetroUI buttons ──────────────────────────────────────────────────────── */
/* Standard button (non-primary/secondary) — dark surface + border */
.dark .button:not(.primary):not(.secondary),
[data-theme="dark"] .button:not(.primary):not(.secondary) {
background: var(--background);
border-color: var(--border-color);
color: var(--foreground);
}
/* Flat & cycle-flat — transparent, no visible border */
.dark .button.flat,
.dark .button.cycle,
.dark .button.cycle.flat,
[data-theme="dark"] .button.flat,
[data-theme="dark"] .button.cycle,
[data-theme="dark"] .button.cycle.flat {
background: transparent;
border-color: transparent;
color: var(--foreground);
}
/* Flat hover state — subtle highlight */
.dark .button.flat:hover:not([disabled]),
.dark .button.cycle.flat:hover:not([disabled]),
[data-theme="dark"] .button.flat:hover:not([disabled]),
[data-theme="dark"] .button.cycle.flat:hover:not([disabled]) {
background: rgba(255, 255, 255, 0.06);
}
/* ── Form controls ────────────────────────────────────────────────────────── */
/* !important is required here: MetroUI's un-layered `select { background: */
/* var(--input-background) }` would otherwise win over our CSS-variable-based */
/* rules. Since this file loads LAST and !important beats any inline style */
/* (including our own fieldStyle), the value of var(--background) is always */
/* the correct theme color (dark or light) set by ThemeContext. */
.dark input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]),
.dark select,
.dark textarea,
[data-theme="dark"] input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
background: var(--background) !important;
color: var(--foreground) !important;
border-color: var(--border-color) !important;
color-scheme: dark;
}
/* ── Panels / cards without explicit inline background ────────────────────── */
.dark .card,
.dark .panel,
[data-theme="dark"] .card,
[data-theme="dark"] .panel {
background: var(--background);
border-color: var(--border-color);
color: var(--foreground);
}
/* ── Tailwind bg-white / bg-slate-50 overrides in dark mode ──────────────── */
/* These classes compile to @layer utilities (low cascade priority). */
/* This un-layered file loads after MetroUI so these rules win. */
/* Elements that already carry an inline background= are unaffected because */
/* inline styles always beat stylesheet rules. */
.dark .bg-white,
[data-theme="dark"] .bg-white {
background-color: var(--background);
}
.dark .bg-slate-50,
[data-theme="dark"] .bg-slate-50 {
background-color: var(--body-background);
}
.dark .bg-slate-100,
[data-theme="dark"] .bg-slate-100 {
background-color: var(--background);
}
/* pre elements (transcript / file text views) */
.dark pre,
[data-theme="dark"] pre {
background-color: var(--body-background);
color: var(--foreground);
}
/* Text colour for unmigrated Tailwind text-slate-* classes */
.dark .text-slate-600,
.dark .text-slate-700,
.dark .text-slate-900,
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-slate-900 {
color: var(--foreground);
}
.dark .text-slate-400,
.dark .text-slate-500,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-slate-500 {
color: var(--foreground-muted);
}
/* Border colours */
.dark .border-slate-200,
.dark .border-slate-300,
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-slate-300 {
border-color: var(--border-color);
}
/* ── MetroUI button hover / active state ──────────────────────────────────── */
/* Cycle-button hover (non-flat) — keep surface dark */
.dark .button.cycle:hover:not([disabled]),
[data-theme="dark"] .button.cycle:hover:not([disabled]) {
background: rgba(255, 255, 255, 0.06);
color: var(--foreground);
}
/* MetroUI's .button::before / info popup overlay that appears on hover */
.dark .button:hover::before,
.dark .button:hover::after,
[data-theme="dark"] .button:hover::before,
[data-theme="dark"] .button:hover::after {
background: var(--background);
color: var(--foreground);
}
/* MetroUI info-box / toast / popup panels */
.dark .info-box,
.dark .metro-dropdown,
.dark .dropdown-menu,
[data-theme="dark"] .info-box,
[data-theme="dark"] .metro-dropdown,
[data-theme="dark"] .dropdown-menu {
background: var(--background);
color: var(--foreground);
border-color: var(--border-color);
}
/* ── LyricsLivePreview tab/icon button hover ─────────────────────────────── */
.lp-btn:hover {
background: rgba(128, 128, 128, 0.15);
}
+3 -1
View File
@@ -27,7 +27,9 @@ echo "[frontend] Building..."
npx vite build 2>&1
echo "[frontend] Starting watch mode (rebuilds on .tsx/.ts changes)..."
npx vite build --watch 2>&1 &
# CHOKIDAR_USEPOLLING=1: WSL2→Docker bind-mounts don't propagate inotify events,
# so chokidar falls back to stat-based polling to detect host-side edits.
CHOKIDAR_USEPOLLING=1 CHOKIDAR_INTERVAL=800 npx vite build --watch 2>&1 &
# ── Backend ───────────────────────────────────────────────────────────────────
cd /app