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:
parent
f57e40d82a
commit
b8b91901eb
7 changed files with 25 additions and 135 deletions
|
|
@ -1,10 +0,0 @@
|
|||
// apps/admin/src/lib/supabase-server.ts
|
||||
// Next.js cookies() 주입 래퍼 — 실제 로직은 @d3ro/api-client
|
||||
|
||||
import { cookies } from 'next/headers'
|
||||
import { createSupabaseServerClient } from '@d3ro/api-client/supabase-server'
|
||||
|
||||
export async function getSupabaseServerClient() {
|
||||
const cookieStore = await cookies()
|
||||
return createSupabaseServerClient(cookieStore)
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
// src/renderer/components/ProBadge.tsx
|
||||
// Feature gate badge: renders children normally if unlocked,
|
||||
// shows lock overlay with PRO badge if locked.
|
||||
// v4(2026-09-28): 덮개는 키보드로도 누를 수 있는 버튼. 모노 글꼴·강조색 글자 제거 — 잠김은 강조가 아니다.
|
||||
|
||||
import { Box, ButtonBase, Typography } from '@mui/material'
|
||||
import { Lock } from 'lucide-react'
|
||||
import { d3roPalette, d3roRadius, d3roTransition, typoSx } from '@d3ro/ui/theme'
|
||||
import { useProFeature } from '../hooks/useProFeature'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
import type { Feature } from '@d3ro/core/types'
|
||||
|
||||
interface ProBadgeProps {
|
||||
feature: Feature
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function ProBadge({ feature, children }: ProBadgeProps): React.ReactElement {
|
||||
const { t } = useI18n()
|
||||
const { unlocked, loading, showUpgrade } = useProFeature(feature)
|
||||
|
||||
// While loading or if unlocked, render children normally
|
||||
if (loading || unlocked) {
|
||||
return <>{children}</>
|
||||
}
|
||||
|
||||
return (
|
||||
<Box sx={{ position: 'relative' }}>
|
||||
{/* 잠긴 내용은 흐리게, 조작 불가 */}
|
||||
<Box aria-hidden sx={{ opacity: 0.35, pointerEvents: 'none' }}>
|
||||
{children}
|
||||
</Box>
|
||||
|
||||
<ButtonBase
|
||||
onClick={showUpgrade}
|
||||
aria-label={t('license.pro.required')}
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
borderRadius: d3roRadius.inner,
|
||||
transition: d3roTransition('background-color'),
|
||||
'&:hover': { bgcolor: d3roPalette.surface.overlaySoft },
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 0.75,
|
||||
px: 1.5,
|
||||
py: 0.5,
|
||||
borderRadius: d3roRadius.small,
|
||||
bgcolor: d3roPalette.bg.elevated,
|
||||
border: `1px solid ${d3roPalette.border.default}`,
|
||||
}}
|
||||
>
|
||||
<Lock size={14} aria-hidden style={{ color: d3roPalette.text.secondary }} />
|
||||
<Typography component="span" sx={{ ...typoSx('small'), fontWeight: 500, color: d3roPalette.text.primary }}>
|
||||
{t('license.pro.required')}
|
||||
</Typography>
|
||||
</Box>
|
||||
</ButtonBase>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
|
@ -11,14 +11,9 @@ export {
|
|||
d3roNativeTypo,
|
||||
d3roNativeRadius,
|
||||
d3roNativeFonts,
|
||||
d3roNativeSpace,
|
||||
d3roNativeControl,
|
||||
d3roNativeWeight,
|
||||
d3roNativeMotion,
|
||||
d3roNativeNumerals,
|
||||
d3roNativeOverlayShadow,
|
||||
type D3roNativePalette,
|
||||
type D3roNativePaletteKey,
|
||||
type D3roNativeStatus,
|
||||
type D3roNativeThemeKey,
|
||||
type D3roNativeTypoKey
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// - accent.solid 는 채운 버튼 배경, accent.ink 는 그 위 글자 (4.5:1 이상). accent.main 은 채움에 쓰지 않는다.
|
||||
// - 굵기는 400/500 (강조 600). 대문자 변환·자간 없음. 모노 폰트 없음(한글 글리프가 없다).
|
||||
|
||||
import { Platform, type TextStyle, type ViewStyle } from 'react-native'
|
||||
import { Platform, type TextStyle } from 'react-native'
|
||||
|
||||
export type D3roNativeThemeKey = 'dark' | 'light'
|
||||
|
||||
|
|
@ -209,11 +209,6 @@ export function getD3roNativePalette(key: D3roNativeThemeKey): D3roNativePalette
|
|||
return key === 'light' ? d3roNativeLightPalette : d3roNativeDarkPalette
|
||||
}
|
||||
|
||||
// ── 간격·컨트롤·웨이트·모션 (RN 은 숫자) ──
|
||||
export const d3roNativeSpace = {
|
||||
s1: 4, s2: 8, s3: 12, s4: 16, s5: 24, s6: 40, s7: 64, s8: 96
|
||||
} as const
|
||||
|
||||
/** 터치 타깃: iOS 44pt / Android 48dp — 두 플랫폼 모두 48 로 맞춘다. 버튼처럼 생긴 것은 이 높이 이상. */
|
||||
export const d3roNativeControl = {
|
||||
h: 48,
|
||||
|
|
@ -221,15 +216,6 @@ export const d3roNativeControl = {
|
|||
padXSm: 12
|
||||
} as const
|
||||
|
||||
export const d3roNativeWeight = {
|
||||
body: '400' as const, medium: '500' as const, strong: '600' as const
|
||||
} as const
|
||||
|
||||
/** theme-raw MOTION 과 같은 길이(ms). 상태 변화 피드백만 — 등장 연출은 쓰지 않는다. */
|
||||
export const d3roNativeMotion = {
|
||||
instant: 100, quick: 160, normal: 240, slow: 400
|
||||
} as const
|
||||
|
||||
// v4 타입 — 데스크톱 d3roTypo v4 와 같은 철학: 크기·명도로 위계, 굵기 400/500, 자간 0(큰 제목만 살짝 음수).
|
||||
// RN letterSpacing 단위는 px, lineHeight 는 px. 한글 본문 행간 1.6.
|
||||
export const d3roNativeTypo = {
|
||||
|
|
@ -263,16 +249,4 @@ export const d3roNativeFonts = {
|
|||
/** 수치 정렬 — 흔들리는 숫자 방지 */
|
||||
export const d3roNativeNumerals: TextStyle = { fontVariant: ['tabular-nums'] }
|
||||
|
||||
/** 떠 있는 층(시트·메뉴·플로팅 버튼) 전용 그림자. 카드·버튼 표면에는 쓰지 않는다. */
|
||||
export function d3roNativeOverlayShadow(palette: D3roNativePalette): ViewStyle {
|
||||
return {
|
||||
shadowColor: palette.shadow,
|
||||
shadowOffset: { width: 0, height: 8 },
|
||||
shadowOpacity: 0.28,
|
||||
shadowRadius: 16,
|
||||
elevation: 8
|
||||
}
|
||||
}
|
||||
|
||||
export type D3roNativePaletteKey = keyof D3roNativePalette
|
||||
export type D3roNativeTypoKey = keyof typeof d3roNativeTypo
|
||||
|
|
|
|||
|
|
@ -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]),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue