Merge pull request #172 from poli0981/feat/ui-redesign

feat(ui): redesign — design system, app shell, command palette, every page
This commit is contained in:
poli0981 authored and GitHub committed 2026-09-30 21:11:28 +07:00
commit 7f8dc0ad64
119 files changed
+10416 -3650

No files matched your search

+8 -2
View File
@@ -12,20 +12,26 @@ Bundled into the web app and the desktop / Android apps.
| Package | Version | License | Project |
| --- | --- | --- | --- |
| `@fontsource-variable/inter` | 5.3.0 | OFL-1.1 | <https://github.com/fontsource/font-files> |
| `@fontsource-variable/jetbrains-mono` | 5.3.0 | OFL-1.1 | <https://github.com/fontsource/font-files> |
| `@tauri-apps/api` | 2.12.0 | Apache-2.0 OR MIT | <https://github.com/tauri-apps/tauri> |
| `@tauri-apps/plugin-dialog` | 2.8.0 | MIT OR Apache-2.0 | <https://github.com/tauri-apps/plugins-workspace> |
| `@tauri-apps/plugin-fs` | 2.6.0 | MIT OR Apache-2.0 | <https://github.com/tauri-apps/plugins-workspace> |
| `@tauri-apps/plugin-opener` | 2.7.0 | MIT OR Apache-2.0 | <https://github.com/tauri-apps/plugins-workspace> |
| `@tauri-apps/plugin-shell` | 2.4.0 | MIT OR Apache-2.0 | <https://github.com/tauri-apps/plugins-workspace> |
| `clsx` | 2.1.1 | MIT | <https://github.com/lukeed/clsx> |
| `cmdk` | 1.1.1 | MIT | <https://github.com/pacocoursey/cmdk> |
| `i18next` | 26.4.2 | MIT | <https://github.com/i18next/i18next> |
| `i18next-resources-to-backend` | 1.2.3 | MIT | <https://github.com/i18next/i18next-resources-to-backend> |
| `lucide-react` | 0.577.0 | ISC | <https://github.com/lucide-icons/lucide> |
| `lucide-react` | 1.49.0 | ISC | <https://github.com/lucide-icons/lucide> |
| `motion` | 13.4.6 | MIT | <https://github.com/motiondivision/motion> |
| `radix-ui` | 1.6.7 | MIT | <https://github.com/radix-ui/primitives> |
| `react` | 19.3.0 | MIT | <https://github.com/react/react> |
| `react-dom` | 19.3.0 | MIT | <https://github.com/react/react> |
| `react-hot-toast` | 2.6.1 | MIT | <https://github.com/timolins/react-hot-toast> |
| `react-i18next` | 17.0.15 | MIT | <https://github.com/i18next/react-i18next> |
| `react-router-dom` | 7.18.4 | MIT | <https://github.com/remix-run/react-router> |
| `simple-icons` | 16.33.0 | CC0-1.0 | <https://simpleicons.org> |
| `sonner` | 2.0.8 | MIT | <https://github.com/emilkowalski/sonner> |
| `zustand` | 5.0.15 | MIT | <https://github.com/pmndrs/zustand> |
## Build and development tools
+1898 -44
View File
File diff suppressed because it is too large. Load diff
+8 -2
View File
@@ -33,20 +33,26 @@
"generate:third-party": "tsx scripts/third-party.ts --write"
},
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
"@fontsource-variable/jetbrains-mono": "^5.3.0",
"@tauri-apps/api": "^2.12.0",
"@tauri-apps/plugin-dialog": "^2.8.0",
"@tauri-apps/plugin-fs": "^2.6.0",
"@tauri-apps/plugin-opener": "^2.7.0",
"@tauri-apps/plugin-shell": "^2.4.0",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"i18next": "^26.4.2",
"i18next-resources-to-backend": "^1.2.3",
"lucide-react": "^0.577.0",
"lucide-react": "^1.49.0",
"motion": "^13.4.6",
"radix-ui": "^1.6.7",
"react": "^19.3.0",
"react-dom": "^19.3.0",
"react-hot-toast": "^2.6.1",
"react-i18next": "^17.0.15",
"react-router-dom": "^7.18.4",
"simple-icons": "^16.33.0",
"sonner": "^2.0.8",
"zustand": "^5.0.15"
},
"devDependencies": {
+6 -8
View File
@@ -13,14 +13,12 @@
"windows": [
{
"title": "YTDescGen",
"width": 1100,
"height": 750,
"minWidth": 1100,
"minHeight": 750,
"maxWidth": 1100,
"maxHeight": 750,
"resizable": false,
"maximizable": false,
"width": 1280,
"height": 820,
"minWidth": 960,
"minHeight": 640,
"resizable": true,
"maximizable": true,
"fullscreen": false,
"center": true
}
+145 -127
View File
@@ -1,21 +1,28 @@
import { lazy, Suspense, useEffect, type ReactNode } from "react";
import { BrowserRouter, HashRouter, Outlet, Routes, Route } from "react-router-dom";
import { Toaster } from "react-hot-toast";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { AppShell } from "@components/layout/AppShell";
import { MotionProvider } from "@components/motion/MotionProvider";
import { TooltipProvider } from "@components/ui/Tooltip";
import { Toaster } from "@components/ui/Toaster";
import { Spinner } from "@components/icons/animated";
import { ErrorBoundary } from "@components/ErrorBoundary";
import { ErrorPage } from "@components/errors/ErrorPage";
import { OfflineBanner } from "@components/errors/OfflineBanner";
import { ConsentGate } from "@components/ConsentGate";
import { needsConsent } from "@config/legal";
import { EditorPage } from "@pages/EditorPage";
import { OutputPage } from "@pages/OutputPage";
import { checkDataFileHealth } from "@utils/storage-adapter";
import { hydrateLogStore } from "@store/log-store";
import { useSettingsStore } from "@store/settings-store";
import i18n from "@i18n/index";
import { IS_TAURI } from "@utils/platform";
// The Editor is the landing page and stays in the entry bundle; Output is
// the usual next stop, so it is fetched as soon as the browser is idle.
const loadOutputPage = () => import("@pages/OutputPage");
const OutputPage = lazy(() => loadOutputPage().then((m) => ({ default: m.OutputPage })));
const ProfilesPage = lazy(() =>
import("@pages/ProfilesPage").then((m) => ({ default: m.ProfilesPage })),
);
@@ -43,7 +50,16 @@ const LegalPage = lazy(() => import("@pages/LegalPage").then((m) => ({ default:
const Router = IS_TAURI ? HashRouter : BrowserRouter;
function PageLoader() {
return <div className="text-text-muted flex items-center justify-center p-12">Loading...</div>;
const { t } = useTranslation("ui");
return (
<div
role="status"
className="text-text-muted flex items-center justify-center gap-2 p-16 text-sm"
>
<Spinner className="size-4" />
{t("common.loading")}
</div>
);
}
/**
@@ -74,18 +90,10 @@ function ConsentGuard() {
return needsConsent(legalConsentVersion) ? <ConsentGate /> : <Outlet />;
}
const TOASTER_OPTIONS = {
style: {
background: "var(--surface-2)",
color: "var(--text-primary)",
border: "1px solid var(--border)",
},
};
export default function App() {
useEffect(() => {
checkDataFileHealth().then((msg) => {
if (msg) toast(msg, { icon: "⚠️", duration: 5000 });
if (msg) toast.warning(msg, { duration: 5000 });
});
// v0.17.0: hydrate the log store from persisted JSONL files /
// localStorage so prior-session entries surface in the Logs tab
@@ -94,6 +102,14 @@ export default function App() {
// every settings tweak.
const retentionDays = useSettingsStore.getState().logRetentionDays;
void hydrateLogStore(retentionDays);
const prefetch = () => void loadOutputPage().catch(() => undefined);
if ("requestIdleCallback" in window) {
const id = window.requestIdleCallback(prefetch, { timeout: 4000 });
return () => window.cancelIdleCallback(id);
}
const timer = setTimeout(prefetch, 1500);
return () => clearTimeout(timer);
}, []);
// v0.18.0: bridge the persisted `appLanguage` setting back to i18next.
@@ -127,122 +143,124 @@ export default function App() {
}, []);
return (
<>
<Router>
<Routes>
<Route
path="/legal"
element={
<PageBoundary label="Legal">
<LegalPage />
</PageBoundary>
}
/>
<Route
path="/legal/:docId"
element={
<PageBoundary label="Legal">
<LegalPage />
</PageBoundary>
}
/>
<Route element={<ConsentGuard />}>
<Route element={<AppShell />}>
<Route
index
element={
<ErrorBoundary label="Editor">
<EditorPage />
</ErrorBoundary>
}
/>
<Route
path="output"
element={
<ErrorBoundary label="Output">
<OutputPage />
</ErrorBoundary>
}
/>
<Route
path="profiles"
element={
<PageBoundary label="Profiles">
<ProfilesPage />
</PageBoundary>
}
/>
<Route
path="history"
element={
<PageBoundary label="History">
<HistoryPage />
</PageBoundary>
}
/>
<Route
path="settings"
element={
<PageBoundary label="Settings">
<SettingsPage />
</PageBoundary>
}
/>
<Route
path="batch"
element={
<PageBoundary label="Batch">
<BatchPage />
</PageBoundary>
}
/>
<Route
path="social"
element={
<PageBoundary label="Social">
<SocialPage />
</PageBoundary>
}
/>
<Route
path="playlist"
element={
<PageBoundary label="Playlist">
<PlaylistPage />
</PageBoundary>
}
/>
<Route
path="logs"
element={
<PageBoundary label="Logs">
<LogPage />
</PageBoundary>
}
/>
<Route
path="about"
element={
<PageBoundary label="About">
<AboutPage />
</PageBoundary>
}
/>
</Route>
{/* Designed error pages — siblings of the AppShell group so they
<MotionProvider>
<TooltipProvider>
<Router>
<Routes>
<Route
path="/legal"
element={
<PageBoundary label="Legal">
<LegalPage />
</PageBoundary>
}
/>
<Route
path="/legal/:docId"
element={
<PageBoundary label="Legal">
<LegalPage />
</PageBoundary>
}
/>
<Route element={<ConsentGuard />}>
<Route element={<AppShell />}>
<Route
index
element={
<ErrorBoundary label="Editor">
<EditorPage />
</ErrorBoundary>
}
/>
<Route
path="output"
element={
<PageBoundary label="Output">
<OutputPage />
</PageBoundary>
}
/>
<Route
path="profiles"
element={
<PageBoundary label="Profiles">
<ProfilesPage />
</PageBoundary>
}
/>
<Route
path="history"
element={
<PageBoundary label="History">
<HistoryPage />
</PageBoundary>
}
/>
<Route
path="settings"
element={
<PageBoundary label="Settings">
<SettingsPage />
</PageBoundary>
}
/>
<Route
path="batch"
element={
<PageBoundary label="Batch">
<BatchPage />
</PageBoundary>
}
/>
<Route
path="social"
element={
<PageBoundary label="Social">
<SocialPage />
</PageBoundary>
}
/>
<Route
path="playlist"
element={
<PageBoundary label="Playlist">
<PlaylistPage />
</PageBoundary>
}
/>
<Route
path="logs"
element={
<PageBoundary label="Logs">
<LogPage />
</PageBoundary>
}
/>
<Route
path="about"
element={
<PageBoundary label="About">
<AboutPage />
</PageBoundary>
}
/>
</Route>
{/* Designed error pages — siblings of the AppShell group so they
render full-screen with no Sidebar/Header. `403/419/500` are
route-reachable for future triggers; `*` is the live 404 for
any mistyped path. */}
<Route path="/403" element={<ErrorPage kind="forbidden" />} />
<Route path="/419" element={<ErrorPage kind="expired" />} />
<Route path="/500" element={<ErrorPage kind="serverError" />} />
<Route path="/offline" element={<ErrorPage kind="offline" />} />
<Route path="*" element={<ErrorPage kind="notFound" />} />
</Route>
</Routes>
<OfflineBanner />
</Router>
<Toaster position="bottom-right" toastOptions={TOASTER_OPTIONS} />
</>
<Route path="/403" element={<ErrorPage kind="forbidden" />} />
<Route path="/419" element={<ErrorPage kind="expired" />} />
<Route path="/500" element={<ErrorPage kind="serverError" />} />
<Route path="/offline" element={<ErrorPage kind="offline" />} />
<Route path="*" element={<ErrorPage kind="notFound" />} />
</Route>
</Routes>
<OfflineBanner />
</Router>
<Toaster />
</TooltipProvider>
</MotionProvider>
);
}
+75 -40
View File
@@ -1,9 +1,14 @@
import { useState } from "react";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { ChevronRight, ShieldCheck } from "lucide-react";
import { ChevronRight, FileText, Languages } from "lucide-react";
import { Button } from "@components/ui/Button";
import { Card } from "@components/ui/Card";
import { Checkbox } from "@components/ui/Checkbox";
import { IconButton } from "@components/ui/IconButton";
import { LanguageChip } from "@components/layout/LanguageChip";
import { Logo } from "@components/brand/Logo";
import { ThemeToggleIcon } from "@components/icons/animated";
import { useDocumentTitle } from "@hooks/use-document-title";
import { useSettingsStore } from "@store/settings-store";
import { LEGAL_DOCS, legalDocPath } from "@config/legal";
@@ -16,17 +21,22 @@ const CONSENT_DOCS = LEGAL_DOCS.filter((doc) => doc.consent);
* (no ESC / backdrop / X — deliberately NOT the {@link import("@components/ui/Modal").Modal})
* in place of the router until the user accepts the current terms version.
*
* Layout mirrors the v0.27.0 ErrorPage fullscreen pattern. Acceptance is
* recorded in the settings store (`acceptLegalConsent`); the gate then yields
* to the app. Re-shows automatically when CURRENT_TERMS_VERSION is bumped, and
* in fresh / incognito storage. Each document opens in the in-app Legal Center
* (a route outside the consent guard), so reading one never leaves the app.
* On the web, agreeing on the Cloudflare gate page counts too — see
* Acceptance is recorded in the settings store (`acceptLegalConsent`); the
* gate then yields to the app. Re-shows automatically when
* CURRENT_TERMS_VERSION is bumped, and in fresh / incognito storage. Each
* document opens in the in-app Legal Center (a route outside the consent
* guard), so reading one never leaves the app. Language and theme can be
* changed right here — it is the first screen a new desktop user sees. On
* the web, agreeing on the Cloudflare gate page counts too — see
* `acceptConsentFromGate` in main.tsx.
*/
export function ConsentGate() {
const { t } = useTranslation("ui");
const [agreed, setAgreed] = useState(false);
const appLanguage = useSettingsStore((s) => s.appLanguage);
const setAppLanguage = useSettingsStore((s) => s.setAppLanguage);
const theme = useSettingsStore((s) => s.theme);
const setTheme = useSettingsStore((s) => s.setTheme);
useDocumentTitle(t("consentGate.title"));
const onContinue = (): void => {
@@ -35,44 +45,69 @@ export function ConsentGate() {
};
return (
<div
role="dialog"
aria-modal="true"
aria-labelledby="consent-title"
className="bg-surface-0 flex min-h-screen flex-col items-center justify-center gap-6 px-6 py-12 text-center"
>
<ShieldCheck className="text-accent h-14 w-14" aria-hidden />
<div className="bg-surface-0 relative flex min-h-dvh flex-col items-center justify-center px-4 py-12">
<div
className="bg-brand-gradient pointer-events-none absolute top-0 left-1/2 h-64 w-[36rem] max-w-full -translate-x-1/2 rounded-full opacity-15 blur-3xl"
aria-hidden="true"
/>
<div className="max-w-md space-y-2">
<h1 id="consent-title" className="text-text-primary text-2xl font-semibold">
{t("consentGate.title")}
</h1>
<p className="text-text-secondary text-sm">{t("consentGate.intro")}</p>
<div className="absolute top-3 right-3 flex items-center gap-1">
<LanguageChip
label={t("header.interfaceLanguage")}
value={appLanguage}
onChange={setAppLanguage}
prefix={<Languages className="size-3.5" aria-hidden="true" />}
/>
<IconButton
label={t(theme === "dark" ? "header.switchToLight" : "header.switchToDark")}
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
>
<ThemeToggleIcon theme={theme} />
</IconButton>
</div>
<div className="grid w-full max-w-md gap-2 sm:grid-cols-2">
{CONSENT_DOCS.map((doc) => (
<Link
key={doc.id}
to={legalDocPath(doc.id)}
className="border-border bg-surface-1 text-text-primary hover:border-accent hover:bg-surface-2 flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors"
>
<span className="flex-1 truncate text-left">{t(doc.labelKey)}</span>
<ChevronRight className="text-text-muted h-3.5 w-3.5 shrink-0" aria-hidden />
</Link>
))}
</div>
<main className="relative w-full max-w-md">
<Card className="flex flex-col gap-5 p-6 sm:p-7">
<div className="flex flex-col items-center gap-3 text-center">
<Logo className="size-12" />
<h1 className="text-text-primary text-xl font-semibold tracking-tight">
{t("consentGate.title")}
</h1>
<p className="text-text-secondary text-sm leading-relaxed">{t("consentGate.intro")}</p>
</div>
<div className="border-border bg-surface-1 w-full max-w-md rounded-lg border p-4">
<Checkbox checked={agreed} onChange={setAgreed} label={t("consentGate.agreeLabel")} />
</div>
<ul className="flex flex-col gap-1.5">
{CONSENT_DOCS.map((doc) => (
<li key={doc.id}>
<Link
to={legalDocPath(doc.id)}
className="border-border bg-surface-0 text-text-primary hover:border-accent group flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors"
>
<FileText className="text-accent size-4 shrink-0" aria-hidden />
<span className="flex-1 truncate text-left">{t(doc.labelKey)}</span>
<ChevronRight
className="text-text-muted group-hover:text-accent size-4 shrink-0"
aria-hidden
/>
</Link>
</li>
))}
</ul>
<div className="flex flex-col items-center gap-2">
<Button variant="primary" onClick={onContinue} disabled={!agreed}>
{t("consentGate.continue")}
</Button>
{!agreed && <p className="text-text-muted text-xs">{t("consentGate.mustAgree")}</p>}
</div>
<div className="border-border bg-surface-0 rounded-lg border p-3">
<Checkbox checked={agreed} onChange={setAgreed} label={t("consentGate.agreeLabel")} />
</div>
<div className="flex flex-col gap-2">
<Button variant="brand" size="lg" onClick={onContinue} disabled={!agreed}>
{t("consentGate.continue")}
</Button>
{!agreed && (
<p className="text-text-muted text-center text-xs">{t("consentGate.mustAgree")}</p>
)}
</div>
</Card>
</main>
</div>
);
}
+38
View File
@@ -0,0 +1,38 @@
import { useId } from "react";
import clsx from "clsx";
import { BRAND_GRADIENT } from "@config/brand";
/** The app mark (assets/brand/logo.svg) as a component. Decorative. */
export function Logo({ className }: { className?: string }) {
// Unique gradient id per instance — two logos on a page must not share one.
const gradientId = `ytg-logo-${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
return (
<svg
viewBox="0 0 512 512"
aria-hidden="true"
focusable="false"
className={clsx("shrink-0", className)}
>
<defs>
<linearGradient
id={gradientId}
x1="40"
y1="24"
x2="472"
y2="488"
gradientUnits="userSpaceOnUse"
>
<stop offset="0" stopColor={BRAND_GRADIENT.from} />
<stop offset="1" stopColor={BRAND_GRADIENT.to} />
</linearGradient>
</defs>
<rect width="512" height="512" rx="120" fill={`url(#${gradientId})`} />
<path
d="M176 118c0-17.9 19.4-29.1 34.9-20.1l128.2 74c15.5 9 15.5 31.2 0 40.2l-128.2 74C195.4 295.1 176 283.9 176 266z"
fill="#fff"
/>
<rect x="136" y="322" width="240" height="32" rx="16" fill="#fff" fillOpacity=".92" />
<rect x="136" y="374" width="160" height="32" rx="16" fill="#fff" fillOpacity=".6" />
</svg>
);
}
+1 -1
View File
@@ -43,7 +43,7 @@ export function CommunityEditor() {
return (
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
<span className="text-text-secondary text-sm font-medium">{t("editor.community")}</span>
<span className="text-text-primary text-sm font-semibold">{t("editor.community")}</span>
<p className="text-text-muted text-xs">{t("editor.communityHelp")}</p>
</div>
+18 -149
View File
@@ -1,163 +1,32 @@
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChevronDown, ChevronRight, Search, X } from "lucide-react";
import clsx from "clsx";
import { useEditorStore } from "@store/editor-store";
import { CONTENT_WARNING_GROUPS, type ContentWarningGroup } from "@config/content-warning-groups";
import { CONTENT_WARNING_GROUPS } from "@config/content-warning-groups";
import type { ContentWarning } from "@engine/types";
import { GroupedChecklist } from "./GroupedChecklist";
const optionKey = (id: ContentWarning) => `editor.contentWarningOptions.${id}`;
/**
* Replaces the v0.7 `WarningToggles` (2 boolean toggles + small
* checklist) with a unified, searchable, grouped checklist of ~40
* content-warning items. Each item maps to an entry in the editor's
* `contentWarnings` array; checking appends, unchecking removes.
*
* Selection order is preserved — the description renders bullets in
* the order the user picked them.
* The ~40 content warnings, grouped and searchable. Each maps to an entry in
* the editor's `contentWarnings` array; selection order is preserved so the
* description lists them in the order they were picked. Spoilers — the group
* most videos need — starts open.
*/
export function ContentWarningChecklist() {
const { t } = useTranslation("ui");
const selected = useEditorStore((s) => s.contentWarnings);
const set = useEditorStore((s) => s.set);
const [query, setQuery] = useState("");
// Groups start collapsed except the one with the most-likely-needed
// items (Spoilers). Users can search to bypass the collapse anyway.
const [openGroups, setOpenGroups] = useState<Record<string, boolean>>(() => ({
spoilers: true,
photosensitive: false,
phobias: false,
mental_health: false,
social_phenomena: false,
sensitive: false,
horror_specific: false,
}));
const trimmedQuery = query.trim().toLowerCase();
const isFiltering = trimmedQuery.length > 0;
const filteredGroups = useMemo<ContentWarningGroup[]>(() => {
if (!isFiltering) return [...CONTENT_WARNING_GROUPS];
return CONTENT_WARNING_GROUPS.map((group) => ({
...group,
items: group.items.filter((id) =>
t(`editor.contentWarningOptions.${id}`).toLowerCase().includes(trimmedQuery),
),
})).filter((group) => group.items.length > 0);
}, [t, trimmedQuery, isFiltering]);
const totalMatching = filteredGroups.reduce((acc, g) => acc + g.items.length, 0);
function toggleItem(id: ContentWarning) {
if (selected.includes(id)) {
set(
"contentWarnings",
selected.filter((x) => x !== id),
);
} else {
set("contentWarnings", [...selected, id]);
}
}
function toggleGroup(groupId: string) {
setOpenGroups((prev) => ({ ...prev, [groupId]: !prev[groupId] }));
}
return (
<div className="flex flex-col gap-2">
<div className="flex items-baseline justify-between">
<span className="text-text-secondary text-sm font-medium">{t("editor.warnings")}</span>
{selected.length > 0 && (
<span className="text-text-muted text-xs">{selected.length} selected</span>
)}
</div>
<div className="relative">
<Search className="text-text-muted pointer-events-none absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2" />
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("editor.contentWarningSearchPlaceholder")}
className="border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent w-full rounded-md border py-1.5 pr-7 pl-8 text-sm focus:outline-none"
/>
{query && (
<button
type="button"
onClick={() => setQuery("")}
className="text-text-muted hover:text-text-primary absolute top-1/2 right-2 -translate-y-1/2"
aria-label="Clear search"
>
<X className="h-3.5 w-3.5" />
</button>
)}
</div>
{isFiltering && totalMatching === 0 ? (
<p className="text-text-muted py-2 text-center text-xs">
{t("editor.contentWarningEmpty")}
</p>
) : (
<div className="flex flex-col gap-1">
{filteredGroups.map((group) => {
const isOpen = isFiltering || openGroups[group.id];
const groupSelectedCount = group.items.filter((id) => selected.includes(id)).length;
return (
<div
key={group.id}
className="border-border bg-surface-1 overflow-hidden rounded-md border"
>
<button
type="button"
onClick={() => toggleGroup(group.id)}
className="text-text-secondary hover:bg-surface-2 flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium"
aria-expanded={isOpen}
>
<span className="flex items-center gap-1.5">
{isOpen ? (
<ChevronDown className="h-3.5 w-3.5" />
) : (
<ChevronRight className="h-3.5 w-3.5" />
)}
{t(group.labelKey)}
</span>
{groupSelectedCount > 0 && (
<span className="bg-accent/15 text-accent rounded-full px-2 py-0.5 text-[10px] font-medium">
{groupSelectedCount}
</span>
)}
</button>
{isOpen && (
<div className="border-border bg-surface-1 grid grid-cols-1 gap-x-3 gap-y-1 border-t px-3 py-2 sm:grid-cols-2">
{group.items.map((id) => {
const checked = selected.includes(id);
return (
<label
key={id}
className={clsx(
"flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 text-xs transition-colors",
checked
? "text-text-primary"
: "text-text-secondary hover:text-text-primary",
)}
>
<input
type="checkbox"
checked={checked}
onChange={() => toggleItem(id)}
className="focus:ring-accent/40 border-border text-accent h-3.5 w-3.5 shrink-0 cursor-pointer rounded focus:ring-1"
/>
<span>{t(`editor.contentWarningOptions.${id}`)}</span>
</label>
);
})}
</div>
)}
</div>
);
})}
</div>
)}
</div>
<GroupedChecklist
label={t("editor.warnings")}
groups={CONTENT_WARNING_GROUPS}
optionKey={optionKey}
selected={selected}
onChange={(next) => set("contentWarnings", next)}
searchPlaceholder={t("editor.contentWarningSearchPlaceholder")}
emptyText={t("editor.contentWarningEmpty")}
initiallyOpen={["spoilers"]}
/>
);
}
+32 -18
View File
@@ -1,33 +1,47 @@
import { useState, useEffect } from "react";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { Check } from "lucide-react";
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 [showSaved, setShowSaved] = useState(false);
const gameName = useEditorStore((s) => s.gameName);
const videoType = useEditorStore((s) => s.videoType);
const [visible, setVisible] = useState(false);
useEffect(() => {
// Show, then hide 2s later. Both transitions go through the timer rather
// than one synchronous `setShowSaved(true)` on every dependency change,
// which cost an extra render pass each keystroke-driven update
// (react-hooks/set-state-in-effect).
const show = setTimeout(() => setShowSaved(true), 0);
const hide = setTimeout(() => setShowSaved(false), 2000);
let hide: ReturnType<typeof setTimeout> | undefined;
const unsubscribe = useEditorStore.subscribe(() => {
setVisible(true);
clearTimeout(hide);
hide = setTimeout(() => setVisible(false), 1600);
});
return () => {
clearTimeout(show);
unsubscribe();
clearTimeout(hide);
};
}, [gameName, videoType]);
if (!showSaved) return null;
}, []);
return (
<span className="text-success flex items-center gap-1 text-xs">
<Check className="h-3 w-3" />
{t("editor.draftSaved")}
<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>
);
}
+50 -52
View File
@@ -1,6 +1,8 @@
import { useTranslation } from "react-i18next";
import clsx from "clsx";
import { Input } from "@components/ui/Input";
import { Textarea } from "@components/ui/Textarea";
import { Field, controlClasses } from "@components/ui/Field";
import { VIDEO_TYPES } from "@config/video-types";
import {
GACHA_QUEST_TYPE_GROUPS,
@@ -14,6 +16,9 @@ import { FIELD_LIMITS } from "@config/field-limits";
const ANNIVERSARY_YEARS = Array.from({ length: 20 }, (_, i) => i + 1);
/** Native selects here need <optgroup>, which the shared Select doesn't take. */
const SELECT_CLASS = "h-control cursor-pointer text-base sm:text-sm";
/**
* Renders inputs for the extra fields required by the currently selected
* video type — e.g. "Part Number" for `part`, "Boss Name" for `boss`,
@@ -55,27 +60,26 @@ export function ExtraFieldsInput() {
return (
<div className="flex flex-col gap-3">
{extraFields.includes("gachaQuestType") && (
<div className="flex flex-col gap-1">
<label htmlFor="gacha-quest-type" className="text-text-secondary text-sm font-medium">
{t("editor.gachaQuestType")}
</label>
<select
id="gacha-quest-type"
value={store.gachaQuestType ?? "main_story"}
onChange={(e) => store.set("gachaQuestType", e.target.value as GachaQuestType)}
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
>
{GACHA_QUEST_TYPE_GROUPS.map((g) => (
<optgroup key={g.group} label={t(`editor.gachaQuestTypeGroups.${g.group}`)}>
{g.members.map((m) => (
<option key={m} value={m}>
{t(`editor.gachaQuestTypeOptions.${m}`)}
</option>
))}
</optgroup>
))}
</select>
</div>
<Field label={t("editor.gachaQuestType")}>
{(control) => (
<select
{...control}
value={store.gachaQuestType ?? "main_story"}
onChange={(e) => store.set("gachaQuestType", e.target.value as GachaQuestType)}
className={clsx(controlClasses(false), SELECT_CLASS)}
>
{GACHA_QUEST_TYPE_GROUPS.map((g) => (
<optgroup key={g.group} label={t(`editor.gachaQuestTypeGroups.${g.group}`)}>
{g.members.map((m) => (
<option key={m} value={m}>
{t(`editor.gachaQuestTypeOptions.${m}`)}
</option>
))}
</optgroup>
))}
</select>
)}
</Field>
)}
{isGacha && visibility.characterName && (
<Input
@@ -87,26 +91,25 @@ export function ExtraFieldsInput() {
/>
)}
{isGacha && visibility.anniversaryYear && (
<div className="flex flex-col gap-1">
<label htmlFor="anniversary-year" className="text-text-secondary text-sm font-medium">
{t("editor.anniversaryYear")}
</label>
<select
id="anniversary-year"
value={store.anniversaryYear ?? ""}
onChange={(e) =>
store.set("anniversaryYear", e.target.value === "" ? null : Number(e.target.value))
}
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
>
<option value="">—</option>
{ANNIVERSARY_YEARS.map((y) => (
<option key={y} value={y}>
{t("editor.anniversaryYearOption", { count: y })}
</option>
))}
</select>
</div>
<Field label={t("editor.anniversaryYear")}>
{(control) => (
<select
{...control}
value={store.anniversaryYear ?? ""}
onChange={(e) =>
store.set("anniversaryYear", e.target.value === "" ? null : Number(e.target.value))
}
className={clsx(controlClasses(false), SELECT_CLASS)}
>
<option value="">—</option>
{ANNIVERSARY_YEARS.map((y) => (
<option key={y} value={y}>
{t("editor.anniversaryYearOption", { count: y })}
</option>
))}
</select>
)}
</Field>
)}
{showField("chapterName") && (
<Input
@@ -200,17 +203,12 @@ export function ExtraFieldsInput() {
/>
)}
{extraFields.includes("scheduledTime") && (
<div className="flex flex-col gap-1">
<label className="text-text-secondary text-sm font-medium">
{t("editor.scheduledTime")}
</label>
<input
type="datetime-local"
value={store.scheduledTime ?? ""}
onChange={(e) => store.set("scheduledTime", e.target.value)}
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
/>
</div>
<Input
label={t("editor.scheduledTime")}
type="datetime-local"
value={store.scheduledTime ?? ""}
onChange={(e) => store.set("scheduledTime", e.target.value)}
/>
)}
</div>
);
+90
View File
@@ -0,0 +1,90 @@
import { useTranslation } from "react-i18next";
import { Command } from "cmdk";
import { Check, Layers, Search } from "lucide-react";
import clsx from "clsx";
import { GENRE_GROUP_IDS, type GenreGroupId } from "@config/genres";
import type { Genre } from "@engine/types";
const itemClass =
"flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm text-text-primary select-none data-[selected=true]:bg-surface-2 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-40";
const headingClass =
"[&_[cmdk-group-heading]]:text-text-muted [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:pt-2 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-[0.6875rem] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:tracking-wide [&_[cmdk-group-heading]]:uppercase";
interface GenreListProps {
options: readonly { id: Genre; label: string }[];
selected: readonly Genre[];
atCapacity: boolean;
onToggle: (id: Genre) => void;
onApplyGroup: (groupId: GenreGroupId) => void;
}
/**
* The searchable genre list inside GenreSelector's popover. A separate,
* lazily loaded module so the search library only downloads when the list is
* first opened, not with the Editor.
*/
export default function GenreList({
options,
selected,
atCapacity,
onToggle,
onApplyGroup,
}: GenreListProps) {
const { t } = useTranslation("ui");
return (
<Command loop>
<div className="border-border flex items-center gap-2 border-b px-3">
<Search className="text-text-muted size-4 shrink-0" aria-hidden="true" />
<Command.Input
autoFocus
placeholder={t("editor.genreSearchPlaceholder")}
className="text-text-primary placeholder:text-text-muted h-10 w-full bg-transparent text-sm outline-none"
/>
</div>
<Command.List className="max-h-72 scrollbar-thin overflow-y-auto p-1">
<Command.Empty className="text-text-muted py-6 text-center text-sm">
{t("editor.genreSearchNoResults")}
</Command.Empty>
<Command.Group heading={t("editor.genreQuickSets")} className={headingClass}>
{GENRE_GROUP_IDS.map((groupId) => (
<Command.Item
key={groupId}
value={`set-${groupId} ${t(`editor.genreGroups.${groupId}`)}`}
onSelect={() => onApplyGroup(groupId)}
className={itemClass}
>
<Layers className="text-text-muted size-4 shrink-0" aria-hidden="true" />
<span className="min-w-0 flex-1 truncate">{t(`editor.genreGroups.${groupId}`)}</span>
</Command.Item>
))}
</Command.Group>
<Command.Group heading={t("editor.genre")} className={headingClass}>
{options.map((option) => {
const isSelected = selected.includes(option.id);
return (
<Command.Item
key={option.id}
value={`${option.label} ${option.id}`}
disabled={!isSelected && atCapacity}
onSelect={() => onToggle(option.id)}
className={itemClass}
>
<span
className={clsx(
"flex size-4 shrink-0 items-center justify-center rounded border",
isSelected ? "border-accent bg-accent text-accent-fg" : "border-border-strong",
)}
aria-hidden="true"
>
{isSelected && <Check className="size-3" strokeWidth={3} />}
</span>
<span className="min-w-0 flex-1 truncate">{option.label}</span>
</Command.Item>
);
})}
</Command.Group>
</Command.List>
</Command>
);
}
+117 -81
View File
@@ -1,113 +1,149 @@
import { useMemo, useState } from "react";
import { lazy, Suspense, useId, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChipGroup } from "@components/ui/ChipGroup";
import { GENRES, GENRE_GROUPS, GENRE_GROUP_IDS, type GenreGroupId } from "@config/genres";
import { Plus, X } from "lucide-react";
import clsx from "clsx";
import { GENRES, GENRE_GROUPS, type GenreGroupId } from "@config/genres";
import { GENRES_WITHOUT_GRAPHICS_SETTINGS } from "@config/graphics-settings";
import { useEditorStore } from "@store/editor-store";
import { MAX_GENRES, type Genre } from "@engine/types";
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@components/ui/Popover";
import { Banner } from "@components/ui/Banner";
import { Button } from "@components/ui/Button";
import { Spinner } from "@components/icons/animated";
const GenreList = lazy(() => import("./GenreList"));
/**
* Up to {@link MAX_GENRES} genres: the picked ones as removable chips, the
* rest in a searchable list. Replaces a wall of 42 always-visible chips that
* pushed "Game name" below the fold.
*/
export function GenreSelector() {
const { t } = useTranslation("ui");
const { t, i18n } = useTranslation("ui");
const labelId = useId();
const genres = useEditorStore((s) => s.genres);
const skipGraphicsSettings = useEditorStore((s) => s.skipGraphicsSettings);
const set = useEditorStore((s) => s.set);
const [open, setOpen] = useState(false);
// Session-local dismissal so the hint doesn't keep popping up after the
// user has chosen "Keep". Forgets across reloads, which is fine — a
// creator who flips back-and-forth between visual-novel and other genres
// benefits from being reminded once per session.
// user has chosen "Keep".
const [hintDismissed, setHintDismissed] = useState(false);
const [filter, setFilter] = useState("");
const allOptions = useMemo(
const options = useMemo(
() =>
GENRES.map((g) => ({
id: g.id,
label: t(g.labelKey),
icon: g.icon,
})),
[t],
GENRES.map((g) => ({ id: g.id as Genre, label: t(g.labelKey) })).sort((a, b) =>
a.label.localeCompare(b.label, i18n.language),
),
[t, i18n.language],
);
const labelOf = (id: Genre) => options.find((o) => o.id === id)?.label ?? id;
const atCapacity = genres.length >= MAX_GENRES;
const visibleOptions = useMemo(() => {
const trimmed = filter.trim().toLowerCase();
if (!trimmed) return allOptions;
return allOptions.filter((o) => o.label.toLowerCase().includes(trimmed));
}, [allOptions, filter]);
const toggle = (id: Genre) => {
if (genres.includes(id))
set(
"genres",
genres.filter((g) => g !== id),
);
else if (!atCapacity) set("genres", [...genres, id]);
};
const applyGroup = (groupId: GenreGroupId) => {
set("genres", GENRE_GROUPS[groupId].slice(0, MAX_GENRES) as Genre[]);
setOpen(false);
};
const matchingGenre = genres.find((g) =>
(GENRES_WITHOUT_GRAPHICS_SETTINGS as readonly string[]).includes(g),
);
const showHint = !!matchingGenre && !skipGraphicsSettings && !hintDismissed;
const applyGroup = (groupId: GenreGroupId) => {
const next = GENRE_GROUPS[groupId].slice(0, MAX_GENRES) as Genre[];
set("genres", next);
// Clear the filter so the user can see the newly-selected chips
// light up — otherwise a stale filter could hide them all.
setFilter("");
};
return (
<div className="flex flex-col gap-2">
<div className="flex flex-wrap items-center justify-between gap-2">
<span className="text-text-secondary text-sm font-medium">{t("editor.genre")}</span>
<span className="text-text-muted text-xs">
<div className="flex flex-col gap-1.5">
<div className="flex min-h-5 items-center justify-between gap-2">
<span id={labelId} className="text-text-secondary text-xs font-medium">
{t("editor.genre")}
</span>
<span className="text-text-muted tabular text-xs">
{genres.length}/{MAX_GENRES}
</span>
</div>
<div className="flex flex-wrap gap-2">
{GENRE_GROUP_IDS.map((groupId) => (
<button
key={groupId}
type="button"
onClick={() => applyGroup(groupId)}
className="border-border bg-surface-1 text-text-secondary hover:border-accent hover:text-text-primary rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors"
<div
role="group"
aria-labelledby={labelId}
className="border-border bg-surface-0 min-h-control rounded-control flex flex-wrap items-center gap-1.5 border p-1"
>
{genres.map((id) => (
<span
key={id}
className="bg-accent-muted text-accent inline-flex h-7 items-center gap-1 rounded-full pr-1 pl-2.5 text-xs font-medium"
>
{t(`editor.genreGroups.${groupId}`)}
</button>
{labelOf(id)}
<button
type="button"
onClick={() => toggle(id)}
aria-label={t("editor.genreRemove", { genre: labelOf(id) })}
className="hover:bg-accent/20 flex size-5 cursor-pointer items-center justify-center rounded-full"
>
<X className="size-3" aria-hidden="true" />
</button>
</span>
))}
<PopoverRoot open={open} onOpenChange={setOpen}>
<PopoverTrigger
className={clsx(
"text-text-muted hover:text-text-primary hover:bg-surface-2 inline-flex h-7 cursor-pointer items-center gap-1 rounded-full px-2.5 text-xs font-medium transition-colors",
genres.length === 0 && "text-text-secondary",
)}
>
<Plus className="size-3.5" aria-hidden="true" />
{genres.length === 0 ? t("editor.genrePick") : t("editor.genreAdd")}
</PopoverTrigger>
<PopoverContent ariaLabel={t("editor.genre")} className="w-80">
<Suspense
fallback={
<div className="text-text-muted flex justify-center py-8">
<Spinner className="size-4" />
</div>
}
>
<GenreList
options={options}
selected={genres}
atCapacity={atCapacity}
onToggle={toggle}
onApplyGroup={applyGroup}
/>
</Suspense>
</PopoverContent>
</PopoverRoot>
</div>
<input
type="text"
value={filter}
onChange={(e) => setFilter(e.target.value)}
placeholder={t("editor.genreSearchPlaceholder")}
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
/>
{visibleOptions.length === 0 ? (
<p className="text-text-muted py-2 text-sm">{t("editor.genreSearchNoResults")}</p>
) : (
<ChipGroup
multiple
max={MAX_GENRES}
options={visibleOptions}
value={genres}
onChange={(next) => set("genres", next as Genre[])}
/>
)}
{showHint && (
<div className="border-accent/40 bg-accent/5 text-text-secondary flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-xs">
<span>{t("editor.skipGraphicsHintLabel")}</span>
<div className="flex shrink-0 gap-2">
<button
type="button"
className="bg-accent rounded px-2 py-1 font-medium text-white"
onClick={() => {
set("skipGraphicsSettings", true);
setHintDismissed(true);
}}
>
{t("editor.skipGraphicsHintHide")}
</button>
<button
type="button"
className="text-text-secondary hover:bg-surface-2 rounded px-2 py-1 font-medium"
onClick={() => setHintDismissed(true)}
>
{t("editor.skipGraphicsHintKeep")}
</button>
</div>
</div>
<Banner
tone="accent"
className="mt-1"
action={
<div className="flex flex-wrap gap-2">
<Button
size="sm"
onClick={() => {
set("skipGraphicsSettings", true);
setHintDismissed(true);
}}
>
{t("editor.skipGraphicsHintHide")}
</Button>
<Button size="sm" variant="ghost" onClick={() => setHintDismissed(true)}>
{t("editor.skipGraphicsHintKeep")}
</Button>
</div>
}
>
{t("editor.skipGraphicsHintLabel")}
</Banner>
)}
</div>
);
+145
View File
@@ -0,0 +1,145 @@
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChevronRight, Search } from "lucide-react";
import clsx from "clsx";
import { Badge } from "@components/ui/Badge";
import { Input } from "@components/ui/Input";
interface ChecklistGroup<T extends string> {
id: string;
labelKey: string;
items: readonly T[];
}
interface GroupedChecklistProps<T extends string> {
label: string;
groups: readonly ChecklistGroup<T>[];
/** i18n key of one option's label. */
optionKey: (id: T) => string;
/** In pick order — the description lists them in that order. */
selected: readonly T[];
onChange: (next: T[]) => void;
searchPlaceholder: string;
emptyText: string;
/** Groups expanded on first render. */
initiallyOpen?: readonly string[];
}
/**
* A searchable, grouped multi-select: content warnings and tech notes. The
* two used to be separate 160-line copies of the same markup.
*/
export function GroupedChecklist<T extends string>({
label,
groups,
optionKey,
selected,
onChange,
searchPlaceholder,
emptyText,
initiallyOpen = [],
}: GroupedChecklistProps<T>) {
const { t } = useTranslation("ui");
const [query, setQuery] = useState("");
const [openGroups, setOpenGroups] = useState<ReadonlySet<string>>(() => new Set(initiallyOpen));
const trimmedQuery = query.trim().toLowerCase();
const isFiltering = trimmedQuery.length > 0;
const filteredGroups = useMemo(() => {
if (!isFiltering) return groups;
return groups
.map((group) => ({
...group,
items: group.items.filter((id) => t(optionKey(id)).toLowerCase().includes(trimmedQuery)),
}))
.filter((group) => group.items.length > 0);
}, [groups, optionKey, t, trimmedQuery, isFiltering]);
const toggleItem = (id: T) =>
onChange(selected.includes(id) ? selected.filter((x) => x !== id) : [...selected, id]);
const toggleGroup = (groupId: string) =>
setOpenGroups((prev) => {
const next = new Set(prev);
if (next.has(groupId)) next.delete(groupId);
else next.add(groupId);
return next;
});
return (
<div className="flex flex-col gap-2">
<div className="flex min-h-5 items-center justify-between gap-2">
<span className="text-text-secondary text-xs font-medium">{label}</span>
{selected.length > 0 && (
<Badge tone="accent">{t("editor.selectedCount", { n: selected.length })}</Badge>
)}
</div>
<Input
type="search"
aria-label={searchPlaceholder}
placeholder={searchPlaceholder}
leading={<Search />}
value={query}
onChange={(e) => setQuery(e.target.value)}
/>
{isFiltering && filteredGroups.length === 0 ? (
<p className="text-text-muted py-2 text-center text-xs">{emptyText}</p>
) : (
<div className="border-border divide-border rounded-control divide-y overflow-hidden border">
{filteredGroups.map((group) => {
const isOpen = isFiltering || openGroups.has(group.id);
const groupSelectedCount = group.items.filter((id) => selected.includes(id)).length;
return (
<div key={group.id}>
<button
type="button"
onClick={() => toggleGroup(group.id)}
aria-expanded={isOpen}
className="text-text-secondary hover:bg-surface-2/60 hover:text-text-primary flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2 text-left text-xs font-medium transition-colors"
>
<span className="flex items-center gap-1.5">
<ChevronRight
className={clsx("size-3.5 transition-transform", isOpen && "rotate-90")}
aria-hidden="true"
/>
{t(group.labelKey)}
</span>
{groupSelectedCount > 0 && <Badge tone="accent">{groupSelectedCount}</Badge>}
</button>
{isOpen && (
<div className="bg-surface-0/50 grid grid-cols-1 gap-x-3 gap-y-0.5 px-3 pt-1 pb-2.5 sm:grid-cols-2">
{group.items.map((id) => {
const checked = selected.includes(id);
return (
<label
key={id}
className={clsx(
"flex min-h-8 cursor-pointer items-center gap-2 rounded-md px-1.5 text-xs transition-colors",
checked
? "text-text-primary"
: "text-text-secondary hover:text-text-primary",
)}
>
<input
type="checkbox"
checked={checked}
onChange={() => toggleItem(id)}
className="accent-accent size-3.5 shrink-0 cursor-pointer"
/>
<span>{t(optionKey(id))}</span>
</label>
);
})}
</div>
)}
</div>
);
})}
</div>
)}
</div>
);
}
+1 -1
View File
@@ -10,7 +10,7 @@ export function LanguageSelector() {
const options = SUPPORTED_LANGUAGES.map((lang) => ({
value: lang.id,
label: `${lang.flag} ${lang.nativeName}`,
label: `${lang.nativeName} (${lang.id})`,
}));
return (
+144
View File
@@ -0,0 +1,144 @@
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Eye } from "lucide-react";
import { useGeneratedOutput } from "@hooks/use-generated-output";
import { useOutputLimits } from "@hooks/use-output-limits";
import { useStrictBlock } from "@hooks/use-strict-block";
import { EMPTY_GENERATOR_OUTPUT, YT_LIMITS } from "@engine/types";
import { useEditorStore } from "@store/editor-store";
import { Card } from "@components/ui/Card";
import { TabPanel, Tabs } from "@components/ui/Tabs";
import { CharCounter } from "@components/output/CharCounter";
import { CopyButton } from "@components/output/CopyButton";
type PreviewTab = "title" | "description" | "tags";
/**
* The generated title / description / tags, live, next to the form — with
* the same counters and copy gates as the Output page. Replaces the old
* three-line "Quick Preview", which clipped the description to three lines
* and could not copy anything.
*/
export function LivePreview({
layoutId = "live-preview-tab",
showHeading = true,
}: {
layoutId?: string;
/** Off inside the phone sheet, whose own title already says it. */
showHeading?: boolean;
}) {
const { t } = useTranslation("ui");
const generated = useGeneratedOutput();
// Without a game name the engine still renders "— Gameplay No Commentary";
// show the prompt instead so nothing half-built can be copied.
const hasGame = useEditorStore((s) => s.gameName.trim() !== "");
const output = hasGame ? generated : EMPTY_GENERATOR_OUTPUT;
const [tab, setTab] = useState<PreviewTab>("title");
const outputs = useMemo(() => [output], [output]);
const limitStatus = useOutputLimits(outputs);
const strictBlocked = useStrictBlock();
const blocked = limitStatus.blocked || strictBlocked;
const over = (field: PreviewTab) => limitStatus.overflows.some((o) => o.field === field);
const dot = (field: PreviewTab) =>
over(field) ? <span className="bg-danger size-1.5 rounded-full" aria-hidden="true" /> : null;
const empty = <p className="text-text-muted text-sm italic">{t("editor.previewEmpty")}</p>;
return (
<Card className="overflow-hidden">
{showHeading && (
<div className="flex items-center gap-2 px-4 pt-3.5">
<Eye className="text-accent size-4" aria-hidden="true" />
<h2 className="text-text-primary text-sm font-semibold">{t("editor.quickPreview")}</h2>
</div>
)}
<Tabs
value={tab}
onChange={setTab}
ariaLabel={t("editor.quickPreview")}
layoutId={layoutId}
listClassName="px-2 mt-1"
items={[
{ value: "title", label: t("output.title"), badge: dot("title") },
{ value: "description", label: t("output.description"), badge: dot("description") },
{
value: "tags",
label: `${t("output.tags")} · ${output.tags.length}`,
badge: dot("tags"),
},
]}
>
<TabPanel value="title" className="p-4">
{output.title ? (
<p className="text-text-primary text-[0.9375rem] leading-snug font-medium">
{output.title}
</p>
) : (
empty
)}
</TabPanel>
<TabPanel value="description" className="p-4">
{output.description ? (
<pre className="text-text-secondary max-h-[min(52dvh,32rem)] scrollbar-thin overflow-y-auto font-sans text-xs leading-relaxed whitespace-pre-wrap">
{output.description}
</pre>
) : (
empty
)}
</TabPanel>
<TabPanel value="tags" className="p-4">
{output.tags.length > 0 ? (
<div className="flex flex-wrap gap-1">
{output.tags.map((tag, i) => (
<span
key={i}
className="bg-surface-2 text-text-secondary rounded-md px-1.5 py-0.5 text-[0.6875rem]"
>
{tag}
</span>
))}
</div>
) : (
empty
)}
</TabPanel>
</Tabs>
<div className="border-border flex items-center justify-between gap-2 border-t px-4 py-2.5">
{tab === "title" && <CharCounter text={output.title} limit={YT_LIMITS.TITLE_MAX} />}
{tab === "description" && (
<CharCounter text={output.description} limit={YT_LIMITS.DESCRIPTION_MAX} />
)}
{tab === "tags" && <CharCounter text={output.tagString} limit={YT_LIMITS.TAGS_MAX} />}
{tab === "title" && (
<CopyButton
text={output.title}
label={t("output.copyTitle")}
limit={YT_LIMITS.TITLE_MAX}
fieldLabel={t("output.title")}
blocked={blocked}
/>
)}
{tab === "description" && (
<CopyButton
text={output.description}
label={t("output.copyDescription")}
limit={YT_LIMITS.DESCRIPTION_MAX}
fieldLabel={t("output.description")}
blocked={blocked}
/>
)}
{tab === "tags" && (
<CopyButton
text={output.tagString}
label={t("output.copyTags")}
limit={YT_LIMITS.TAGS_MAX}
fieldLabel={t("output.tags")}
blocked={blocked}
/>
)}
</div>
</Card>
);
}
+1 -1
View File
@@ -80,7 +80,7 @@ export function PlaytestEditor() {
return (
<div className="flex flex-col gap-3">
<span className="text-text-secondary text-sm font-medium">
<span className="text-text-primary text-sm font-semibold">
{t("editor.playtest.heading")}
</span>
@@ -63,7 +63,7 @@ export function PlaythroughNotesForm() {
return (
<div className="flex flex-col gap-3">
<div className="flex items-baseline justify-between">
<span className="text-text-secondary text-sm font-medium">
<span className="text-text-primary text-sm font-semibold">
{t("editor.playthroughNotes.title")}
</span>
</div>
-36
View File
@@ -1,36 +0,0 @@
import { useTranslation } from "react-i18next";
import { useGeneratedOutput } from "@hooks/use-generated-output";
export function QuickPreview() {
const { t } = useTranslation("ui");
const output = useGeneratedOutput();
return (
<div className="border-border bg-surface-1 flex flex-col gap-3 rounded-lg border p-4">
<span className="text-text-secondary text-sm font-medium">{t("editor.quickPreview")}</span>
<div className="flex flex-col gap-2">
<div>
<span className="text-text-muted text-xs font-medium uppercase">{t("output.title")}</span>
<p className="text-text-primary mt-1 text-sm font-medium">{output.title || "..."}</p>
</div>
<div>
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.description")}
</span>
<p className="text-text-secondary mt-1 line-clamp-3 text-xs whitespace-pre-wrap">
{output.description || "..."}
</p>
</div>
<div>
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.tags")} ({output.tags.length})
</span>
<p className="text-text-muted mt-1 line-clamp-2 text-xs">{output.tagString || "..."}</p>
</div>
</div>
</div>
);
}
+10 -10
View File
@@ -86,9 +86,9 @@ export function RigEditor() {
};
return (
<div key={field.id} className="col-span-2 flex flex-col gap-2">
<span className="text-text-secondary text-sm font-medium">{t(field.labelKey)}</span>
<div className="grid grid-cols-3 gap-2">
<div key={field.id} className="flex flex-col gap-2 sm:col-span-2">
<span className="text-text-secondary text-xs font-medium">{t(field.labelKey)}</span>
<div className="grid gap-2 sm:grid-cols-3">
<Select
label={t("editor.gpu_brand")}
value={brand}
@@ -96,7 +96,7 @@ export function RigEditor() {
onChange={setBrand}
/>
{isCustom ? (
<div className="col-span-2">
<div className="sm:col-span-2">
<Input
label={t("editor.gpu_custom")}
maxLength={FIELD_LIMITS.SHORT_NAME}
@@ -172,9 +172,9 @@ export function RigEditor() {
});
return (
<div key={field.id} className="col-span-2 flex flex-col gap-2">
<span className="text-text-secondary text-sm font-medium">{t(field.labelKey)}</span>
<div className="grid grid-cols-2 gap-2">{renderedParts}</div>
<div key={field.id} className="flex flex-col gap-2 sm:col-span-2">
<span className="text-text-secondary text-xs font-medium">{t(field.labelKey)}</span>
<div className="grid gap-3 sm:grid-cols-2">{renderedParts}</div>
{renderValidationBadge(issue)}
</div>
);
@@ -243,7 +243,7 @@ export function RigEditor() {
};
return (
<div key={field.id} className="col-span-2 grid grid-cols-[1fr_auto] gap-2">
<div key={field.id} className="grid grid-cols-[1fr_auto] gap-2 sm:col-span-2">
<Select
label={t(field.labelKey)}
value={value}
@@ -263,8 +263,8 @@ export function RigEditor() {
return (
<div className="flex flex-col gap-3">
<span className="text-text-secondary text-sm font-medium">{t("editor.rig")}</span>
<div className="grid grid-cols-2 gap-2">
<span className="text-text-primary text-sm font-semibold">{t("editor.rig")}</span>
<div className="grid gap-3 sm:grid-cols-2">
{RIG_FIELDS.map((field) => {
if (field.type === "cascading_dropdown") return renderCascading(field);
if (field.type === "composite_dropdown") return renderComposite(field);
+1 -1
View File
@@ -15,7 +15,7 @@ export function SocialEditor() {
return (
<div className="flex flex-col gap-4">
<span className="text-text-secondary text-sm font-medium">{t("editor.social")}</span>
<span className="text-text-primary text-sm font-semibold">{t("editor.social")}</span>
<div className="flex flex-col gap-2">
<span className="text-text-muted text-xs font-medium uppercase">Donate</span>
+6 -20
View File
@@ -1,7 +1,7 @@
import { useMemo, useState } from "react";
import type { ClipboardEvent } from "react";
import { useTranslation } from "react-i18next";
import toast from "react-hot-toast";
import { toast } from "sonner";
import { ValidatedInput } from "@components/ui/ValidatedInput";
import { Select } from "@components/ui/Select";
import { PLATFORMS } from "@config/platforms";
@@ -75,29 +75,15 @@ export function StoreLinkEditor() {
if (!extracted) return;
setField("gameName", extracted);
toast.custom(
(item) => (
<div className="border-border bg-surface-2 text-text-primary flex items-center gap-3 rounded-lg border px-3 py-2 text-sm shadow">
<span>{t("editor.toast.urlAutoFilled", { name: extracted })}</span>
<button
type="button"
className="text-accent hover:bg-surface-1 rounded px-2 py-0.5 text-xs font-medium"
onClick={() => {
setField("gameName", "");
toast.dismiss(item.id);
}}
>
{t("common.undo")}
</button>
</div>
),
{ duration: 5000 },
);
toast(t("editor.toast.urlAutoFilled", { name: extracted }), {
duration: 5000,
action: { label: t("common.undo"), onClick: () => setField("gameName", "") },
});
};
return (
<div className="flex flex-col gap-3">
<span className="text-text-secondary text-sm font-medium">{t("editor.storeLinks")}</span>
<span className="text-text-primary text-sm font-semibold">{t("editor.storeLinks")}</span>
{mismatch && (
<div className="border-warning bg-surface-2 flex items-start gap-2 rounded-lg border px-3 py-2 text-sm">
<span className="text-text-primary flex-1">
+16 -148
View File
@@ -1,162 +1,30 @@
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChevronDown, ChevronRight, Search, X } from "lucide-react";
import clsx from "clsx";
import { useEditorStore } from "@store/editor-store";
import { TECH_NOTE_GROUPS, type TechNoteGroup } from "@config/tech-note-groups";
import { TECH_NOTE_GROUPS } from "@config/tech-note-groups";
import type { TechNote } from "@engine/types";
import { GroupedChecklist } from "./GroupedChecklist";
const optionKey = (id: TechNote) => `editor.techNoteOptions.${id}`;
/**
* v0.12 Tech Notes checklist — searchable, collapsible, grouped
* multi-select for the 24 production / playstyle disclaimers that feed
* the `▸ 🛠 TECH NOTES` description block. Cloned 1:1 from
* {@link ContentWarningChecklist} since both share the same UX shape;
* only the data source (`techNotes` vs `contentWarnings`), groups,
* and i18n namespace differ.
*
* Selection order is preserved so the description renders bullets in
* the order the user picked them.
* Production / playstyle disclaimers that feed the `▸ 🛠 TECH NOTES`
* description block. All groups start closed — 24 items across 5 groups is
* too tall to expand by default; search reaches any of them.
*/
export function TechNotesChecklist() {
const { t } = useTranslation("ui");
const selected = useEditorStore((s) => s.techNotes);
const set = useEditorStore((s) => s.set);
const [query, setQuery] = useState("");
// Default all groups closed — 24 items across 5 groups is too tall to
// expand by default. Users with a specific note in mind use search;
// users browsing pop open the group they care about.
const [openGroups, setOpenGroups] = useState<Record<string, boolean>>(() => ({
audio: false,
video_quality: false,
recording_issues: false,
playstyle: false,
production: false,
}));
const trimmedQuery = query.trim().toLowerCase();
const isFiltering = trimmedQuery.length > 0;
const filteredGroups = useMemo<TechNoteGroup[]>(() => {
if (!isFiltering) return [...TECH_NOTE_GROUPS];
return TECH_NOTE_GROUPS.map((group) => ({
...group,
items: group.items.filter((id) =>
t(`editor.techNoteOptions.${id}`).toLowerCase().includes(trimmedQuery),
),
})).filter((group) => group.items.length > 0);
}, [t, trimmedQuery, isFiltering]);
const totalMatching = filteredGroups.reduce((acc, g) => acc + g.items.length, 0);
function toggleItem(id: TechNote) {
if (selected.includes(id)) {
set(
"techNotes",
selected.filter((x) => x !== id),
);
} else {
set("techNotes", [...selected, id]);
}
}
function toggleGroup(groupId: string) {
setOpenGroups((prev) => ({ ...prev, [groupId]: !prev[groupId] }));
}
return (
<div className="flex flex-col gap-2">
<div className="flex items-baseline justify-between">
<span className="text-text-secondary text-sm font-medium">{t("editor.techNotes")}</span>
{selected.length > 0 && (
<span className="text-text-muted text-xs">{selected.length} selected</span>
)}
</div>
<div className="relative">
<Search className="text-text-muted pointer-events-none absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2" />
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("editor.techNoteSearchPlaceholder")}
className="border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent w-full rounded-md border py-1.5 pr-7 pl-8 text-sm focus:outline-none"
/>
{query && (
<button
type="button"
onClick={() => setQuery("")}
className="text-text-muted hover:text-text-primary absolute top-1/2 right-2 -translate-y-1/2"
aria-label="Clear search"
>
<X className="h-3.5 w-3.5" />
</button>
)}
</div>
{isFiltering && totalMatching === 0 ? (
<p className="text-text-muted py-2 text-center text-xs">{t("editor.techNoteEmpty")}</p>
) : (
<div className="flex flex-col gap-1">
{filteredGroups.map((group) => {
const isOpen = isFiltering || openGroups[group.id];
const groupSelectedCount = group.items.filter((id) => selected.includes(id)).length;
return (
<div
key={group.id}
className="border-border bg-surface-1 overflow-hidden rounded-md border"
>
<button
type="button"
onClick={() => toggleGroup(group.id)}
className="text-text-secondary hover:bg-surface-2 flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium"
aria-expanded={isOpen}
>
<span className="flex items-center gap-1.5">
{isOpen ? (
<ChevronDown className="h-3.5 w-3.5" />
) : (
<ChevronRight className="h-3.5 w-3.5" />
)}
{t(group.labelKey)}
</span>
{groupSelectedCount > 0 && (
<span className="bg-accent/15 text-accent rounded-full px-2 py-0.5 text-[10px] font-medium">
{groupSelectedCount}
</span>
)}
</button>
{isOpen && (
<div className="border-border bg-surface-1 grid grid-cols-1 gap-x-3 gap-y-1 border-t px-3 py-2 sm:grid-cols-2">
{group.items.map((id) => {
const checked = selected.includes(id);
return (
<label
key={id}
className={clsx(
"flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 text-xs transition-colors",
checked
? "text-text-primary"
: "text-text-secondary hover:text-text-primary",
)}
>
<input
type="checkbox"
checked={checked}
onChange={() => toggleItem(id)}
className="focus:ring-accent/40 border-border text-accent h-3.5 w-3.5 shrink-0 cursor-pointer rounded focus:ring-1"
/>
<span>{t(`editor.techNoteOptions.${id}`)}</span>
</label>
);
})}
</div>
)}
</div>
);
})}
</div>
)}
</div>
<GroupedChecklist
label={t("editor.techNotes")}
groups={TECH_NOTE_GROUPS}
optionKey={optionKey}
selected={selected}
onChange={(next) => set("techNotes", next)}
searchPlaceholder={t("editor.techNoteSearchPlaceholder")}
emptyText={t("editor.techNoteEmpty")}
/>
);
}
+2 -4
View File
@@ -112,8 +112,6 @@ export function VideoSettingsForm() {
return (
<div className="flex flex-col gap-3">
<span className="text-text-secondary text-sm font-medium">{t("editor.videoSettings")}</span>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
<Select
label={t("editor.resolution")}
@@ -170,7 +168,7 @@ export function VideoSettingsForm() {
onChange={(next) => store.set("rayTracingModes", next as RTMode[])}
/>
<div className="grid grid-cols-2 gap-3">
<div className="grid gap-3 sm:grid-cols-2">
<Select
label={t("editor.frameGenVendor")}
options={vendorOptions}
@@ -185,7 +183,7 @@ export function VideoSettingsForm() {
/>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="grid gap-3 sm:grid-cols-2">
<Select
label={t("editor.upscaleQuality")}
options={upscaleOptions}
+2 -1
View File
@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";
import { ChipGroup } from "@components/ui/ChipGroup";
import { VIDEO_TYPES } from "@config/video-types";
import { useEditorStore } from "@store/editor-store";
import { VIDEO_TYPE_ICONS } from "./video-type-icons";
export function VideoTypeSelector() {
const { t } = useTranslation("ui");
@@ -11,7 +12,7 @@ export function VideoTypeSelector() {
const options = VIDEO_TYPES.map((vt) => ({
id: vt.id,
label: t(vt.labelKey),
icon: vt.icon,
icon: VIDEO_TYPE_ICONS[vt.id],
}));
return (
@@ -61,11 +61,11 @@ export function VietnameseDonateEditor() {
return (
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
<span className="text-text-secondary text-sm font-medium">{t("editor.vnDonate")}</span>
<span className="text-text-primary text-sm font-semibold">{t("editor.vnDonate")}</span>
<p className="text-text-muted text-xs">{t("editor.vnDonateHelp")}</p>
</div>
<div className="grid grid-cols-2 gap-3">
<div className="grid gap-3 sm:grid-cols-2">
{isVi ? (
<div className="flex flex-col gap-2">
<Select
@@ -117,7 +117,7 @@ export function VietnameseDonateEditor() {
onChange={(e) => store.set("vnBankHolder", e.target.value)}
/>
<div className="grid grid-cols-2 gap-3">
<div className="grid gap-3 sm:grid-cols-2">
<Input
label={t("editor.vnMomo")}
maxLength={FIELD_LIMITS.SHORT_NAME}
+52
View File
@@ -0,0 +1,52 @@
import {
BookOpen,
CircleCheckBig,
Clapperboard,
Columns2,
Film,
Flag,
Gamepad2,
Gem,
ListOrdered,
MapPin,
Package,
Puzzle,
Radio,
Repeat,
Search,
ShieldCheck,
Star,
Swords,
Trophy,
Zap,
type LucideIcon,
} from "lucide-react";
import type { VideoTypeId } from "@config/video-types";
/**
* One icon per video type. Kept out of `config/video-types.ts` because the
* engine imports that module and must not pull in React components; the
* emoji there is only a fallback for plain-text contexts.
*/
export const VIDEO_TYPE_ICONS: Record<VideoTypeId, LucideIcon> = {
full: Gamepad2,
part: ListOrdered,
full_demo: Clapperboard,
demo_part: Film,
boss: Swords,
boss_nohit: ShieldCheck,
ending: Flag,
speedrun: Zap,
"100percent": CircleCheckBig,
dlc: Package,
newgame_plus: Repeat,
challenge: Trophy,
side_quest: MapPin,
secret: Search,
comparison: Columns2,
guide: BookOpen,
mods: Puzzle,
collectibles: Star,
livestream: Radio,
gacha_quest: Gem,
};
+36 -36
View File
@@ -2,6 +2,8 @@ import { useTranslation } from "react-i18next";
import { House, ArrowLeft, RotateCw, RotateCcw, Bug } from "lucide-react";
import clsx from "clsx";
import { Button } from "@components/ui/Button";
import { Card } from "@components/ui/Card";
import { Logo } from "@components/brand/Logo";
import { useDocumentTitle } from "@hooks/use-document-title";
import { ABOUT } from "@config/about";
import { IS_TAURI } from "@utils/platform";
@@ -60,35 +62,42 @@ function FullscreenError({ kind }: ErrorPageProps) {
useDocumentTitle(title);
return (
<div className="bg-surface-0 flex min-h-screen flex-col items-center justify-center gap-6 px-6 py-12 text-center">
<Icon className={clsx("h-16 w-16", colour)} aria-hidden />
{meta.code !== null && (
<p className={clsx("font-mono text-6xl leading-none font-bold tabular-nums", colour)}>
{meta.code}
</p>
)}
<div className="max-w-md space-y-2">
<h1 className="text-text-primary text-2xl font-semibold">{title}</h1>
<main className="bg-surface-0 relative flex min-h-dvh flex-col items-center justify-center gap-6 overflow-hidden px-6 py-12 text-center">
<div
className="bg-brand-gradient pointer-events-none absolute top-0 left-1/2 h-64 w-[36rem] max-w-full -translate-x-1/2 rounded-full opacity-10 blur-3xl"
aria-hidden="true"
/>
<Logo className="relative size-10" />
<div className="relative flex flex-col items-center gap-3">
<Icon className={clsx("size-12", colour)} aria-hidden />
{meta.code !== null && (
<p className={clsx("font-mono text-6xl leading-none font-bold tabular-nums", colour)}>
{meta.code}
</p>
)}
</div>
<div className="relative max-w-md space-y-2">
<h1 className="text-text-primary text-2xl font-semibold tracking-tight">{title}</h1>
<p className="text-text-secondary text-sm">{description}</p>
</div>
<div className="flex flex-wrap items-center justify-center gap-3">
<div className="relative flex flex-wrap items-center justify-center gap-2">
<Button variant="primary" onClick={goHome}>
<House className="h-4 w-4" />
<House />
{t("errorPages.actions.home")}
</Button>
<Button variant="secondary" onClick={() => window.history.back()}>
<ArrowLeft className="h-4 w-4" />
<ArrowLeft />
{t("errorPages.actions.back")}
</Button>
{canReload && (
<Button variant="secondary" onClick={() => window.location.reload()}>
<RotateCw className="h-4 w-4" />
<RotateCw />
{t("errorPages.actions.reload")}
</Button>
)}
<ReportBugLink />
</div>
</div>
</main>
);
}
@@ -102,53 +111,44 @@ function ContainedError({ kind, onReset, detail }: ErrorPageProps) {
return (
<div className="flex min-h-[200px] items-center justify-center p-6">
<div className="border-danger/40 bg-surface-2 w-full max-w-md rounded-lg border p-5 shadow-md shadow-black/10">
<Card className="border-danger/40 w-full max-w-md p-5">
<div className={clsx("mb-3 flex items-center gap-2", colour)}>
<Icon className="h-4 w-4" />
<Icon className="size-4" aria-hidden />
<h2 className="text-sm font-semibold">{title}</h2>
</div>
<p className="text-text-secondary mb-3 text-xs">{description}</p>
{detail && (
<pre className="bg-surface-3 text-text-muted mb-4 max-h-32 overflow-auto rounded p-2 text-[11px] whitespace-pre-wrap">
<pre className="bg-surface-0 border-border text-text-muted mb-4 max-h-32 scrollbar-thin overflow-auto rounded-lg border p-2 font-mono text-[11px] whitespace-pre-wrap">
{detail}
</pre>
)}
<div className="flex flex-wrap items-center gap-2">
{onReset && (
<Button variant="primary" size="sm" onClick={onReset}>
<RotateCcw className="h-3.5 w-3.5" />
<RotateCcw />
{t("errorPages.actions.retry")}
</Button>
)}
<Button variant="secondary" size="sm" onClick={() => window.location.reload()}>
<RotateCw className="h-3.5 w-3.5" />
<RotateCw />
{t("errorPages.actions.reload")}
</Button>
<ReportBugLink size="sm" />
</div>
</div>
</Card>
</div>
);
}
/** External "report a bug" link, styled to match the `ghost` Button. */
/** External "report a bug" link, styled as a ghost button. */
function ReportBugLink({ size = "md" }: { size?: "sm" | "md" }) {
const { t } = useTranslation("ui");
const sizeClass =
size === "sm" ? "min-h-[36px] px-2.5 py-1 text-xs" : "min-h-touch px-4 py-2 text-sm";
const iconClass = size === "sm" ? "h-3.5 w-3.5" : "h-4 w-4";
return (
<a
href={ABOUT.bugReportUrl}
target="_blank"
rel="noopener noreferrer"
className={clsx(
"focus:ring-accent/50 text-text-secondary hover:bg-surface-2 hover:text-text-primary inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus:ring-2 focus:outline-none",
sizeClass,
)}
>
<Bug className={iconClass} />
{t("errorPages.actions.reportBug")}
</a>
<Button asChild variant="ghost" size={size}>
<a href={ABOUT.bugReportUrl} target="_blank" rel="noopener noreferrer">
<Bug aria-hidden="true" />
{t("errorPages.actions.reportBug")}
</a>
</Button>
);
}
+12 -11
View File
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { Link } from "react-router-dom";
import toast from "react-hot-toast";
import { toast } from "sonner";
import { useTranslation } from "react-i18next";
import { WifiOff, X } from "lucide-react";
import { useOnlineStatus } from "@hooks/use-online-status";
@@ -9,10 +9,11 @@ import { useOnlineStatus } from "@hooks/use-online-status";
* Non-blocking offline indicator.
*
* The app works fully offline (everything is client-side), so losing the
* network must never block input — this is a dismissible bottom strip, not a
* takeover page. Dismiss only hides the *current* offline episode; the next
* online→offline transition shows it again. A transient toast confirms when
* the connection returns (reusing the app-level `<Toaster/>`).
* network must never block input — this is a dismissible pill at the top of
* the screen (clear of the phone navigation bar), not a takeover page.
* Dismiss only hides the *current* offline episode; the next online→offline
* transition shows it again. A transient toast confirms when the connection
* returns (reusing the app-level `<Toaster/>`).
*/
export function OfflineBanner() {
const { t } = useTranslation("ui");
@@ -35,20 +36,20 @@ export function OfflineBanner() {
return (
<div
role="status"
className="border-warning/40 bg-surface-2 text-text-primary fixed inset-x-0 bottom-0 z-50 flex items-center justify-center gap-3 border-t px-4 py-2 text-sm shadow-md shadow-black/20"
className="border-warning/40 bg-surface-1 text-text-primary shadow-pop animate-slide-up fixed top-3 left-1/2 z-50 flex max-w-[calc(100%-1.5rem)] -translate-x-1/2 items-center gap-2.5 rounded-full border py-1.5 pr-1.5 pl-3.5 text-xs"
>
<WifiOff className="text-warning h-4 w-4 shrink-0" aria-hidden />
<span>{t("errorPages.offlineBanner.message")}</span>
<Link to="/offline" className="text-accent hover:text-accent-hover font-medium">
<WifiOff className="text-warning size-4 shrink-0" aria-hidden />
<span className="min-w-0 truncate">{t("errorPages.offlineBanner.message")}</span>
<Link to="/offline" className="text-accent hover:text-accent-hover shrink-0 font-medium">
{t("errorPages.offlineBanner.details")}
</Link>
<button
type="button"
onClick={() => setDismissed(true)}
aria-label={t("common.dismiss")}
className="text-text-muted hover:bg-surface-3 hover:text-text-primary ml-1 rounded p-1 transition-colors"
className="text-text-muted hover:bg-surface-2 hover:text-text-primary flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors"
>
<X className="h-4 w-4" />
<X className="size-3.5" aria-hidden="true" />
</button>
</div>
);
+61 -47
View File
@@ -1,71 +1,85 @@
import { useState } from "react";
import { useId, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChevronDown, ChevronUp, Trash2 } from "lucide-react";
import { Button } from "@components/ui/Button";
import { ChevronDown, FileText, Trash2 } from "lucide-react";
import clsx from "clsx";
import { Card } from "@components/ui/Card";
import { IconButton } from "@components/ui/IconButton";
import { CopyButton } from "@components/output/CopyButton";
import { VIDEO_TYPE_ICONS } from "@components/editor/video-type-icons";
import { useHistoryStore, type HistoryEntry } from "@store/history-store";
import { VIDEO_TYPES } from "@config/video-types";
interface HistoryCardProps {
entry: HistoryEntry;
}
export function HistoryCard({ entry }: HistoryCardProps) {
const { t } = useTranslation("ui");
export function HistoryCard({ entry }: { entry: HistoryEntry }) {
const { t, i18n } = useTranslation("ui");
const deleteEntry = useHistoryStore((s) => s.deleteEntry);
const [expanded, setExpanded] = useState(false);
const panelId = useId();
const videoType = VIDEO_TYPES.find((vt) => vt.id === entry.videoType);
const date = new Date(entry.createdAt).toLocaleDateString();
const Icon = videoType ? VIDEO_TYPE_ICONS[videoType.id] : FileText;
const date = new Date(entry.createdAt).toLocaleString(i18n.language, {
dateStyle: "medium",
timeStyle: "short",
});
return (
<div className="hover:border-accent/30 border-border-strong bg-surface-2 rounded-lg border shadow-md shadow-black/10 transition-colors">
<div
className="flex cursor-pointer items-center justify-between p-3"
onClick={() => setExpanded(!expanded)}
>
<div className="flex-1">
<div className="flex items-center gap-2">
{videoType && <span>{videoType.icon}</span>}
<span className="text-text-primary text-sm font-medium">{entry.title}</span>
</div>
<div className="text-text-muted mt-1 flex gap-2 text-xs">
<span>{entry.gameName}</span>
<span>{entry.language.toUpperCase()}</span>
<span>{date}</span>
</div>
</div>
<div className="flex items-center gap-1">
<Button
variant="ghost"
size="sm"
onClick={(e) => {
e.stopPropagation();
deleteEntry(entry.id);
}}
>
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
{expanded ? (
<ChevronUp className="text-text-muted h-4 w-4" />
) : (
<ChevronDown className="text-text-muted h-4 w-4" />
)}
</div>
<Card className="overflow-hidden">
<div className="flex items-center gap-2 pr-2">
<button
type="button"
onClick={() => setExpanded((v) => !v)}
aria-expanded={expanded}
aria-controls={panelId}
className="hover:bg-surface-2/60 flex min-w-0 flex-1 cursor-pointer items-center gap-3 p-3 text-left transition-colors"
>
<span className="bg-surface-2 text-text-muted flex size-9 shrink-0 items-center justify-center rounded-lg">
<Icon className="size-4" aria-hidden />
</span>
<span className="min-w-0 flex-1">
<span className="text-text-primary block truncate text-sm font-medium">
{entry.title}
</span>
<span className="text-text-muted mt-0.5 block truncate text-xs">
{[
entry.gameName,
videoType ? t(videoType.labelKey) : null,
entry.language.toUpperCase(),
date,
]
.filter(Boolean)
.join(" · ")}
</span>
</span>
<ChevronDown
className={clsx(
"text-text-muted size-4 shrink-0 transition-transform duration-200",
expanded && "rotate-180",
)}
aria-hidden="true"
/>
</button>
<IconButton
label={t("common.delete")}
size="icon-sm"
className="hover:text-danger"
onClick={() => deleteEntry(entry.id)}
>
<Trash2 />
</IconButton>
</div>
{expanded && (
<div className="border-border border-t p-3">
<div className="mb-2 flex gap-2">
<div id={panelId} className="border-border flex flex-col gap-2 border-t p-3">
<div className="flex flex-wrap gap-1">
<CopyButton text={entry.title} label={t("output.copyTitle")} />
<CopyButton text={entry.description} label={t("output.copyDescription")} />
<CopyButton text={entry.tags} label={t("output.copyTags")} />
</div>
<pre className="bg-surface-2 text-text-secondary max-h-48 overflow-y-auto rounded p-2 font-sans text-xs whitespace-pre-wrap">
<pre className="bg-surface-0 border-border text-text-secondary max-h-56 scrollbar-thin overflow-y-auto rounded-lg border p-2.5 font-sans text-xs leading-relaxed whitespace-pre-wrap">
{entry.description}
</pre>
</div>
)}
</div>
</Card>
);
}
+117
View File
@@ -0,0 +1,117 @@
import type { ReactNode } from "react";
import { AnimatePresence, m, type Variants } from "motion/react";
import { Check, Copy, LoaderCircle, Moon, Sun } from "lucide-react";
import clsx from "clsx";
import type { IconComponent } from "./brand";
/**
* Animated icons. Every effect is decorative and short (< 400 ms), respects
* the OS "reduce motion" setting through MotionProvider, and never delays the
* action it decorates.
*/
const swap = {
initial: { opacity: 0, scale: 0.5, rotate: -45 },
animate: { opacity: 1, scale: 1, rotate: 0 },
exit: { opacity: 0, scale: 0.5, rotate: 45 },
transition: { duration: 0.18, ease: [0.2, 0.8, 0.2, 1] },
} as const;
function Swap({
id,
children,
className,
}: {
id: string;
children: ReactNode;
className?: string;
}) {
return (
<span className={clsx("relative inline-grid place-items-center", className)} aria-hidden="true">
<AnimatePresence mode="popLayout" initial={false}>
<m.span key={id} className="col-start-1 row-start-1 inline-flex" {...swap}>
{children}
</m.span>
</AnimatePresence>
</span>
);
}
/** Copy → check once copied. */
export function CopyStateIcon({ copied, className }: { copied: boolean; className?: string }) {
return (
<Swap id={copied ? "check" : "copy"}>
{copied ? (
<Check className={clsx("text-success", className)} strokeWidth={2.5} />
) : (
<Copy className={className} />
)}
</Swap>
);
}
/** Sun ↔ moon: shows the theme the toggle will switch TO. */
export function ThemeToggleIcon({
theme,
className,
}: {
theme: "dark" | "light";
className?: string;
}) {
return (
<Swap id={theme}>
{theme === "dark" ? <Sun className={className} /> : <Moon className={className} />}
</Swap>
);
}
export function Spinner({ className }: { className?: string }) {
return <LoaderCircle className={clsx("animate-spin", className)} aria-hidden="true" />;
}
/** Micro-interactions an icon plays while its parent is hovered or focused. */
export type IconMotion = "wiggle" | "bounce" | "spin" | "pop" | "tilt" | "nudge";
const ICON_MOTION: Record<IconMotion, Variants> = {
wiggle: {
rest: { rotate: 0 },
hover: { rotate: [0, -14, 10, -6, 0], transition: { duration: 0.45 } },
},
bounce: { rest: { y: 0 }, hover: { y: [0, -3, 0], transition: { duration: 0.35 } } },
spin: { rest: { rotate: 0 }, hover: { rotate: 90, transition: { duration: 0.35 } } },
pop: { rest: { scale: 1 }, hover: { scale: [1, 1.22, 1], transition: { duration: 0.3 } } },
tilt: {
rest: { rotate: 0 },
hover: { rotate: -12, transition: { type: "spring", stiffness: 400, damping: 12 } },
},
nudge: { rest: { x: 0 }, hover: { x: [0, 3, 0], transition: { duration: 0.3 } } },
};
/**
* An icon that animates when an ANCESTOR carrying `initial="rest"
* whileHover="hover" whileFocus="hover"` (see {@link hoverParent}) is hovered
* or focused — so the whole nav row or button triggers it, not just the glyph.
*/
export function HoverIcon({
icon: Icon,
motion = "pop",
className,
}: {
icon: IconComponent;
motion?: IconMotion;
className?: string;
}) {
return (
<m.span className="inline-flex shrink-0" variants={ICON_MOTION[motion]} aria-hidden="true">
<Icon className={className} />
</m.span>
);
}
/** Spread on the element whose hover/focus should play a child HoverIcon. */
export const hoverParent = {
initial: "rest",
animate: "rest",
whileHover: "hover",
whileFocus: "hover",
} as const;
+62
View File
@@ -0,0 +1,62 @@
import type { ComponentType } from "react";
import {
siBluesky,
siBuymeacoffee,
siDiscord,
siFacebook,
siGithub,
siInstagram,
siKofi,
siMastodon,
siPatreon,
siPaypal,
siSteam,
siTelegram,
siTiktok,
siX,
siYoutube,
type SimpleIcon,
} from "simple-icons";
/**
* Brand marks from Simple Icons (CC0-1.0). lucide-react 1.0 removed its brand
* icons; these replace them. The marks themselves remain their owners'
* trademarks and are used only to label links to those services.
*/
/** Any icon component the UI accepts — lucide icons and these alike. */
export type IconComponent = ComponentType<{ className?: string; "aria-hidden"?: boolean }>;
function brandIcon(icon: SimpleIcon): IconComponent {
function BrandIcon({ className }: { className?: string }) {
return (
<svg
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
focusable="false"
className={className}
>
<path d={icon.path} />
</svg>
);
}
BrandIcon.displayName = `BrandIcon(${icon.title})`;
return BrandIcon;
}
export const YoutubeIcon = brandIcon(siYoutube);
export const XIcon = brandIcon(siX);
export const BlueskyIcon = brandIcon(siBluesky);
export const MastodonIcon = brandIcon(siMastodon);
export const DiscordIcon = brandIcon(siDiscord);
export const SteamIcon = brandIcon(siSteam);
export const TelegramIcon = brandIcon(siTelegram);
export const GithubIcon = brandIcon(siGithub);
export const KofiIcon = brandIcon(siKofi);
export const BuyMeACoffeeIcon = brandIcon(siBuymeacoffee);
export const PatreonIcon = brandIcon(siPatreon);
export const PaypalIcon = brandIcon(siPaypal);
export const FacebookIcon = brandIcon(siFacebook);
export const InstagramIcon = brandIcon(siInstagram);
export const TiktokIcon = brandIcon(siTiktok);
+123 -31
View File
@@ -1,46 +1,138 @@
import { useRef, useState } from "react";
import { Outlet } from "react-router-dom";
import { lazy, Suspense, useCallback, useEffect, useRef, useState } from "react";
import { Outlet, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Header } from "./Header";
import { Sidebar, SidebarNavList } from "./Sidebar";
import { Sidebar, NavList, NavFooterLinks } from "./Sidebar";
import { MobileNav } from "./MobileNav";
import { ScrollToTopButton } from "./ScrollToTopButton";
import { Drawer } from "@components/ui/Drawer";
import { ShortcutHelpModal } from "@components/ui/ShortcutHelpModal";
import { useKeyboardShortcuts } from "@hooks/use-keyboard-shortcuts";
import { useKeyboardShortcuts, type ShortcutHandlers } from "@hooks/use-keyboard-shortcuts";
import { useGlobalErrorHandler } from "@hooks/use-global-error-handler";
import { useSettingsStore } from "@store/settings-store";
export function AppShell() {
const [showShortcuts, setShowShortcuts] = useState(false);
const [mobileNavOpen, setMobileNavOpen] = useState(false);
const mainRef = useRef<HTMLElement>(null);
const setSetting = useSettingsStore((s) => s.setSetting);
const collapsed = useSettingsStore((s) => s.sidebarCollapsed);
// Both download on first use — neither is needed to render a page.
const CommandPalette = lazy(() =>
import("./CommandPalette").then((m) => ({ default: m.CommandPalette })),
);
const ShortcutHelpModal = lazy(() =>
import("@components/ui/ShortcutHelpModal").then((m) => ({ default: m.ShortcutHelpModal })),
);
useKeyboardShortcuts({
onToggleHelp: () => setShowShortcuts((v) => !v),
onToggleSidebar: () => setSetting("sidebarCollapsed", !collapsed),
});
/**
* Renders nothing. The shortcut hook reads the generated output, which
* changes on every keystroke in the editor — isolating it here means only
* this empty component re-renders, not the whole shell.
*/
function GlobalShortcuts(props: ShortcutHandlers) {
useKeyboardShortcuts(props);
return null;
}
export function AppShell() {
const { t } = useTranslation("ui");
const { pathname } = useLocation();
const [showShortcuts, setShowShortcuts] = useState(false);
const [moreOpen, setMoreOpen] = useState(false);
const [paletteOpen, setPaletteOpen] = useState(false);
// Once opened, stay mounted so closing can animate and reopening is instant.
const [paletteUsed, setPaletteUsed] = useState(false);
const [shortcutsUsed, setShortcutsUsed] = useState(false);
const mainRef = useRef<HTMLElement>(null);
useGlobalErrorHandler();
// The same <main> scrolls every page, so a new page would otherwise open
// wherever the previous one was scrolled to.
useEffect(() => {
mainRef.current?.scrollTo({ top: 0 });
}, [pathname]);
const toggleHelp = useCallback(() => {
setShortcutsUsed(true);
setShowShortcuts((v) => !v);
}, []);
const togglePalette = useCallback(() => {
setPaletteUsed(true);
setPaletteOpen((v) => !v);
}, []);
const openPalette = useCallback(() => {
setPaletteUsed(true);
setPaletteOpen(true);
}, []);
const toggleSidebar = useCallback(() => {
const { sidebarCollapsed, setSetting } = useSettingsStore.getState();
setSetting("sidebarCollapsed", !sidebarCollapsed);
}, []);
return (
<div className="bg-surface-0 flex h-screen overflow-hidden">
<Sidebar />
<div className="flex min-w-0 flex-1 flex-col">
<Header onOpenMobileNav={() => setMobileNavOpen(true)} />
<main ref={mainRef} className="min-h-0 flex-1 overflow-y-auto">
<Outlet />
</main>
</div>
<Drawer
open={mobileNavOpen}
onClose={() => setMobileNavOpen(false)}
side="left"
ariaLabel="Navigation"
<div className="bg-surface-0 flex h-dvh overflow-hidden">
{/* Not an href="#main": under HashRouter (desktop) that is a route. */}
<a
href="#main"
onClick={(e) => {
e.preventDefault();
mainRef.current?.focus();
}}
className="bg-accent text-accent-fg rounded-control sr-only z-[60] px-3 py-2 text-sm font-medium focus:not-sr-only focus:fixed focus:top-2 focus:left-2"
>
<SidebarNavList collapsed={false} onItemClick={() => setMobileNavOpen(false)} />
{t("nav.skipToContent")}
</a>
<Sidebar />
<div className="flex min-w-0 flex-1 flex-col">
<Header onOpenCommandPalette={openPalette} />
<div className="relative min-h-0 flex-1">
<main
id="main"
ref={mainRef}
tabIndex={-1}
className="h-full scrollbar-thin overflow-y-auto focus:outline-none"
>
<Outlet />
</main>
<ScrollToTopButton scrollRef={mainRef} />
</div>
<MobileNav onOpenMore={() => setMoreOpen(true)} moreActive={moreOpen} />
</div>
<Drawer
open={moreOpen}
onClose={() => setMoreOpen(false)}
side="bottom"
title={t("nav.more")}
>
<nav aria-label={t("nav.main")} className="flex flex-col gap-4 p-3">
<NavList
collapsed={false}
layoutId="nav-active-sheet"
onNavigate={() => setMoreOpen(false)}
/>
<div className="border-border border-t pt-3">
<NavFooterLinks collapsed={false} onNavigate={() => setMoreOpen(false)} />
</div>
</nav>
</Drawer>
<ShortcutHelpModal open={showShortcuts} onClose={() => setShowShortcuts(false)} />
<ScrollToTopButton scrollRef={mainRef} />
<Suspense fallback={null}>
{paletteUsed && (
<CommandPalette
open={paletteOpen}
onOpenChange={setPaletteOpen}
onShowShortcuts={() => {
setShortcutsUsed(true);
setShowShortcuts(true);
}}
/>
)}
{shortcutsUsed && (
<ShortcutHelpModal open={showShortcuts} onClose={() => setShowShortcuts(false)} />
)}
</Suspense>
<GlobalShortcuts
onToggleHelp={toggleHelp}
onToggleSidebar={toggleSidebar}
onTogglePalette={togglePalette}
/>
</div>
);
}
+244
View File
@@ -0,0 +1,244 @@
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Command } from "cmdk";
import {
BookOpen,
Bug,
ClipboardCopy,
Contrast,
FileText,
Gamepad2,
Keyboard,
Languages,
LayoutTemplate,
Scale,
Search,
Tags,
Type,
UserRound,
} from "lucide-react";
import type { ReactNode } from "react";
import { NAV_ITEMS } from "@config/navigation";
import { ABOUT } from "@config/about";
import { SUPPORTED_LANGUAGES } from "@i18n/index";
import { useSettingsStore } from "@store/settings-store";
import { useEditorStore } from "@store/editor-store";
import { useProfileStore } from "@store/profile-store";
import { usePresetStore } from "@store/preset-store";
import { useTemplateStore } from "@store/template-store";
import { useOutputCopy } from "@hooks/use-output-copy";
import { applyPreset, applyProfile, applyTemplate } from "@utils/library-apply";
import { openExternal } from "@utils/open-external";
import type { SupportedLanguage } from "@engine/types";
import { Kbd, ShortcutKeys } from "@components/ui/Badge";
interface CommandPaletteProps {
open: boolean;
onOpenChange: (open: boolean) => void;
onShowShortcuts: () => void;
}
function Item({
children,
onSelect,
keywords,
icon,
hint,
}: {
children: ReactNode;
onSelect: () => void;
keywords?: string[];
icon?: ReactNode;
hint?: ReactNode;
}) {
return (
<Command.Item
onSelect={onSelect}
keywords={keywords}
className="text-text-primary data-[selected=true]:bg-surface-2 flex h-9 cursor-pointer items-center gap-2.5 rounded-lg px-2.5 text-sm select-none [&_svg]:size-4 [&_svg]:shrink-0"
>
<span className="text-text-muted flex">{icon}</span>
<span className="min-w-0 flex-1 truncate">{children}</span>
{hint && <span className="text-text-muted text-xs">{hint}</span>}
</Command.Item>
);
}
const groupClass =
"[&_[cmdk-group-heading]]:text-text-muted [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:pt-3 [&_[cmdk-group-heading]]:pb-1 [&_[cmdk-group-heading]]:text-[0.6875rem] [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:tracking-wide [&_[cmdk-group-heading]]:uppercase";
/** Everything below only mounts while the palette is open. */
function PaletteBody({
close,
onShowShortcuts,
}: {
close: () => void;
onShowShortcuts: () => void;
}) {
const { t } = useTranslation("ui");
const navigate = useNavigate();
const copyOutput = useOutputCopy();
const profiles = useProfileStore((s) => s.profiles);
const presets = usePresetStore((s) => s.presets);
const templates = useTemplateStore((s) => s.templates);
const theme = useSettingsStore((s) => s.theme);
const setTheme = useSettingsStore((s) => s.setTheme);
const setAppLanguage = useSettingsStore((s) => s.setAppLanguage);
const setEditorField = useEditorStore((s) => s.set);
const run = (fn: () => void) => () => {
close();
fn();
};
return (
<>
<div className="border-border flex items-center gap-2 border-b px-3">
<Search className="text-text-muted size-4 shrink-0" aria-hidden="true" />
<Command.Input
autoFocus
placeholder={t("command.placeholder")}
className="text-text-primary placeholder:text-text-muted h-12 w-full bg-transparent text-sm outline-none"
/>
<Kbd>Esc</Kbd>
</div>
<Command.List className="max-h-[min(60dvh,26rem)] scrollbar-thin overflow-y-auto p-1.5">
<Command.Empty className="text-text-muted py-10 text-center text-sm">
{t("command.empty")}
</Command.Empty>
<Command.Group heading={t("command.groups.navigate")} className={groupClass}>
{NAV_ITEMS.map((item) => (
<Item key={item.to} icon={<item.icon />} onSelect={run(() => navigate(item.to))}>
{t(item.labelKey)}
</Item>
))}
<Item icon={<Scale />} onSelect={run(() => navigate("/legal"))}>
{t("legal.title")}
</Item>
</Command.Group>
<Command.Group heading={t("command.groups.copy")} className={groupClass}>
<Item icon={<Type />} onSelect={run(() => void copyOutput("title"))}>
{t("output.copyTitle")}
</Item>
<Item icon={<FileText />} onSelect={run(() => void copyOutput("description"))}>
{t("output.copyDescription")}
</Item>
<Item icon={<Tags />} onSelect={run(() => void copyOutput("tags"))}>
{t("output.copyTags")}
</Item>
<Item
icon={<ClipboardCopy />}
hint={<ShortcutKeys keys={["mod", "shift", "C"]} />}
onSelect={run(() => void copyOutput("all"))}
>
{t("output.copyAll")}
</Item>
</Command.Group>
{profiles.length > 0 && (
<Command.Group heading={t("command.groups.profiles")} className={groupClass}>
{profiles.map((profile) => (
<Item
key={profile.id}
icon={<UserRound />}
keywords={[profile.channelName]}
onSelect={run(() => applyProfile(profile))}
>
{profile.name}
</Item>
))}
</Command.Group>
)}
{presets.length > 0 && (
<Command.Group heading={t("command.groups.presets")} className={groupClass}>
{presets.map((preset) => (
<Item key={preset.id} icon={<Gamepad2 />} onSelect={run(() => applyPreset(preset))}>
{preset.gameName}
</Item>
))}
</Command.Group>
)}
{templates.length > 0 && (
<Command.Group heading={t("command.groups.templates")} className={groupClass}>
{templates.map((template) => (
<Item
key={template.id}
icon={<LayoutTemplate />}
onSelect={run(() => void applyTemplate(template))}
>
{template.name}
</Item>
))}
</Command.Group>
)}
<Command.Group heading={t("command.groups.preferences")} className={groupClass}>
<Item
icon={<Contrast />}
onSelect={run(() => setTheme(theme === "dark" ? "light" : "dark"))}
>
{t(theme === "dark" ? "header.switchToLight" : "header.switchToDark")}
</Item>
{SUPPORTED_LANGUAGES.map((lang) => (
<Item
key={`ui-${lang.id}`}
icon={<Languages />}
keywords={[lang.label, lang.id]}
hint={lang.id.toUpperCase()}
onSelect={run(() => setAppLanguage(lang.id as SupportedLanguage))}
>
{t("command.interfaceIn", { language: lang.nativeName })}
</Item>
))}
{SUPPORTED_LANGUAGES.map((lang) => (
<Item
key={`out-${lang.id}`}
icon={<FileText />}
keywords={[lang.label, lang.id]}
hint={lang.id.toUpperCase()}
onSelect={run(() => setEditorField("language", lang.id as SupportedLanguage))}
>
{t("command.outputIn", { language: lang.nativeName })}
</Item>
))}
</Command.Group>
<Command.Group heading={t("command.groups.help")} className={groupClass}>
<Item icon={<Keyboard />} onSelect={run(onShowShortcuts)}>
{t("shortcuts.title")}
</Item>
<Item icon={<BookOpen />} onSelect={run(() => void openExternal(ABOUT.wikiUrl))}>
{t("command.wiki")}
</Item>
<Item icon={<Bug />} onSelect={run(() => void openExternal(ABOUT.bugReportUrl))}>
{t("tabs.reportBug")}
</Item>
</Command.Group>
</Command.List>
</>
);
}
/**
* Ctrl/⌘+K: jump to any page, copy output, apply a saved profile / preset /
* template, switch theme or language — without leaving the keyboard.
*/
export function CommandPalette({ open, onOpenChange, onShowShortcuts }: CommandPaletteProps) {
const { t } = useTranslation("ui");
return (
<Command.Dialog
open={open}
onOpenChange={onOpenChange}
label={t("command.title")}
loop
overlayClassName="bg-overlay animate-fade-in fixed inset-0 z-50 backdrop-blur-[2px]"
contentClassName="bg-surface-1 border-border shadow-pop animate-pop-in fixed top-[12dvh] left-1/2 z-50 w-[calc(100%-1.5rem)] max-w-xl -translate-x-1/2 overflow-hidden rounded-panel border focus:outline-none"
>
{open && <PaletteBody close={() => onOpenChange(false)} onShowShortcuts={onShowShortcuts} />}
</Command.Dialog>
);
}
+81 -95
View File
@@ -1,111 +1,97 @@
import { useState, useRef, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { ChevronDown, Heart, Menu, Moon, Sun } from "lucide-react";
import { SUPPORTED_LANGUAGES } from "@i18n/index";
import { useSettingsStore } from "@store/settings-store";
import { PRIMARY_DONATE_URL } from "@config/donate";
import type { SupportedLanguage } from "@engine/types";
import { Heart, Languages, Search } from "lucide-react";
import clsx from "clsx";
import { useSettingsStore } from "@store/settings-store";
import { useEditorStore } from "@store/editor-store";
import { PRIMARY_DONATE_URL } from "@config/donate";
import { ABOUT } from "@config/about";
import { Logo } from "@components/brand/Logo";
import { ThemeToggleIcon } from "@components/icons/animated";
import { IconButton } from "@components/ui/IconButton";
import { ShortcutKeys } from "@components/ui/Badge";
import { Tooltip } from "@components/ui/Tooltip";
import { LanguageChip } from "./LanguageChip";
interface HeaderProps {
onOpenMobileNav?: () => void;
onOpenCommandPalette: () => void;
}
export function Header({ onOpenMobileNav }: HeaderProps) {
const { t, i18n } = useTranslation("ui");
const { appLanguage, setAppLanguage, theme, setTheme } = useSettingsStore();
const [open, setOpen] = useState(false);
const dropdownRef = useRef<HTMLDivElement>(null);
const current = SUPPORTED_LANGUAGES.find((l) => l.id === appLanguage);
useEffect(() => {
if (!open) return;
const handleClick = (e: MouseEvent) => {
if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {
setOpen(false);
}
};
document.addEventListener("mousedown", handleClick);
return () => document.removeEventListener("mousedown", handleClick);
}, [open]);
const handleSwitch = (langId: SupportedLanguage) => {
setAppLanguage(langId);
i18n.changeLanguage(langId);
setOpen(false);
};
/** Top bar: command palette, languages, theme, donate (and the brand on phones). */
export function Header({ onOpenCommandPalette }: HeaderProps) {
const { t } = useTranslation("ui");
const appLanguage = useSettingsStore((s) => s.appLanguage);
const setAppLanguage = useSettingsStore((s) => s.setAppLanguage);
const theme = useSettingsStore((s) => s.theme);
const setTheme = useSettingsStore((s) => s.setTheme);
const outputLanguage = useEditorStore((s) => s.language);
const setEditorField = useEditorStore((s) => s.set);
return (
<header className="border-border bg-surface-1 flex items-center justify-between gap-2 border-b px-3 py-3 pt-[max(0.75rem,env(safe-area-inset-top))] sm:px-6">
<div className="flex min-w-0 items-center gap-2">
{onOpenMobileNav && (
<button
type="button"
onClick={onOpenMobileNav}
aria-label="Open navigation menu"
className="text-text-secondary hover:bg-surface-2 hover:text-text-primary -ml-1 rounded-lg p-2 transition-colors md:hidden"
>
<Menu className="h-5 w-5" />
</button>
)}
<div className="min-w-0">
<h1 className="text-text-primary truncate text-base font-bold sm:text-lg">
{t("app.title")}
</h1>
<p className="text-text-muted hidden truncate text-xs sm:block">{t("app.subtitle")}</p>
<header className="border-border bg-surface-0/85 safe-top sticky top-0 z-30 border-b backdrop-blur-md">
<div className="flex h-14 items-center gap-2 px-3 sm:px-5">
{/* Phones have no sidebar: show the brand here. Every page has its own
<h1>, so the bar never repeats the page name. */}
<div className="flex min-w-0 items-center gap-2 md:hidden">
<Logo className="size-7" />
<span className="text-text-primary truncate text-sm font-bold tracking-tight">
{ABOUT.appName}
</span>
</div>
</div>
<div className="flex shrink-0 items-center gap-2">
<a
href={PRIMARY_DONATE_URL}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-1.5 rounded-lg border border-pink-500/30 bg-pink-500/10 px-2.5 py-1.5 text-sm text-pink-300 transition-colors hover:border-pink-400/60 hover:bg-pink-500/20 hover:text-pink-200 sm:px-3"
title={t("header.donate")}
aria-label={t("header.donate")}
>
<Heart className="h-4 w-4 sm:h-3.5 sm:w-3.5" />
<span className="hidden md:inline">{t("header.donate")}</span>
</a>
<button
type="button"
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
className="text-text-secondary hover:bg-surface-2 hover:text-text-primary rounded-lg p-2 transition-colors"
title={t("header.toggleTheme")}
aria-label={t("header.toggleTheme")}
>
{theme === "dark" ? <Moon className="h-4 w-4" /> : <Sun className="h-4 w-4" />}
</button>
<div className="relative" ref={dropdownRef}>
<button
onClick={() => setOpen(!open)}
className="hover:bg-surface-2 flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm transition-colors sm:px-3"
aria-haspopup="listbox"
aria-expanded={open}
>
<span>{current?.flag}</span>
<span className="text-text-primary hidden sm:inline">{current?.nativeName}</span>
<ChevronDown className="text-text-muted h-3.5 w-3.5" />
</button>
{open && (
<div className="border-border bg-surface-1 absolute top-full right-0 z-50 mt-1 max-w-[calc(100vw-2rem)] min-w-[200px] rounded-lg border py-1 shadow-xl">
{SUPPORTED_LANGUAGES.map((lang) => (
<button
key={lang.id}
onClick={() => handleSwitch(lang.id as SupportedLanguage)}
className={clsx(
"hover:bg-surface-2 flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors",
lang.id === appLanguage ? "bg-accent-muted text-accent" : "text-text-primary",
)}
>
<span>{lang.flag}</span>
<span>{lang.nativeName}</span>
</button>
))}
</div>
onClick={onOpenCommandPalette}
aria-label={t("command.open")}
className={clsx(
"border-border bg-surface-1 text-text-muted hover:border-border-strong hover:text-text-secondary",
"ml-auto inline-flex h-8 cursor-pointer items-center gap-2 rounded-lg border px-2 text-xs transition-colors sm:w-64 sm:px-2.5 md:mr-auto md:ml-0",
)}
>
<Search className="size-3.5 shrink-0" aria-hidden="true" />
<span className="hidden flex-1 truncate text-left sm:inline">{t("command.open")}</span>
{/* Wrappers carry the responsive display: the components' own
inline-flex would otherwise beat a plain `hidden`. */}
<span className="hidden sm:inline-flex">
<ShortcutKeys keys={["mod", "K"]} />
</span>
</button>
<div className="hidden sm:block">
<LanguageChip
label={t("header.outputLanguage")}
value={outputLanguage}
onChange={(language) => setEditorField("language", language)}
prefix={<span className="text-text-muted font-medium">{t("tabs.output")}</span>}
/>
</div>
<LanguageChip
label={t("header.interfaceLanguage")}
value={appLanguage}
onChange={setAppLanguage}
prefix={<Languages className="size-3.5" aria-hidden="true" />}
/>
<IconButton
label={t(theme === "dark" ? "header.switchToLight" : "header.switchToDark")}
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
>
<ThemeToggleIcon theme={theme} />
</IconButton>
<Tooltip content={t("header.donate")}>
<a
href={PRIMARY_DONATE_URL}
target="_blank"
rel="noopener noreferrer"
aria-label={t("header.donate")}
className="text-donate hover:bg-donate/10 group size-control rounded-control hidden items-center justify-center transition-colors sm:inline-flex"
>
<Heart
className="size-4 transition-transform duration-200 group-hover:scale-125 group-active:scale-90"
aria-hidden="true"
/>
</a>
</Tooltip>
</div>
</header>
);
+52
View File
@@ -0,0 +1,52 @@
import type { ReactNode } from "react";
import { ChevronDown } from "lucide-react";
import clsx from "clsx";
import { SUPPORTED_LANGUAGES } from "@i18n/index";
import type { SupportedLanguage } from "@engine/types";
import { Tooltip } from "@components/ui/Tooltip";
interface LanguageChipProps {
value: string;
onChange: (language: SupportedLanguage) => void;
/** Accessible name and tooltip. */
label: string;
/** Icon or short text before the language code. */
prefix?: ReactNode;
className?: string;
}
/**
* A compact language switch: the chip shows the language code, and a native
* <select> laid invisibly over it does the picking — the platform's own list
* (a proper picker on phones), type-ahead and keyboard handling for free,
* without a menu library in the first download.
*/
export function LanguageChip({ value, onChange, label, prefix, className }: LanguageChipProps) {
return (
<Tooltip content={label}>
<label
className={clsx(
"border-border text-text-secondary hover:border-border-strong hover:text-text-primary relative inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border px-2 text-xs font-semibold transition-colors",
"focus-within:border-accent focus-within:ring-accent/30 focus-within:ring-2",
className,
)}
>
{prefix}
<span aria-hidden="true">{value.toUpperCase()}</span>
<ChevronDown className="size-3 opacity-60" aria-hidden="true" />
<select
aria-label={label}
value={value}
onChange={(e) => onChange(e.target.value as SupportedLanguage)}
className="absolute inset-0 cursor-pointer opacity-0"
>
{SUPPORTED_LANGUAGES.map((lang) => (
<option key={lang.id} value={lang.id}>
{lang.nativeName} ({lang.id})
</option>
))}
</select>
</label>
</Tooltip>
);
}
+78
View File
@@ -0,0 +1,78 @@
import { NavLink, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { m } from "motion/react";
import { Ellipsis } from "lucide-react";
import clsx from "clsx";
import { MOBILE_PRIMARY_PATHS, NAV_ITEMS } from "@config/navigation";
import { HoverIcon, hoverParent } from "@components/icons/animated";
const PRIMARY = NAV_ITEMS.filter((item) => MOBILE_PRIMARY_PATHS.includes(item.to));
/**
* Bottom tab bar below `md`: the four pages a phone user needs most, plus
* "More" for the rest (the navigation sheet). Replaces the hamburger-only
* drawer, which hid every page behind a tap. It is the last row of the shell's
* column rather than `position: fixed`, so the page area ends above it and
* nothing sticky inside a page can slide underneath.
*/
export function MobileNav({
onOpenMore,
moreActive,
}: {
onOpenMore: () => void;
moreActive: boolean;
}) {
const { t } = useTranslation("ui");
const { pathname } = useLocation();
const onPrimaryPage = PRIMARY.some((item) =>
item.to === "/" ? pathname === "/" : pathname.startsWith(item.to),
);
const cell =
"relative flex h-14 flex-1 flex-col items-center justify-center gap-0.5 text-[0.6875rem] font-medium";
return (
<nav
aria-label={t("nav.main")}
className="border-border bg-surface-1 safe-bottom shrink-0 border-t md:hidden"
>
<div className="flex">
{PRIMARY.map((item) => (
<NavLink
key={item.to}
to={item.to}
end={item.to === "/"}
className={({ isActive }) => clsx(cell, isActive ? "text-accent" : "text-text-muted")}
>
{({ isActive }) => (
<m.span {...hoverParent} className="flex flex-col items-center gap-0.5">
{isActive && (
<m.span
layoutId="nav-active-mobile"
className="bg-accent absolute top-0 h-0.5 w-8 rounded-full"
aria-hidden="true"
/>
)}
<HoverIcon icon={item.icon} motion={item.motion} className="size-5" />
<span className="max-w-full truncate px-1">{t(item.labelKey)}</span>
</m.span>
)}
</NavLink>
))}
<button
type="button"
onClick={onOpenMore}
aria-expanded={moreActive}
className={clsx(
cell,
"cursor-pointer",
!onPrimaryPage || moreActive ? "text-accent" : "text-text-muted",
)}
>
<Ellipsis className="size-5" aria-hidden="true" />
<span>{t("nav.more")}</span>
</button>
</div>
</nav>
);
}
+27 -30
View File
@@ -1,30 +1,25 @@
import { useEffect, useState, type RefObject } from "react";
import { useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { AnimatePresence, m } from "motion/react";
import { ArrowUp } from "lucide-react";
import clsx from "clsx";
interface ScrollToTopButtonProps {
/** The scrollable container to watch and scroll back to the top. */
/**
* React 19 types `useRef<T>(null)` as `RefObject<T | null>` rather than
* `RefObject<T>` — the ref genuinely is null before the element mounts, and
* the old type quietly lied about it. Matching that here rather than casting
* at the call site keeps the null-check below honest.
* The scrollable container to watch and scroll back to the top. React 19
* types `useRef<T>(null)` as `RefObject<T | null>` — the ref genuinely is
* null before the element mounts.
*/
scrollRef: RefObject<HTMLElement | null>;
}
/** Scroll distance (px) past which the button fades in. */
const SHOW_AFTER_PX = 300;
/** Scroll distance (px) past which the button appears. */
const SHOW_AFTER_PX = 600;
/**
* Floating "back to top" button, fixed to the bottom-right of the
* viewport. Fades in once the app's scroll container is scrolled past
* {@link SHOW_AFTER_PX} and smooth-scrolls back on click.
*
* The scroll container is the `<main>` element (see AppShell), not the
* window — so the listener and `scrollTo` both target the passed ref.
* Floating "back to top" button in the bottom-left corner of the page area
* (bottom-right is where pages keep their primary actions and toasts). It
* appears once `<main>` is scrolled past {@link SHOW_AFTER_PX}.
*/
export function ScrollToTopButton({ scrollRef }: ScrollToTopButtonProps) {
const { t } = useTranslation("ui");
@@ -47,7 +42,7 @@ export function ScrollToTopButton({ scrollRef }: ScrollToTopButtonProps) {
};
// Re-evaluate on mount and whenever the route changes — the same
// <main> persists across tabs, so scrollTop does not reset itself.
// <main> persists across pages.
update();
el.addEventListener("scroll", onScroll, { passive: true });
return () => el.removeEventListener("scroll", onScroll);
@@ -58,24 +53,26 @@ export function ScrollToTopButton({ scrollRef }: ScrollToTopButtonProps) {
if (!el) return;
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
el.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
el.focus({ preventScroll: true });
}
return (
<button
type="button"
onClick={scrollToTop}
aria-label={t("common.scrollToTop")}
aria-hidden={!visible}
tabIndex={visible ? 0 : -1}
className={clsx(
"h-touch w-touch fixed right-6 bottom-6 z-40 flex items-center justify-center",
"border-border bg-surface-1 text-text-primary rounded-full border shadow-lg",
"hover:bg-surface-2 transition-opacity duration-200",
"focus-visible:ring-accent focus:outline-none focus-visible:ring-2",
visible ? "opacity-100" : "pointer-events-none opacity-0",
<AnimatePresence>
{visible && (
<m.button
type="button"
onClick={scrollToTop}
aria-label={t("common.scrollToTop")}
initial={{ opacity: 0, y: 8, scale: 0.9 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 8, scale: 0.9 }}
transition={{ duration: 0.16 }}
whileHover={{ y: -2 }}
className="border-border bg-surface-1/90 text-text-secondary hover:text-text-primary shadow-pop absolute bottom-4 left-4 z-20 flex size-10 cursor-pointer items-center justify-center rounded-full border backdrop-blur-md"
>
<ArrowUp className="size-4" aria-hidden="true" />
</m.button>
)}
>
<ArrowUp className="h-5 w-5" />
</button>
</AnimatePresence>
);
}
+159 -99
View File
@@ -1,129 +1,189 @@
import { NavLink } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Pencil,
FileText,
User,
Clock,
Settings,
Layers,
Share2,
ListVideo,
ScrollText,
Info,
Bug,
PanelLeftClose,
PanelLeftOpen,
type LucideIcon,
} from "lucide-react";
import { m } from "motion/react";
import { Bug, PanelLeftClose, PanelLeftOpen, Scale } from "lucide-react";
import clsx from "clsx";
import { useSettingsStore } from "@store/settings-store";
import { ABOUT } from "@config/about";
import { NAV_GROUPS, type NavItem } from "@config/navigation";
import { Logo } from "@components/brand/Logo";
import { HoverIcon, hoverParent } from "@components/icons/animated";
import { IconButton } from "@components/ui/IconButton";
import { Tooltip } from "@components/ui/Tooltip";
interface TabItem {
to: string;
labelKey: string;
icon: LucideIcon;
external?: boolean;
}
const tabs: readonly TabItem[] = [
{ to: "/", labelKey: "tabs.editor", icon: Pencil },
{ to: "/output", labelKey: "tabs.output", icon: FileText },
{ to: "/batch", labelKey: "tabs.batch", icon: Layers },
{ to: "/social", labelKey: "tabs.social", icon: Share2 },
{ to: "/profiles", labelKey: "tabs.profiles", icon: User },
{ to: "/history", labelKey: "tabs.history", icon: Clock },
{ to: "/playlist", labelKey: "tabs.playlist", icon: ListVideo },
{ to: "/logs", labelKey: "tabs.logs", icon: ScrollText },
{ to: "/settings", labelKey: "tabs.settings", icon: Settings },
{ to: "/about", labelKey: "tabs.about", icon: Info },
{ to: ABOUT.bugReportUrl, labelKey: "tabs.reportBug", icon: Bug, external: true },
] as const;
interface SidebarNavListProps {
interface NavListProps {
collapsed: boolean;
onItemClick?: () => void;
onNavigate?: () => void;
/** Scopes the sliding highlight — the drawer copy needs its own. */
layoutId: string;
}
export function SidebarNavList({ collapsed, onItemClick }: SidebarNavListProps) {
function NavRow({ item, collapsed, onNavigate, layoutId }: { item: NavItem } & NavListProps) {
const { t } = useTranslation("ui");
const label = t(item.labelKey);
return (
<nav className="flex flex-1 flex-col gap-0.5 overflow-y-auto p-2">
{tabs.map((tab) => {
const baseClass = clsx(
"flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",
collapsed && "justify-center px-0",
);
if (tab.external) {
return (
<a
key={tab.to}
href={tab.to}
target="_blank"
rel="noopener noreferrer"
title={collapsed ? t(tab.labelKey) : undefined}
onClick={onItemClick}
className={clsx(
baseClass,
"text-text-secondary hover:bg-surface-2 hover:text-text-primary",
)}
>
<tab.icon className="h-4 w-4 shrink-0" />
{!collapsed && <span className="truncate">{t(tab.labelKey)}</span>}
</a>
);
<Tooltip content={label} side="right" disabled={!collapsed}>
<NavLink
to={item.to}
end={item.to === "/"}
onClick={onNavigate}
aria-label={collapsed ? label : undefined}
className={({ isActive }) =>
clsx(
"relative block rounded-lg text-sm font-medium outline-offset-0",
isActive ? "text-text-primary" : "text-text-secondary hover:text-text-primary",
)
}
return (
<NavLink
key={tab.to}
to={tab.to}
end={tab.to === "/"}
title={collapsed ? t(tab.labelKey) : undefined}
onClick={onItemClick}
className={({ isActive }) =>
clsx(
baseClass,
isActive
? "bg-accent-muted text-accent"
: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
)
}
>
{({ isActive }) => (
<m.span
{...hoverParent}
className={clsx(
"relative flex h-9 items-center gap-3 rounded-lg transition-colors",
collapsed ? "justify-center px-0" : "px-3",
!isActive && "hover:bg-surface-2",
)}
>
<tab.icon className="h-4 w-4 shrink-0" />
{!collapsed && <span className="truncate">{t(tab.labelKey)}</span>}
</NavLink>
);
})}
</nav>
{isActive && (
<m.span
layoutId={layoutId}
className="bg-accent-muted absolute inset-0 rounded-lg"
transition={{ type: "spring", stiffness: 500, damping: 38 }}
aria-hidden="true"
>
<span className="bg-accent absolute top-2 bottom-2 -left-2 w-1 rounded-full" />
</m.span>
)}
<span className={clsx("relative flex", isActive && "text-accent")}>
<HoverIcon icon={item.icon} motion={item.motion} className="size-[1.125rem]" />
</span>
{!collapsed && <span className="relative truncate">{label}</span>}
</m.span>
)}
</NavLink>
</Tooltip>
);
}
/** The grouped page list — shared by the desktop sidebar and the mobile sheet. */
export function NavList({ collapsed, onNavigate, layoutId }: NavListProps) {
const { t } = useTranslation("ui");
return (
<div className="flex flex-col gap-4">
{NAV_GROUPS.map((group) => (
<div key={group.id} className="flex flex-col gap-0.5">
{collapsed ? (
<div className="bg-border mx-3 my-1 h-px first:hidden" aria-hidden="true" />
) : (
<p className="text-text-muted px-3 pb-1 text-[0.6875rem] font-semibold tracking-wider uppercase">
{t(group.labelKey)}
</p>
)}
{group.items.map((item) => (
<NavRow
key={item.to}
item={item}
collapsed={collapsed}
onNavigate={onNavigate}
layoutId={layoutId}
/>
))}
</div>
))}
</div>
);
}
/** Secondary links under the page list: legal centre and bug reports. */
export function NavFooterLinks({
collapsed,
onNavigate,
}: {
collapsed: boolean;
onNavigate?: () => void;
}) {
const { t } = useTranslation("ui");
const row = clsx(
"text-text-muted hover:bg-surface-2 hover:text-text-primary flex h-8 items-center gap-3 rounded-lg text-xs font-medium transition-colors",
collapsed ? "justify-center" : "px-3",
);
return (
<div className="flex flex-col gap-0.5">
<Tooltip content={t("legal.title")} side="right" disabled={!collapsed}>
<NavLink
to="/legal"
onClick={onNavigate}
className={row}
aria-label={collapsed ? t("legal.title") : undefined}
>
<Scale className="size-4 shrink-0" aria-hidden="true" />
{!collapsed && t("legal.title")}
</NavLink>
</Tooltip>
<Tooltip content={t("tabs.reportBug")} side="right" disabled={!collapsed}>
<a
href={ABOUT.bugReportUrl}
target="_blank"
rel="noopener noreferrer"
onClick={onNavigate}
className={row}
aria-label={collapsed ? t("tabs.reportBug") : undefined}
>
<Bug className="size-4 shrink-0" aria-hidden="true" />
{!collapsed && t("tabs.reportBug")}
</a>
</Tooltip>
</div>
);
}
/** Desktop sidebar (md and up): full width or a 68px icon rail. */
export function Sidebar() {
const { t } = useTranslation("ui");
const collapsed = useSettingsStore((s) => s.sidebarCollapsed);
const setSetting = useSettingsStore((s) => s.setSetting);
const toggle = () => setSetting("sidebarCollapsed", !collapsed);
return (
<aside
className={clsx(
"border-border bg-surface-1 hidden shrink-0 flex-col border-r transition-[width] duration-200 md:flex",
collapsed ? "w-14" : "w-56",
"border-border bg-surface-1 hidden shrink-0 flex-col border-r transition-[width] duration-200 ease-out md:flex",
collapsed ? "w-[4.25rem]" : "w-60",
)}
>
<button
type="button"
onClick={toggle}
aria-label={t(collapsed ? "sidebar.expand" : "sidebar.collapse")}
title={t(collapsed ? "sidebar.expand" : "sidebar.collapse")}
className="border-border text-text-muted hover:bg-surface-2 hover:text-text-primary flex h-12 items-center justify-center border-b transition-colors"
<div
className={clsx(
"flex h-14 shrink-0 items-center gap-2.5",
collapsed ? "justify-center" : "px-4",
)}
>
{collapsed ? <PanelLeftOpen className="h-5 w-5" /> : <PanelLeftClose className="h-5 w-5" />}
</button>
<SidebarNavList collapsed={collapsed} />
<Logo className="size-8" />
{!collapsed && (
<div className="min-w-0 leading-tight">
<p className="text-text-primary truncate text-sm font-bold tracking-tight">
{ABOUT.appName}
</p>
<p className="text-text-muted tabular text-[0.6875rem]">v{ABOUT.version}</p>
</div>
)}
</div>
<nav aria-label={t("nav.main")} className="flex-1 scrollbar-thin overflow-y-auto px-2.5 py-3">
<NavList collapsed={collapsed} layoutId="nav-active-desktop" />
</nav>
<div className="border-border flex flex-col gap-1 border-t px-2.5 py-3">
<NavFooterLinks collapsed={collapsed} />
<div className={clsx("flex", collapsed ? "justify-center" : "justify-end px-1")}>
<IconButton
label={t(collapsed ? "sidebar.expand" : "sidebar.collapse")}
tooltipSide="right"
size="icon-sm"
onClick={() => setSetting("sidebarCollapsed", !collapsed)}
>
{collapsed ? <PanelLeftOpen /> : <PanelLeftClose />}
</IconButton>
</div>
</div>
</aside>
);
}
+106
View File
@@ -0,0 +1,106 @@
import { useState, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { Check, Pencil, Trash2 } from "lucide-react";
import { Button } from "@components/ui/Button";
import { Card } from "@components/ui/Card";
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
import { IconButton } from "@components/ui/IconButton";
import type { IconComponent } from "@components/icons/brand";
interface LibraryCardProps {
icon: IconComponent;
title: string;
/** Secondary line(s) under the title. */
meta?: ReactNode;
applyLabel: string;
onApply: () => void;
onEdit?: () => void;
onDelete: () => void;
deleteMessage: string;
}
/** One saved profile / preset / template: apply, edit, delete. */
export function LibraryCard({
icon: Icon,
title,
meta,
applyLabel,
onApply,
onEdit,
onDelete,
deleteMessage,
}: LibraryCardProps) {
const { t } = useTranslation("ui");
const [confirmDelete, setConfirmDelete] = useState(false);
return (
<>
<Card className="hover:border-border-strong flex items-center gap-3 p-3 transition-colors sm:p-4">
<span className="bg-accent-muted text-accent flex size-10 shrink-0 items-center justify-center rounded-xl">
<Icon className="size-5" aria-hidden />
</span>
<div className="min-w-0 flex-1">
<h3 className="text-text-primary truncate text-sm font-semibold">{title}</h3>
{meta && <div className="text-text-muted mt-0.5 text-xs">{meta}</div>}
</div>
<div className="flex shrink-0 items-center gap-1">
<Button variant="secondary" size="sm" onClick={onApply}>
<Check />
<span className="hidden sm:inline">{applyLabel}</span>
<span className="sr-only sm:hidden">{`${applyLabel}: ${title}`}</span>
</Button>
{onEdit && (
<IconButton label={t("common.edit")} size="icon-sm" onClick={onEdit}>
<Pencil />
</IconButton>
)}
<IconButton
label={t("common.delete")}
size="icon-sm"
className="hover:text-danger"
onClick={() => setConfirmDelete(true)}
>
<Trash2 />
</IconButton>
</div>
</Card>
<ConfirmDialog
open={confirmDelete}
onConfirm={() => {
onDelete();
setConfirmDelete(false);
}}
onCancel={() => setConfirmDelete(false)}
title={`${t("common.delete")}: ${title}`}
message={deleteMessage}
confirmLabel={t("common.delete")}
variant="danger"
/>
</>
);
}
/** Toolbar + list + empty state shared by the three library tabs. */
export function LibraryList({
hint,
action,
empty,
children,
}: {
hint: ReactNode;
action?: ReactNode;
/** Rendered instead of the list when there is nothing saved. */
empty?: ReactNode;
children: ReactNode;
}) {
return (
<div className="flex flex-col gap-3">
<div className="flex flex-wrap items-center justify-between gap-2">
<p className="text-text-muted min-w-0 flex-1 text-xs">{hint}</p>
{action}
</div>
{empty ?? <div className="flex flex-col gap-2">{children}</div>}
</div>
);
}
+71 -57
View File
@@ -1,87 +1,101 @@
import { useState } from "react";
import { ChevronDown, ChevronUp, Trash2, Copy, Check } from "lucide-react";
import { useLogStore, type LogEntry as LogEntryType, type LogLevel } from "@store/log-store";
import { useTranslation } from "react-i18next";
import { ChevronDown, Trash2 } from "lucide-react";
import clsx from "clsx";
import { useLogStore, type LogEntry as LogEntryType, type LogLevel } from "@store/log-store";
import { CopyStateIcon } from "@components/icons/animated";
import { IconButton } from "@components/ui/IconButton";
const LEVEL_STYLES: Record<LogLevel, string> = {
error: "bg-red-500/20 text-red-400",
warn: "bg-yellow-500/20 text-yellow-400",
info: "bg-blue-500/20 text-blue-400",
debug: "bg-gray-500/20 text-gray-400",
error: "bg-danger/15 text-danger",
warn: "bg-warning/15 text-warning",
info: "bg-info/15 text-info",
debug: "bg-surface-3 text-text-muted",
};
interface LogEntryProps {
entry: LogEntryType;
}
export function LogEntryCard({ entry }: LogEntryProps) {
export function LogEntryCard({ entry }: { entry: LogEntryType }) {
const { t, i18n } = useTranslation("ui");
const deleteEntry = useLogStore((s) => s.deleteEntry);
const [expanded, setExpanded] = useState(false);
const [copied, setCopied] = useState(false);
const time = new Date(entry.timestamp).toLocaleTimeString();
const time = new Date(entry.timestamp).toLocaleTimeString(i18n.language);
const hasDetails = Boolean(entry.details);
const handleCopy = (e: React.MouseEvent) => {
e.stopPropagation();
const handleCopy = () => {
const text = `[${entry.level.toUpperCase()}] [${entry.source}] ${entry.message}${entry.details ? `\n${entry.details}` : ""}`;
navigator.clipboard.writeText(text).then(() => {
void navigator.clipboard.writeText(text).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 1500);
});
};
const summary = (
<>
<span
className={clsx(
"shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-bold uppercase",
LEVEL_STYLES[entry.level],
)}
>
{entry.level}
</span>
<span className="bg-surface-2 text-text-muted shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px]">
{entry.source}
</span>
<span className="text-text-primary min-w-0 flex-1 truncate text-xs">{entry.message}</span>
<span className="text-text-muted tabular shrink-0 text-[10px]">{time}</span>
</>
);
return (
<div
className={clsx(
"bg-surface-2 rounded-lg border transition-colors",
entry.level === "error" ? "border-red-500/30" : "border-border",
"bg-surface-0 rounded-lg border",
entry.level === "error" ? "border-danger/30" : "border-border",
)}
>
<div
className="flex cursor-pointer items-center gap-2 px-3 py-2"
onClick={() => setExpanded(!expanded)}
>
<span
className={clsx(
"shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] font-bold uppercase",
LEVEL_STYLES[entry.level],
)}
<div className="flex items-center gap-1 pr-1">
{hasDetails ? (
<button
type="button"
onClick={() => setExpanded((v) => !v)}
aria-expanded={expanded}
className="flex min-w-0 flex-1 cursor-pointer items-center gap-2 px-3 py-2 text-left"
>
{summary}
<ChevronDown
className={clsx(
"text-text-muted size-3.5 shrink-0 transition-transform",
expanded && "rotate-180",
)}
aria-hidden="true"
/>
</button>
) : (
<div className="flex min-w-0 flex-1 items-center gap-2 px-3 py-2">{summary}</div>
)}
<IconButton
label={t("logs.copyEntry")}
size="icon-sm"
onClick={handleCopy}
className="size-7"
>
{entry.level}
</span>
<span className="bg-surface-3 text-text-muted shrink-0 rounded px-1.5 py-0.5 text-[10px]">
{entry.source}
</span>
<span className="text-text-primary min-w-0 flex-1 truncate text-xs">{entry.message}</span>
<span className="text-text-muted shrink-0 text-[10px]">{time}</span>
<div className="flex shrink-0 items-center gap-0.5">
<button
onClick={handleCopy}
className="text-text-muted hover:bg-surface-3 hover:text-text-primary rounded p-1"
>
{copied ? <Check className="text-success h-3 w-3" /> : <Copy className="h-3 w-3" />}
</button>
<button
onClick={(e) => {
e.stopPropagation();
deleteEntry(entry.id);
}}
className="text-text-muted hover:bg-surface-3 hover:text-danger rounded p-1"
>
<Trash2 className="h-3 w-3" />
</button>
{entry.details &&
(expanded ? (
<ChevronUp className="text-text-muted h-3.5 w-3.5" />
) : (
<ChevronDown className="text-text-muted h-3.5 w-3.5" />
))}
</div>
<CopyStateIcon copied={copied} className="size-3.5" />
</IconButton>
<IconButton
label={t("logs.deleteEntry")}
size="icon-sm"
className="hover:text-danger size-7"
onClick={() => deleteEntry(entry.id)}
>
<Trash2 className="size-3.5" />
</IconButton>
</div>
{expanded && entry.details && (
<div className="border-border border-t px-3 py-2">
<pre className="text-text-secondary max-h-40 overflow-auto font-mono text-[11px] whitespace-pre-wrap">
<pre className="text-text-secondary max-h-40 scrollbar-thin overflow-auto font-mono text-[11px] whitespace-pre-wrap">
{entry.details}
</pre>
</div>
+20
View File
@@ -0,0 +1,20 @@
import type { ReactNode } from "react";
import { LazyMotion, MotionConfig } from "motion/react";
/**
* Motion's feature bundle (animations, layout, gestures) arrives after first
* paint instead of in the initial download: `m.*` components render their
* final state immediately and start animating once it lands. `strict` makes a
* stray `motion.*` import (which would pull the full bundle eagerly) throw in
* development.
*/
const loadFeatures = () => import("./features").then((mod) => mod.default);
/** Motion setup for the whole app. Honours the OS "reduce motion" setting. */
export function MotionProvider({ children }: { children: ReactNode }) {
return (
<LazyMotion features={loadFeatures} strict>
<MotionConfig reducedMotion="user">{children}</MotionConfig>
</LazyMotion>
);
}
+5
View File
@@ -0,0 +1,5 @@
import { domMax } from "motion/react";
// Loaded lazily by MotionProvider — layout animations (the sliding nav
// indicator) need domMax rather than the smaller domAnimation.
export default domMax;
-48
View File
@@ -1,48 +0,0 @@
import { useTranslation } from "react-i18next";
import { ClipboardCopy } from "lucide-react";
import { Button } from "@components/ui/Button";
import { useClipboard } from "@hooks/use-clipboard";
import { LimitBlockBanner } from "./LimitBlockBanner";
import type { OutputLimitStatus } from "@engine/limits";
interface CopyAllBarProps {
/** Exactly what gets copied — the caller decides single vs multi-language. */
text: string;
/**
* Over-limit status of every output contributing to `text`. The bar copies a
* concatenation, so one offending language blocks the blob.
*/
status: OutputLimitStatus;
}
/**
* Sticky "copy everything" bar.
*
* Before v0.35.0 this owned its own over-limit check — which skipped tags, and
* more importantly bailed out entirely when an `extraText` prop was present.
* That prop was set by exactly one caller: OutputPage, whenever more than one
* language was selected. So selecting a second language silently turned off
* every limit check on the primary copy path. The bar no longer decides
* anything; it renders the status the page computes.
*/
export function CopyAllBar({ text, status }: CopyAllBarProps) {
const { t } = useTranslation("ui");
const { copy } = useClipboard();
return (
<div className="border-border bg-surface-0 sticky bottom-0 flex flex-col gap-2 border-t px-3 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-4">
<LimitBlockBanner status={status} />
<div className="flex items-center justify-end">
<Button
onClick={() => void copy(text)}
disabled={status.blocked || !text}
size="lg"
className="text-sm sm:text-base"
>
<ClipboardCopy className="h-4 w-4" />
{t("output.copyAll")}
</Button>
</div>
</div>
);
}
+24 -36
View File
@@ -8,7 +8,9 @@ import { useLanguagesReady } from "@hooks/use-languages-ready";
import { buildPinnedComment } from "@engine/pinned-comment-builder";
import { GENRES } from "@config/genres";
import type { Genre } from "@engine/types";
import { Image, MessageSquareText, Pin } from "lucide-react";
import { CopyButton } from "./CopyButton";
import { OutputField, OutputText } from "./OutputField";
/**
* Renders the non-description artefacts on the Output page:
@@ -69,49 +71,35 @@ export function OutputExtras() {
if (!hasThumbnail && !hasPinned && !hasTemplate) return null;
return (
<div className="flex flex-col gap-6">
<div className="flex flex-col gap-4">
{hasThumbnail && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">{t("output.thumbnailText")}</h3>
<CopyButton text={thumbnailText} label={t("output.copyThumbnailText")} />
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{thumbnailText}
</pre>
</div>
</section>
<OutputField
title={t("output.thumbnailText")}
icon={Image}
actions={<CopyButton text={thumbnailText} label={t("output.copyThumbnailText")} />}
>
<OutputText>{thumbnailText}</OutputText>
</OutputField>
)}
{hasPinned && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">{t("output.pinnedComment")}</h3>
<CopyButton text={pinnedComment} label={t("output.copyPinnedComment")} />
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{pinnedComment}
</pre>
</div>
</section>
<OutputField
title={t("output.pinnedComment")}
icon={Pin}
actions={<CopyButton text={pinnedComment} label={t("output.copyPinnedComment")} />}
>
<OutputText>{pinnedComment}</OutputText>
</OutputField>
)}
{hasTemplate && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">
{t("output.pinnedCommentTemplate")}
</h3>
<CopyButton text={templateText} label={t("output.copyPinnedCommentTemplate")} />
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{templateText}
</pre>
</div>
</section>
<OutputField
title={t("output.pinnedCommentTemplate")}
icon={MessageSquareText}
actions={<CopyButton text={templateText} label={t("output.copyPinnedCommentTemplate")} />}
>
<OutputText>{templateText}</OutputText>
</OutputField>
)}
</div>
);
+40
View File
@@ -0,0 +1,40 @@
import type { ReactNode } from "react";
import { Card } from "@components/ui/Card";
import type { IconComponent } from "@components/icons/brand";
interface OutputFieldProps {
title: ReactNode;
icon?: IconComponent;
/** Right side of the header: counter, copy button. */
actions?: ReactNode;
children: ReactNode;
}
/** One generated artefact (title, description, tags, pinned comment…) as a card. */
export function OutputField({ title, icon: Icon, actions, children }: OutputFieldProps) {
return (
<Card>
<div className="flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5 pb-1.5">
{Icon && <Icon className="text-text-muted size-4 shrink-0" aria-hidden />}
<h2 className="text-text-primary min-w-0 flex-1 text-sm font-semibold">{title}</h2>
{actions && <div className="flex items-center gap-2">{actions}</div>}
</div>
<div className="px-4 pb-4">{children}</div>
</Card>
);
}
/** Pre-formatted generated text, scrollable when long. */
export function OutputText({ children, tall }: { children: ReactNode; tall?: boolean }) {
return (
<pre
className={
tall
? "bg-surface-0 border-border text-text-secondary max-h-[60dvh] scrollbar-thin overflow-y-auto rounded-lg border p-3 font-sans text-sm leading-relaxed whitespace-pre-wrap sm:max-h-[28rem]"
: "bg-surface-0 border-border text-text-secondary rounded-lg border p-3 font-sans text-sm leading-relaxed whitespace-pre-wrap"
}
>
{children}
</pre>
);
}
+51 -51
View File
@@ -1,8 +1,10 @@
import { useTranslation } from "react-i18next";
import { FileText, Tags, Type } from "lucide-react";
import { useGeneratedOutput } from "@hooks/use-generated-output";
import { useSettingsStore } from "@store/settings-store";
import { CopyButton } from "./CopyButton";
import { CharCounter } from "./CharCounter";
import { OutputField, OutputText } from "./OutputField";
import { YT_LIMITS } from "@engine/types";
import type { GeneratorOutput } from "@engine/types";
import type { OutputLimitStatus } from "@engine/limits";
@@ -20,16 +22,17 @@ interface OutputPreviewProps {
export function OutputPreview({ output: outputProp, status }: OutputPreviewProps) {
const { t } = useTranslation("ui");
const defaultOutput = useGeneratedOutput();
const { showCharCount, compactTagDisplay } = useSettingsStore();
const showCharCount = useSettingsStore((s) => s.showCharCount);
const compactTagDisplay = useSettingsStore((s) => s.compactTagDisplay);
const output = outputProp ?? defaultOutput;
return (
<div className="flex flex-col gap-6">
{/* Title */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">{t("output.title")}</h3>
<div className="flex items-center gap-3">
<div className="flex flex-col gap-4">
<OutputField
title={t("output.title")}
icon={Type}
actions={
<>
{showCharCount && <CharCounter text={output.title} limit={YT_LIMITS.TITLE_MAX} />}
<CopyButton
text={output.title}
@@ -38,18 +41,19 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
fieldLabel={t("output.title")}
blocked={status.blocked}
/>
</div>
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<p className="text-text-primary text-sm font-medium">{output.title}</p>
</div>
</section>
</>
}
>
<p className="bg-surface-0 border-border text-text-primary rounded-lg border p-3 text-[0.9375rem] font-medium">
{output.title || "…"}
</p>
</OutputField>
{/* Description */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">{t("output.description")}</h3>
<div className="flex items-center gap-3">
<OutputField
title={t("output.description")}
icon={FileText}
actions={
<>
{showCharCount && (
<CharCounter text={output.description} limit={YT_LIMITS.DESCRIPTION_MAX} />
)}
@@ -60,22 +64,17 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
fieldLabel={t("output.description")}
blocked={status.blocked}
/>
</div>
</div>
<div className="border-border bg-surface-1 max-h-[60vh] overflow-y-auto rounded-lg border p-3 sm:max-h-[400px]">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{output.description}
</pre>
</div>
</section>
</>
}
>
<OutputText tall>{output.description || "…"}</OutputText>
</OutputField>
{/* Tags */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-text-primary text-sm font-semibold">
{t("output.tags")} ({output.tags.length})
</h3>
<div className="flex items-center gap-3">
<OutputField
title={`${t("output.tags")} · ${output.tags.length}`}
icon={Tags}
actions={
<>
{showCharCount && <CharCounter text={output.tagString} limit={YT_LIMITS.TAGS_MAX} />}
<CopyButton
text={output.tagString}
@@ -84,25 +83,26 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
fieldLabel={t("output.tags")}
blocked={status.blocked}
/>
</>
}
>
{compactTagDisplay ? (
<p className="bg-surface-0 border-border text-text-secondary rounded-lg border p-3 text-xs leading-relaxed">
{output.tagString}
</p>
) : (
<div className="flex flex-wrap gap-1.5">
{output.tags.map((tag, i) => (
<span
key={i}
className="border-border bg-surface-2 text-text-secondary rounded-md border px-2 py-0.5 text-xs"
>
{tag}
</span>
))}
</div>
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
{compactTagDisplay ? (
<p className="text-text-secondary text-xs">{output.tagString}</p>
) : (
<div className="flex flex-wrap gap-1.5">
{output.tags.map((tag, i) => (
<span
key={i}
className="bg-surface-2 text-text-secondary rounded-md px-2 py-0.5 text-xs"
>
{tag}
</span>
))}
</div>
)}
</div>
</section>
)}
</OutputField>
</div>
);
}
+4 -9
View File
@@ -82,12 +82,7 @@ export function VariantPicker({ open, onClose }: VariantPickerProps) {
]);
return (
<Modal
open={open}
onClose={onClose}
title={t("output.generateAlternatives")}
className="max-w-2xl"
>
<Modal open={open} onClose={onClose} title={t("output.generateAlternatives")} size="lg">
<div className="flex flex-col gap-4">
{variants.map((variant) => (
<section key={variant.id} className="flex flex-col gap-2">
@@ -100,9 +95,9 @@ export function VariantPicker({ open, onClose }: VariantPickerProps) {
<CopyButton text={variant.title} label={t("output.copyTitle")} />
</div>
</div>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<p className="text-text-primary text-sm font-medium">{variant.title}</p>
</div>
<p className="border-border bg-surface-0 text-text-primary rounded-lg border px-3 py-2.5 text-sm font-medium">
{variant.title}
</p>
</section>
))}
</div>
+91
View File
@@ -0,0 +1,91 @@
import { useTranslation } from "react-i18next";
import { MonitorPlay, Play } from "lucide-react";
import { Card } from "@components/ui/Card";
import { Banner } from "@components/ui/Banner";
/**
* Rough cut-offs, not exact: YouTube truncates by pixel width, which varies
* with the device and the characters used. They are what creator guides quote
* and are good enough to say "the end of this won't be seen".
*/
const SEARCH_TITLE_CHARS = 70;
const FOLD_DESCRIPTION_CHARS = 150;
interface YouTubePreviewProps {
title: string;
description: string;
channelName: string;
gameName: string;
}
/**
* How the title and the start of the description read on YouTube — in a
* search result and above the watch page's "…more". Most viewers never see
* anything past those points, so this is where the important words must go.
*/
export function YouTubePreview({ title, description, channelName, gameName }: YouTubePreviewProps) {
const { t } = useTranslation("ui");
const titleCut = title.length > SEARCH_TITLE_CHARS;
const descriptionCut = description.length > FOLD_DESCRIPTION_CHARS;
const fold = description.slice(0, FOLD_DESCRIPTION_CHARS).trimEnd();
const channel = channelName.trim() || t("output.youtubePreview.channelPlaceholder");
return (
<Card className="overflow-hidden">
<div className="flex items-center gap-2 px-4 pt-3.5 pb-3">
<MonitorPlay className="text-text-muted size-4" aria-hidden="true" />
<h2 className="text-text-primary text-sm font-semibold">
{t("output.youtubePreview.heading")}
</h2>
</div>
<div className="flex flex-col gap-4 px-4 pb-4 sm:flex-row">
{/* Search result */}
<div className="bg-brand-gradient relative flex aspect-video w-full shrink-0 items-center justify-center overflow-hidden rounded-xl sm:w-56">
<span className="absolute inset-0 bg-black/25" aria-hidden="true" />
<span className="relative line-clamp-2 px-4 text-center text-sm font-bold text-white drop-shadow">
{gameName || "YTDescGen"}
</span>
<span className="absolute right-2 bottom-2 flex size-7 items-center justify-center rounded-full bg-black/60 text-white">
<Play className="size-3.5 fill-current" aria-hidden="true" />
</span>
</div>
<div className="min-w-0 flex-1">
<p className="text-text-primary line-clamp-2 text-base leading-snug font-semibold">
{title || "…"}
</p>
<p className="text-text-muted mt-1 text-xs">{channel}</p>
<p className="text-text-muted mt-2 line-clamp-2 text-xs leading-relaxed">{description}</p>
</div>
</div>
{/* Watch page, above "…more" */}
<div className="border-border bg-surface-0/60 mx-4 mb-4 rounded-xl border p-3">
<p className="text-text-secondary text-xs leading-relaxed whitespace-pre-line">
{fold || "…"}
{descriptionCut && (
<span className="text-text-primary font-semibold">
{" "}
{t("output.youtubePreview.more")}
</span>
)}
</p>
</div>
{(titleCut || descriptionCut) && (
<div className="flex flex-col gap-2 px-4 pb-4">
{titleCut && (
<Banner tone="info">
{t("output.youtubePreview.titleCut", { chars: SEARCH_TITLE_CHARS })}
</Banner>
)}
{descriptionCut && (
<Banner tone="info">
{t("output.youtubePreview.foldHint", { chars: FOLD_DESCRIPTION_CHARS })}
</Banner>
)}
</div>
)}
</Card>
);
}
+18 -72
View File
@@ -1,90 +1,36 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Upload, Pencil, Trash2 } from "lucide-react";
import { Button } from "@components/ui/Button";
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
import { useEditorStore } from "@store/editor-store";
import { useSettingsStore } from "@store/settings-store";
import { Gamepad2 } from "lucide-react";
import { LibraryCard } from "@components/library/LibraryCard";
import { usePresetStore, type GamePreset } from "@store/preset-store";
import { GENRES } from "@config/genres";
import { PLATFORMS } from "@config/platforms";
import { applyPreset } from "@utils/library-apply";
import { PresetSaveForm } from "./PresetSaveForm";
interface PresetCardProps {
preset: GamePreset;
}
export function PresetCard({ preset }: PresetCardProps) {
export function PresetCard({ preset }: { preset: GamePreset }) {
const { t } = useTranslation("ui");
const loadPreset = useEditorStore((s) => s.loadPreset);
const setSetting = useSettingsStore((s) => s.setSetting);
const deletePreset = usePresetStore((s) => s.deletePreset);
const [showDelete, setShowDelete] = useState(false);
const [showEdit, setShowEdit] = useState(false);
const handleLoad = () => {
loadPreset({
gameName: preset.gameName,
gameNameLocalized: preset.gameNameLocalized ? { ...preset.gameNameLocalized } : {},
genres: [...preset.genres],
platform: preset.platform,
storeLinks: { ...preset.storeLinks },
spoilerWarning: preset.spoilerWarning,
matureWarning: preset.matureWarning,
pubDevName: preset.pubDevName ?? "",
});
// v0.21.0: same pattern as PresetSelector — only flip the setting
// when the preset explicitly carries it, so older presets don't
// silently reset a user's preference on first load.
if (preset.showGameCopyright !== undefined) {
setSetting("showGameCopyright", preset.showGameCopyright);
}
};
const genreDefs = preset.genres
const genreLabels = (preset.genres ?? [])
.map((id) => GENRES.find((g) => g.id === id))
.filter((g): g is (typeof GENRES)[number] => g !== undefined);
.filter((g): g is (typeof GENRES)[number] => g !== undefined)
.map((g) => t(g.labelKey));
const platform = PLATFORMS.find((p) => p.id === preset.platform)?.label ?? preset.platform;
return (
<>
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-text-primary text-sm font-semibold">{preset.gameName}</h3>
<div className="text-text-muted mt-1.5 flex flex-wrap items-center gap-1.5 text-xs">
{genreDefs.map((g) => (
<span key={g.id} className="bg-surface-2 rounded px-1.5 py-0.5">
{g.icon} {t(g.labelKey)}
</span>
))}
<span>{preset.platform}</span>
</div>
</div>
<div className="flex shrink-0 items-center gap-1.5">
<Button variant="primary" size="sm" onClick={handleLoad}>
<Upload className="h-3.5 w-3.5" />
{t("presets.loadPreset")}
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowEdit(true)}>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
<ConfirmDialog
open={showDelete}
onConfirm={() => {
deletePreset(preset.id);
setShowDelete(false);
}}
onCancel={() => setShowDelete(false)}
title={t("common.delete")}
message={t("presets.deleteConfirm")}
confirmLabel={t("common.delete")}
variant="danger"
<LibraryCard
icon={Gamepad2}
title={preset.gameName}
meta={[...genreLabels, platform].filter(Boolean).join(" · ")}
applyLabel={t("presets.loadPreset")}
onApply={() => applyPreset(preset)}
onEdit={() => setShowEdit(true)}
onDelete={() => deletePreset(preset.id)}
deleteMessage={t("presets.deleteConfirm")}
/>
<PresetSaveForm open={showEdit} onClose={() => setShowEdit(false)} editPreset={preset} />
</>
);
+24 -23
View File
@@ -1,7 +1,9 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Plus } from "lucide-react";
import { Gamepad2, Plus } from "lucide-react";
import { Button } from "@components/ui/Button";
import { EmptyState } from "@components/ui/EmptyState";
import { LibraryList } from "@components/library/LibraryCard";
import { usePresetStore } from "@store/preset-store";
import { PresetCard } from "./PresetCard";
import { PresetSaveForm } from "./PresetSaveForm";
@@ -10,30 +12,29 @@ export function PresetList() {
const { t } = useTranslation("ui");
const presets = usePresetStore((s) => s.presets);
const [showCreate, setShowCreate] = useState(false);
const create = (
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus />
{t("presets.createNew")}
</Button>
);
return (
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<h2 className="text-text-primary text-base font-semibold">{t("presets.title")}</h2>
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus className="h-4 w-4" />
{t("presets.createNew")}
</Button>
</div>
{presets.length === 0 ? (
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("presets.emptyState")}
</p>
) : (
<div className="flex flex-col gap-2">
{presets.map((preset) => (
<PresetCard key={preset.id} preset={preset} />
))}
</div>
)}
<>
<LibraryList
hint={t("presets.hint")}
action={presets.length > 0 ? create : undefined}
empty={
presets.length === 0 ? (
<EmptyState icon={Gamepad2} title={t("presets.emptyState")} action={create} />
) : undefined
}
>
{presets.map((preset) => (
<PresetCard key={preset.id} preset={preset} />
))}
</LibraryList>
<PresetSaveForm open={showCreate} onClose={() => setShowCreate(false)} />
</div>
</>
);
}
+12 -29
View File
@@ -1,46 +1,29 @@
import { useTranslation } from "react-i18next";
import { Select } from "@components/ui/Select";
import { usePresetStore } from "@store/preset-store";
import { useEditorStore } from "@store/editor-store";
import { useSettingsStore } from "@store/settings-store";
import { applyPreset } from "@utils/library-apply";
/** Fill the game fields from a saved preset (with Undo). */
export function PresetSelector() {
const { t } = useTranslation("ui");
const presets = usePresetStore((s) => s.presets);
const loadPreset = useEditorStore((s) => s.loadPreset);
const setSetting = useSettingsStore((s) => s.setSetting);
if (presets.length === 0) return null;
const options = [
{ value: "", label: `-- ${t("presets.selectPreset")} --` },
{ value: "", label: t("presets.selectPreset") },
...presets.map((p) => ({ value: p.id, label: p.gameName })),
];
const handleSelect = (id: string) => {
if (!id) return;
const preset = presets.find((p) => p.id === id);
if (!preset) return;
loadPreset({
gameName: preset.gameName,
gameNameLocalized: preset.gameNameLocalized ? { ...preset.gameNameLocalized } : {},
genres: [...preset.genres],
platform: preset.platform,
storeLinks: { ...preset.storeLinks },
spoilerWarning: preset.spoilerWarning,
matureWarning: preset.matureWarning,
pubDevName: preset.pubDevName ?? "",
});
// v0.21.0: pull the per-preset toggle into the global setting so the
// description re-renders with the right credit obligation. Missing
// means "leave the user's setting alone" — older presets don't carry
// this field.
if (preset.showGameCopyright !== undefined) {
setSetting("showGameCopyright", preset.showGameCopyright);
}
};
return (
<Select label={t("presets.selectPreset")} options={options} value="" onChange={handleSelect} />
<Select
label={t("presets.selectPreset")}
options={options}
value=""
onChange={(id) => {
const preset = presets.find((p) => p.id === id);
if (preset) applyPreset(preset);
}}
/>
);
}
+22 -70
View File
@@ -1,88 +1,40 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Upload, Pencil, Trash2 } from "lucide-react";
import { Button } from "@components/ui/Button";
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
import { useEditorStore } from "@store/editor-store";
import { UserRound } from "lucide-react";
import { LibraryCard } from "@components/library/LibraryCard";
import { useProfileStore, type Profile } from "@store/profile-store";
import { applyProfile } from "@utils/library-apply";
import { ProfileSaveForm } from "./ProfileSaveForm";
interface ProfileCardProps {
profile: Profile;
}
export function ProfileCard({ profile }: ProfileCardProps) {
export function ProfileCard({ profile }: { profile: Profile }) {
const { t } = useTranslation("ui");
const loadProfile = useEditorStore((s) => s.loadProfile);
const deleteProfile = useProfileStore((s) => s.deleteProfile);
const [showDelete, setShowDelete] = useState(false);
const [showEdit, setShowEdit] = useState(false);
const handleLoad = () => {
// v0.15.0: defensive nullish-coalesce on the two nested record
// fields. A malformed imported profile may carry `social: null` /
// `rig: null` — spreading null throws "Cannot convert undefined or
// null to object", which used to black-screen the app. `?? {}`
// turns the bad import into a partial load instead of a crash.
loadProfile({
channelName: profile.channelName,
contactEmail: profile.contactEmail,
adEmail: profile.adEmail ?? "",
gameKeyEmail: profile.gameKeyEmail ?? "",
social: { ...(profile.social ?? {}) },
rig: { ...(profile.rig ?? {}) },
resolution: profile.resolution,
fps: profile.fps,
graphicsPreset: profile.graphicsPreset,
thirdPartyAdText: profile.thirdPartyAdText ?? "",
});
};
// Same defence on render: `Object.values(null)` throws. With the
// coalesce the count falls back to 0 and the chip just hides.
// An imported profile may carry null for either record, and
// Object.values(null) throws.
const socialCount = Object.values(profile.social ?? {}).filter((v) => v).length;
const rigCount = Object.values(profile.rig ?? {}).filter((v) => v).length;
const meta = [
profile.channelName || t("profiles.noChannel"),
socialCount > 0 ? t("profiles.socialLinks", { n: socialCount }) : null,
rigCount > 0 ? t("profiles.rigFields", { n: rigCount }) : null,
]
.filter(Boolean)
.join(" · ");
return (
<>
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-text-primary text-sm font-semibold">{profile.name}</h3>
<p className="text-text-secondary mt-0.5 text-xs">
{profile.channelName || "No channel"}
</p>
<div className="text-text-muted mt-1.5 flex flex-wrap gap-3 text-xs">
{socialCount > 0 && <span>{socialCount} social links</span>}
{rigCount > 0 && <span>{rigCount} rig fields</span>}
</div>
</div>
<div className="flex shrink-0 items-center gap-1.5">
<Button variant="primary" size="sm" onClick={handleLoad}>
<Upload className="h-3.5 w-3.5" />
{t("profiles.loadProfile")}
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowEdit(true)}>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
<ConfirmDialog
open={showDelete}
onConfirm={() => {
deleteProfile(profile.id);
setShowDelete(false);
}}
onCancel={() => setShowDelete(false)}
title={t("common.delete")}
message={t("profiles.deleteConfirm")}
confirmLabel={t("common.delete")}
variant="danger"
<LibraryCard
icon={UserRound}
title={profile.name}
meta={meta}
applyLabel={t("profiles.loadProfile")}
onApply={() => applyProfile(profile)}
onEdit={() => setShowEdit(true)}
onDelete={() => deleteProfile(profile.id)}
deleteMessage={t("profiles.deleteConfirm")}
/>
<ProfileSaveForm open={showEdit} onClose={() => setShowEdit(false)} editProfile={profile} />
</>
);
+24 -23
View File
@@ -1,7 +1,9 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Plus } from "lucide-react";
import { Plus, UserRound } from "lucide-react";
import { Button } from "@components/ui/Button";
import { EmptyState } from "@components/ui/EmptyState";
import { LibraryList } from "@components/library/LibraryCard";
import { useProfileStore } from "@store/profile-store";
import { ProfileCard } from "./ProfileCard";
import { ProfileSaveForm } from "./ProfileSaveForm";
@@ -10,30 +12,29 @@ export function ProfileList() {
const { t } = useTranslation("ui");
const profiles = useProfileStore((s) => s.profiles);
const [showCreate, setShowCreate] = useState(false);
const create = (
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus />
{t("profiles.createNew")}
</Button>
);
return (
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<h2 className="text-text-primary text-base font-semibold">{t("profiles.title")}</h2>
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus className="h-4 w-4" />
{t("profiles.createNew")}
</Button>
</div>
{profiles.length === 0 ? (
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("profiles.emptyState")}
</p>
) : (
<div className="flex flex-col gap-2">
{profiles.map((profile) => (
<ProfileCard key={profile.id} profile={profile} />
))}
</div>
)}
<>
<LibraryList
hint={t("profiles.hint")}
action={profiles.length > 0 ? create : undefined}
empty={
profiles.length === 0 ? (
<EmptyState icon={UserRound} title={t("profiles.emptyState")} action={create} />
) : undefined
}
>
{profiles.map((profile) => (
<ProfileCard key={profile.id} profile={profile} />
))}
</LibraryList>
<ProfileSaveForm open={showCreate} onClose={() => setShowCreate(false)} />
</div>
</>
);
}
+15 -66
View File
@@ -1,74 +1,23 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Upload, Trash2 } from "lucide-react";
import { Button } from "@components/ui/Button";
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
import { useEditorStore } from "@store/editor-store";
import { LayoutTemplate } from "lucide-react";
import { LibraryCard } from "@components/library/LibraryCard";
import { useTemplateStore, type EditorTemplate } from "@store/template-store";
import toast from "react-hot-toast";
import { applyTemplate } from "@utils/library-apply";
interface TemplateCardProps {
template: EditorTemplate;
}
export function TemplateCard({ template }: TemplateCardProps) {
const { t } = useTranslation("ui");
const loadProfile = useEditorStore((s) => s.loadProfile);
export function TemplateCard({ template }: { template: EditorTemplate }) {
const { t, i18n } = useTranslation("ui");
const deleteTemplate = useTemplateStore((s) => s.deleteTemplate);
const [showDelete, setShowDelete] = useState(false);
const handleApply = () => {
// v0.15.0: defend against a template whose `snapshot` field is
// null/undefined — most commonly when the template was imported
// from a malformed JSON. `loadProfile` itself now ignores a null
// patch via `normalizeEditorPatch`, but checking here lets us
// surface a clearer toast and skip the no-op success message.
if (!template.snapshot || typeof template.snapshot !== "object") {
toast.error(
t("templates.applyFailed", { defaultValue: "Template is corrupt — cannot apply" }),
);
return;
}
loadProfile(template.snapshot);
toast.success(t("templates.appliedToast", { name: template.name }));
};
const date = new Date(template.createdAt).toLocaleDateString();
const date = new Date(template.createdAt).toLocaleDateString(i18n.language);
return (
<>
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-text-primary text-sm font-semibold">{template.name}</h3>
<div className="text-text-muted mt-1.5 flex flex-wrap items-center gap-2 text-xs">
<span>{template.snapshot.gameName || "—"}</span>
<span>·</span>
<span>{date}</span>
</div>
</div>
<div className="flex shrink-0 items-center gap-1.5">
<Button variant="primary" size="sm" onClick={handleApply}>
<Upload className="h-3.5 w-3.5" />
{t("templates.loadTemplate")}
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
<ConfirmDialog
open={showDelete}
onConfirm={() => {
deleteTemplate(template.id);
setShowDelete(false);
}}
onCancel={() => setShowDelete(false)}
title={t("common.delete")}
message={t("templates.deleteConfirm")}
confirmLabel={t("common.delete")}
variant="danger"
/>
</>
<LibraryCard
icon={LayoutTemplate}
title={template.name}
meta={`${template.snapshot?.gameName || "—"} · ${date}`}
applyLabel={t("templates.loadTemplate")}
onApply={() => void applyTemplate(template)}
onDelete={() => deleteTemplate(template.id)}
deleteMessage={t("templates.deleteConfirm")}
/>
);
}
+12 -10
View File
@@ -1,4 +1,7 @@
import { useTranslation } from "react-i18next";
import { LayoutTemplate } from "lucide-react";
import { EmptyState } from "@components/ui/EmptyState";
import { LibraryList } from "@components/library/LibraryCard";
import { useTemplateStore } from "@store/template-store";
import { TemplateCard } from "./TemplateCard";
@@ -6,19 +9,18 @@ export function TemplateList() {
const { t } = useTranslation("ui");
const templates = useTemplateStore((s) => s.templates);
if (templates.length === 0) {
return (
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("templates.emptyState")}
</p>
);
}
return (
<div className="flex flex-col gap-2">
<LibraryList
hint={t("templates.saveHint")}
empty={
templates.length === 0 ? (
<EmptyState icon={LayoutTemplate} title={t("templates.emptyState")} />
) : undefined
}
>
{templates.map((template) => (
<TemplateCard key={template.id} template={template} />
))}
</div>
</LibraryList>
);
}
@@ -5,7 +5,7 @@ import { Button } from "@components/ui/Button";
import { Input } from "@components/ui/Input";
import { useEditorStore } from "@store/editor-store";
import { useTemplateStore, type TemplateSnapshot } from "@store/template-store";
import toast from "react-hot-toast";
import { toast } from "sonner";
import { FIELD_LIMITS } from "@config/field-limits";
interface TemplateSaveFormProps {
+55 -27
View File
@@ -1,14 +1,17 @@
import { ChevronDown } from "lucide-react";
import type { ReactNode } from "react";
import { ChevronDown } from "lucide-react";
import clsx from "clsx";
import type { IconComponent } from "@components/icons/brand";
interface AccordionProps {
/** Unique id for the section — used as React key in lists. */
/** Unique id — the section's DOM anchor (`section-<id>`) and React key. */
id: string;
/** Header label. */
title: string;
/** Optional leading icon (emoji or single-char string). */
icon?: string;
/** Leading icon. */
icon?: IconComponent;
/** Short line under the title while collapsed (e.g. a summary). */
summary?: ReactNode;
/** Optional trailing badge — e.g. a count or status chip. */
badge?: ReactNode;
/** Controlled open state. */
@@ -19,42 +22,67 @@ interface AccordionProps {
}
/**
* Single-section accordion. Controlled only — the parent decides which
* sections are open and persists that choice. Height animates via a
* grid-rows trick so content can be any height without measurement.
* A collapsible card section. Controlled — the parent decides which sections
* are open and persists that choice. Collapsed content is `inert`, so it can
* no longer be tabbed into or read out while hidden (it used to be).
*/
export function Accordion({ id, title, icon, badge, open, onToggle, children }: AccordionProps) {
export function Accordion({
id,
title,
icon,
summary,
badge,
open,
onToggle,
children,
}: AccordionProps) {
const panelId = `section-${id}-panel`;
const Icon = icon;
return (
<section
id={`section-${id}`}
data-accordion-id={id}
className="border-border bg-surface-1 overflow-hidden rounded-lg border"
className="border-border bg-surface-1 shadow-card rounded-card scroll-mt-24 overflow-hidden border"
>
<button
type="button"
onClick={onToggle}
aria-expanded={open}
className="hover:bg-surface-2 flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors"
>
<div className="flex items-center gap-2">
{icon && <span className="text-base leading-none">{icon}</span>}
<span className="text-text-primary text-sm font-semibold">{title}</span>
{badge}
</div>
<ChevronDown
className={clsx(
"text-text-muted h-4 w-4 transition-transform duration-200",
open && "rotate-180",
<h2 className="m-0">
<button
type="button"
onClick={onToggle}
aria-expanded={open}
aria-controls={panelId}
className="group hover:bg-surface-2/60 flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors"
>
{Icon && (
<span className="bg-accent-muted text-accent flex size-8 shrink-0 items-center justify-center rounded-lg">
<Icon className="size-4" aria-hidden />
</span>
)}
/>
</button>
<span className="min-w-0 flex-1">
<span className="text-text-primary block text-sm font-semibold">{title}</span>
{summary && !open && (
<span className="text-text-muted block truncate text-xs">{summary}</span>
)}
</span>
{badge}
<ChevronDown
className={clsx(
"text-text-muted size-4 shrink-0 transition-transform duration-200",
open && "rotate-180",
)}
aria-hidden="true"
/>
</button>
</h2>
<div
id={panelId}
inert={!open}
className={clsx(
"grid transition-[grid-template-rows] duration-200 ease-out",
open ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
)}
>
<div className="overflow-hidden">
<div className="border-border flex flex-col gap-3 border-t px-4 py-4">{children}</div>
<div className="border-border flex flex-col gap-4 border-t px-4 py-4">{children}</div>
</div>
</div>
</section>
+65
View File
@@ -0,0 +1,65 @@
import type { HTMLAttributes } from "react";
import clsx from "clsx";
import { IS_MAC } from "@utils/platform";
type Tone = "neutral" | "accent" | "success" | "warning" | "danger" | "info";
const TONES: Record<Tone, string> = {
neutral: "bg-surface-2 text-text-secondary border-border",
accent: "bg-accent-muted text-accent border-transparent",
success: "bg-success/12 text-success border-transparent",
warning: "bg-warning/14 text-warning border-transparent",
danger: "bg-danger/12 text-danger border-transparent",
info: "bg-info/12 text-info border-transparent",
};
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
tone?: Tone;
}
/** Small status / count label. */
export function Badge({ tone = "neutral", className, ...props }: BadgeProps) {
return (
<span
className={clsx(
"tabular inline-flex h-5 items-center gap-1 rounded-full border px-2 text-[0.6875rem] font-semibold whitespace-nowrap",
TONES[tone],
className,
)}
{...props}
/>
);
}
/** Keyboard key cap, e.g. <Kbd>Ctrl</Kbd>. */
export function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>) {
return (
<kbd
className={clsx(
"border-border bg-surface-2 text-text-secondary inline-flex h-5 min-w-5 items-center justify-center rounded-md border border-b-2 px-1 font-sans text-[0.6875rem] font-medium",
className,
)}
{...props}
/>
);
}
const KEY_NAMES: Record<string, string> = IS_MAC
? { mod: "⌘", shift: "⇧", alt: "⌥", enter: "↵", esc: "Esc" }
: { mod: "Ctrl", shift: "Shift", alt: "Alt", enter: "Enter", esc: "Esc" };
/** Spell a key the way the user's keyboard labels it ("mod" → ⌘ or Ctrl). */
export function keyName(key: string): string {
return KEY_NAMES[key] ?? key;
}
/** A key combination as key caps, e.g. ["mod", "K"] → ⌘ K / Ctrl K. */
export function ShortcutKeys({ keys, className }: { keys: readonly string[]; className?: string }) {
return (
<span className={clsx("inline-flex items-center gap-0.5", className)}>
{keys.map((key) => (
<Kbd key={key}>{keyName(key)}</Kbd>
))}
</span>
);
}
+68
View File
@@ -0,0 +1,68 @@
import type { ReactNode } from "react";
import { CircleAlert, Info, TriangleAlert, CircleCheck, X } from "lucide-react";
import clsx from "clsx";
type Tone = "info" | "warning" | "danger" | "success" | "accent";
const TONES: Record<Tone, { box: string; icon: typeof Info }> = {
info: { box: "border-info/30 bg-info/8 text-info", icon: Info },
accent: { box: "border-accent/30 bg-accent-muted text-accent", icon: Info },
warning: { box: "border-warning/35 bg-warning/10 text-warning", icon: TriangleAlert },
danger: { box: "border-danger/35 bg-danger/10 text-danger", icon: CircleAlert },
success: { box: "border-success/30 bg-success/10 text-success", icon: CircleCheck },
};
interface BannerProps {
tone?: Tone;
title?: ReactNode;
children?: ReactNode;
action?: ReactNode;
onDismiss?: () => void;
dismissLabel?: string;
/** Announce to screen readers when it appears (errors, blocking notices). */
alert?: boolean;
className?: string;
}
/** Inline notice: warnings, limits, strict-mode blocks, tips. */
export function Banner({
tone = "info",
title,
children,
action,
onDismiss,
dismissLabel,
alert,
className,
}: BannerProps) {
const { box, icon: Icon } = TONES[tone];
return (
<div
role={alert ? "alert" : undefined}
className={clsx(
"rounded-card flex gap-3 border px-3.5 py-3 text-xs leading-relaxed",
box,
className,
)}
>
<Icon className="mt-px size-4 shrink-0" aria-hidden="true" />
<div className="min-w-0 flex-1">
{title && <p className="text-[0.8125rem] font-semibold">{title}</p>}
{children && (
<div className={clsx("text-text-secondary", title && "mt-0.5")}>{children}</div>
)}
{action && <div className="mt-2">{action}</div>}
</div>
{onDismiss && (
<button
type="button"
onClick={onDismiss}
aria-label={dismissLabel}
className="-m-1 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md opacity-70 hover:opacity-100"
>
<X className="size-3.5" aria-hidden="true" />
</button>
)}
</div>
);
}
+71 -25
View File
@@ -1,38 +1,84 @@
import { forwardRef, type ButtonHTMLAttributes } from "react";
import { Slot } from "radix-ui";
import clsx from "clsx";
import { Spinner } from "@components/icons/animated";
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: "primary" | "secondary" | "ghost";
size?: "sm" | "md" | "lg";
export type ButtonVariant = "primary" | "brand" | "secondary" | "outline" | "ghost" | "danger";
export type ButtonSize = "sm" | "md" | "lg" | "icon" | "icon-sm";
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ButtonVariant;
size?: ButtonSize;
/** Shows a spinner, disables the button and keeps its width. */
loading?: boolean;
/** Render the child element (e.g. a router Link) with button styling. */
asChild?: boolean;
}
const variantClasses = {
primary: "bg-accent text-white hover:bg-accent-hover",
secondary: "bg-surface-2 text-text-primary border border-border hover:bg-surface-3",
ghost: "text-text-secondary hover:text-text-primary hover:bg-surface-2",
const VARIANTS: Record<ButtonVariant, string> = {
primary: "bg-accent text-accent-fg shadow-sm hover:bg-accent-hover",
brand: "bg-brand-gradient text-white shadow-sm hover:brightness-110",
secondary:
"border border-border bg-surface-2 text-text-primary hover:border-border-strong hover:bg-surface-3",
outline: "border border-border text-text-primary hover:bg-surface-2",
ghost: "text-text-secondary hover:bg-surface-2 hover:text-text-primary",
danger: "bg-danger text-white shadow-sm hover:brightness-110",
};
const sizeClasses = {
sm: "px-2.5 py-1 text-xs min-h-[36px]",
md: "px-4 py-2 text-sm min-h-touch",
lg: "px-6 py-2.5 text-base min-h-touch",
const SIZES: Record<ButtonSize, string> = {
sm: "h-control-sm gap-1.5 px-2.5 text-xs",
md: "h-control gap-2 px-3.5 text-sm",
lg: "h-11 gap-2 px-5 text-sm",
icon: "size-control",
"icon-sm": "size-control-sm",
};
export const buttonClasses = (variant: ButtonVariant = "primary", size: ButtonSize = "md") =>
clsx(
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-control font-medium whitespace-nowrap select-none",
"transition-[background-color,border-color,color,filter,transform] duration-150 active:scale-[0.97]",
"disabled:pointer-events-none disabled:opacity-45 [&_svg]:size-4 [&_svg]:shrink-0",
VARIANTS[variant],
SIZES[size],
);
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ variant = "primary", size = "md", className, children, ...props }, ref) => (
<button
ref={ref}
className={clsx(
"focus:ring-accent/50 inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus:ring-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
variantClasses[variant],
sizeClasses[size],
className,
)}
{...props}
>
{children}
</button>
),
(
{
variant = "primary",
size = "md",
loading = false,
asChild = false,
className,
children,
disabled,
type,
...props
},
ref,
) => {
if (asChild) {
return (
<Slot.Root ref={ref} className={clsx(buttonClasses(variant, size), className)} {...props}>
{children}
</Slot.Root>
);
}
return (
<button
ref={ref}
// A button inside a <form> defaults to submit — make every other one explicit.
type={type ?? "button"}
disabled={disabled || loading}
aria-busy={loading || undefined}
className={clsx(buttonClasses(variant, size), className)}
{...props}
>
{loading && <Spinner />}
{children}
</button>
);
},
);
Button.displayName = "Button";
+49
View File
@@ -0,0 +1,49 @@
import type { HTMLAttributes, ReactNode } from "react";
import clsx from "clsx";
/** Surface for a self-contained block of content. */
export function Card({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
return (
<div
className={clsx("border-border bg-surface-1 shadow-card rounded-card border", className)}
{...props}
/>
);
}
interface CardHeaderProps {
title: ReactNode;
description?: ReactNode;
icon?: ReactNode;
actions?: ReactNode;
className?: string;
/** Heading level for the title (default h2). */
as?: "h2" | "h3";
}
export function CardHeader({
title,
description,
icon,
actions,
className,
as = "h2",
}: CardHeaderProps) {
const Heading = as;
return (
<div className={clsx("flex items-start gap-3 px-4 pt-4", className)}>
{icon && (
<span className="bg-accent-muted text-accent flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4">
{icon}
</span>
)}
<div className="min-w-0 flex-1">
<Heading className="text-text-primary text-sm font-semibold">{title}</Heading>
{description && (
<p className="text-text-muted mt-0.5 text-xs leading-snug">{description}</p>
)}
</div>
{actions && <div className="flex shrink-0 items-center gap-1">{actions}</div>}
</div>
);
}
+34 -31
View File
@@ -1,5 +1,6 @@
import { type ReactNode, useId } from "react";
import { Check } from "lucide-react";
import { Checkbox as RadixCheckbox } from "radix-ui";
import { m } from "motion/react";
import clsx from "clsx";
interface CheckboxProps {
@@ -9,47 +10,49 @@ interface CheckboxProps {
label: ReactNode;
className?: string;
id?: string;
disabled?: boolean;
}
/**
* Accessible square checkbox. A real `<input type="checkbox">` (visually
* hidden as a `peer`) keeps native keyboard + screen-reader semantics, while
* the styled box mirrors its state. Tailwind tokens only, so it tracks the
* dark/light theme. Distinct from {@link import("./Toggle").Toggle}, which is
* a `role="switch"` on/off pill — a checkbox is the right control for a
* one-time "I agree" acknowledgement.
* Square checkbox with a drawn-on tick. Distinct from {@link import("./Toggle").Toggle},
* a switch: a checkbox is the right control for "I agree" and for picking
* items from a list.
*/
export function Checkbox({ checked, onChange, label, className, id }: CheckboxProps) {
export function Checkbox({ checked, onChange, label, className, id, disabled }: CheckboxProps) {
const autoId = useId();
const inputId = id ?? autoId;
return (
<label
htmlFor={inputId}
className={clsx(
"group min-h-touch flex cursor-pointer items-start gap-3 text-left",
className,
)}
>
<input
<div className={clsx("flex items-start gap-3", disabled && "opacity-55", className)}>
<RadixCheckbox.Root
id={inputId}
type="checkbox"
checked={checked}
onChange={(e) => onChange(e.target.checked)}
className="peer sr-only"
/>
<span
aria-hidden
onCheckedChange={(state) => onChange(state === true)}
disabled={disabled}
className={clsx(
"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors",
"peer-focus-visible:ring-accent/50 peer-focus-visible:ring-2",
checked
? "border-accent bg-accent text-white"
: "border-border bg-surface-1 group-hover:border-border-strong text-transparent",
"mt-0.5 flex size-[1.125rem] shrink-0 cursor-pointer items-center justify-center rounded-[5px] border",
"transition-colors duration-150 disabled:cursor-not-allowed",
"data-[state=checked]:border-accent data-[state=checked]:bg-accent",
"data-[state=unchecked]:border-border-strong data-[state=unchecked]:bg-surface-1 hover:data-[state=unchecked]:border-accent",
)}
>
<Check className="h-3.5 w-3.5" strokeWidth={3} />
</span>
<span className="text-text-primary text-sm leading-snug">{label}</span>
</label>
<RadixCheckbox.Indicator forceMount className="text-accent-fg flex">
<svg viewBox="0 0 16 16" className="size-3.5" fill="none" aria-hidden="true">
<m.path
d="M3.5 8.5l3 3 6-7"
stroke="currentColor"
strokeWidth={2.2}
strokeLinecap="round"
strokeLinejoin="round"
initial={false}
animate={{ pathLength: checked ? 1 : 0, opacity: checked ? 1 : 0 }}
transition={{ duration: 0.18, ease: "easeOut" }}
/>
</svg>
</RadixCheckbox.Indicator>
</RadixCheckbox.Root>
<label htmlFor={inputId} className="text-text-primary cursor-pointer text-sm leading-snug">
{label}
</label>
</div>
);
}
+16 -13
View File
@@ -1,9 +1,10 @@
import clsx from "clsx";
import type { IconComponent } from "@components/icons/brand";
interface ChipOption {
id: string;
label: string;
icon?: string;
icon?: IconComponent;
}
interface BaseProps {
@@ -29,13 +30,12 @@ type MultiProps = BaseProps & {
export type ChipGroupProps = SingleProps | MultiProps;
/** Pill toggles for picking one or several options from a short list. */
export function ChipGroup(props: ChipGroupProps) {
const { label, options, className } = props;
const isSelected = (id: string): boolean => {
if (props.multiple) return props.value.includes(id);
return props.value === id;
};
const isSelected = (id: string): boolean =>
props.multiple ? props.value.includes(id) : props.value === id;
const atCapacity = props.multiple && props.max != null && props.value.length >= props.max;
@@ -58,30 +58,33 @@ export function ChipGroup(props: ChipGroupProps) {
<div className={clsx("flex flex-col gap-2", className)}>
{(label || counter) && (
<div className="flex items-center justify-between">
{label && <span className="text-text-secondary text-sm font-medium">{label}</span>}
{counter && <span className="text-text-muted text-xs">{counter}</span>}
{label && <span className="text-text-secondary text-xs font-medium">{label}</span>}
{counter && <span className="text-text-muted tabular text-xs">{counter}</span>}
</div>
)}
<div className="flex flex-wrap gap-2">
<div className="flex flex-wrap gap-1.5" role="group" aria-label={label}>
{options.map((option) => {
const selected = isSelected(option.id);
const disabled = !selected && atCapacity;
const Icon = option.icon;
return (
<button
key={option.id}
type="button"
disabled={disabled}
aria-pressed={selected}
onClick={() => handleClick(option.id)}
className={clsx(
"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors",
"h-control-sm inline-flex items-center gap-1.5 rounded-full border px-3 text-xs font-medium",
"transition-[background-color,border-color,color,transform] duration-150 active:scale-95",
selected
? "bg-accent text-white"
? "border-accent bg-accent-muted text-accent"
: disabled
? "bg-surface-2 text-text-muted cursor-not-allowed opacity-40"
: "bg-surface-2 text-text-secondary hover:bg-surface-3 hover:text-text-primary",
? "border-border text-text-muted cursor-not-allowed opacity-45"
: "border-border bg-surface-1 text-text-secondary hover:border-border-strong hover:text-text-primary",
)}
>
{option.icon && <span>{option.icon}</span>}
{Icon && <Icon className="size-3.5 shrink-0" aria-hidden />}
{option.label}
</button>
);
+42 -24
View File
@@ -1,6 +1,8 @@
import { useTranslation } from "react-i18next";
import { Modal } from "./Modal";
import { Button } from "./Button";
import { AlertDialog } from "radix-ui";
import { TriangleAlert } from "lucide-react";
import clsx from "clsx";
import { buttonClasses } from "./Button";
interface ConfirmDialogProps {
open: boolean;
@@ -12,6 +14,10 @@ interface ConfirmDialogProps {
variant?: "danger" | "default";
}
/**
* "Are you sure?" on Radix AlertDialog: it cannot be dismissed by clicking the
* backdrop, and focus starts on Cancel so Enter never confirms by accident.
*/
export function ConfirmDialog({
open,
onConfirm,
@@ -22,28 +28,40 @@ export function ConfirmDialog({
variant = "default",
}: ConfirmDialogProps) {
const { t } = useTranslation("ui");
const danger = variant === "danger";
return (
<Modal
open={open}
onClose={onCancel}
title={title}
footer={
<>
<Button variant="ghost" onClick={onCancel}>
{t("common.cancel")}
</Button>
<Button
variant="primary"
onClick={onConfirm}
className={variant === "danger" ? "hover:bg-danger/80 bg-danger" : ""}
>
{confirmLabel ?? t("common.confirm")}
</Button>
</>
}
>
<p className="text-text-secondary text-sm">{message}</p>
</Modal>
<AlertDialog.Root open={open} onOpenChange={(next) => !next && onCancel()}>
<AlertDialog.Portal>
<AlertDialog.Overlay className="bg-overlay animate-fade-in fixed inset-0 z-50 backdrop-blur-[2px]" />
<AlertDialog.Content className="bg-surface-1 border-border shadow-pop animate-pop-in rounded-panel fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 border p-5 focus:outline-none">
<div className="flex gap-4">
{danger && (
<span className="bg-danger/12 text-danger flex size-10 shrink-0 items-center justify-center rounded-full">
<TriangleAlert className="size-5" aria-hidden="true" />
</span>
)}
<div className="min-w-0">
<AlertDialog.Title className="text-text-primary text-base font-semibold">
{title}
</AlertDialog.Title>
<AlertDialog.Description className="text-text-secondary mt-1.5 text-sm leading-relaxed">
{message}
</AlertDialog.Description>
</div>
</div>
<div className="mt-5 flex justify-end gap-2">
<AlertDialog.Cancel className={buttonClasses("ghost")}>
{t("common.cancel")}
</AlertDialog.Cancel>
<AlertDialog.Action
className={clsx(buttonClasses(danger ? "danger" : "primary"))}
onClick={onConfirm}
>
{confirmLabel ?? t("common.confirm")}
</AlertDialog.Action>
</div>
</AlertDialog.Content>
</AlertDialog.Portal>
</AlertDialog.Root>
);
}
+58 -55
View File
@@ -1,17 +1,33 @@
import { useEffect, type ReactNode } from "react";
import type { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { Dialog, VisuallyHidden } from "radix-ui";
import { X } from "lucide-react";
import clsx from "clsx";
interface DrawerProps {
open: boolean;
onClose: () => void;
side?: "left" | "right";
/** Edge the sheet slides from. `bottom` is the mobile action sheet. */
side?: "left" | "right" | "bottom";
title?: string;
children: ReactNode;
className?: string;
ariaLabel?: string;
}
const PANEL: Record<NonNullable<DrawerProps["side"]>, string> = {
left: "inset-y-0 left-0 w-72 max-w-[86vw] border-r data-[state=open]:animate-[drawer-in-left_220ms_cubic-bezier(0.2,0.8,0.2,1)]",
right:
"inset-y-0 right-0 w-80 max-w-[90vw] border-l data-[state=open]:animate-[drawer-in-right_220ms_cubic-bezier(0.2,0.8,0.2,1)]",
bottom:
"inset-x-0 bottom-0 max-h-[85dvh] rounded-t-panel border-t data-[state=open]:animate-[drawer-in-bottom_240ms_cubic-bezier(0.2,0.8,0.2,1)]",
};
/**
* Slide-in sheet on Radix Dialog. Unlike the old always-mounted drawer, a
* closed sheet is not in the DOM, so its links can't be tabbed into while
* hidden, and focus is trapped while it is open.
*/
export function Drawer({
open,
onClose,
@@ -21,59 +37,46 @@ export function Drawer({
className,
ariaLabel,
}: DrawerProps) {
useEffect(() => {
if (!open) return;
const handleEsc = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose();
};
document.addEventListener("keydown", handleEsc);
const prevOverflow = document.body.style.overflow;
document.body.style.overflow = "hidden";
return () => {
document.removeEventListener("keydown", handleEsc);
document.body.style.overflow = prevOverflow;
};
}, [open, onClose]);
const { t } = useTranslation("ui");
return (
<div
className={clsx(
"fixed inset-0 z-50 transition-opacity duration-200",
open ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0",
)}
aria-hidden={!open}
>
<div className="absolute inset-0 bg-black/60" onClick={onClose} aria-hidden="true" />
<div
role="dialog"
aria-modal="true"
aria-label={ariaLabel ?? title}
className={clsx(
"bg-surface-1 absolute top-0 bottom-0 flex w-64 max-w-[85vw] flex-col shadow-2xl transition-transform duration-200",
side === "left" ? "border-border left-0 border-r" : "border-border right-0 border-l",
open ? "translate-x-0" : side === "left" ? "-translate-x-full" : "translate-x-full",
className,
)}
style={{
paddingTop: "env(safe-area-inset-top)",
paddingBottom: "env(safe-area-inset-bottom)",
}}
>
{title && (
<div className="border-border flex items-center justify-between border-b px-4 py-3">
<h2 className="text-text-primary text-base font-semibold">{title}</h2>
<button
type="button"
onClick={onClose}
className="text-text-muted hover:bg-surface-2 hover:text-text-primary rounded-lg p-2"
aria-label="Close"
>
<X className="h-4 w-4" />
</button>
</div>
)}
<div className="flex-1 overflow-y-auto">{children}</div>
</div>
</div>
<Dialog.Root open={open} onOpenChange={(next) => !next && onClose()}>
<Dialog.Portal>
<Dialog.Overlay className="bg-overlay animate-fade-in fixed inset-0 z-50" />
<Dialog.Content
aria-describedby={undefined}
className={clsx(
"bg-surface-1 border-border shadow-pop fixed z-50 flex flex-col focus:outline-none",
"safe-top safe-bottom",
PANEL[side],
className,
)}
>
{side === "bottom" && (
<div
className="bg-border-strong mx-auto mt-2 h-1 w-10 shrink-0 rounded-full"
aria-hidden="true"
/>
)}
{title ? (
<div className="border-border flex items-center justify-between border-b px-4 py-3">
<Dialog.Title className="text-text-primary text-base font-semibold">
{title}
</Dialog.Title>
<Dialog.Close
className="text-text-muted hover:bg-surface-2 hover:text-text-primary flex size-8 cursor-pointer items-center justify-center rounded-lg"
aria-label={t("common.close")}
>
<X className="size-4" aria-hidden="true" />
</Dialog.Close>
</div>
) : (
<VisuallyHidden.Root>
<Dialog.Title>{ariaLabel ?? t("common.close")}</Dialog.Title>
</VisuallyHidden.Root>
)}
<div className="flex-1 scrollbar-thin overflow-y-auto">{children}</div>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
);
}
+44
View File
@@ -0,0 +1,44 @@
import type { ReactNode } from "react";
import clsx from "clsx";
import type { IconComponent } from "@components/icons/brand";
interface EmptyStateProps {
icon?: IconComponent;
title: ReactNode;
description?: ReactNode;
action?: ReactNode;
className?: string;
/** Tighter padding for use inside cards. */
compact?: boolean;
}
/** What a list or page shows when there is nothing in it yet. */
export function EmptyState({
icon: Icon,
title,
description,
action,
className,
compact,
}: EmptyStateProps) {
return (
<div
className={clsx(
"border-border rounded-card flex flex-col items-center justify-center border border-dashed text-center",
compact ? "gap-2 px-4 py-6" : "gap-3 px-6 py-12",
className,
)}
>
{Icon && (
<span className="bg-surface-2 text-text-muted flex size-11 items-center justify-center rounded-full">
<Icon className="size-5" aria-hidden />
</span>
)}
<p className="text-text-primary text-sm font-medium">{title}</p>
{description && (
<p className="text-text-muted max-w-sm text-xs leading-relaxed">{description}</p>
)}
{action && <div className="mt-1">{action}</div>}
</div>
);
}
+76
View File
@@ -0,0 +1,76 @@
import { useId, type ReactNode } from "react";
import clsx from "clsx";
/** Props a Field hands to the control it wraps. */
export interface FieldControlProps {
id: string;
"aria-invalid"?: true;
"aria-describedby"?: string;
}
interface FieldProps {
label?: ReactNode;
/** Inline error (takes precedence over the hint). */
error?: ReactNode;
/** Hint shown under the control when there is no error. */
help?: ReactNode;
/** Right-aligned extra in the label row (counter, action). */
labelExtra?: ReactNode;
/** Explicit control id; generated otherwise. */
id?: string;
className?: string;
children: (control: FieldControlProps) => ReactNode;
}
/**
* Label + control + hint/error, wired for assistive tech: the label points at
* the control, and the hint or error is its description. Ids are generated
* with useId — the old primitives derived them from the label text, which
* collided (ten "Type" selects all got id="type") and produced non-ASCII ids.
*/
export function Field({ label, error, help, labelExtra, id, className, children }: FieldProps) {
const autoId = useId();
const controlId = id ?? autoId;
const messageId = `${controlId}-message`;
const message = error ?? help;
return (
<div className={clsx("flex min-w-0 flex-col gap-1.5", className)}>
{(label || labelExtra) && (
<div className="flex min-h-5 items-center justify-between gap-2">
{label && (
<label htmlFor={controlId} className="text-text-secondary text-xs font-medium">
{label}
</label>
)}
{labelExtra}
</div>
)}
{children({
id: controlId,
...(error ? { "aria-invalid": true as const } : {}),
...(message ? { "aria-describedby": messageId } : {}),
})}
{message && (
<p
id={messageId}
className={clsx("text-xs leading-snug", error ? "text-danger" : "text-text-muted")}
>
{message}
</p>
)}
</div>
);
}
/** Shared look of every text-like control. */
export const controlClasses = (invalid: boolean) =>
clsx(
"w-full min-w-0 rounded-control border bg-surface-1 px-3 text-text-primary",
"placeholder:text-text-muted transition-[border-color,box-shadow] duration-150",
"focus:outline-none focus-visible:outline-none focus:ring-3 focus:ring-accent/25",
"disabled:cursor-not-allowed disabled:opacity-55",
invalid
? "border-danger focus:border-danger"
: "border-border hover:border-border-strong focus:border-accent",
);
+29
View File
@@ -0,0 +1,29 @@
import { forwardRef } from "react";
import { Button, type ButtonProps } from "./Button";
import { Tooltip } from "./Tooltip";
interface IconButtonProps extends Omit<ButtonProps, "size" | "children" | "aria-label"> {
/** Accessible name AND tooltip text — an icon-only control needs both. */
label: string;
children: React.ReactNode;
size?: "icon" | "icon-sm";
/** Hide the hover tooltip (the name stays for screen readers). */
noTooltip?: boolean;
tooltipSide?: "top" | "right" | "bottom" | "left";
}
/** A square, icon-only button that cannot be rendered without a name. */
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
(
{ label, children, variant = "ghost", size = "icon", noTooltip, tooltipSide, ...props },
ref,
) => (
<Tooltip content={label} disabled={noTooltip} side={tooltipSide}>
<Button ref={ref} variant={variant} size={size} aria-label={label} {...props}>
{children}
</Button>
</Tooltip>
),
);
IconButton.displayName = "IconButton";
+30 -24
View File
@@ -1,5 +1,6 @@
import { forwardRef, type InputHTMLAttributes } from "react";
import { forwardRef, type InputHTMLAttributes, type ReactNode } from "react";
import clsx from "clsx";
import { Field, controlClasses } from "./Field";
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
label?: string;
@@ -8,34 +9,39 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
errorText?: string;
/** Inline hint shown below the input when there is no error. */
helpText?: string;
/** Right side of the label row — e.g. a character counter. */
labelExtra?: ReactNode;
/** Icon or text inside the field, before the value. */
leading?: ReactNode;
}
export const Input = forwardRef<HTMLInputElement, InputProps>(
({ label, error, errorText, helpText, className, id, ...props }, ref) => {
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
const isError = error || Boolean(errorText);
({ label, error, errorText, helpText, labelExtra, leading, className, id, ...props }, ref) => {
const isError = Boolean(error) || Boolean(errorText);
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={inputId} className="text-text-secondary text-sm font-medium">
{label}
</label>
<Field label={label} error={errorText} help={helpText} labelExtra={labelExtra} id={id}>
{(control) => (
<div className="relative">
{leading && (
<span className="text-text-muted pointer-events-none absolute inset-y-0 left-3 flex items-center [&_svg]:size-4">
{leading}
</span>
)}
<input
ref={ref}
{...control}
aria-invalid={isError || undefined}
className={clsx(
controlClasses(isError),
"h-control text-base sm:text-sm",
leading ? "pl-9" : undefined,
className,
)}
{...props}
/>
</div>
)}
<input
ref={ref}
id={inputId}
aria-invalid={isError || undefined}
className={clsx(
"focus:ring-accent/50 min-h-touch bg-surface-1 text-text-primary placeholder:text-text-muted rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
isError ? "border-danger" : "border-border focus:border-accent",
className,
)}
{...props}
/>
{errorText && <p className="text-danger text-xs">{errorText}</p>}
{helpText && !errorText && <p className="text-text-muted text-xs">{helpText}</p>}
</div>
</Field>
);
},
);
+74 -44
View File
@@ -1,4 +1,6 @@
import { useEffect, useRef, type ReactNode } from "react";
import type { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { Dialog, VisuallyHidden } from "radix-ui";
import { X } from "lucide-react";
import clsx from "clsx";
@@ -6,55 +8,83 @@ interface ModalProps {
open: boolean;
onClose: () => void;
title?: string;
/** Visible sub-line under the title (also the dialog's description). */
description?: ReactNode;
children: ReactNode;
footer?: ReactNode;
/** Max width: sm 24rem · md 32rem (default) · lg 42rem · xl 56rem. */
size?: "sm" | "md" | "lg" | "xl";
className?: string;
}
export function Modal({ open, onClose, title, children, footer, className }: ModalProps) {
const overlayRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!open) return;
const handleEsc = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose();
};
document.addEventListener("keydown", handleEsc);
return () => document.removeEventListener("keydown", handleEsc);
}, [open, onClose]);
if (!open) return null;
const SIZES = { sm: "max-w-sm", md: "max-w-lg", lg: "max-w-2xl", xl: "max-w-4xl" } as const;
/**
* Centered dialog on Radix Dialog: focus is trapped inside and restored to the
* trigger on close, the page behind cannot scroll, Escape and the backdrop
* close it, and it is announced as a modal dialog with its title. The old
* hand-rolled modal had none of that.
*/
export function Modal({
open,
onClose,
title,
description,
children,
footer,
size = "md",
className,
}: ModalProps) {
const { t } = useTranslation("ui");
return (
<div
ref={overlayRef}
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
onClick={(e) => {
if (e.target === overlayRef.current) onClose();
}}
>
<div
className={clsx(
"border-border bg-surface-1 mx-4 flex max-h-[85vh] w-[calc(100%-2rem)] max-w-lg flex-col rounded-xl border shadow-2xl",
className,
)}
>
{title && (
<div className="border-border flex items-center justify-between border-b px-5 py-4">
<h2 className="text-text-primary text-base font-semibold">{title}</h2>
<button
onClick={onClose}
className="text-text-muted hover:bg-surface-2 hover:text-text-primary rounded-lg p-1"
>
<X className="h-4 w-4" />
</button>
</div>
)}
<div className="flex-1 overflow-y-auto px-5 py-4">{children}</div>
{footer && (
<div className="border-border flex justify-end gap-2 border-t px-5 py-3">{footer}</div>
)}
</div>
</div>
<Dialog.Root open={open} onOpenChange={(next) => !next && onClose()}>
<Dialog.Portal>
<Dialog.Overlay className="bg-overlay animate-fade-in fixed inset-0 z-50 backdrop-blur-[2px]" />
<Dialog.Content
className={clsx(
"bg-surface-1 border-border shadow-pop animate-pop-in rounded-panel fixed top-1/2 left-1/2 z-50 flex max-h-[min(88dvh,52rem)] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col border",
"focus:outline-none",
SIZES[size],
className,
)}
>
{title ? (
<div className="border-border flex items-start justify-between gap-4 border-b px-5 py-4">
<div className="min-w-0">
<Dialog.Title className="text-text-primary text-base font-semibold">
{title}
</Dialog.Title>
{description ? (
<Dialog.Description className="text-text-muted mt-0.5 text-xs">
{description}
</Dialog.Description>
) : (
<VisuallyHidden.Root asChild>
<Dialog.Description>{title}</Dialog.Description>
</VisuallyHidden.Root>
)}
</div>
<Dialog.Close
className="text-text-muted hover:bg-surface-2 hover:text-text-primary -m-1.5 flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg transition-colors"
aria-label={t("common.close")}
>
<X className="size-4" aria-hidden="true" />
</Dialog.Close>
</div>
) : (
<VisuallyHidden.Root>
<Dialog.Title>{t("common.close")}</Dialog.Title>
<Dialog.Description>{t("common.close")}</Dialog.Description>
</VisuallyHidden.Root>
)}
<div className="flex-1 scrollbar-thin overflow-y-auto px-5 py-4">{children}</div>
{footer && (
<div className="border-border flex flex-wrap justify-end gap-2 border-t px-5 py-3">
{footer}
</div>
)}
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
);
}
+70
View File
@@ -0,0 +1,70 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Input } from "./Input";
interface NumberFieldProps {
label: string;
value: number;
min: number;
max: number;
/** Receives a whole number within [min, max]; never called with anything else. */
onCommit: (value: number) => void;
/** Hint under the field; defaults to the allowed range. */
help?: string;
}
/**
* A whole-number setting that is saved when the user is done typing (blur or
* Enter). The inputs this replaces clamped on every keystroke, so clearing
* "100" to type "250" snapped straight back to the minimum. An out-of-range
* value is kept on screen with an inline error instead of being saved;
* Escape restores the saved value.
*/
export function NumberField({ label, value, min, max, onCommit, help }: NumberFieldProps) {
const { t } = useTranslation("ui");
// null while not editing, so outside changes (an import) still show up.
const [draft, setDraft] = useState<string | null>(null);
const [showError, setShowError] = useState(false);
const text = draft ?? String(value);
const parsed = Number(text);
const valid = text.trim() !== "" && Number.isInteger(parsed) && parsed >= min && parsed <= max;
const range = t("settings.numberRange", { min, max });
const commit = () => {
if (draft === null) return;
if (!valid) {
setShowError(true);
return;
}
if (parsed !== value) onCommit(parsed);
setDraft(null);
setShowError(false);
};
return (
<Input
label={label}
type="number"
inputMode="numeric"
min={min}
max={max}
step={1}
value={text}
onChange={(e) => {
setDraft(e.target.value);
setShowError(false);
}}
onBlur={commit}
onKeyDown={(e) => {
if (e.key === "Enter") commit();
if (e.key === "Escape") {
setDraft(null);
setShowError(false);
}
}}
errorText={showError ? range : undefined}
helpText={help ?? range}
className="max-w-40"
/>
);
}
+57
View File
@@ -0,0 +1,57 @@
import type { ReactNode } from "react";
import clsx from "clsx";
interface PageHeaderProps {
title: ReactNode;
description?: ReactNode;
/** Buttons on the right (they wrap under the title on narrow screens). */
actions?: ReactNode;
/** Small element after the title (version pill, count). */
meta?: ReactNode;
className?: string;
}
/**
* The one <h1> of a page. The top bar carries no heading, so every screen has
* exactly one — before v1.0.0 most pages had two (the app name in the header
* plus their own) and Editor, Output and Profiles had none of their own.
*/
export function PageHeader({ title, description, actions, meta, className }: PageHeaderProps) {
return (
<header className={clsx("flex flex-wrap items-end justify-between gap-x-4 gap-y-3", className)}>
<div className="min-w-0">
<div className="flex items-center gap-2">
<h1 className="text-text-primary text-xl font-semibold tracking-tight">{title}</h1>
{meta}
</div>
{description && <p className="text-text-muted mt-1 text-sm">{description}</p>}
</div>
{actions && <div className="flex flex-wrap items-center gap-2">{actions}</div>}
</header>
);
}
/** Standard page width + padding, so every page lines up. */
export function PageContainer({
children,
width = "default",
className,
}: {
children: ReactNode;
width?: "narrow" | "default" | "wide";
className?: string;
}) {
return (
<div
className={clsx(
"mx-auto flex w-full flex-col gap-6 px-4 py-6 sm:px-6 lg:py-8",
width === "narrow" && "max-w-3xl",
width === "default" && "max-w-5xl",
width === "wide" && "max-w-7xl",
className,
)}
>
{children}
</div>
);
}
+36
View File
@@ -0,0 +1,36 @@
import type { ReactNode } from "react";
import { Popover as RadixPopover } from "radix-ui";
import clsx from "clsx";
export const PopoverRoot = RadixPopover.Root;
export const PopoverTrigger = RadixPopover.Trigger;
/** Floating panel anchored to its trigger (Radix Popover: focus-managed, Escape closes). */
export function PopoverContent({
children,
align = "start",
className,
ariaLabel,
}: {
children: ReactNode;
align?: "start" | "center" | "end";
className?: string;
ariaLabel?: string;
}) {
return (
<RadixPopover.Portal>
<RadixPopover.Content
align={align}
sideOffset={6}
collisionPadding={12}
aria-label={ariaLabel}
className={clsx(
"bg-surface-1 border-border shadow-pop animate-pop-in rounded-card z-[60] w-[var(--radix-popover-trigger-width)] min-w-64 overflow-hidden border focus:outline-none",
className,
)}
>
{children}
</RadixPopover.Content>
</RadixPopover.Portal>
);
}
+80
View File
@@ -0,0 +1,80 @@
import type { ReactNode } from "react";
import { ToggleGroup } from "radix-ui";
import { m } from "motion/react";
import clsx from "clsx";
export interface SegmentOption<T extends string> {
value: T;
label: ReactNode;
/** Accessible name when `label` is an icon. */
ariaLabel?: string;
}
interface SegmentedControlProps<T extends string> {
value: T;
onChange: (value: T) => void;
options: readonly SegmentOption<T>[];
/** Names the group for screen readers. */
ariaLabel: string;
size?: "sm" | "md";
className?: string;
/** Unique per page — scopes the sliding highlight's shared layout id. */
layoutId?: string;
}
/**
* One-of-N switch with a highlight that slides between segments. Replaces the
* five hand-rolled segmented button rows (Profiles tabs, Social platform,
* Log levels …), which had no ARIA state.
*/
export function SegmentedControl<T extends string>({
value,
onChange,
options,
ariaLabel,
size = "md",
className,
layoutId = "segmented",
}: SegmentedControlProps<T>) {
return (
<ToggleGroup.Root
type="single"
value={value}
onValueChange={(next) => {
if (next) onChange(next as T);
}}
aria-label={ariaLabel}
className={clsx(
"bg-surface-2 border-border rounded-control inline-flex max-w-full items-center gap-0.5 overflow-x-auto border p-0.5",
className,
)}
>
{options.map((option) => {
const active = option.value === value;
return (
<ToggleGroup.Item
key={option.value}
value={option.value}
aria-label={option.ariaLabel}
className={clsx(
"relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-[0.5rem] font-medium whitespace-nowrap",
"transition-colors duration-150 [&_svg]:size-4",
size === "sm" ? "h-7 px-2.5 text-xs" : "h-8 px-3 text-sm",
active ? "text-text-primary" : "text-text-secondary hover:text-text-primary",
)}
>
{active && (
<m.span
layoutId={layoutId}
className="bg-surface-0 border-border absolute inset-0 rounded-[0.5rem] border shadow-sm"
transition={{ type: "spring", stiffness: 500, damping: 38 }}
aria-hidden="true"
/>
)}
<span className="relative inline-flex items-center gap-1.5">{option.label}</span>
</ToggleGroup.Item>
);
})}
</ToggleGroup.Root>
);
}
+40 -30
View File
@@ -1,5 +1,7 @@
import { forwardRef, type SelectHTMLAttributes } from "react";
import { ChevronsUpDown } from "lucide-react";
import clsx from "clsx";
import { Field, controlClasses } from "./Field";
interface SelectOption {
value: string;
@@ -10,39 +12,47 @@ interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "onC
label?: string;
options: readonly SelectOption[];
onChange: (value: string) => void;
helpText?: string;
errorText?: string;
}
/**
* A native <select>, styled. Native on purpose: it gets the platform picker on
* Android and iOS, type-ahead, and full keyboard support for free — and it
* now matches the other controls' height (it used to be ~6px shorter).
*/
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
({ label, options, value, onChange, className, id, ...props }, ref) => {
const selectId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={selectId} className="text-text-secondary text-sm font-medium">
{label}
</label>
)}
<select
ref={ref}
id={selectId}
value={value}
onChange={(e) => onChange(e.target.value)}
className={clsx(
"focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none",
className,
)}
{...props}
>
{options.map((opt) => (
<option key={opt.value} value={opt.value}>
{opt.label}
</option>
))}
</select>
</div>
);
},
({ label, options, value, onChange, helpText, errorText, className, id, ...props }, ref) => (
<Field label={label} help={helpText} error={errorText} id={id}>
{(control) => (
// `className` sizes the control box (e.g. max-w-40), so the chevron
// stays inside the narrowed select instead of at the row's far end.
<div className={clsx("relative", className)}>
<select
ref={ref}
{...control}
value={value}
onChange={(e) => onChange(e.target.value)}
className={clsx(
controlClasses(Boolean(errorText)),
"h-control cursor-pointer appearance-none pr-9 text-base sm:text-sm",
)}
{...props}
>
{options.map((opt) => (
<option key={opt.value} value={opt.value}>
{opt.label}
</option>
))}
</select>
<ChevronsUpDown
className="text-text-muted pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2"
aria-hidden="true"
/>
</div>
)}
</Field>
),
);
Select.displayName = "Select";
+32 -29
View File
@@ -1,6 +1,8 @@
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Search } from "lucide-react";
import { Modal } from "./Modal";
import { ShortcutKeys, keyName } from "./Badge";
interface ShortcutHelpModalProps {
open: boolean;
@@ -8,14 +10,15 @@ interface ShortcutHelpModalProps {
}
const SHORTCUTS = [
{ keys: "Ctrl + G", labelKey: "shortcuts.generate" },
{ keys: "Ctrl + Enter", labelKey: "shortcuts.generate" },
{ keys: "Ctrl + Shift + C", labelKey: "shortcuts.copyAll" },
{ keys: "Ctrl + S", labelKey: "shortcuts.saveDraft" },
{ keys: "Ctrl + B", labelKey: "shortcuts.toggleSidebar" },
{ keys: "Ctrl + /", labelKey: "shortcuts.help" },
{ keys: "?", labelKey: "shortcuts.help" },
{ keys: "Escape", labelKey: "shortcuts.close" },
{ keys: ["mod", "K"], labelKey: "command.open" },
{ keys: ["mod", "G"], labelKey: "shortcuts.generate" },
{ keys: ["mod", "enter"], labelKey: "shortcuts.generate" },
{ keys: ["mod", "shift", "C"], labelKey: "shortcuts.copyAll" },
{ keys: ["mod", "S"], labelKey: "shortcuts.saveDraft" },
{ keys: ["mod", "B"], labelKey: "shortcuts.toggleSidebar" },
{ keys: ["mod", "/"], labelKey: "shortcuts.help" },
{ keys: ["?"], labelKey: "shortcuts.help" },
{ keys: ["esc"], labelKey: "shortcuts.close" },
] as const;
export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
@@ -32,37 +35,37 @@ export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
if (!trimmed) return SHORTCUTS;
return SHORTCUTS.filter((s) => {
const label = t(s.labelKey).toLowerCase();
return label.includes(trimmed) || s.keys.toLowerCase().includes(trimmed);
const keys = s.keys.map(keyName).join(" ").toLowerCase();
return label.includes(trimmed) || keys.includes(trimmed);
});
}, [activeQuery, t]);
return (
<Modal open={open} onClose={onClose} title={t("shortcuts.title")}>
<Modal open={open} onClose={onClose} title={t("shortcuts.title")} size="sm">
<div className="flex flex-col gap-3">
<input
type="text"
value={activeQuery}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("shortcuts.searchPlaceholder")}
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
autoFocus
/>
<label className="border-border bg-surface-0 focus-within:border-accent focus-within:ring-accent/25 h-control rounded-control flex items-center gap-2 border px-3 transition-colors focus-within:ring-2">
<Search className="text-text-muted size-4 shrink-0" aria-hidden="true" />
<input
type="search"
value={activeQuery}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("shortcuts.searchPlaceholder")}
aria-label={t("shortcuts.searchPlaceholder")}
className="text-text-primary placeholder:text-text-muted w-full bg-transparent text-sm outline-none"
autoFocus
/>
</label>
{filtered.length === 0 ? (
<p className="text-text-muted py-2 text-sm">{t("shortcuts.noResults")}</p>
<p className="text-text-muted py-4 text-center text-sm">{t("shortcuts.noResults")}</p>
) : (
<div className="flex flex-col gap-2">
<ul className="divide-border flex flex-col divide-y">
{filtered.map((s) => (
<div
key={`${s.keys}-${s.labelKey}`}
className="flex items-center justify-between py-1"
>
<li key={s.keys.join("+")} className="flex items-center justify-between gap-4 py-2">
<span className="text-text-secondary text-sm">{t(s.labelKey)}</span>
<kbd className="bg-surface-2 text-text-primary rounded px-2 py-0.5 font-mono text-xs">
{s.keys}
</kbd>
</div>
<ShortcutKeys keys={s.keys} />
</li>
))}
</div>
</ul>
)}
</div>
</Modal>
+6 -13
View File
@@ -1,7 +1,7 @@
import { ShieldAlert } from "lucide-react";
import { useTranslation } from "react-i18next";
import { useSettingsStore } from "@store/settings-store";
import { useEditorIssues } from "@hooks/use-strict-block";
import { Banner } from "./Banner";
/**
* Lists the fields Strict Mode is blocking on.
@@ -19,24 +19,17 @@ export function StrictModeBanner() {
if (!strictMode || errors.length === 0) return null;
return (
<div
role="alert"
className="border-danger/40 bg-danger/10 text-danger flex flex-col gap-1 rounded-lg border px-3 py-2 text-xs"
>
<span className="flex items-center gap-1.5 font-semibold">
<ShieldAlert className="h-3.5 w-3.5 shrink-0" />
{t("strict.blockedTitle", { count: errors.length })}
</span>
<ul className="flex flex-col gap-0.5 pl-5">
<Banner tone="danger" alert title={t("strict.blockedTitle", { count: errors.length })}>
<ul className="flex list-disc flex-col gap-0.5 pl-4">
{errors.map((issue) => (
<li key={issue.id}>
<span className="font-medium">{t(issue.labelKey)}</span>
<span className="text-text-primary font-medium">{t(issue.labelKey)}</span>
{" — "}
{t(issue.messageKey, issue.params as Record<string, string>)}
</li>
))}
</ul>
<span className="text-text-muted">{t("strict.fixHint")}</span>
</div>
<p className="text-text-muted mt-1">{t("strict.fixHint")}</p>
</Banner>
);
}
+92
View File
@@ -0,0 +1,92 @@
import type { ReactNode } from "react";
import { Tabs as RadixTabs } from "radix-ui";
import { m } from "motion/react";
import clsx from "clsx";
export interface TabItem<T extends string> {
value: T;
label: ReactNode;
/** Small trailing element — a count or a warning dot. */
badge?: ReactNode;
}
interface TabsProps<T extends string> {
value: T;
onChange: (value: T) => void;
items: readonly TabItem<T>[];
ariaLabel: string;
/** Scopes the sliding underline's shared layout id. */
layoutId: string;
children?: ReactNode;
className?: string;
listClassName?: string;
}
/**
* Underlined tabs on Radix Tabs (arrow keys move between tabs, the panel is
* labelled by its tab). Panels are passed as `<TabPanel value>` children.
*/
export function Tabs<T extends string>({
value,
onChange,
items,
ariaLabel,
layoutId,
children,
className,
listClassName,
}: TabsProps<T>) {
return (
<RadixTabs.Root value={value} onValueChange={(v) => onChange(v as T)} className={className}>
<RadixTabs.List
aria-label={ariaLabel}
className={clsx(
"border-border flex scrollbar-thin gap-1 overflow-x-auto overflow-y-hidden border-b",
listClassName,
)}
>
{items.map((item) => {
const active = item.value === value;
return (
<RadixTabs.Trigger
key={item.value}
value={item.value}
className={clsx(
"relative inline-flex h-9 shrink-0 cursor-pointer items-center gap-1.5 px-3 text-sm font-medium whitespace-nowrap transition-colors",
active ? "text-text-primary" : "text-text-muted hover:text-text-secondary",
)}
>
{item.label}
{item.badge}
{active && (
<m.span
layoutId={layoutId}
className="bg-accent absolute inset-x-2 bottom-0 h-0.5 rounded-full"
transition={{ type: "spring", stiffness: 500, damping: 40 }}
aria-hidden="true"
/>
)}
</RadixTabs.Trigger>
);
})}
</RadixTabs.List>
{children}
</RadixTabs.Root>
);
}
export function TabPanel({
value,
children,
className,
}: {
value: string;
children: ReactNode;
className?: string;
}) {
return (
<RadixTabs.Content value={value} className={clsx("focus:outline-none", className)}>
{children}
</RadixTabs.Content>
);
}
+21 -20
View File
@@ -1,33 +1,34 @@
import { forwardRef, type TextareaHTMLAttributes } from "react";
import { forwardRef, type ReactNode, type TextareaHTMLAttributes } from "react";
import clsx from "clsx";
import { Field, controlClasses } from "./Field";
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
label?: string;
error?: boolean;
errorText?: string;
helpText?: string;
labelExtra?: ReactNode;
}
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
({ label, error, className, id, ...props }, ref) => {
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
({ label, error, errorText, helpText, labelExtra, className, id, ...props }, ref) => {
const isError = Boolean(error) || Boolean(errorText);
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={inputId} className="text-text-secondary text-sm font-medium">
{label}
</label>
<Field label={label} error={errorText} help={helpText} labelExtra={labelExtra} id={id}>
{(control) => (
<textarea
ref={ref}
{...control}
aria-invalid={isError || undefined}
className={clsx(
controlClasses(isError),
"min-h-24 resize-y py-2 text-base leading-relaxed sm:text-sm",
className,
)}
{...props}
/>
)}
<textarea
ref={ref}
id={inputId}
className={clsx(
"focus:ring-accent/50 bg-surface-1 text-text-primary placeholder:text-text-muted min-h-[96px] resize-y rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
error ? "border-danger" : "border-border focus:border-accent",
className,
)}
{...props}
/>
</div>
</Field>
);
},
);
+32
View File
@@ -0,0 +1,32 @@
import { Toaster as Sonner } from "sonner";
import { useSettingsStore } from "@store/settings-store";
/**
* App-wide toasts (sonner). Bottom-center, clear of the scroll-to-top button
* (bottom-left) and page actions (right); on phones they sit above the
* bottom navigation bar. The old bottom-right corner was shared by four
* floating elements.
*/
export function Toaster() {
const theme = useSettingsStore((s) => s.theme);
return (
<Sonner
theme={theme}
position="bottom-center"
closeButton
// globals.css switches this at the md breakpoint, where the bar goes.
offset={{ bottom: "var(--toast-offset-bottom)" }}
mobileOffset={{ bottom: "var(--toast-offset-bottom)" }}
toastOptions={{
classNames: {
toast:
"!bg-surface-1 !border-border !text-text-primary !rounded-card !shadow-pop !font-sans",
description: "!text-text-secondary",
actionButton: "!bg-accent !text-accent-fg !rounded-lg !font-medium",
cancelButton: "!bg-surface-2 !text-text-secondary !rounded-lg",
closeButton: "!bg-surface-2 !border-border !text-text-secondary",
},
}}
/>
);
}
+43 -16
View File
@@ -1,33 +1,60 @@
import { useId, type ReactNode } from "react";
import { Switch } from "radix-ui";
import clsx from "clsx";
interface ToggleProps {
label: string;
label: ReactNode;
checked: boolean;
onChange: (checked: boolean) => void;
/** Secondary line under the label, aligned with it. */
description?: ReactNode;
disabled?: boolean;
className?: string;
}
export function Toggle({ label, checked, onChange, className }: ToggleProps) {
/** An on/off switch with its label (and optional description) to the right. */
export function Toggle({
label,
checked,
onChange,
description,
disabled,
className,
}: ToggleProps) {
const id = useId();
const descriptionId = description ? `${id}-desc` : undefined;
return (
<label className={clsx("flex cursor-pointer items-center gap-3", className)}>
<button
role="switch"
type="button"
aria-checked={checked}
onClick={() => onChange(!checked)}
<div className={clsx("flex items-start gap-3", disabled && "opacity-55", className)}>
<Switch.Root
id={id}
checked={checked}
onCheckedChange={onChange}
disabled={disabled}
aria-describedby={descriptionId}
className={clsx(
"focus:ring-accent/50 relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus:ring-2 focus:outline-none",
checked ? "bg-accent" : "bg-surface-3",
"relative mt-0.5 inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent",
"transition-colors duration-200 disabled:cursor-not-allowed",
"data-[state=checked]:bg-accent data-[state=unchecked]:bg-surface-3",
)}
>
<span
<Switch.Thumb
className={clsx(
"pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-sm transition-transform",
checked ? "translate-x-5" : "translate-x-0",
"pointer-events-none block size-4 rounded-full bg-white shadow-sm",
"transition-transform duration-200 ease-[cubic-bezier(0.2,0.9,0.3,1.2)]",
"translate-x-0.5 data-[state=checked]:translate-x-[1.125rem]",
)}
/>
</button>
<span className="text-text-primary text-sm">{label}</span>
</label>
</Switch.Root>
<div className="min-w-0">
<label htmlFor={id} className="text-text-primary cursor-pointer text-sm leading-snug">
{label}
</label>
{description && (
<p id={descriptionId} className="text-text-muted mt-0.5 text-xs leading-snug">
{description}
</p>
)}
</div>
</div>
);
}
+45
View File
@@ -0,0 +1,45 @@
import type { ReactNode } from "react";
import { Tooltip as RadixTooltip } from "radix-ui";
import clsx from "clsx";
/** Mount once near the root; every Tooltip below shares its delay. */
export function TooltipProvider({ children }: { children: ReactNode }) {
return (
<RadixTooltip.Provider delayDuration={350} skipDelayDuration={200}>
{children}
</RadixTooltip.Provider>
);
}
interface TooltipProps {
content: ReactNode;
children: ReactNode;
side?: "top" | "right" | "bottom" | "left";
/** Skip the tooltip entirely (e.g. when a label is already visible). */
disabled?: boolean;
}
/**
* Hover/focus label for a control. The trigger keeps its own accessible name
* (aria-label); the tooltip only adds the visible hint.
*/
export function Tooltip({ content, children, side = "top", disabled = false }: TooltipProps) {
if (disabled) return <>{children}</>;
return (
<RadixTooltip.Root>
<RadixTooltip.Trigger asChild>{children}</RadixTooltip.Trigger>
<RadixTooltip.Portal>
<RadixTooltip.Content
side={side}
sideOffset={6}
className={clsx(
"z-[70] max-w-xs rounded-lg px-2.5 py-1.5 text-xs font-medium",
"bg-text-primary text-surface-0 shadow-pop animate-fade-in",
)}
>
{content}
</RadixTooltip.Content>
</RadixTooltip.Portal>
</RadixTooltip.Root>
);
}
+22 -22
View File
@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import type { ValidationResult } from "@utils/validation";
import { usePendingInvalidStore } from "@store/pending-invalid-store";
import clsx from "clsx";
import { Field, controlClasses } from "./Field";
interface ValidatedInputProps {
label: string;
@@ -162,28 +163,27 @@ export function ValidatedInput({
// not silently clear the very thing Strict Mode is supposed to catch.
}, [fieldId, labelKey, label, isInvalid, invalidKey, invalidParams]);
const showError = touched && Boolean(message);
return (
<div className="flex flex-col gap-1">
<label className="text-text-secondary text-sm font-medium">{label}</label>
<input
type="text"
value={displayValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={() => setTouched(true)}
onPaste={onPaste}
placeholder={placeholder}
inputMode={inputMode}
autoComplete={autoComplete}
enterKeyHint={enterKeyHint}
maxLength={maxLength}
aria-invalid={touched && Boolean(message) ? true : undefined}
className={clsx(
"focus:ring-accent/50 min-h-touch bg-surface-1 text-text-primary placeholder:text-text-muted rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
touched && message ? "border-danger" : "border-border focus:border-accent",
)}
/>
{touched && message && <p className="text-danger text-xs">{message}</p>}
{helpText && !message && <p className="text-text-muted text-xs">{helpText}</p>}
</div>
<Field label={label} error={showError ? message : undefined} help={helpText}>
{(control) => (
<input
{...control}
type="text"
value={displayValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={() => setTouched(true)}
onPaste={onPaste}
placeholder={placeholder}
inputMode={inputMode}
autoComplete={autoComplete}
enterKeyHint={enterKeyHint}
maxLength={maxLength}
aria-invalid={showError || undefined}
className={clsx(controlClasses(showError), "h-control text-base sm:text-sm")}
/>
)}
</Field>
);
}
+30 -10
View File
@@ -1,37 +1,57 @@
import pkg from "../../package.json";
/**
* App metadata + author / social links surfaced on the About page.
* App metadata, author and contact details surfaced on the About page.
*
* Versions come from `package.json` so the About page never lies after a
* version bump. Empty social URLs are hidden by the page; fill in the
* channel / handle URLs you want to expose before tagging a release.
* version bump. Empty social URLs are hidden by the page.
*
* Note: Ko-fi / Patreon were moved out of `socials` into `@config/donate`
* in v0.13.1 — they're "support" links, not "presence" links.
* Donate links live in `@config/donate` — they're "support" links, not
* "presence" links.
*/
export const ABOUT = {
appName: "YTDescGen",
version: pkg.version,
license: "Apache-2.0",
website: "https://ytgenerator.stream",
repo: "https://github.com/poli0981/youtube-generator",
issuesUrl: "https://github.com/poli0981/youtube-generator/issues",
bugReportUrl: "https://github.com/poli0981/youtube-generator/issues/new?template=bug_report.yml",
discussionsUrl: "https://github.com/poli0981/youtube-generator/discussions",
licenseUrl: "https://github.com/poli0981/youtube-generator/blob/main/LICENSE",
githubAuthor: "https://github.com/poli0981",
wikiUrl: "https://github.com/poli0981/youtube-generator/wiki",
securityAdvisoryUrl: "https://github.com/poli0981/youtube-generator/security/advisories/new",
author: {
name: "SkullMute",
github: "https://github.com/poli0981",
website: "https://poli0981.dev/",
links: "https://poli0981.dev/links/",
},
/**
* One address per purpose, so a message lands with whoever handles it.
* Keep in sync with SECURITY.md, PRIVACY.md, TERMS.md, NOTICE and
* public/.well-known/security.txt.
*/
contacts: {
general: "contact@poli0981.dev",
security: "security@poli0981.dev",
privacy: "privacy@poli0981.dev",
legal: "legal@poli0981.dev",
dmca: "dmca@poli0981.dev",
copyright: "copyright@poli0981.dev",
code: "code@poli0981.dev",
sponsor: "sponsor@poli0981.dev",
},
socials: {
youtube: "https://www.youtube.com/@SkullMute",
x: "https://x.com/SkullMute0011",
bluesky: "https://bsky.app/profile/skullmute0011.bsky.social",
mastodon: "https://mastodon.social/@skullmute1122",
discord: "https://discord.gg/2aNR3aVt",
discordGame: "https://discord.gg/kDM9GMu5vm",
discord: "https://discord.gg/kDM9GMu5vm",
steam: "https://steamcommunity.com/profiles/76561199544666292/",
telegramBot: "https://t.me/my_skull_bot",
telegramUser: "https://t.me/SkullMute0011",
email: "mailto:lopop05905@proton.me",
},
} as const;
export type AboutSocialId = keyof typeof ABOUT.socials;
export type AboutContactId = keyof typeof ABOUT.contacts;
+69
View File
@@ -0,0 +1,69 @@
import {
CircleHelp,
FileText,
History,
Layers,
ListVideo,
PenLine,
ScrollText,
Settings,
Share2,
UserRound,
type LucideIcon,
} from "lucide-react";
import type { IconMotion } from "@components/icons/animated";
/**
* The app's pages, grouped the way the sidebar shows them. One list drives the
* sidebar, the mobile bottom bar, the command palette and the page titles, so
* adding a page is one entry here plus its route in App.tsx.
*/
export interface NavItem {
to: string;
labelKey: string;
icon: LucideIcon;
/** Micro-animation the icon plays on hover / focus. */
motion: IconMotion;
}
export interface NavGroup {
id: "create" | "library" | "system";
labelKey: string;
items: readonly NavItem[];
}
export const NAV_GROUPS: readonly NavGroup[] = [
{
id: "create",
labelKey: "nav.create",
items: [
{ to: "/", labelKey: "tabs.editor", icon: PenLine, motion: "wiggle" },
{ to: "/output", labelKey: "tabs.output", icon: FileText, motion: "bounce" },
{ to: "/batch", labelKey: "tabs.batch", icon: Layers, motion: "pop" },
{ to: "/social", labelKey: "tabs.social", icon: Share2, motion: "tilt" },
{ to: "/playlist", labelKey: "tabs.playlist", icon: ListVideo, motion: "nudge" },
],
},
{
id: "library",
labelKey: "nav.library",
items: [
{ to: "/profiles", labelKey: "tabs.profiles", icon: UserRound, motion: "pop" },
{ to: "/history", labelKey: "tabs.history", icon: History, motion: "spin" },
],
},
{
id: "system",
labelKey: "nav.system",
items: [
{ to: "/settings", labelKey: "tabs.settings", icon: Settings, motion: "spin" },
{ to: "/logs", labelKey: "tabs.logs", icon: ScrollText, motion: "bounce" },
{ to: "/about", labelKey: "tabs.about", icon: CircleHelp, motion: "pop" },
],
},
];
export const NAV_ITEMS: readonly NavItem[] = NAV_GROUPS.flatMap((g) => g.items);
/** The four pages that get their own slot in the mobile bottom bar. */
export const MOBILE_PRIMARY_PATHS: readonly string[] = ["/", "/output", "/batch", "/profiles"];
+10 -5
View File
@@ -1,4 +1,9 @@
import { Music2, Instagram, Facebook, type LucideIcon } from "lucide-react";
import {
FacebookIcon,
InstagramIcon,
TiktokIcon,
type IconComponent,
} from "@components/icons/brand";
/**
* A short-form platform the cross-post generator targets (v0.24.0). Each
@@ -16,7 +21,7 @@ export interface SocialPlatform {
readonly labelKey: string;
/** Caption character ceiling enforced by the platform. */
readonly charLimit: number;
readonly icon: LucideIcon;
readonly icon: IconComponent;
/**
* Platform-popular hashtags appended after the game / genre hashtags.
* Stored with the leading `#`; deduped case-insensitively against the
@@ -30,7 +35,7 @@ export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
id: "tiktok",
labelKey: "socialPost.platforms.tiktok",
charLimit: 4000,
icon: Music2, // lucide has no TikTok glyph; Music2 is the established stand-in
icon: TiktokIcon,
popularHashtags: [
"#fyp",
"#foryou",
@@ -45,7 +50,7 @@ export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
id: "instagram_reels",
labelKey: "socialPost.platforms.instagram_reels",
charLimit: 2200,
icon: Instagram,
icon: InstagramIcon,
popularHashtags: [
"#reels",
"#reelsinstagram",
@@ -60,7 +65,7 @@ export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
id: "facebook_reels",
labelKey: "socialPost.platforms.facebook_reels",
charLimit: 2200,
icon: Facebook,
icon: FacebookIcon,
popularHashtags: [
"#reels",
"#facebookreels",
+39 -3
View File
@@ -64,10 +64,28 @@ export const THIRD_PARTY: readonly ThirdPartyEntry[] = [
url: "https://react.i18next.com/",
},
{
name: "react-hot-toast",
version: v(deps, "react-hot-toast"),
name: "Radix UI",
version: v(deps, "radix-ui"),
license: "MIT",
url: "https://react-hot-toast.com/",
url: "https://www.radix-ui.com/primitives",
},
{
name: "Motion",
version: v(deps, "motion"),
license: "MIT",
url: "https://motion.dev/",
},
{
name: "cmdk",
version: v(deps, "cmdk"),
license: "MIT",
url: "https://cmdk.paco.me/",
},
{
name: "sonner",
version: v(deps, "sonner"),
license: "MIT",
url: "https://sonner.emilkowal.ski/",
},
{
name: "lucide-react",
@@ -75,6 +93,24 @@ export const THIRD_PARTY: readonly ThirdPartyEntry[] = [
license: "ISC",
url: "https://lucide.dev/",
},
{
name: "Simple Icons",
version: v(deps, "simple-icons"),
license: "CC0-1.0",
url: "https://simpleicons.org/",
},
{
name: "Inter",
version: v(deps, "@fontsource-variable/inter"),
license: "OFL-1.1",
url: "https://rsms.me/inter/",
},
{
name: "JetBrains Mono",
version: v(deps, "@fontsource-variable/jetbrains-mono"),
license: "OFL-1.1",
url: "https://www.jetbrains.com/lp/mono/",
},
{
name: "clsx",
version: v(deps, "clsx"),
+1 -1
View File
@@ -1,5 +1,5 @@
import { useState, useCallback, useRef } from "react";
import toast from "react-hot-toast";
import { toast } from "sonner";
import { useTranslation } from "react-i18next";
import { logger } from "@utils/logger";
+1 -1
View File
@@ -1,5 +1,5 @@
import { useCallback } from "react";
import toast from "react-hot-toast";
import { toast } from "sonner";
import { useTranslation } from "react-i18next";
import type { SaveOutcome } from "@utils/file-ops";
+44 -21
View File
@@ -1,55 +1,78 @@
import { useEffect } from "react";
import { useEffect, useRef } from "react";
import { useNavigate } from "react-router-dom";
import { useGeneratedOutput } from "./use-generated-output";
import { useClipboard } from "./use-clipboard";
import toast from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { useOutputCopy } from "./use-output-copy";
interface ShortcutOptions {
export interface ShortcutHandlers {
onToggleHelp: () => void;
onToggleSidebar: () => void;
onTogglePalette: () => void;
}
export function useKeyboardShortcuts({ onToggleHelp, onToggleSidebar }: ShortcutOptions) {
/**
* App-wide keyboard shortcuts. `mod` is Ctrl, or ⌘ on a Mac — both are
* accepted everywhere so an external keyboard never matters.
*
* The listener is attached once and reads the latest output / handlers from a
* ref, instead of being torn down and re-added on every keystroke that
* changes the output.
*/
export function useKeyboardShortcuts(handlers: ShortcutHandlers) {
const navigate = useNavigate();
const output = useGeneratedOutput();
const { copy } = useClipboard();
const { t } = useTranslation("ui");
const copyOutput = useOutputCopy();
const latest = useRef({ handlers, navigate, t, copyOutput });
useEffect(() => {
latest.current = { handlers, navigate, t, copyOutput };
});
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
const ctrl = e.ctrlKey || e.metaKey;
const { handlers, navigate, t, copyOutput } = latest.current;
const mod = e.ctrlKey || e.metaKey;
const key = e.key.toLowerCase();
if (ctrl && (e.key === "Enter" || e.key === "g" || e.key === "G")) {
if (mod && !e.shiftKey && !e.altKey && key === "k") {
e.preventDefault();
handlers.onTogglePalette();
} else if (mod && (e.key === "Enter" || (!e.shiftKey && key === "g"))) {
e.preventDefault();
navigate("/output");
} else if (ctrl && e.shiftKey && e.key === "C") {
} else if (mod && e.shiftKey && key === "c") {
e.preventDefault();
copy(`${output.title}\n\n${output.description}`);
} else if (ctrl && !e.shiftKey && e.key === "s") {
// Same gates as the Output page's Copy All: over-limit or a Strict
// Mode error means nothing is copied.
void copyOutput("all");
} else if (mod && !e.shiftKey && key === "s") {
// The draft is saved on every change already; this only confirms it
// (and keeps the browser's "Save page" dialog out of the way).
e.preventDefault();
toast.success("Draft saved");
} else if (ctrl && !e.shiftKey && (e.key === "b" || e.key === "B")) {
toast.success(t("editor.draftSaved"));
} else if (mod && !e.shiftKey && key === "b") {
// VS Code convention: Ctrl/Cmd+B toggles the sidebar.
e.preventDefault();
onToggleSidebar();
} else if (ctrl && e.key === "/") {
handlers.onToggleSidebar();
} else if (mod && e.key === "/") {
e.preventDefault();
onToggleHelp();
handlers.onToggleHelp();
} else if (
// Bare `?` (Shift+/) opens the cheatsheet too. Skip when the
// user is typing into a form field — `?` is a legitimate
// character in titles, descriptions, and other inputs.
e.key === "?" &&
!ctrl &&
!mod &&
!isEditableTarget(e.target)
) {
e.preventDefault();
onToggleHelp();
handlers.onToggleHelp();
}
};
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
}, [navigate, output.title, output.description, copy, onToggleHelp, onToggleSidebar]);
}, []);
}
/**
+60
View File
@@ -0,0 +1,60 @@
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { getOutputLimitStatus } from "@engine/limits";
import { YT_LIMITS } from "@engine/types";
import { useEditorStore } from "@store/editor-store";
import { useGeneratedOutput } from "./use-generated-output";
import { useClipboard } from "./use-clipboard";
import { useStrictBlock } from "./use-strict-block";
export type OutputCopyTarget = "title" | "description" | "tags" | "all";
/**
* Copy part of the current output from outside the Output page — the command
* palette and Ctrl/⌘+Shift+C — under the same rules as the Output page's own
* buttons: nothing is copied while Strict Mode is blocking or while any field
* is over its YouTube limit. (The shortcut used to copy title + description
* past both gates.)
*/
export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean> {
const { t } = useTranslation("ui");
const output = useGeneratedOutput();
const hasGame = useEditorStore((s) => s.gameName.trim() !== "");
const strictBlocked = useStrictBlock();
const { copy } = useClipboard();
return useCallback(
async (target: OutputCopyTarget) => {
if (!hasGame || !output.title) {
toast.error(t("output.copy.empty"));
return false;
}
if (strictBlocked) {
toast.error(t("strict.copyBlocked"));
return false;
}
if (getOutputLimitStatus(output).blocked) {
toast.error(t("output.limits.bannerTitle"));
return false;
}
switch (target) {
case "title":
return copy(output.title, { limit: YT_LIMITS.TITLE_MAX, fieldLabel: t("output.title") });
case "description":
return copy(output.description, {
limit: YT_LIMITS.DESCRIPTION_MAX,
fieldLabel: t("output.description"),
});
case "tags":
return copy(output.tagString, {
limit: YT_LIMITS.TAGS_MAX,
fieldLabel: t("output.tags"),
});
case "all":
return copy(`${output.title}\n\n${output.description}`);
}
},
[output, hasGame, strictBlocked, copy, t],
);
}
File diff suppressed because it is too large. Load diff
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "Donate",
"toggleTheme": "Toggle theme"
"outputLanguage": "Output language",
"interfaceLanguage": "Interface language",
"switchToLight": "Switch to light theme",
"switchToDark": "Switch to dark theme"
},
"about": {
"tagline": "YouTube title, description, and tag generator for Gameplay No Commentary channels.",
"repoHeading": "Repository & License",
"repoLabel": "GitHub Repo",
"issuesLabel": "Report an Issue",
"reportBugLabel": "Report a Bug",
"discussionsLabel": "Discussions",
"authorLabel": "Author",
"licenseLabel": "License",
"donateHeading": "Donate / Support",
"donateHelp": "If YTDescGen saves you time, consider buying me a coffee. Every bit helps keep the project going.",
"legalHeading": "Legal",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — Repo / General",
"discordGame": "Discord — Game lobby",
"discord": "Discord",
"steam": "Steam profile",
"telegramBot": "Telegram bot",
"telegramUser": "Telegram",
"email": "Email"
"telegramUser": "Telegram"
},
"websiteLabel": "Website",
"wikiLabel": "Wiki & guides",
"contactHeading": "Contact",
"contactHelp": "Pick the address for your topic so it reaches the right inbox.",
"authorWebsite": "Personal website",
"authorLinks": "All links",
"contacts": {
"general": "General questions",
"security": "Security vulnerabilities",
"privacy": "Privacy & data requests",
"legal": "Terms & legal",
"dmca": "DMCA / takedown notices",
"copyright": "Licensing & attribution",
"code": "Source code & conduct",
"sponsor": "Sponsorship & advertising"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "Support the developers",
"online_connectivity_issues": "Online connectivity issues"
},
"videoSettings": "Video Settings",
"quickPreview": "Quick Preview",
"version": "Version",
"clearDraft": "Clear Draft",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "Check link and add again — '{{host}}' suggests '{{suggestedName}}', but Game Name is '{{gameName}}'."
}
},
"collapseAll": "Collapse all",
"expandAll": "Expand all",
"viewOutput": "View output",
"previewEmpty": "Enter a game name to see the preview.",
"genrePick": "Pick genres",
"genreAdd": "Add",
"genreQuickSets": "Quick sets",
"genreRemove": "Remove {{genre}}",
"selectedCount": "{{n}} selected"
},
"output": {
"title": "Title",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}} is too long: {{count}}/{{limit}} chars. Trim before copying.",
"fieldGeneric": "Text",
"failed": "Failed to copy"
"failed": "Failed to copy",
"empty": "Nothing to copy yet — enter a game name in the Editor."
},
"limits": {
"bannerTitle": "Copying is blocked — over the YouTube limit",
@@ -768,6 +792,15 @@
"copyBlocked": "Blocked: another field is over the YouTube limit",
"batchRowBlocked": "This part is over the limit — copying is blocked.",
"batchAllBlocked": "Copy All is blocked — at least one part is over the limit"
},
"emptyTitle": "Nothing to show yet",
"emptyHint": "Enter a game name in the Editor — the title, description and tags appear here.",
"youtubePreview": {
"heading": "On YouTube",
"channelPlaceholder": "Your channel",
"more": "…more",
"titleCut": "Search results and suggestions cut titles at about {{chars}} characters — keep the key words at the front.",
"foldHint": "Viewers see only the first ~{{chars}} characters of the description before “…more”."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "Dismiss",
"scrollToTop": "Scroll to top",
"exported": "Exported",
"exportFailed": "Export failed"
"exportFailed": "Export failed",
"close": "Close",
"edit": "Edit",
"loading": "Loading…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "Import Profiles",
"thirdPartyAdText": "Third-party ad copy",
"thirdPartyAdTextPlaceholder": "e.g. Use code SAVE10 at GameStore.com — 10% off all titles\nSponsored by ChairCo — link in description",
"thirdPartyAdTextHelp": "Optional sponsor / partner / affiliate copy. Shown when 'Third-party ads' is enabled in Settings."
"thirdPartyAdTextHelp": "Optional sponsor / partner / affiliate copy. Shown when 'Third-party ads' is enabled in Settings.",
"intro": "Reusable channel profiles, game presets and full editor templates.",
"hint": "Your channel identity — name, contact, socials and rig. Apply one to fill those fields in the Editor.",
"noChannel": "No channel name",
"socialLinks": "{{n}} social links",
"rigFields": "{{n}} rig fields"
},
"presets": {
"title": "Game Presets",
@@ -965,7 +1006,8 @@
"selectPreset": "Load Game Preset",
"noPresets": "No presets",
"exportPresets": "Export Presets",
"importPresets": "Import Presets"
"importPresets": "Import Presets",
"hint": "A game's name, genres, platform and store links — reused across all its parts."
},
"templates": {
"title": "Templates",
@@ -980,14 +1022,16 @@
"savedAs": "Saved as '{{name}}'",
"appliedToast": "Applied '{{name}}'",
"exportTemplates": "Export Templates",
"importTemplates": "Import Templates"
"importTemplates": "Import Templates",
"applyFailed": "This template is damaged and can't be applied."
},
"history": {
"title": "History",
"emptyState": "No generation history yet.",
"clearAll": "Clear All",
"clearConfirm": "Are you sure you want to clear all history?",
"searchPlaceholder": "Search by game name..."
"searchPlaceholder": "Search by game name...",
"noResults": "No entries match your search."
},
"settings": {
"title": "Settings",
@@ -1043,7 +1087,10 @@
"guardrails": "Guardrails",
"strictMode": "Strict Mode",
"strictModeHint": "Block Generate, Copy and Export while any field has an error. Soft warnings still let you through.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "Between {{min}} and {{max}}.",
"themeDark": "Dark",
"themeLight": "Light"
},
"socialPost": {
"title": "Cross-Post Captions",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "{{captions}} captions"
},
"batch": {
"title": "Batch Mode",
@@ -1070,7 +1118,10 @@
"endPart": "End Part",
"generateBatch": "Generate Batch",
"copyAllBatch": "Copy All",
"emptyState": "Configure batch range and generate."
"emptyState": "Configure batch range and generate.",
"intro": "Generate a run of parts for the game in the Editor, in one or more languages.",
"partLabel": "Part {{n}}",
"summary": "{{parts}} parts × {{languages}} languages"
},
"shortcuts": {
"title": "Keyboard Shortcuts",
@@ -1126,6 +1177,25 @@
"delisted": "Removed / delisted from store",
"low_views": "Low views / engagement",
"time": "No time / shifted priorities"
},
"intro": "Title, description and pinned comment for a series playlist, from the game in the Editor.",
"totalVideosPlaceholder": "e.g. 25",
"customNotePlaceholder": "Optional note…",
"statuses": {
"completed": "Completed",
"dropped": "Dropped",
"incomplete": "Incomplete",
"in_progress": "In progress"
},
"contentTypes": {
"full_gameplay": "Full gameplay",
"boss_fights": "Boss fights",
"speedrun": "Speedrun",
"all_endings": "All endings",
"dlc": "DLC",
"100_percent": "100%",
"guide": "Guide",
"highlights": "Highlights"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "Export TXT",
"sessionCurrent": "Current session",
"sessionLabel": "Session {{n}}",
"entriesShort": "entries"
"entriesShort": "entries",
"copyEntry": "Copy entry",
"deleteEntry": "Delete entry",
"errorCount": "{{n}} errors",
"warnCount": "{{n}} warnings",
"summary": "{{entries}} entries · {{sessions}} sessions",
"levels": {
"all": "All",
"error": "Error",
"warn": "Warning",
"info": "Info",
"debug": "Debug"
}
},
"strict": {
"blockedTitle": "Strict Mode: {{count}} field(s) need fixing",
"fixHint": "Fix these in the Editor, or turn Strict Mode off in Settings."
"fixHint": "Fix these in the Editor, or turn Strict Mode off in Settings.",
"copyBlocked": "Strict Mode: fix the flagged fields before copying."
},
"legal": {
"title": "Legal",
@@ -1175,5 +1258,35 @@
"notice": "The Apache-2.0 NOTICE file with copyright and attribution.",
"conduct": "Contributor Covenant rules for the project's community spaces."
}
},
"nav": {
"create": "Create",
"library": "Library",
"system": "System",
"main": "Main navigation",
"more": "More",
"skipToContent": "Skip to content"
},
"command": {
"open": "Search or run a command…",
"title": "Command palette",
"placeholder": "Type a command or search…",
"empty": "No results.",
"groups": {
"navigate": "Go to",
"copy": "Copy",
"profiles": "Apply profile",
"presets": "Apply game preset",
"templates": "Apply template",
"preferences": "Preferences",
"help": "Help"
},
"interfaceIn": "Interface language: {{language}}",
"outputIn": "Output language: {{language}}",
"wiki": "Open the wiki"
},
"library": {
"profileApplied": "Profile “{{name}}” applied",
"presetApplied": "Preset “{{name}}” applied"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "Donar",
"toggleTheme": "Cambiar tema"
"outputLanguage": "Idioma de salida",
"interfaceLanguage": "Idioma de la interfaz",
"switchToLight": "Cambiar al tema claro",
"switchToDark": "Cambiar al tema oscuro"
},
"about": {
"tagline": "Generador de título, descripción y etiquetas de YouTube para canales de Gameplay sin comentarios.",
"repoHeading": "Repositorio y Licencia",
"repoLabel": "Repositorio en GitHub",
"issuesLabel": "Reportar un Problema",
"reportBugLabel": "Reportar un bug",
"discussionsLabel": "Discusiones",
"authorLabel": "Autor",
"licenseLabel": "Licencia",
"donateHeading": "Donar / Apoyar",
"donateHelp": "Si YTDescGen te ahorra tiempo, considera invitarme un café. Cada aporte ayuda al proyecto.",
"legalHeading": "Legal",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — Repo / General",
"discordGame": "Discord — Sala de juego",
"discord": "Discord",
"steam": "Perfil de Steam",
"telegramBot": "Bot de Telegram",
"telegramUser": "Telegram",
"email": "Email"
"telegramUser": "Telegram"
},
"websiteLabel": "Sitio web",
"wikiLabel": "Wiki y guías",
"contactHeading": "Contacto",
"contactHelp": "Elige la dirección según el tema para que llegue al buzón correcto.",
"authorWebsite": "Sitio personal",
"authorLinks": "Todos los enlaces",
"contacts": {
"general": "Consultas generales",
"security": "Vulnerabilidades de seguridad",
"privacy": "Privacidad y solicitudes de datos",
"legal": "Términos y asuntos legales",
"dmca": "DMCA / avisos de retirada",
"copyright": "Licencias y atribución",
"code": "Código fuente y conducta",
"sponsor": "Patrocinios y publicidad"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "Apoya a los desarrolladores",
"online_connectivity_issues": "Problemas de conexión online"
},
"videoSettings": "Ajustes de Video",
"quickPreview": "Vista Previa Rápida",
"version": "Versión",
"clearDraft": "Limpiar Borrador",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "Comprueba el enlace y vuelve a añadirlo — '{{host}}' sugiere '{{suggestedName}}', pero el Nombre del juego es '{{gameName}}'."
}
},
"collapseAll": "Contraer todo",
"expandAll": "Expandir todo",
"viewOutput": "Ver resultado",
"previewEmpty": "Escribe el nombre del juego para ver la vista previa.",
"genrePick": "Elegir géneros",
"genreAdd": "Añadir",
"genreQuickSets": "Conjuntos rápidos",
"genreRemove": "Quitar {{genre}}",
"selectedCount": "{{n}} seleccionados"
},
"output": {
"title": "Título",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}} demasiado largo: {{count}}/{{limit}} caracteres. Recórtalo antes de copiar.",
"fieldGeneric": "Texto",
"failed": "Error al copiar"
"failed": "Error al copiar",
"empty": "Aún no hay nada que copiar: escribe el nombre del juego en el Editor."
},
"limits": {
"bannerTitle": "Copia bloqueada: supera el límite de YouTube",
@@ -768,6 +792,15 @@
"copyBlocked": "Bloqueado: otro campo supera el límite de YouTube",
"batchRowBlocked": "Esta parte supera el límite: copia bloqueada.",
"batchAllBlocked": "Copiar todo bloqueado: al menos una parte supera el límite"
},
"emptyTitle": "Aún no hay nada que mostrar",
"emptyHint": "Escribe el nombre del juego en el Editor y aquí aparecerán el título, la descripción y las etiquetas.",
"youtubePreview": {
"heading": "En YouTube",
"channelPlaceholder": "Tu canal",
"more": "…más",
"titleCut": "Los resultados de búsqueda y las sugerencias cortan el título en unos {{chars}} caracteres: pon las palabras clave al principio.",
"foldHint": "Los espectadores solo ven los primeros ~{{chars}} caracteres de la descripción antes de «…más»."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "Descartar",
"scrollToTop": "Volver arriba",
"exported": "Exportado",
"exportFailed": "Error al exportar"
"exportFailed": "Error al exportar",
"close": "Cerrar",
"edit": "Editar",
"loading": "Cargando…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "Importar Perfiles",
"thirdPartyAdText": "Texto publicitario de terceros",
"thirdPartyAdTextPlaceholder": "ej. Usa el código SAVE10 en GameStore.com — 10% de descuento\nPatrocinado por ChairCo — enlace en la descripción",
"thirdPartyAdTextHelp": "Texto opcional de patrocinador / socio / afiliado. Se muestra cuando 'Anuncios de terceros' está activado en Ajustes."
"thirdPartyAdTextHelp": "Texto opcional de patrocinador / socio / afiliado. Se muestra cuando 'Anuncios de terceros' está activado en Ajustes.",
"intro": "Perfiles de canal, preajustes de juego y plantillas completas del editor, reutilizables.",
"hint": "La identidad de tu canal: nombre, contacto, redes y equipo. Aplica uno para rellenar esos campos en el Editor.",
"noChannel": "Sin nombre de canal",
"socialLinks": "{{n}} enlaces sociales",
"rigFields": "{{n}} datos del equipo"
},
"templates": {
"title": "Plantillas",
@@ -968,7 +1009,8 @@
"savedAs": "Guardado como '{{name}}'",
"appliedToast": "Aplicado '{{name}}'",
"exportTemplates": "Exportar Plantillas",
"importTemplates": "Importar Plantillas"
"importTemplates": "Importar Plantillas",
"applyFailed": "Esta plantilla está dañada y no se puede aplicar."
},
"presets": {
"title": "Preajustes de Juego",
@@ -980,14 +1022,16 @@
"selectPreset": "Cargar Preajuste de Juego",
"noPresets": "Sin preajustes",
"exportPresets": "Exportar Preajustes",
"importPresets": "Importar Preajustes"
"importPresets": "Importar Preajustes",
"hint": "Nombre, géneros, plataforma y enlaces de tienda de un juego, reutilizados en todas sus partes."
},
"history": {
"title": "Historial",
"emptyState": "Aún no hay historial. Genera una descripción para empezar.",
"clearAll": "Borrar Todo",
"clearConfirm": "¿Estás seguro de que quieres borrar todo el historial?",
"searchPlaceholder": "Buscar en el historial..."
"searchPlaceholder": "Buscar en el historial...",
"noResults": "Ninguna entrada coincide con la búsqueda."
},
"settings": {
"title": "Ajustes",
@@ -1043,7 +1087,10 @@
"guardrails": "Protecciones",
"strictMode": "Modo estricto",
"strictModeHint": "Bloquea Generar, Copiar y Exportar mientras algún campo tenga un error. Las advertencias leves no bloquean.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "Entre {{min}} y {{max}}.",
"themeDark": "Oscuro",
"themeLight": "Claro"
},
"socialPost": {
"title": "Publicaciones multiplataforma",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "{{captions}} textos"
},
"batch": {
"title": "Generación por Lote",
@@ -1070,7 +1118,10 @@
"endPart": "Parte Final",
"generateBatch": "Generar Lote",
"copyAllBatch": "Copiar Todo el Lote",
"emptyState": "Configura el rango de partes y genera descripciones en lote."
"emptyState": "Configura el rango de partes y genera descripciones en lote.",
"intro": "Genera una serie de partes del juego del Editor, en uno o varios idiomas.",
"partLabel": "Parte {{n}}",
"summary": "{{parts}} partes × {{languages}} idiomas"
},
"shortcuts": {
"title": "Atajos de Teclado",
@@ -1126,6 +1177,25 @@
"delisted": "Eliminado / retirado de la tienda",
"low_views": "Pocas visitas / interacción",
"time": "Sin tiempo / cambio de prioridades"
},
"intro": "Título, descripción y comentario fijado para la playlist de una serie, a partir del juego del Editor.",
"totalVideosPlaceholder": "p. ej. 25",
"customNotePlaceholder": "Nota opcional…",
"statuses": {
"completed": "Completada",
"dropped": "Abandonada",
"incomplete": "Incompleta",
"in_progress": "En curso"
},
"contentTypes": {
"full_gameplay": "Partida completa",
"boss_fights": "Jefes",
"speedrun": "Speedrun",
"all_endings": "Todos los finales",
"dlc": "DLC",
"100_percent": "100%",
"guide": "Guía",
"highlights": "Momentos destacados"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "Exportar TXT",
"sessionCurrent": "Sesión actual",
"sessionLabel": "Sesión {{n}}",
"entriesShort": "entradas"
"entriesShort": "entradas",
"copyEntry": "Copiar entrada",
"deleteEntry": "Eliminar entrada",
"errorCount": "{{n}} errores",
"warnCount": "{{n}} avisos",
"summary": "{{entries}} entradas · {{sessions}} sesiones",
"levels": {
"all": "Todos",
"error": "Error",
"warn": "Aviso",
"info": "Info",
"debug": "Depuración"
}
},
"strict": {
"blockedTitle": "Modo estricto: {{count}} campo(s) por corregir",
"fixHint": "Corrígelos en el Editor o desactiva el Modo estricto en Ajustes."
"fixHint": "Corrígelos en el Editor o desactiva el Modo estricto en Ajustes.",
"copyBlocked": "Modo estricto: corrige los campos marcados antes de copiar."
},
"legal": {
"title": "Información legal",
@@ -1175,5 +1258,35 @@
"notice": "El archivo NOTICE de Apache-2.0 con derechos de autor y atribución.",
"conduct": "Normas del Contributor Covenant para los espacios comunitarios del proyecto."
}
},
"nav": {
"create": "Crear",
"library": "Biblioteca",
"system": "Sistema",
"main": "Navegación principal",
"more": "Más",
"skipToContent": "Saltar al contenido"
},
"command": {
"open": "Buscar o ejecutar un comando…",
"title": "Paleta de comandos",
"placeholder": "Escribe un comando o busca…",
"empty": "Sin resultados.",
"groups": {
"navigate": "Ir a",
"copy": "Copiar",
"profiles": "Aplicar perfil",
"presets": "Aplicar preajuste de juego",
"templates": "Aplicar plantilla",
"preferences": "Preferencias",
"help": "Ayuda"
},
"interfaceIn": "Idioma de la interfaz: {{language}}",
"outputIn": "Idioma de salida: {{language}}",
"wiki": "Abrir la wiki"
},
"library": {
"profileApplied": "Perfil «{{name}}» aplicado",
"presetApplied": "Preajuste «{{name}}» aplicado"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "Donasi",
"toggleTheme": "Ganti tema"
"outputLanguage": "Bahasa keluaran",
"interfaceLanguage": "Bahasa antarmuka",
"switchToLight": "Beralih ke tema terang",
"switchToDark": "Beralih ke tema gelap"
},
"about": {
"tagline": "Generator judul, deskripsi, dan tag YouTube untuk channel Gameplay Tanpa Komentar.",
"repoHeading": "Repositori & Lisensi",
"repoLabel": "Repo GitHub",
"issuesLabel": "Laporkan Masalah",
"reportBugLabel": "Laporkan Bug",
"discussionsLabel": "Diskusi",
"authorLabel": "Penulis",
"licenseLabel": "Lisensi",
"donateHeading": "Donasi / Dukungan",
"donateHelp": "Kalau YTDescGen menghemat waktumu, pertimbangkan traktir kopi. Setiap dukungan membantu proyek ini terus jalan.",
"legalHeading": "Legal",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — Repo / Umum",
"discordGame": "Discord — Lobi game",
"discord": "Discord",
"steam": "Profil Steam",
"telegramBot": "Bot Telegram",
"telegramUser": "Telegram",
"email": "Email"
"telegramUser": "Telegram"
},
"websiteLabel": "Situs web",
"wikiLabel": "Wiki & panduan",
"contactHeading": "Kontak",
"contactHelp": "Pilih alamat sesuai topik agar sampai ke kotak masuk yang tepat.",
"authorWebsite": "Situs pribadi",
"authorLinks": "Semua tautan",
"contacts": {
"general": "Pertanyaan umum",
"security": "Kerentanan keamanan",
"privacy": "Privasi & permintaan data",
"legal": "Ketentuan & hukum",
"dmca": "DMCA / permintaan penghapusan",
"copyright": "Lisensi & atribusi",
"code": "Kode sumber & perilaku",
"sponsor": "Sponsor & iklan"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "Dukung para pengembang",
"online_connectivity_issues": "Kendala koneksi daring"
},
"videoSettings": "Pengaturan Video",
"quickPreview": "Pratinjau Cepat",
"version": "Versi",
"clearDraft": "Hapus Draf",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "Periksa tautannya lalu tambahkan lagi — '{{host}}' menunjukkan '{{suggestedName}}', tetapi Nama Game-nya '{{gameName}}'."
}
},
"collapseAll": "Ciutkan semua",
"expandAll": "Buka semua",
"viewOutput": "Lihat hasil",
"previewEmpty": "Isi nama game untuk melihat pratinjau.",
"genrePick": "Pilih genre",
"genreAdd": "Tambah",
"genreQuickSets": "Set cepat",
"genreRemove": "Hapus {{genre}}",
"selectedCount": "{{n}} dipilih"
},
"output": {
"title": "Judul",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}} terlalu panjang: {{count}}/{{limit}} karakter. Persingkat sebelum menyalin.",
"fieldGeneric": "Teks",
"failed": "Gagal menyalin"
"failed": "Gagal menyalin",
"empty": "Belum ada yang bisa disalin — isi nama game di Editor."
},
"limits": {
"bannerTitle": "Penyalinan diblokir — melebihi batas YouTube",
@@ -768,6 +792,15 @@
"copyBlocked": "Diblokir: kolom lain melebihi batas YouTube",
"batchRowBlocked": "Part ini melebihi batas — penyalinan diblokir.",
"batchAllBlocked": "Salin Semua diblokir — setidaknya ada satu part yang melebihi batas"
},
"emptyTitle": "Belum ada yang ditampilkan",
"emptyHint": "Isi nama game di Editor — judul, deskripsi, dan tag akan muncul di sini.",
"youtubePreview": {
"heading": "Di YouTube",
"channelPlaceholder": "Kanal Anda",
"more": "…selengkapnya",
"titleCut": "Hasil pencarian dan saran memotong judul di sekitar {{chars}} karakter — taruh kata kunci penting di depan.",
"foldHint": "Penonton hanya melihat sekitar {{chars}} karakter pertama deskripsi sebelum “…selengkapnya”."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "Tutup",
"scrollToTop": "Ke atas",
"exported": "Diekspor",
"exportFailed": "Ekspor gagal"
"exportFailed": "Ekspor gagal",
"close": "Tutup",
"edit": "Edit",
"loading": "Memuat…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "Impor Profil",
"thirdPartyAdText": "Teks iklan pihak ketiga",
"thirdPartyAdTextPlaceholder": "mis. Pakai kode SAVE10 di GameStore.com — diskon 10% semua judul\nDisponsori ChairCo — tautan di deskripsi",
"thirdPartyAdTextHelp": "Teks sponsor / mitra / afiliasi opsional. Muncul saat 'Iklan pihak ketiga' diaktifkan di Pengaturan."
"thirdPartyAdTextHelp": "Teks sponsor / mitra / afiliasi opsional. Muncul saat 'Iklan pihak ketiga' diaktifkan di Pengaturan.",
"intro": "Profil kanal, preset game, dan template editor lengkap yang bisa dipakai ulang.",
"hint": "Identitas kanal Anda — nama, kontak, media sosial, dan spesifikasi PC. Terapkan untuk mengisi kolom tersebut di Editor.",
"noChannel": "Belum ada nama kanal",
"socialLinks": "{{n}} tautan sosial",
"rigFields": "{{n}} item spesifikasi"
},
"presets": {
"title": "Preset Game",
@@ -965,7 +1006,8 @@
"selectPreset": "Muat Preset Game",
"noPresets": "Tidak ada preset",
"exportPresets": "Ekspor Preset",
"importPresets": "Impor Preset"
"importPresets": "Impor Preset",
"hint": "Nama, genre, platform, dan tautan toko sebuah game — dipakai ulang di semua part-nya."
},
"templates": {
"title": "Template",
@@ -980,14 +1022,16 @@
"savedAs": "Disimpan sebagai '{{name}}'",
"appliedToast": "'{{name}}' diterapkan",
"exportTemplates": "Ekspor Template",
"importTemplates": "Impor Template"
"importTemplates": "Impor Template",
"applyFailed": "Template ini rusak dan tidak dapat diterapkan."
},
"history": {
"title": "Riwayat",
"emptyState": "Belum ada riwayat pembuatan.",
"clearAll": "Hapus Semua",
"clearConfirm": "Yakin ingin menghapus seluruh riwayat?",
"searchPlaceholder": "Cari berdasarkan nama game..."
"searchPlaceholder": "Cari berdasarkan nama game...",
"noResults": "Tidak ada entri yang cocok dengan pencarian."
},
"settings": {
"title": "Pengaturan",
@@ -1043,7 +1087,10 @@
"guardrails": "Pengaman",
"strictMode": "Mode Ketat",
"strictModeHint": "Memblokir Buat, Salin, dan Ekspor selama ada kolom yang error. Peringatan ringan tetap lolos.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "Antara {{min}} dan {{max}}.",
"themeDark": "Gelap",
"themeLight": "Terang"
},
"socialPost": {
"title": "Caption Lintas Platform",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "{{captions}} caption"
},
"batch": {
"title": "Mode Batch",
@@ -1070,7 +1118,10 @@
"endPart": "Part Akhir",
"generateBatch": "Buat Batch",
"copyAllBatch": "Salin Semua",
"emptyState": "Atur rentang batch lalu buat."
"emptyState": "Atur rentang batch lalu buat.",
"intro": "Buat serangkaian part untuk game di Editor, dalam satu atau beberapa bahasa.",
"partLabel": "Part {{n}}",
"summary": "{{parts}} part × {{languages}} bahasa"
},
"shortcuts": {
"title": "Pintasan Keyboard",
@@ -1126,6 +1177,25 @@
"delisted": "Dihapus / ditarik dari toko",
"low_views": "Sedikit penonton / interaksi rendah",
"time": "Tidak ada waktu / prioritas berubah"
},
"intro": "Judul, deskripsi, dan komentar sematan untuk playlist seri, dari game di Editor.",
"totalVideosPlaceholder": "mis. 25",
"customNotePlaceholder": "Catatan opsional…",
"statuses": {
"completed": "Selesai",
"dropped": "Dihentikan",
"incomplete": "Belum selesai",
"in_progress": "Sedang berjalan"
},
"contentTypes": {
"full_gameplay": "Gameplay penuh",
"boss_fights": "Pertarungan bos",
"speedrun": "Speedrun",
"all_endings": "Semua ending",
"dlc": "DLC",
"100_percent": "100%",
"guide": "Panduan",
"highlights": "Sorotan"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "Ekspor TXT",
"sessionCurrent": "Sesi saat ini",
"sessionLabel": "Sesi {{n}}",
"entriesShort": "entri"
"entriesShort": "entri",
"copyEntry": "Salin entri",
"deleteEntry": "Hapus entri",
"errorCount": "{{n}} galat",
"warnCount": "{{n}} peringatan",
"summary": "{{entries}} entri · {{sessions}} sesi",
"levels": {
"all": "Semua",
"error": "Galat",
"warn": "Peringatan",
"info": "Info",
"debug": "Debug"
}
},
"strict": {
"blockedTitle": "Mode Ketat: {{count}} kolom perlu diperbaiki",
"fixHint": "Perbaiki di Editor, atau matikan Mode Ketat di Pengaturan."
"fixHint": "Perbaiki di Editor, atau matikan Mode Ketat di Pengaturan.",
"copyBlocked": "Mode Ketat: perbaiki kolom yang ditandai sebelum menyalin."
},
"legal": {
"title": "Informasi hukum",
@@ -1175,5 +1258,35 @@
"notice": "Berkas NOTICE Apache-2.0 berisi hak cipta dan atribusi.",
"conduct": "Aturan Contributor Covenant untuk ruang komunitas proyek."
}
},
"nav": {
"create": "Buat",
"library": "Pustaka",
"system": "Sistem",
"main": "Navigasi utama",
"more": "Lainnya",
"skipToContent": "Lompat ke konten"
},
"command": {
"open": "Cari atau jalankan perintah…",
"title": "Palet perintah",
"placeholder": "Ketik perintah atau cari…",
"empty": "Tidak ada hasil.",
"groups": {
"navigate": "Buka",
"copy": "Salin",
"profiles": "Terapkan profil",
"presets": "Terapkan preset game",
"templates": "Terapkan template",
"preferences": "Preferensi",
"help": "Bantuan"
},
"interfaceIn": "Bahasa antarmuka: {{language}}",
"outputIn": "Bahasa keluaran: {{language}}",
"wiki": "Buka wiki"
},
"library": {
"profileApplied": "Profil “{{name}}” diterapkan",
"presetApplied": "Preset “{{name}}” diterapkan"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "寄付",
"toggleTheme": "テーマ切り替え"
"outputLanguage": "出力言語",
"interfaceLanguage": "表示言語",
"switchToLight": "ライトテーマに切り替え",
"switchToDark": "ダークテーマに切り替え"
},
"about": {
"tagline": "ゲームプレイ実況なしチャンネル向けのタイトル・説明文・タグ生成ツール。",
"repoHeading": "リポジトリ & ライセンス",
"repoLabel": "GitHub リポジトリ",
"issuesLabel": "問題を報告",
"reportBugLabel": "バグを報告",
"discussionsLabel": "ディスカッション",
"authorLabel": "作者",
"licenseLabel": "ライセンス",
"donateHeading": "寄付 / サポート",
"donateHelp": "YTDescGenが時短に役立ったら、コーヒー一杯分でも支援していただけると嬉しいです。",
"legalHeading": "法的事項",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — リポジトリ / 一般",
"discordGame": "Discord — ゲームロビー",
"discord": "Discord",
"steam": "Steamプロフィール",
"telegramBot": "Telegram bot",
"telegramUser": "Telegram",
"email": "メール"
"telegramUser": "Telegram"
},
"websiteLabel": "ウェブサイト",
"wikiLabel": "Wiki とガイド",
"contactHeading": "お問い合わせ",
"contactHelp": "内容に合ったアドレスを選ぶと、適切な窓口に届きます。",
"authorWebsite": "個人サイト",
"authorLinks": "リンク一覧",
"contacts": {
"general": "一般的なお問い合わせ",
"security": "セキュリティの脆弱性",
"privacy": "プライバシー・データに関する請求",
"legal": "利用規約・法務",
"dmca": "DMCA / 削除申し立て",
"copyright": "ライセンス・クレジット表記",
"code": "ソースコード・行動規範",
"sponsor": "スポンサー・広告"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "開発者を応援",
"online_connectivity_issues": "オンライン接続不調"
},
"videoSettings": "動画設定",
"quickPreview": "クイックプレビュー",
"version": "バージョン",
"clearDraft": "下書きをクリア",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "リンクを確認して再追加してください — 「{{host}}」は「{{suggestedName}}」を指していますが、ゲーム名は「{{gameName}}」です。"
}
},
"collapseAll": "すべて閉じる",
"expandAll": "すべて開く",
"viewOutput": "出力を見る",
"previewEmpty": "ゲーム名を入力するとプレビューが表示されます。",
"genrePick": "ジャンルを選択",
"genreAdd": "追加",
"genreQuickSets": "クイックセット",
"genreRemove": "{{genre}} を外す",
"selectedCount": "{{n}} 件選択中"
},
"output": {
"title": "タイトル",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}}が長すぎます:{{count}}/{{limit}}文字。コピー前に短縮してください。",
"fieldGeneric": "テキスト",
"failed": "コピーに失敗しました"
"failed": "コピーに失敗しました",
"empty": "まだコピーできる内容がありません — エディターでゲーム名を入力してください。"
},
"limits": {
"bannerTitle": "コピーできません — YouTube の上限を超えています",
@@ -768,6 +792,15 @@
"copyBlocked": "ブロック中: 他の項目が YouTube の上限を超えています",
"batchRowBlocked": "このパートは上限を超えています — コピーできません。",
"batchAllBlocked": "すべてコピーはできません — 上限を超えたパートがあります"
},
"emptyTitle": "まだ表示する内容がありません",
"emptyHint": "エディターでゲーム名を入力すると、タイトル・説明文・タグがここに表示されます。",
"youtubePreview": {
"heading": "YouTube での表示",
"channelPlaceholder": "あなたのチャンネル",
"more": "…もっと見る",
"titleCut": "検索結果やおすすめではタイトルが約 {{chars}} 文字で切れます — 重要な語を先頭に置きましょう。",
"foldHint": "「…もっと見る」の前に表示されるのは説明文の最初の約 {{chars}} 文字だけです。"
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "閉じる",
"scrollToTop": "トップへ戻る",
"exported": "エクスポートしました",
"exportFailed": "エクスポートに失敗しました"
"exportFailed": "エクスポートに失敗しました",
"close": "閉じる",
"edit": "編集",
"loading": "読み込み中…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "プロフィールをインポート",
"thirdPartyAdText": "サードパーティ広告コピー",
"thirdPartyAdTextPlaceholder": "例: コード SAVE10 で GameStore.com 全タイトル10%オフ\nスポンサー: ChairCo — リンクは説明欄に",
"thirdPartyAdTextHelp": "任意のスポンサー / パートナー / アフィリエイト文。設定で「サードパーティ広告」をオンにすると表示されます。"
"thirdPartyAdTextHelp": "任意のスポンサー / パートナー / アフィリエイト文。設定で「サードパーティ広告」をオンにすると表示されます。",
"intro": "再利用できるチャンネルプロフィール、ゲームプリセット、エディターのテンプレート。",
"hint": "チャンネル情報 — 名前・連絡先・SNS・PC 構成。適用するとエディターの該当項目に入力されます。",
"noChannel": "チャンネル名なし",
"socialLinks": "SNS リンク {{n}} 件",
"rigFields": "PC 構成 {{n}} 項目"
},
"templates": {
"title": "テンプレート",
@@ -968,7 +1009,8 @@
"savedAs": "'{{name}}' として保存しました",
"appliedToast": "'{{name}}' を適用しました",
"exportTemplates": "テンプレートをエクスポート",
"importTemplates": "テンプレートをインポート"
"importTemplates": "テンプレートをインポート",
"applyFailed": "このテンプレートは破損しているため適用できません。"
},
"presets": {
"title": "ゲームプリセット",
@@ -980,14 +1022,16 @@
"selectPreset": "ゲームプリセットを選択",
"noPresets": "プリセットなし",
"exportPresets": "プリセットをエクスポート",
"importPresets": "プリセットをインポート"
"importPresets": "プリセットをインポート",
"hint": "ゲーム名・ジャンル・プラットフォーム・ストアリンク — すべてのパートで使い回せます。"
},
"history": {
"title": "履歴",
"emptyState": "履歴がありません。",
"clearAll": "すべて削除",
"clearConfirm": "すべての履歴を削除しますか?",
"searchPlaceholder": "ゲーム名で検索..."
"searchPlaceholder": "ゲーム名で検索...",
"noResults": "検索に一致する履歴はありません。"
},
"settings": {
"title": "設定",
@@ -1043,7 +1087,10 @@
"guardrails": "ガードレール",
"strictMode": "厳格モード",
"strictModeHint": "エラーのある項目が残っている間、生成・コピー・エクスポートをブロックします。軽度の警告は通過できます。",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "{{min}}〜{{max}} の範囲で入力してください。",
"themeDark": "ダーク",
"themeLight": "ライト"
},
"socialPost": {
"title": "クロス投稿キャプション",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "キャプション {{captions}} 件"
},
"batch": {
"title": "一括モード",
@@ -1070,7 +1118,10 @@
"endPart": "終了パート",
"generateBatch": "一括生成",
"copyAllBatch": "すべてコピー",
"emptyState": "範囲を設定して生成してください。"
"emptyState": "範囲を設定して生成してください。",
"intro": "エディターのゲームについて、連続するパートを 1 つ以上の言語でまとめて生成します。",
"partLabel": "パート {{n}}",
"summary": "{{parts}} パート × {{languages}} 言語"
},
"shortcuts": {
"title": "キーボードショートカット",
@@ -1126,6 +1177,25 @@
"delisted": "ストアから削除 / 配信終了",
"low_views": "再生回数 / 反応が少ない",
"time": "時間がない / 優先度の変更"
},
"intro": "エディターのゲームから、シリーズ再生リストのタイトル・説明文・固定コメントを作成します。",
"totalVideosPlaceholder": "例: 25",
"customNotePlaceholder": "メモ(任意)…",
"statuses": {
"completed": "完結",
"dropped": "打ち切り",
"incomplete": "未完",
"in_progress": "進行中"
},
"contentTypes": {
"full_gameplay": "フルプレイ",
"boss_fights": "ボス戦",
"speedrun": "スピードラン",
"all_endings": "全エンディング",
"dlc": "DLC",
"100_percent": "100%",
"guide": "攻略",
"highlights": "ハイライト"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "TXT でエクスポート",
"sessionCurrent": "現在のセッション",
"sessionLabel": "セッション {{n}}",
"entriesShort": "件"
"entriesShort": "件",
"copyEntry": "エントリをコピー",
"deleteEntry": "エントリを削除",
"errorCount": "エラー {{n}} 件",
"warnCount": "警告 {{n}} 件",
"summary": "{{entries}} 件 · {{sessions}} セッション",
"levels": {
"all": "すべて",
"error": "エラー",
"warn": "警告",
"info": "情報",
"debug": "デバッグ"
}
},
"strict": {
"blockedTitle": "厳格モード: {{count}} 件の項目に修正が必要です",
"fixHint": "エディタで修正するか、設定で厳格モードをオフにしてください。"
"fixHint": "エディタで修正するか、設定で厳格モードをオフにしてください。",
"copyBlocked": "Strict Mode: コピーする前に指摘された項目を修正してください。"
},
"legal": {
"title": "法的情報",
@@ -1175,5 +1258,35 @@
"notice": "著作権と帰属を記した Apache-2.0 の NOTICE ファイル。",
"conduct": "プロジェクトのコミュニティに適用される Contributor Covenant の規則。"
}
},
"nav": {
"create": "作成",
"library": "ライブラリ",
"system": "システム",
"main": "メインナビゲーション",
"more": "その他",
"skipToContent": "本文へスキップ"
},
"command": {
"open": "検索またはコマンドを実行…",
"title": "コマンドパレット",
"placeholder": "コマンドを入力、または検索…",
"empty": "結果がありません。",
"groups": {
"navigate": "移動",
"copy": "コピー",
"profiles": "プロフィールを適用",
"presets": "ゲームプリセットを適用",
"templates": "テンプレートを適用",
"preferences": "設定",
"help": "ヘルプ"
},
"interfaceIn": "表示言語: {{language}}",
"outputIn": "出力言語: {{language}}",
"wiki": "Wiki を開く"
},
"library": {
"profileApplied": "プロフィール「{{name}}」を適用しました",
"presetApplied": "プリセット「{{name}}」を適用しました"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "후원",
"toggleTheme": "테마 전환"
"outputLanguage": "출력 언어",
"interfaceLanguage": "인터페이스 언어",
"switchToLight": "라이트 테마로 전환",
"switchToDark": "다크 테마로 전환"
},
"about": {
"tagline": "게임플레이 무편집 채널을 위한 YouTube 제목, 설명, 태그 생성기.",
"repoHeading": "저장소 및 라이선스",
"repoLabel": "GitHub 저장소",
"issuesLabel": "문제 보고",
"reportBugLabel": "버그 신고",
"discussionsLabel": "디스커션",
"authorLabel": "저자",
"licenseLabel": "라이선스",
"donateHeading": "후원 / 지원",
"donateHelp": "YTDescGen이 시간을 아껴드렸다면 커피 한 잔으로 응원 부탁드립니다.",
"legalHeading": "법적 고지",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — 저장소 / 일반",
"discordGame": "Discord — 게임 로비",
"discord": "Discord",
"steam": "Steam 프로필",
"telegramBot": "텔레그램 봇",
"telegramUser": "텔레그램",
"email": "이메일"
"telegramUser": "텔레그램"
},
"websiteLabel": "웹사이트",
"wikiLabel": "위키 및 가이드",
"contactHeading": "연락처",
"contactHelp": "주제에 맞는 주소를 선택하면 담당자에게 바로 전달됩니다.",
"authorWebsite": "개인 웹사이트",
"authorLinks": "모든 링크",
"contacts": {
"general": "일반 문의",
"security": "보안 취약점",
"privacy": "개인정보 및 데이터 요청",
"legal": "약관 및 법무",
"dmca": "DMCA / 삭제 요청",
"copyright": "라이선스 및 저작자 표시",
"code": "소스 코드 및 행동 강령",
"sponsor": "스폰서십 및 광고"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "개발자 응원",
"online_connectivity_issues": "온라인 연결 문제"
},
"videoSettings": "영상 설정",
"quickPreview": "빠른 미리보기",
"version": "버전",
"clearDraft": "초안 지우기",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "링크를 확인하고 다시 추가하세요 — '{{host}}'은(는) '{{suggestedName}}'을(를) 가리키지만, 게임 이름은 '{{gameName}}'입니다."
}
},
"collapseAll": "모두 접기",
"expandAll": "모두 펼치기",
"viewOutput": "출력 보기",
"previewEmpty": "게임 이름을 입력하면 미리보기가 표시됩니다.",
"genrePick": "장르 선택",
"genreAdd": "추가",
"genreQuickSets": "빠른 세트",
"genreRemove": "{{genre}} 제거",
"selectedCount": "{{n}}개 선택됨"
},
"output": {
"title": "제목",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}}이(가) 너무 깁니다: {{count}}/{{limit}}자. 복사 전에 줄여주세요.",
"fieldGeneric": "텍스트",
"failed": "복사 실패"
"failed": "복사 실패",
"empty": "아직 복사할 내용이 없습니다 — 에디터에서 게임 이름을 입력하세요."
},
"limits": {
"bannerTitle": "복사 차단됨 — YouTube 제한 초과",
@@ -768,6 +792,15 @@
"copyBlocked": "차단됨: 다른 항목이 YouTube 제한을 초과했습니다",
"batchRowBlocked": "이 파트가 제한을 초과했습니다 — 복사할 수 없습니다.",
"batchAllBlocked": "전체 복사 차단됨 — 제한을 초과한 파트가 있습니다"
},
"emptyTitle": "아직 표시할 내용이 없습니다",
"emptyHint": "에디터에서 게임 이름을 입력하면 제목, 설명, 태그가 여기에 표시됩니다.",
"youtubePreview": {
"heading": "YouTube에서",
"channelPlaceholder": "내 채널",
"more": "…더보기",
"titleCut": "검색 결과와 추천 영상에서는 제목이 약 {{chars}}자에서 잘립니다 — 핵심 단어를 앞에 두세요.",
"foldHint": "시청자는 “…더보기” 전에 설명의 처음 약 {{chars}}자만 봅니다."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "닫기",
"scrollToTop": "맨 위로",
"exported": "내보냈습니다",
"exportFailed": "내보내기 실패"
"exportFailed": "내보내기 실패",
"close": "닫기",
"edit": "편집",
"loading": "불러오는 중…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "프로필 가져오기",
"thirdPartyAdText": "써드파티 광고 문구",
"thirdPartyAdTextPlaceholder": "예: 코드 SAVE10 입력 시 GameStore.com 전 타이틀 10% 할인\n스폰서: ChairCo — 링크는 설명란에",
"thirdPartyAdTextHelp": "선택적 스폰서 / 파트너 / 제휴 문구. 설정에서 '써드파티 광고'가 활성화되면 표시됩니다."
"thirdPartyAdTextHelp": "선택적 스폰서 / 파트너 / 제휴 문구. 설정에서 '써드파티 광고'가 활성화되면 표시됩니다.",
"intro": "다시 쓸 수 있는 채널 프로필, 게임 프리셋, 에디터 템플릿.",
"hint": "채널 정보 — 이름, 연락처, SNS, PC 사양. 적용하면 에디터의 해당 항목이 채워집니다.",
"noChannel": "채널 이름 없음",
"socialLinks": "SNS 링크 {{n}}개",
"rigFields": "PC 사양 {{n}}개"
},
"templates": {
"title": "템플릿",
@@ -968,7 +1009,8 @@
"savedAs": "'{{name}}'(으)로 저장됨",
"appliedToast": "'{{name}}' 적용됨",
"exportTemplates": "템플릿 내보내기",
"importTemplates": "템플릿 가져오기"
"importTemplates": "템플릿 가져오기",
"applyFailed": "이 템플릿은 손상되어 적용할 수 없습니다."
},
"presets": {
"title": "게임 프리셋",
@@ -980,14 +1022,16 @@
"selectPreset": "게임 프리셋 불러오기",
"noPresets": "프리셋 없음",
"exportPresets": "프리셋 내보내기",
"importPresets": "프리셋 가져오기"
"importPresets": "프리셋 가져오기",
"hint": "게임 이름, 장르, 플랫폼, 스토어 링크 — 모든 파트에서 재사용됩니다."
},
"history": {
"title": "기록",
"emptyState": "기록이 없습니다. 설명을 생성하면 여기에 표시됩니다.",
"clearAll": "전체 삭제",
"clearConfirm": "모든 기록을 삭제하시겠습니까?",
"searchPlaceholder": "기록 검색..."
"searchPlaceholder": "기록 검색...",
"noResults": "검색과 일치하는 기록이 없습니다."
},
"settings": {
"title": "설정",
@@ -1043,7 +1087,10 @@
"guardrails": "안전장치",
"strictMode": "엄격 모드",
"strictModeHint": "오류가 있는 항목이 남아 있는 동안 생성·복사·내보내기를 차단합니다. 가벼운 경고는 통과합니다.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "{{min}}~{{max}} 사이의 값.",
"themeDark": "다크",
"themeLight": "라이트"
},
"socialPost": {
"title": "크로스포스트 캡션",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "캡션 {{captions}}개"
},
"batch": {
"title": "일괄 생성",
@@ -1070,7 +1118,10 @@
"endPart": "끝 파트",
"generateBatch": "일괄 생성",
"copyAllBatch": "전체 일괄 복사",
"emptyState": "파트 범위를 설정하고 일괄 설명을 생성하세요."
"emptyState": "파트 범위를 설정하고 일괄 설명을 생성하세요.",
"intro": "에디터의 게임에 대해 연속된 파트를 하나 이상의 언어로 한 번에 생성합니다.",
"partLabel": "파트 {{n}}",
"summary": "파트 {{parts}}개 × 언어 {{languages}}개"
},
"shortcuts": {
"title": "키보드 단축키",
@@ -1126,6 +1177,25 @@
"delisted": "스토어에서 삭제 / 판매 종료",
"low_views": "조회수 / 반응 저조",
"time": "시간 부족 / 우선순위 변경"
},
"intro": "에디터의 게임으로 시리즈 재생목록의 제목, 설명, 고정 댓글을 만듭니다.",
"totalVideosPlaceholder": "예: 25",
"customNotePlaceholder": "메모 (선택)…",
"statuses": {
"completed": "완결",
"dropped": "중단",
"incomplete": "미완",
"in_progress": "진행 중"
},
"contentTypes": {
"full_gameplay": "풀 플레이",
"boss_fights": "보스전",
"speedrun": "스피드런",
"all_endings": "모든 엔딩",
"dlc": "DLC",
"100_percent": "100%",
"guide": "공략",
"highlights": "하이라이트"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "TXT 내보내기",
"sessionCurrent": "현재 세션",
"sessionLabel": "세션 {{n}}",
"entriesShort": "건"
"entriesShort": "건",
"copyEntry": "항목 복사",
"deleteEntry": "항목 삭제",
"errorCount": "오류 {{n}}개",
"warnCount": "경고 {{n}}개",
"summary": "항목 {{entries}}개 · 세션 {{sessions}}개",
"levels": {
"all": "전체",
"error": "오류",
"warn": "경고",
"info": "정보",
"debug": "디버그"
}
},
"strict": {
"blockedTitle": "엄격 모드: {{count}}개 항목을 수정해야 합니다",
"fixHint": "편집기에서 수정하거나 설정에서 엄격 모드를 끄세요."
"fixHint": "편집기에서 수정하거나 설정에서 엄격 모드를 끄세요.",
"copyBlocked": "Strict Mode: 복사하기 전에 표시된 항목을 수정하세요."
},
"legal": {
"title": "법적 고지",
@@ -1175,5 +1258,35 @@
"notice": "저작권과 출처 표시를 담은 Apache-2.0 NOTICE 파일.",
"conduct": "프로젝트 커뮤니티 공간에 적용되는 Contributor Covenant 규칙."
}
},
"nav": {
"create": "만들기",
"library": "라이브러리",
"system": "시스템",
"main": "주 메뉴",
"more": "더보기",
"skipToContent": "본문으로 건너뛰기"
},
"command": {
"open": "검색 또는 명령 실행…",
"title": "명령 팔레트",
"placeholder": "명령을 입력하거나 검색…",
"empty": "결과가 없습니다.",
"groups": {
"navigate": "이동",
"copy": "복사",
"profiles": "프로필 적용",
"presets": "게임 프리셋 적용",
"templates": "템플릿 적용",
"preferences": "환경설정",
"help": "도움말"
},
"interfaceIn": "인터페이스 언어: {{language}}",
"outputIn": "출력 언어: {{language}}",
"wiki": "위키 열기"
},
"library": {
"profileApplied": "프로필 “{{name}}” 적용됨",
"presetApplied": "프리셋 “{{name}}” 적용됨"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "Doar",
"toggleTheme": "Alternar tema"
"outputLanguage": "Idioma de saída",
"interfaceLanguage": "Idioma da interface",
"switchToLight": "Mudar para o tema claro",
"switchToDark": "Mudar para o tema escuro"
},
"about": {
"tagline": "Gerador de títulos, descrições e tags do YouTube para canais de Gameplay Sem Comentários.",
"repoHeading": "Repositório e Licença",
"repoLabel": "Repositório no GitHub",
"issuesLabel": "Reportar um problema",
"reportBugLabel": "Reportar um bug",
"discussionsLabel": "Discussões",
"authorLabel": "Autor",
"licenseLabel": "Licença",
"donateHeading": "Doar / Apoiar",
"donateHelp": "Se o YTDescGen te poupa tempo, considere me pagar um café. Cada ajuda mantém o projeto vivo.",
"legalHeading": "Jurídico",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — Repositório / Geral",
"discordGame": "Discord — Sala de jogos",
"discord": "Discord",
"steam": "Perfil na Steam",
"telegramBot": "Bot do Telegram",
"telegramUser": "Telegram",
"email": "E-mail"
"telegramUser": "Telegram"
},
"websiteLabel": "Site",
"wikiLabel": "Wiki e guias",
"contactHeading": "Contato",
"contactHelp": "Escolha o endereço do assunto para chegar à caixa certa.",
"authorWebsite": "Site pessoal",
"authorLinks": "Todos os links",
"contacts": {
"general": "Dúvidas gerais",
"security": "Vulnerabilidades de segurança",
"privacy": "Privacidade e pedidos de dados",
"legal": "Termos e jurídico",
"dmca": "DMCA / pedidos de remoção",
"copyright": "Licenças e atribuição",
"code": "Código-fonte e conduta",
"sponsor": "Patrocínio e publicidade"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "Apoiem os desenvolvedores",
"online_connectivity_issues": "Problemas de conexão online"
},
"videoSettings": "Configurações do vídeo",
"quickPreview": "Prévia rápida",
"version": "Versão",
"clearDraft": "Limpar rascunho",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "Confira o link e adicione de novo — '{{host}}' sugere '{{suggestedName}}', mas o Nome do Jogo é '{{gameName}}'."
}
},
"collapseAll": "Recolher tudo",
"expandAll": "Expandir tudo",
"viewOutput": "Ver saída",
"previewEmpty": "Digite o nome do jogo para ver a prévia.",
"genrePick": "Escolher gêneros",
"genreAdd": "Adicionar",
"genreQuickSets": "Conjuntos rápidos",
"genreRemove": "Remover {{genre}}",
"selectedCount": "{{n}} selecionados"
},
"output": {
"title": "Título",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}} está longo demais: {{count}}/{{limit}} caracteres. Reduza antes de copiar.",
"fieldGeneric": "Texto",
"failed": "Falha ao copiar"
"failed": "Falha ao copiar",
"empty": "Ainda não há nada para copiar — digite o nome do jogo no Editor."
},
"limits": {
"bannerTitle": "Cópia bloqueada — acima do limite do YouTube",
@@ -768,6 +792,15 @@
"copyBlocked": "Bloqueado: outro campo está acima do limite do YouTube",
"batchRowBlocked": "Esta parte está acima do limite — a cópia está bloqueada.",
"batchAllBlocked": "Copiar tudo está bloqueado — pelo menos uma parte está acima do limite"
},
"emptyTitle": "Nada para mostrar ainda",
"emptyHint": "Digite o nome do jogo no Editor — o título, a descrição e as tags aparecem aqui.",
"youtubePreview": {
"heading": "No YouTube",
"channelPlaceholder": "Seu canal",
"more": "…mais",
"titleCut": "Resultados de busca e sugestões cortam o título em cerca de {{chars}} caracteres — coloque as palavras-chave no início.",
"foldHint": "Os espectadores veem só os primeiros ~{{chars}} caracteres da descrição antes de “…mais”."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "Dispensar",
"scrollToTop": "Voltar ao topo",
"exported": "Exportado",
"exportFailed": "Falha ao exportar"
"exportFailed": "Falha ao exportar",
"close": "Fechar",
"edit": "Editar",
"loading": "Carregando…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "Importar perfis",
"thirdPartyAdText": "Texto de anúncio de terceiros",
"thirdPartyAdTextPlaceholder": "ex.: Use o código SAVE10 na GameStore.com — 10% de desconto em todos os títulos\nPatrocinado pela ChairCo — link na descrição",
"thirdPartyAdTextHelp": "Texto opcional de patrocinador / parceiro / afiliado. Aparece quando 'Anúncios de terceiros' está ativo nas Configurações."
"thirdPartyAdTextHelp": "Texto opcional de patrocinador / parceiro / afiliado. Aparece quando 'Anúncios de terceiros' está ativo nas Configurações.",
"intro": "Perfis de canal, presets de jogo e modelos completos do editor, reutilizáveis.",
"hint": "A identidade do seu canal — nome, contato, redes e setup. Aplique um para preencher esses campos no Editor.",
"noChannel": "Sem nome de canal",
"socialLinks": "{{n}} links sociais",
"rigFields": "{{n}} itens do setup"
},
"presets": {
"title": "Presets de jogo",
@@ -965,7 +1006,8 @@
"selectPreset": "Carregar preset de jogo",
"noPresets": "Nenhum preset",
"exportPresets": "Exportar presets",
"importPresets": "Importar presets"
"importPresets": "Importar presets",
"hint": "Nome, gêneros, plataforma e links de loja de um jogo — reutilizados em todas as partes."
},
"templates": {
"title": "Modelos",
@@ -980,14 +1022,16 @@
"savedAs": "Salvo como '{{name}}'",
"appliedToast": "'{{name}}' aplicado",
"exportTemplates": "Exportar modelos",
"importTemplates": "Importar modelos"
"importTemplates": "Importar modelos",
"applyFailed": "Este modelo está corrompido e não pode ser aplicado."
},
"history": {
"title": "Histórico",
"emptyState": "Ainda não há histórico de geração.",
"clearAll": "Limpar tudo",
"clearConfirm": "Tem certeza de que quer limpar todo o histórico?",
"searchPlaceholder": "Buscar pelo nome do jogo..."
"searchPlaceholder": "Buscar pelo nome do jogo...",
"noResults": "Nenhuma entrada corresponde à busca."
},
"settings": {
"title": "Configurações",
@@ -1043,7 +1087,10 @@
"guardrails": "Proteções",
"strictMode": "Modo estrito",
"strictModeHint": "Bloqueia Gerar, Copiar e Exportar enquanto algum campo tiver erro. Avisos leves continuam passando.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "Entre {{min}} e {{max}}.",
"themeDark": "Escuro",
"themeLight": "Claro"
},
"socialPost": {
"title": "Legendas para outras redes",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "{{captions}} legendas"
},
"batch": {
"title": "Modo em lote",
@@ -1070,7 +1118,10 @@
"endPart": "Parte final",
"generateBatch": "Gerar lote",
"copyAllBatch": "Copiar tudo",
"emptyState": "Configure o intervalo do lote e gere."
"emptyState": "Configure o intervalo do lote e gere.",
"intro": "Gere uma sequência de partes do jogo do Editor, em um ou mais idiomas.",
"partLabel": "Parte {{n}}",
"summary": "{{parts}} partes × {{languages}} idiomas"
},
"shortcuts": {
"title": "Atalhos de teclado",
@@ -1126,6 +1177,25 @@
"delisted": "Removido / retirado da loja",
"low_views": "Poucas visualizações / pouco engajamento",
"time": "Sem tempo / mudança de prioridades"
},
"intro": "Título, descrição e comentário fixado para a playlist de uma série, a partir do jogo do Editor.",
"totalVideosPlaceholder": "ex.: 25",
"customNotePlaceholder": "Observação opcional…",
"statuses": {
"completed": "Concluída",
"dropped": "Abandonada",
"incomplete": "Incompleta",
"in_progress": "Em andamento"
},
"contentTypes": {
"full_gameplay": "Gameplay completo",
"boss_fights": "Chefes",
"speedrun": "Speedrun",
"all_endings": "Todos os finais",
"dlc": "DLC",
"100_percent": "100%",
"guide": "Guia",
"highlights": "Destaques"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "Exportar TXT",
"sessionCurrent": "Sessão atual",
"sessionLabel": "Sessão {{n}}",
"entriesShort": "registros"
"entriesShort": "registros",
"copyEntry": "Copiar entrada",
"deleteEntry": "Excluir entrada",
"errorCount": "{{n}} erros",
"warnCount": "{{n}} avisos",
"summary": "{{entries}} entradas · {{sessions}} sessões",
"levels": {
"all": "Todos",
"error": "Erro",
"warn": "Aviso",
"info": "Info",
"debug": "Depuração"
}
},
"strict": {
"blockedTitle": "Modo estrito: {{count}} campo(s) precisam de correção",
"fixHint": "Corrija no Editor ou desative o Modo estrito nas Configurações."
"fixHint": "Corrija no Editor ou desative o Modo estrito nas Configurações.",
"copyBlocked": "Modo estrito: corrija os campos marcados antes de copiar."
},
"legal": {
"title": "Informações legais",
@@ -1175,5 +1258,35 @@
"notice": "O arquivo NOTICE da Apache-2.0 com direitos autorais e atribuição.",
"conduct": "Regras do Contributor Covenant para os espaços da comunidade do projeto."
}
},
"nav": {
"create": "Criar",
"library": "Biblioteca",
"system": "Sistema",
"main": "Navegação principal",
"more": "Mais",
"skipToContent": "Pular para o conteúdo"
},
"command": {
"open": "Pesquisar ou executar um comando…",
"title": "Paleta de comandos",
"placeholder": "Digite um comando ou pesquise…",
"empty": "Nenhum resultado.",
"groups": {
"navigate": "Ir para",
"copy": "Copiar",
"profiles": "Aplicar perfil",
"presets": "Aplicar preset de jogo",
"templates": "Aplicar modelo",
"preferences": "Preferências",
"help": "Ajuda"
},
"interfaceIn": "Idioma da interface: {{language}}",
"outputIn": "Idioma de saída: {{language}}",
"wiki": "Abrir a wiki"
},
"library": {
"profileApplied": "Perfil “{{name}}” aplicado",
"presetApplied": "Preset “{{name}}” aplicado"
}
}
+133 -20
View File
@@ -22,17 +22,18 @@
},
"header": {
"donate": "Ủng hộ",
"toggleTheme": "Đổi giao diện sáng/tối"
"outputLanguage": "Ngôn ngữ đầu ra",
"interfaceLanguage": "Ngôn ngữ giao diện",
"switchToLight": "Chuyển sang giao diện sáng",
"switchToDark": "Chuyển sang giao diện tối"
},
"about": {
"tagline": "Công cụ tạo title, description, tag cho kênh YouTube Gameplay No Commentary.",
"repoHeading": "Repository & License",
"repoLabel": "GitHub Repo",
"issuesLabel": "Báo lỗi / Góp ý",
"reportBugLabel": "Báo lỗi",
"discussionsLabel": "Thảo luận",
"authorLabel": "Tác giả",
"licenseLabel": "Giấy phép",
"donateHeading": "Ủng hộ / Donate",
"donateHelp": "Nếu YTDescGen giúp bạn tiết kiệm thời gian, mời mình một ly cà phê nhé. Mọi ủng hộ đều giúp dự án tiếp tục.",
"legalHeading": "Pháp lý",
@@ -51,12 +52,26 @@
"x": "X / Twitter",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"discord": "Discord — Repo / Chung",
"discordGame": "Discord — Game lobby",
"discord": "Discord",
"steam": "Profile Steam",
"telegramBot": "Telegram bot",
"telegramUser": "Telegram",
"email": "Email"
"telegramUser": "Telegram"
},
"websiteLabel": "Trang web",
"wikiLabel": "Wiki & hướng dẫn",
"contactHeading": "Liên hệ",
"contactHelp": "Chọn địa chỉ đúng chủ đề để thư đến đúng người.",
"authorWebsite": "Trang cá nhân",
"authorLinks": "Tất cả liên kết",
"contacts": {
"general": "Câu hỏi chung",
"security": "Lỗ hổng bảo mật",
"privacy": "Quyền riêng tư & yêu cầu dữ liệu",
"legal": "Điều khoản & pháp lý",
"dmca": "DMCA / yêu cầu gỡ bỏ",
"copyright": "Giấy phép & ghi công",
"code": "Mã nguồn & quy tắc ứng xử",
"sponsor": "Tài trợ & quảng cáo"
}
},
"editor": {
@@ -701,7 +716,6 @@
"support_developers": "Ủng hộ nhà phát triển",
"online_connectivity_issues": "Lỗi kết nối online"
},
"videoSettings": "Cài đặt Video",
"quickPreview": "Xem trước nhanh",
"version": "Phiên bản",
"clearDraft": "Xóa bản nháp",
@@ -728,7 +742,16 @@
},
"warning": {
"linkNameMismatch": "Kiểm tra link và thêm lại — '{{host}}' gợi ý '{{suggestedName}}', nhưng Tên Game đang là '{{gameName}}'."
}
},
"collapseAll": "Thu gọn tất cả",
"expandAll": "Mở rộng tất cả",
"viewOutput": "Xem kết quả",
"previewEmpty": "Nhập tên game để xem trước.",
"genrePick": "Chọn thể loại",
"genreAdd": "Thêm",
"genreQuickSets": "Bộ chọn nhanh",
"genreRemove": "Bỏ {{genre}}",
"selectedCount": "Đã chọn {{n}}"
},
"output": {
"title": "Tiêu đề",
@@ -759,7 +782,8 @@
"copy": {
"overLimit": "{{field}} quá dài: {{count}}/{{limit}} ký tự. Cắt bớt trước khi copy.",
"fieldGeneric": "Văn bản",
"failed": "Copy thất bại"
"failed": "Copy thất bại",
"empty": "Chưa có gì để sao chép — hãy nhập tên game trong trang Chỉnh sửa."
},
"limits": {
"bannerTitle": "Không thể sao chép — vượt giới hạn của YouTube",
@@ -768,6 +792,15 @@
"copyBlocked": "Bị chặn: một trường khác vượt giới hạn của YouTube",
"batchRowBlocked": "Phần này vượt giới hạn — không thể sao chép.",
"batchAllBlocked": "Không thể sao chép tất cả — có ít nhất một phần vượt giới hạn"
},
"emptyTitle": "Chưa có gì để hiển thị",
"emptyHint": "Nhập tên game trong trang Chỉnh sửa — tiêu đề, mô tả và tags sẽ hiện ở đây.",
"youtubePreview": {
"heading": "Trên YouTube",
"channelPlaceholder": "Kênh của bạn",
"more": "…thêm",
"titleCut": "Kết quả tìm kiếm và đề xuất cắt tiêu đề ở khoảng {{chars}} ký tự — hãy đặt từ khóa quan trọng lên đầu.",
"foldHint": "Người xem chỉ thấy khoảng {{chars}} ký tự đầu của mô tả trước nút “…thêm”."
}
},
"common": {
@@ -784,7 +817,10 @@
"dismiss": "Bỏ qua",
"scrollToTop": "Cuộn lên đầu trang",
"exported": "Đã xuất",
"exportFailed": "Xuất thất bại"
"exportFailed": "Xuất thất bại",
"close": "Đóng",
"edit": "Sửa",
"loading": "Đang tải…"
},
"errorPages": {
"actions": {
@@ -953,7 +989,12 @@
"importProfiles": "Nhập hồ sơ",
"thirdPartyAdText": "Nội dung quảng cáo bên thứ 3",
"thirdPartyAdTextPlaceholder": "vd: Dùng code SAVE10 tại GameStore.com — giảm 10% mọi tựa game\nTài trợ bởi ChairCo — link ở phần mô tả",
"thirdPartyAdTextHelp": "Nội dung sponsor / partner / affiliate (tuỳ chọn). Hiện khi bật 'Quảng cáo bên thứ 3' trong Cài đặt."
"thirdPartyAdTextHelp": "Nội dung sponsor / partner / affiliate (tuỳ chọn). Hiện khi bật 'Quảng cáo bên thứ 3' trong Cài đặt.",
"intro": "Hồ sơ kênh, preset game và template editor để dùng lại.",
"hint": "Thông tin kênh — tên, liên hệ, mạng xã hội và cấu hình máy. Áp dụng để điền các trường này trong trang Chỉnh sửa.",
"noChannel": "Chưa có tên kênh",
"socialLinks": "{{n}} liên kết MXH",
"rigFields": "{{n}} mục cấu hình"
},
"templates": {
"title": "Template",
@@ -968,7 +1009,8 @@
"savedAs": "Đã lưu '{{name}}'",
"appliedToast": "Đã áp dụng '{{name}}'",
"exportTemplates": "Xuất template",
"importTemplates": "Nhập template"
"importTemplates": "Nhập template",
"applyFailed": "Template này bị hỏng, không thể áp dụng."
},
"presets": {
"title": "Cài đặt Game",
@@ -980,14 +1022,16 @@
"selectPreset": "Chọn Game Preset",
"noPresets": "Chưa có preset",
"exportPresets": "Xuất presets",
"importPresets": "Nhập presets"
"importPresets": "Nhập presets",
"hint": "Tên game, thể loại, nền tảng và link cửa hàng — dùng lại cho mọi tập."
},
"history": {
"title": "Lịch sử",
"emptyState": "Chưa có lịch sử.",
"clearAll": "Xóa tất cả",
"clearConfirm": "Bạn có chắc muốn xóa toàn bộ lịch sử?",
"searchPlaceholder": "Tìm theo tên game..."
"searchPlaceholder": "Tìm theo tên game...",
"noResults": "Không có mục nào khớp với tìm kiếm."
},
"settings": {
"title": "Cài đặt",
@@ -1043,7 +1087,10 @@
"guardrails": "Bảo vệ",
"strictMode": "Chế độ nghiêm ngặt",
"strictModeHint": "Chặn Generate, Copy và Export khi còn trường bị lỗi. Cảnh báo nhẹ vẫn cho qua.",
"genrePlaylistsBadge": "{{filled}}/{{total}}"
"genrePlaylistsBadge": "{{filled}}/{{total}}",
"numberRange": "Từ {{min}} đến {{max}}.",
"themeDark": "Tối",
"themeLight": "Sáng"
},
"socialPost": {
"title": "Bài đăng đa nền tảng",
@@ -1062,7 +1109,8 @@
"tiktok": "TikTok",
"instagram_reels": "Instagram Reels",
"facebook_reels": "Facebook Reels"
}
},
"bulkSummary": "{{captions}} caption"
},
"batch": {
"title": "Chế độ hàng loạt",
@@ -1070,7 +1118,10 @@
"endPart": "Phần kết thúc",
"generateBatch": "Tạo hàng loạt",
"copyAllBatch": "Sao chép tất cả",
"emptyState": "Cấu hình phạm vi và tạo."
"emptyState": "Cấu hình phạm vi và tạo.",
"intro": "Tạo nhiều tập liên tiếp cho game trong trang Chỉnh sửa, bằng một hoặc nhiều ngôn ngữ.",
"partLabel": "Tập {{n}}",
"summary": "{{parts}} tập × {{languages}} ngôn ngữ"
},
"shortcuts": {
"title": "Phím tắt",
@@ -1126,6 +1177,25 @@
"delisted": "Bị gỡ / khai tử khỏi store",
"low_views": "Lượt xem / tương tác thấp",
"time": "Không có thời gian / đổi ưu tiên"
},
"intro": "Tiêu đề, mô tả và bình luận ghim cho playlist của cả series, lấy từ game trong trang Chỉnh sửa.",
"totalVideosPlaceholder": "vd: 25",
"customNotePlaceholder": "Ghi chú (không bắt buộc)…",
"statuses": {
"completed": "Hoàn thành",
"dropped": "Bỏ dở",
"incomplete": "Chưa xong",
"in_progress": "Đang thực hiện"
},
"contentTypes": {
"full_gameplay": "Full gameplay",
"boss_fights": "Đánh boss",
"speedrun": "Speedrun",
"all_endings": "Tất cả kết thúc",
"dlc": "DLC",
"100_percent": "100%",
"guide": "Hướng dẫn",
"highlights": "Highlight"
}
},
"logs": {
@@ -1140,11 +1210,24 @@
"exportTxt": "Xuất TXT",
"sessionCurrent": "Phiên hiện tại",
"sessionLabel": "Phiên {{n}}",
"entriesShort": "bản ghi"
"entriesShort": "bản ghi",
"copyEntry": "Sao chép mục",
"deleteEntry": "Xóa mục",
"errorCount": "{{n}} lỗi",
"warnCount": "{{n}} cảnh báo",
"summary": "{{entries}} mục · {{sessions}} phiên",
"levels": {
"all": "Tất cả",
"error": "Lỗi",
"warn": "Cảnh báo",
"info": "Thông tin",
"debug": "Gỡ lỗi"
}
},
"strict": {
"blockedTitle": "Strict Mode: {{count}} trường cần sửa",
"fixHint": "Hãy sửa trong tab Editor, hoặc tắt Strict Mode trong Cài đặt."
"fixHint": "Hãy sửa trong tab Editor, hoặc tắt Strict Mode trong Cài đặt.",
"copyBlocked": "Strict Mode: hãy sửa các trường bị đánh dấu trước khi sao chép."
},
"legal": {
"title": "Pháp lý",
@@ -1175,5 +1258,35 @@
"notice": "Tệp NOTICE theo Apache-2.0 với thông tin bản quyền và ghi công.",
"conduct": "Quy tắc Contributor Covenant cho các không gian cộng đồng của dự án."
}
},
"nav": {
"create": "Tạo",
"library": "Thư viện",
"system": "Hệ thống",
"main": "Điều hướng chính",
"more": "Thêm",
"skipToContent": "Chuyển đến nội dung"
},
"command": {
"open": "Tìm kiếm hoặc chạy lệnh…",
"title": "Bảng lệnh",
"placeholder": "Nhập lệnh hoặc tìm kiếm…",
"empty": "Không có kết quả.",
"groups": {
"navigate": "Đi tới",
"copy": "Sao chép",
"profiles": "Áp dụng hồ sơ",
"presets": "Áp dụng preset game",
"templates": "Áp dụng template",
"preferences": "Tùy chọn",
"help": "Trợ giúp"
},
"interfaceIn": "Ngôn ngữ giao diện: {{language}}",
"outputIn": "Ngôn ngữ đầu ra: {{language}}",
"wiki": "Mở wiki"
},
"library": {
"profileApplied": "Đã áp dụng hồ sơ “{{name}}”",
"presetApplied": "Đã áp dụng preset “{{name}}”"
}
}
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff. Show more