Complete Phase 1 implementation of YTDescGen: - Project setup: Vite 5 + React 18 + TypeScript strict + Tailwind CSS dark theme - Config layer: 7 video types, 10 genres, 7 platforms, rig/social fields - i18n: EN/VI/JA with separate UI and template namespaces + validation script - Core engine: title-builder, description-builder, tag-generator (pure TS, zero React) - 42 unit tests covering all engine functions - Zustand stores: editor + settings with localStorage persistence - UI: 6 primitives, 11 editor components, 4 output components, 3 layout components - Pages: Editor (form + quick preview) and Output (title/desc/tags + copy) - CI/CD: GitHub Actions for lint/typecheck/test/build + GitHub Pages deploy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import { useTranslation } from "react-i18next";
|
|
import { Input } from "@components/ui/Input";
|
|
import { Select } from "@components/ui/Select";
|
|
import { PLATFORMS } from "@config/platforms";
|
|
import { VIDEO_TYPES } from "@config/video-types";
|
|
import { useEditorStore } from "@store/editor-store";
|
|
|
|
export function GameInfoForm() {
|
|
const { t } = useTranslation("ui");
|
|
const store = useEditorStore();
|
|
|
|
const currentVideoType = VIDEO_TYPES.find((vt) => vt.id === store.videoType);
|
|
const extraFields: readonly string[] = currentVideoType?.extraFields ?? [];
|
|
|
|
const platformOptions = PLATFORMS.map((p) => ({ value: p.id, label: p.label }));
|
|
|
|
return (
|
|
<div className="flex flex-col gap-3">
|
|
<Input
|
|
label={t("editor.gameName")}
|
|
placeholder={t("editor.gameNamePlaceholder")}
|
|
value={store.gameName}
|
|
onChange={(e) => store.set("gameName", e.target.value)}
|
|
/>
|
|
<Input
|
|
label={t("editor.channelName")}
|
|
placeholder={t("editor.channelNamePlaceholder")}
|
|
value={store.channelName}
|
|
onChange={(e) => store.set("channelName", e.target.value)}
|
|
/>
|
|
<Select
|
|
label={t("editor.platform")}
|
|
options={platformOptions}
|
|
value={store.platform}
|
|
onChange={(v) => store.set("platform", v)}
|
|
/>
|
|
{extraFields.includes("partNumber") && (
|
|
<Input
|
|
label={t("editor.partNumber")}
|
|
placeholder={t("editor.partNumberPlaceholder")}
|
|
value={store.partNumber ?? ""}
|
|
onChange={(e) => store.set("partNumber", e.target.value)}
|
|
/>
|
|
)}
|
|
{extraFields.includes("bossName") && (
|
|
<Input
|
|
label={t("editor.bossName")}
|
|
placeholder={t("editor.bossNamePlaceholder")}
|
|
value={store.bossName ?? ""}
|
|
onChange={(e) => store.set("bossName", e.target.value)}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|