import { Lock } from 'lucide-react'; import type { ReactNode } from 'react'; import { useTranslation } from '../../i18n'; import { fs } from '../shared/DialogShell'; interface DemoLockProps { /** From useDemoAccountLock: false renders the children untouched. */ locked: boolean; /** One line saying what the demo does not allow here. */ reason: string; children: ReactNode; /** `row` for a single settings row: the note sits in the middle instead of at the top. */ size?: 'section' | 'row'; className?: string; } /** Thin diagonal stripes in the theme's own ink, so they read in light and dark alike. */ const STRIPES = 'repeating-linear-gradient(135deg, color-mix(in srgb, var(--text-primary) 8%, transparent) 0 9px, transparent 9px 18px)'; /** * A section the shared demo account may look at but not change: dimmed, * out of reach for pointer and keyboard, under a striped veil that carries a * small "Demo mode" badge and the reason. Used on the desktop settings and on * the phone screens alike. */ export default function DemoLock({ locked, reason, children, size = 'section', className = '' }: DemoLockProps) { const { t } = useTranslation(); if (!locked) return <>{children}; return (
{t('demo.lock.badge')} {reason}
); }