A new, compact interface on Radix primitives, Motion, cmdk and sonner. Design system - Tokens for surfaces, text, accent and states in dark and light, used everywhere (no more hard-coded red/yellow/pink); Inter and JetBrains Mono self-hosted; compact controls that grow to 44px on touch screens. - Primitives rebuilt on Radix: Button, IconButton (cannot render without a name), Field/Input/Select/Textarea (labels wired to controls; the ten selects that shared id="type" are gone), Switch, Checkbox, Tabs, SegmentedControl, Accordion (closed content is inert), Dialog, AlertDialog, Sheet, Popover, Tooltip, Card, Badge, Banner, EmptyState, PageHeader, NumberField. - Animated icons (copy→check, sun↔moon, hover micro-motion on the nav) that follow the OS reduce-motion setting. App shell - Collapsible sidebar with grouped pages and a sliding active marker; top bar with the command palette, output/interface language, theme and donate; on phones a bottom bar with four pages plus "More". - Ctrl/⌘+K command palette: go anywhere, copy title/description/tags, apply a profile/preset/template, switch theme or languages. - Skip link, one h1 per page, <main> focusable; toasts no longer share a corner with three other floating elements. Pages - Editor: two columns with a sticky live preview (tabs, counters, copy) or a sheet on phones; sections reordered so video type and game come first; genres are a searchable picker instead of a wall of 42 chips; expand/collapse all; a button to the Output page. - Output: a YouTube preview (what search results and the "…more" fold show), language tabs, Copy All in the header (floating on phones). - Profiles/presets/templates share one card with Apply + Undo; History, Logs, Batch, Social, Playlist, Settings, About, Legal, the consent screen and the error pages all use the same primitives. Fixes - Ctrl/⌘+Shift+C ignored the YouTube limits and Strict Mode. - Number settings clamped on every keystroke; they now save on blur. - Hard-coded English on Playlist, Batch, Logs, Profiles and Settings. - Flags as language icons (Windows shows letters) → native name + code. - The consent screen could not change language or theme. - About: dead Discord invite removed; contact addresses by purpose. - Desktop window is resizable (1280×820, min 960×640). Initial load 262 KB gzip (budget 280): the command palette, the genre list and the Output page load on demand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { useEffect, useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { AnimatePresence, m } from "motion/react";
|
|
import { CloudCheck } from "lucide-react";
|
|
import { useEditorStore } from "@store/editor-store";
|
|
|
|
/**
|
|
* "Draft saved", briefly, after each edit. It subscribes to the store instead
|
|
* of watching fields, so it only reacts to real edits — the old version also
|
|
* flashed every time the Editor page mounted.
|
|
*/
|
|
export function DraftIndicator() {
|
|
const { t } = useTranslation("ui");
|
|
const [visible, setVisible] = useState(false);
|
|
|
|
useEffect(() => {
|
|
let hide: ReturnType<typeof setTimeout> | undefined;
|
|
const unsubscribe = useEditorStore.subscribe(() => {
|
|
setVisible(true);
|
|
clearTimeout(hide);
|
|
hide = setTimeout(() => setVisible(false), 1600);
|
|
});
|
|
return () => {
|
|
unsubscribe();
|
|
clearTimeout(hide);
|
|
};
|
|
}, []);
|
|
|
|
return (
|
|
<span className="inline-flex h-5 items-center" aria-live="polite">
|
|
<AnimatePresence>
|
|
{visible && (
|
|
<m.span
|
|
initial={{ opacity: 0, y: 2 }}
|
|
animate={{ opacity: 1, y: 0 }}
|
|
exit={{ opacity: 0 }}
|
|
transition={{ duration: 0.15 }}
|
|
className="text-success inline-flex items-center gap-1 text-xs font-medium"
|
|
>
|
|
<CloudCheck className="size-3.5" aria-hidden="true" />
|
|
{t("editor.draftSaved")}
|
|
</m.span>
|
|
)}
|
|
</AnimatePresence>
|
|
</span>
|
|
);
|
|
}
|