refactor(ui): remove dead DS exports and unify wave gradient fallbacks (WS-G1)

Wave 5 G1 — evidence-based deletion only (docs/REFACTOR_WAVE5_AUDIT.md).

Deleted (references = 0 repo-wide, grep verified):
- apps/desktop/src/renderer/components/ProBadge.tsx (65 lines, self-reference only)
- apps/admin/src/lib/supabase-server.ts (unused duplicate of the web wrapper;
  api-client already owns createSupabaseServerClient)
- packages/ui: d3roSpace, d3roWeight, d3roMotion, darkTheme, lightTheme,
  getModePalette; `themes` kept module-private (used by getTheme)
- packages/ui-native: d3roNativeSpace, d3roNativeWeight, d3roNativeMotion,
  d3roNativeOverlayShadow, D3roNativePaletteKey (+ barrel entries)

Changed:
- ds/AudioVisualizerBar, ds/GradientWave: SSR/무-문서 폴백 hex 대신
  theme-raw RAW.dark.gradient 를 읽는다. 같은 색을 두 곳에 적지 않는다 (DP1).

Verification:
- npm run typecheck (desktop/web/admin/packages) GREEN
- npm run lint --max-warnings=0 GREEN
- npm run test GREEN
- npm run typecheck:mobile, lint:mobile GREEN; test:mobile 599 GREEN
- npm run check:design: 0 violations

Kept (with reason): apps/desktop/src/preload/popup.ts (electron-vite entry),
apps/*/src/proxy.ts (Next middleware), instrumentation.ts, *.d.ts,
constants.ts WAVE_BAR (화면 고유 수치, P4).
This commit is contained in:
Yun Chan 2026-11-08 20:55:40 +09:00
parent f57e40d82a
commit b8b91901eb
7 changed files with 25 additions and 135 deletions

View file

@ -6,6 +6,10 @@
import React, { useRef, useEffect } from 'react'
import { Box, type BoxProps } from '@mui/material'
import { d3roRadius } from '../../theme'
import { RAW } from '../../theme-raw'
/** SSR/무-문서 환경 폴백 — 테마 원시값에서 가져온다(하드코딩 hex 금지). */
const WAVE_FALLBACK = RAW.dark.gradient
export interface AudioVisualizerBarProps extends Omit<BoxProps, 'children'> {
/** Real-time normalized audio RMS level (0.0 to 1.0) */
@ -23,14 +27,15 @@ export interface AudioVisualizerBarProps extends Omit<BoxProps, 'children'> {
}
function readVisualizerColors(): [string, string, string, string] {
if (typeof document === 'undefined') return ['#60a5fa', '#3b82f6', '#818cf8', '#a78bfa']
const fallback = [WAVE_FALLBACK.wave1, WAVE_FALLBACK.wave2, WAVE_FALLBACK.wave3, WAVE_FALLBACK.wave4]
if (typeof document === 'undefined') return [fallback[0], fallback[1], fallback[2], fallback[3]]
const style = getComputedStyle(document.documentElement)
const read = (name: string, fallback: string): string => style.getPropertyValue(name).trim() || fallback
const read = (name: string, fb: string): string => style.getPropertyValue(name).trim() || fb
return [
read('--d3-gradient-wave1', '#60a5fa'),
read('--d3-gradient-wave2', '#3b82f6'),
read('--d3-gradient-wave3', '#818cf8'),
read('--d3-gradient-wave4', '#a78bfa'),
read('--d3-gradient-wave1', fallback[0]),
read('--d3-gradient-wave2', fallback[1]),
read('--d3-gradient-wave3', fallback[2]),
read('--d3-gradient-wave4', fallback[3]),
]
}

View file

@ -7,6 +7,10 @@
import { useRef, useEffect } from 'react'
import { Box } from '@mui/material'
import { RAW } from '../../theme-raw'
/** SSR/무-문서 환경 폴백 — 테마 원시값에서 가져온다(하드코딩 hex 금지). */
const WAVE_FALLBACK = RAW.dark.gradient
interface GradientWaveProps {
/** 실시간 오디오 레벨 0~1 (없으면 유휴 애니메이션만) */
@ -27,15 +31,16 @@ interface GradientWaveProps {
/** :root에 주입된 웨이브 그라디언트 스톱을 읽는다 */
function readWaveColors(): [string, string, string, string] {
if (typeof document === 'undefined') return ['#60a5fa', '#3b82f6', '#818cf8', '#a78bfa']
const fallback = [WAVE_FALLBACK.wave1, WAVE_FALLBACK.wave2, WAVE_FALLBACK.wave3, WAVE_FALLBACK.wave4]
if (typeof document === 'undefined') return [fallback[0], fallback[1], fallback[2], fallback[3]]
const style = getComputedStyle(document.documentElement)
const read = (name: string, fallback: string): string =>
style.getPropertyValue(name).trim() || fallback
const read = (name: string, fb: string): string =>
style.getPropertyValue(name).trim() || fb
return [
read('--d3-gradient-wave1', '#60a5fa'),
read('--d3-gradient-wave2', '#3b82f6'),
read('--d3-gradient-wave3', '#818cf8'),
read('--d3-gradient-wave4', '#a78bfa'),
read('--d3-gradient-wave1', fallback[0]),
read('--d3-gradient-wave2', fallback[1]),
read('--d3-gradient-wave3', fallback[2]),
read('--d3-gradient-wave4', fallback[3]),
]
}

View file

@ -14,16 +14,13 @@ import {
RAW,
STATUS,
TAG,
SPACE,
CONTROL,
WEIGHT,
MOTION,
RADIUS,
FONT_SANS,
FONT_MONO,
buildCssVars,
type ThemeKey,
type RawTheme,
} from './theme-raw'
export type { ThemeKey, RawTheme } from './theme-raw'
@ -226,10 +223,7 @@ export const d3roShadow = {
// ── SSOT: 반경 · 간격 · 컨트롤 · 웨이트 · 모션 ─────────────────
export const d3roRadius = RADIUS
export const d3roSpace = SPACE
export const d3roControl = CONTROL
export const d3roWeight = WEIGHT
export const d3roMotion = MOTION
/** 상태 변화 트랜지션 한 줄 — 컴포넌트마다 duration/easing 을 새로 적지 않는다. */
export function d3roTransition(...props: string[]): string {
@ -462,7 +456,7 @@ function createD3ROTheme(key: ThemeKey): Theme {
}
// ── Export ─────────────────────────────────────────────────
export const themes: Record<ThemeKey, Theme> = {
const themes: Record<ThemeKey, Theme> = {
dark: createD3ROTheme('dark'),
light: createD3ROTheme('light'),
nord: createD3ROTheme('nord'),
@ -471,15 +465,7 @@ export const themes: Record<ThemeKey, Theme> = {
dracula: createD3ROTheme('dracula'),
}
// 하위 호환 export
export const darkTheme = themes.dark
export const lightTheme = themes.light
export function getTheme(mode: ThemeMode, prefersDark = true): Theme {
if (mode === 'auto') return prefersDark ? themes.dark : themes.light
return themes[mode as ThemeKey] ?? themes.dark
}
export function getModePalette(mode: ThemeMode): RawTheme {
return RAW[mode as ThemeKey] ?? RAW.dark
}