fix(data): hardware names, YouTube's tag count, chapters, history duplicates, validation
Hardware
- GPU catalog rewritten with stable ids and official names: descriptions
read "NVIDIA GeForce RTX 5080", "AMD Radeon RX 9070 XT", "Apple M4 Pro"
instead of "NVIDIA RTX 5080" / "AMD RX 9070 XT" / "Apple Silicon M4 Pro".
Cards that never shipped (RX 9080, RX 9090 XT, Arc B380) are gone;
RTX 50/40/30 laptop GPUs, RX 9070 GRE, VRAM variants, Radeon/Intel
integrated graphics, handheld APUs and Apple M5 (Pro/Max/Ultra) added.
One searchable picker ("5080", "rog ally") replaces Brand › Series ›
Model, with free text for anything else.
- Old `brand|series|model` values are migrated (editor v19, profiles v3,
templates v2, and on load/import); unknown cards keep their full name.
- RAM: 24/48/192 GB, LPDDR4/4X/5/5X, optional speed ("32 GB DDR5-6000");
no DDR6/DDR7; plain "DDR"; "48GB GB" fixed; changing the size no longer
clears the type. OS: SteamOS, Bazzite, CachyOS, Nobara, openSUSE,
Fedora 43/44; Linux reads "Ubuntu 24.04 LTS". CPU: suggestions, and
Windows' "Intel(R) Core(TM) … CPU @ 3.60GHz" is tidied on blur.
- The rig block uses translated labels in a fixed order (CPU, GPU, RAM…)
in both the description and the social captions.
Tags
- Measured the way YouTube counts (quotes around multi-word tags, one
comma between): 15 of 51 real tag sets were over 500 by YouTube's count
while showing under. Counters and the limit warning use the same count.
- Trimming keeps trying shorter tags after one that doesn't fit.
- "Elden Ring Steam", "itch.io gameplay" (was STEAM / ITCHIO); no platform
tags for a publisher site; "best open world games" (was "openworld");
RPG/simulation/card pools no longer carry other genres' tags.
Timestamps
- Keywords need a word boundary: "Final Fantasy VII" stays a title (was
"Ending Fantasy VII"), "Introduction" stays whole.
- Accepts [0:00], 0:00 - label and editor frame counts; pt-BR and
Indonesian keywords; a Tidy up button; a live check of YouTube's
chapter rules (0:00 first, 3+, 10 s apart, in order).
Output and data
- History keeps one entry per video (updated in place) instead of one per
Output visit; existing duplicates are folded (history v3). The History
Limit is healed on every load.
- A field over its limit blocks only its own copy button (Copy All: title
or description); a warning when YouTube would reject "<" or ">".
- Validation: Steam /sub/, /bundle/ and s.team links, GOG/Humble/xbox.com
without www, regional Nintendo sites, Microsoft Store, Luna; social
links with www./m./twitter.com; phone, YouTube Music and
video-in-playlist links (normalised); email domains need a TLD; the live
URL is validated; no bare "#" hashtag.
- The engine takes the year from the caller; "Ending N" follows the output
language.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f8dc0ad64
commit
7e6c12152f
66 files changed
+2817
-1059
No files matched your search
@@ -3,6 +3,8 @@ import clsx from "clsx";
|
||||
import { Input } from "@components/ui/Input";
|
||||
import { Textarea } from "@components/ui/Textarea";
|
||||
import { Field, controlClasses } from "@components/ui/Field";
|
||||
import { ValidatedInput } from "@components/ui/ValidatedInput";
|
||||
import { validateUrl } from "@utils/validation";
|
||||
import { VIDEO_TYPES } from "@config/video-types";
|
||||
import {
|
||||
GACHA_QUEST_TYPE_GROUPS,
|
||||
@@ -194,12 +196,19 @@ export function ExtraFieldsInput() {
|
||||
</>
|
||||
)}
|
||||
{extraFields.includes("liveUrl") && (
|
||||
<Input
|
||||
// Validated like every other link (it wasn't): a typo here goes
|
||||
// straight into the description as a dead "Watch / replay" line.
|
||||
<ValidatedInput
|
||||
fieldId="liveUrl"
|
||||
labelKey="editor.liveUrl"
|
||||
label={t("editor.liveUrl")}
|
||||
maxLength={FIELD_LIMITS.URL}
|
||||
placeholder={t("editor.liveUrlPlaceholder")}
|
||||
value={store.liveUrl ?? ""}
|
||||
onChange={(e) => store.set("liveUrl", e.target.value)}
|
||||
onChange={(v) => store.set("liveUrl", v)}
|
||||
validate={validateUrl}
|
||||
inputMode="url"
|
||||
autoComplete="off"
|
||||
/>
|
||||
)}
|
||||
{extraFields.includes("scheduledTime") && (
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Command } from "cmdk";
|
||||
import { Check, PenLine, Search, X } from "lucide-react";
|
||||
import { GPU_GROUPS, type GpuModel } from "@config/gpu-catalog";
|
||||
|
||||
const itemClass =
|
||||
"flex min-h-8 cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-sm text-text-primary select-none data-[selected=true]:bg-surface-2";
|
||||
|
||||
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 GpuListProps {
|
||||
selectedId: string | undefined;
|
||||
hasValue: boolean;
|
||||
onSelect: (model: GpuModel) => void;
|
||||
onCustom: () => void;
|
||||
onClear: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every word of the query must appear in the card's name or keywords:
|
||||
* "5080" finds the RTX 5080s only, where cmdk's default fuzzy score also
|
||||
* offered the RX 580 and the HD 7850 ("5…8…0"). Exact model-number hits
|
||||
* rank first.
|
||||
*/
|
||||
function gpuFilter(value: string, search: string, keywords?: string[]): number {
|
||||
const haystack = [value, ...(keywords ?? [])].join(" ").toLowerCase();
|
||||
const words = search.toLowerCase().split(/\s+/).filter(Boolean);
|
||||
if (words.length === 0) return 1;
|
||||
if (!words.every((word) => haystack.includes(word))) return 0;
|
||||
const whole = words.every((word) =>
|
||||
new RegExp(`(^|[^a-z0-9])${word.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}($|[^a-z0-9])`).test(
|
||||
haystack,
|
||||
),
|
||||
);
|
||||
return whole ? 1 : 0.5;
|
||||
}
|
||||
|
||||
/**
|
||||
* The searchable GPU list in the rig editor ("5080", "9070 xt", "m4 pro",
|
||||
* "rog ally"…). Lazily loaded with the search library it needs.
|
||||
*/
|
||||
export default function GpuList({
|
||||
selectedId,
|
||||
hasValue,
|
||||
onSelect,
|
||||
onCustom,
|
||||
onClear,
|
||||
}: GpuListProps) {
|
||||
const { t } = useTranslation("ui");
|
||||
return (
|
||||
<Command loop filter={gpuFilter}>
|
||||
<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.gpuSearch")}
|
||||
className="text-text-primary placeholder:text-text-muted h-10 w-full bg-transparent text-sm outline-none"
|
||||
/>
|
||||
</div>
|
||||
<Command.List className="max-h-80 scrollbar-thin overflow-y-auto p-1">
|
||||
<Command.Empty className="text-text-muted py-4 text-center text-sm">
|
||||
{t("editor.gpuNoMatch")}
|
||||
</Command.Empty>
|
||||
{GPU_GROUPS.map((group) => (
|
||||
<Command.Group key={group.id} heading={group.label} className={headingClass}>
|
||||
{group.models.map((model) => (
|
||||
<Command.Item
|
||||
key={model.id}
|
||||
value={model.id}
|
||||
keywords={[model.name, ...(model.keywords ?? [])]}
|
||||
onSelect={() => onSelect(model)}
|
||||
className={itemClass}
|
||||
>
|
||||
<span
|
||||
className="flex size-4 shrink-0 items-center justify-center"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{model.id === selectedId && <Check className="text-accent size-4" />}
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">{model.name}</span>
|
||||
</Command.Item>
|
||||
))}
|
||||
</Command.Group>
|
||||
))}
|
||||
<Command.Group forceMount className="border-border mt-1 border-t pt-1">
|
||||
<Command.Item forceMount value="__custom" onSelect={onCustom} className={itemClass}>
|
||||
<PenLine className="text-text-muted size-4 shrink-0" aria-hidden="true" />
|
||||
<span className="min-w-0 flex-1">{t("editor.gpuCustom")}</span>
|
||||
</Command.Item>
|
||||
{hasValue && (
|
||||
<Command.Item forceMount value="__clear" onSelect={onClear} className={itemClass}>
|
||||
<X className="text-text-muted size-4 shrink-0" aria-hidden="true" />
|
||||
<span className="min-w-0 flex-1">{t("editor.gpuNone")}</span>
|
||||
</Command.Item>
|
||||
)}
|
||||
</Command.Group>
|
||||
</Command.List>
|
||||
</Command>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ 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 { useCopyGate } from "@hooks/use-copy-gate";
|
||||
import { EMPTY_GENERATOR_OUTPUT, YT_LIMITS } from "@engine/types";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { Card } from "@components/ui/Card";
|
||||
@@ -38,7 +39,7 @@ export function LivePreview({
|
||||
const outputs = useMemo(() => [output], [output]);
|
||||
const limitStatus = useOutputLimits(outputs);
|
||||
const strictBlocked = useStrictBlock();
|
||||
const blocked = limitStatus.blocked || strictBlocked;
|
||||
const gate = useCopyGate(limitStatus, strictBlocked);
|
||||
|
||||
const over = (field: PreviewTab) => limitStatus.overflows.some((o) => o.field === field);
|
||||
const dot = (field: PreviewTab) =>
|
||||
@@ -110,14 +111,20 @@ export function LivePreview({
|
||||
{tab === "description" && (
|
||||
<CharCounter text={output.description} limit={YT_LIMITS.DESCRIPTION_MAX} />
|
||||
)}
|
||||
{tab === "tags" && <CharCounter text={output.tagString} limit={YT_LIMITS.TAGS_MAX} />}
|
||||
{tab === "tags" && (
|
||||
<CharCounter
|
||||
text={output.tagString}
|
||||
count={output.charCounts.tags}
|
||||
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}
|
||||
{...gate("title")}
|
||||
/>
|
||||
)}
|
||||
{tab === "description" && (
|
||||
@@ -126,16 +133,15 @@ export function LivePreview({
|
||||
label={t("output.copyDescription")}
|
||||
limit={YT_LIMITS.DESCRIPTION_MAX}
|
||||
fieldLabel={t("output.description")}
|
||||
blocked={blocked}
|
||||
{...gate("description")}
|
||||
/>
|
||||
)}
|
||||
{tab === "tags" && (
|
||||
<CopyButton
|
||||
text={output.tagString}
|
||||
label={t("output.copyTags")}
|
||||
limit={YT_LIMITS.TAGS_MAX}
|
||||
fieldLabel={t("output.tags")}
|
||||
blocked={blocked}
|
||||
{...gate("tags")}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+193
-166
@@ -1,37 +1,160 @@
|
||||
import { lazy, Suspense, useId, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AlertTriangle } from "lucide-react";
|
||||
import { AlertTriangle, ChevronsUpDown } from "lucide-react";
|
||||
import clsx from "clsx";
|
||||
import { Input } from "@components/ui/Input";
|
||||
import { Select } from "@components/ui/Select";
|
||||
import { Field, controlClasses } from "@components/ui/Field";
|
||||
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@components/ui/Popover";
|
||||
import { Spinner } from "@components/icons/animated";
|
||||
import {
|
||||
RIG_FIELDS,
|
||||
parseCascadingValue,
|
||||
cleanCpuName,
|
||||
parseCompositeValue,
|
||||
resolveCompositeOptions,
|
||||
resolveCompositeLabelKey,
|
||||
type RigField,
|
||||
type CompositePart,
|
||||
} from "@config/rig-fields";
|
||||
import { GPU_CUSTOM_BRAND_ID, findGpuBrand } from "@config/gpu-catalog";
|
||||
import { gpuValue, migrateGpuValue, modelForGpuValue } from "@config/gpu-catalog";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { FIELD_LIMITS } from "@config/field-limits";
|
||||
import {
|
||||
validateGpuValue,
|
||||
validateCompositeField,
|
||||
type RigValidationIssue,
|
||||
} from "@utils/rig-validation";
|
||||
import { validateCompositeField, type RigValidationIssue } from "@utils/rig-validation";
|
||||
|
||||
const GpuList = lazy(() => import("./GpuList"));
|
||||
|
||||
const CUSTOM_PREFIX = "custom:";
|
||||
|
||||
function joinCascading(brand: string, series: string, model: string): string {
|
||||
if (!brand && !series && !model) return "";
|
||||
return `${brand}|${series}|${model}`;
|
||||
}
|
||||
|
||||
function joinComposite(parts: readonly string[]): string {
|
||||
if (parts.every((p) => !p)) return "";
|
||||
return parts.join("|");
|
||||
}
|
||||
|
||||
/**
|
||||
* GPU: one searchable picker over the catalog, printing the official name
|
||||
* ("NVIDIA GeForce RTX 5080"), plus a free-text fallback for anything not
|
||||
* listed. Replaces three dependent dropdowns (Brand › Series › Model).
|
||||
*/
|
||||
function GpuPicker({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
label: string;
|
||||
value: string;
|
||||
onChange: (next: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation("ui");
|
||||
const [open, setOpen] = useState(false);
|
||||
const [customMode, setCustomMode] = useState(false);
|
||||
const normalized = migrateGpuValue(value);
|
||||
const model = modelForGpuValue(normalized);
|
||||
const isOwnText = !model && normalized !== "";
|
||||
const showCustom = customMode || isOwnText;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2 sm:col-span-2">
|
||||
<Field label={label}>
|
||||
{(control) => (
|
||||
<PopoverRoot open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger
|
||||
{...control}
|
||||
className={clsx(
|
||||
controlClasses(false),
|
||||
"h-control flex cursor-pointer items-center gap-2 text-left text-base sm:text-sm",
|
||||
)}
|
||||
>
|
||||
<span className={clsx("min-w-0 flex-1 truncate", !model && "text-text-muted")}>
|
||||
{model?.name ?? (showCustom ? t("editor.gpuCustomChosen") : t("editor.gpuPick"))}
|
||||
</span>
|
||||
<ChevronsUpDown className="text-text-muted size-4 shrink-0" aria-hidden="true" />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent ariaLabel={label} className="w-[min(28rem,calc(100vw-2rem))]">
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="text-text-muted flex justify-center py-8">
|
||||
<Spinner className="size-4" />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<GpuList
|
||||
selectedId={model?.id}
|
||||
hasValue={normalized !== ""}
|
||||
onSelect={(next) => {
|
||||
onChange(gpuValue(next));
|
||||
setCustomMode(false);
|
||||
setOpen(false);
|
||||
}}
|
||||
onCustom={() => {
|
||||
// Start from the current card's name so "RTX 5080" can
|
||||
// become "RTX 5080 (overclocked)" without retyping.
|
||||
onChange(model ? model.name : normalized);
|
||||
setCustomMode(true);
|
||||
setOpen(false);
|
||||
}}
|
||||
onClear={() => {
|
||||
onChange("");
|
||||
setCustomMode(false);
|
||||
setOpen(false);
|
||||
}}
|
||||
/>
|
||||
</Suspense>
|
||||
</PopoverContent>
|
||||
</PopoverRoot>
|
||||
)}
|
||||
</Field>
|
||||
{showCustom && (
|
||||
<Input
|
||||
label={t("editor.gpuCustomLabel")}
|
||||
maxLength={FIELD_LIMITS.SHORT_NAME}
|
||||
placeholder="NVIDIA GeForce RTX 3060 12GB"
|
||||
value={isOwnText ? normalized : ""}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
autoComplete="off"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** CPU (and any other suggested text field): type freely or pick a suggestion. */
|
||||
function SuggestedTextField({
|
||||
field,
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
field: RigField;
|
||||
value: string;
|
||||
onChange: (next: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation("ui");
|
||||
const listId = useId();
|
||||
return (
|
||||
<>
|
||||
<Input
|
||||
label={t(field.labelKey)}
|
||||
maxLength={FIELD_LIMITS.SHORT_NAME}
|
||||
placeholder={field.placeholder}
|
||||
value={value}
|
||||
list={listId}
|
||||
autoComplete="off"
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
// "Intel(R) Core(TM) i7-12700K CPU @ 3.60GHz", as Windows shows it,
|
||||
// becomes "Intel Core i7-12700K" once the user leaves the field.
|
||||
onBlur={(e) => {
|
||||
const cleaned = field.id === "cpu" ? cleanCpuName(e.target.value) : e.target.value.trim();
|
||||
if (cleaned !== e.target.value) onChange(cleaned);
|
||||
}}
|
||||
/>
|
||||
<datalist id={listId}>
|
||||
{field.suggestions?.map((s) => (
|
||||
<option key={s} value={s} />
|
||||
))}
|
||||
</datalist>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function RigEditor() {
|
||||
const { t } = useTranslation("ui");
|
||||
const rig = useEditorStore((s) => s.rig);
|
||||
@@ -41,186 +164,58 @@ export function RigEditor() {
|
||||
if (!issue) return null;
|
||||
return (
|
||||
<div className="text-warning flex items-center gap-1 text-xs">
|
||||
<AlertTriangle className="h-3 w-3" />
|
||||
<AlertTriangle className="size-3" aria-hidden="true" />
|
||||
<span>{t(issue.messageKey)}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const renderCascading = (field: RigField) => {
|
||||
const raw = rig[field.id] ?? "";
|
||||
const { brand, series, model } = parseCascadingValue(raw);
|
||||
const isCustom = brand === GPU_CUSTOM_BRAND_ID;
|
||||
const issue = validateGpuValue(raw);
|
||||
const catalog = field.catalog ?? [];
|
||||
|
||||
const brandOptions = [
|
||||
{ value: "", label: "—" },
|
||||
...catalog.map((b) => ({ value: b.id, label: b.label })),
|
||||
];
|
||||
const currentBrand = findGpuBrand(brand);
|
||||
const seriesOptions = currentBrand
|
||||
? [
|
||||
{ value: "", label: "—" },
|
||||
...currentBrand.series.map((s) => ({ value: s.id, label: s.label })),
|
||||
]
|
||||
: [{ value: "", label: "—" }];
|
||||
const currentSeries = currentBrand?.series.find((s) => s.id === series);
|
||||
const modelOptions = currentSeries
|
||||
? [{ value: "", label: "—" }, ...currentSeries.models.map((m) => ({ value: m, label: m }))]
|
||||
: [{ value: "", label: "—" }];
|
||||
|
||||
const setBrand = (next: string) => {
|
||||
// Switching brand resets series + model so the user can't end up
|
||||
// with mismatched cascading values (NVIDIA brand + AMD series).
|
||||
setNested("rig", field.id, next ? joinCascading(next, "", "") : "");
|
||||
};
|
||||
const setSeries = (next: string) => {
|
||||
setNested("rig", field.id, joinCascading(brand, next, ""));
|
||||
};
|
||||
const setModel = (next: string) => {
|
||||
setNested("rig", field.id, joinCascading(brand, series, next));
|
||||
};
|
||||
const setCustomText = (text: string) => {
|
||||
setNested("rig", field.id, text ? joinCascading(GPU_CUSTOM_BRAND_ID, "", text) : "");
|
||||
};
|
||||
|
||||
return (
|
||||
<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}
|
||||
options={brandOptions}
|
||||
onChange={setBrand}
|
||||
/>
|
||||
{isCustom ? (
|
||||
<div className="sm:col-span-2">
|
||||
<Input
|
||||
label={t("editor.gpu_custom")}
|
||||
maxLength={FIELD_LIMITS.SHORT_NAME}
|
||||
placeholder="e.g. RTX 4090 (custom OC)"
|
||||
value={model}
|
||||
onChange={(e) => setCustomText(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Select
|
||||
label={t("editor.gpu_series")}
|
||||
value={series}
|
||||
options={seriesOptions}
|
||||
onChange={setSeries}
|
||||
disabled={!brand}
|
||||
/>
|
||||
<Select
|
||||
label={t("editor.gpu_model")}
|
||||
value={model}
|
||||
options={modelOptions}
|
||||
onChange={setModel}
|
||||
disabled={!series}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{renderValidationBadge(issue)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const renderComposite = (field: RigField) => {
|
||||
if (!field.composite) return null;
|
||||
const composite = field.composite;
|
||||
const raw = rig[field.id] ?? "";
|
||||
const { parts: storedParts } = parseCompositeValue(raw);
|
||||
// Validate per field — only RAM has size/DDR semantics. Running the
|
||||
// RAM validator on the OS composite mis-fired "Pick a DDR generation."
|
||||
const issue = validateCompositeField(field.id, raw);
|
||||
const partValues = field.composite.parts.map((_p, i) => storedParts[i] ?? "");
|
||||
const partValues = composite.parts.map((_p, i) => storedParts[i] ?? "");
|
||||
|
||||
// v0.23.0: setting a part also resets all downstream parts to "" so
|
||||
// a cascading parent change can't leave the form with a stale child
|
||||
// value that no longer exists in the new option list (e.g. switching
|
||||
// OS name from Windows to macOS clears any leftover "11" / "Pro").
|
||||
// Cascading composites (OS) clear the parts after the one that changed,
|
||||
// so switching Windows → macOS can't leave "Pro" behind. Independent
|
||||
// ones (RAM) keep them: picking 32 GB must not wipe the DDR5 already set.
|
||||
const setPart = (index: number, next: string) => {
|
||||
const updated = [...partValues];
|
||||
updated[index] = next;
|
||||
for (let j = index + 1; j < updated.length; j++) {
|
||||
updated[j] = "";
|
||||
if (composite.cascade) {
|
||||
for (let j = index + 1; j < updated.length; j++) updated[j] = "";
|
||||
}
|
||||
setNested("rig", field.id, joinComposite(updated));
|
||||
};
|
||||
|
||||
// Walk parts in declaration order; each part's resolvers see the
|
||||
// previously-rendered values so cascading option lists / dynamic
|
||||
// labels / hidden-when predicates work cleanly.
|
||||
const previousValues: string[] = [];
|
||||
const renderedParts: React.ReactNode[] = [];
|
||||
|
||||
field.composite.parts.forEach((part, index) => {
|
||||
const stored = partValues[index] ?? "";
|
||||
// hiddenWhen short-circuits BEFORE we render — and we still push
|
||||
// the stored value into previousValues so a later visible part
|
||||
// sees the full history (though in practice, parts after a
|
||||
// hidden one are rare).
|
||||
if (part.hiddenWhen?.(previousValues)) {
|
||||
previousValues.push(stored);
|
||||
return;
|
||||
}
|
||||
renderedParts.push(renderPart(part, index, previousValues, setPart));
|
||||
previousValues.push(stored);
|
||||
});
|
||||
|
||||
return (
|
||||
<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>
|
||||
);
|
||||
|
||||
// Inner closure — needs access to `t`, `partValues`, and the part-
|
||||
// local mutators. Defined as a function so the forEach above stays
|
||||
// readable; not hoisted out because it captures lexical state.
|
||||
function renderPart(
|
||||
part: CompositePart,
|
||||
index: number,
|
||||
previousValues: readonly string[],
|
||||
setPart: (index: number, next: string) => void,
|
||||
) {
|
||||
const renderPart = (part: CompositePart, index: number, previous: readonly string[]) => {
|
||||
const stored = partValues[index] ?? "";
|
||||
const isCustom = part.allowCustom && stored.startsWith(CUSTOM_PREFIX);
|
||||
const customText = isCustom ? stored.slice(CUSTOM_PREFIX.length) : "";
|
||||
const selectValue = isCustom ? "custom" : stored;
|
||||
const options = resolveCompositeOptions(part.options, previousValues);
|
||||
const labelKey = resolveCompositeLabelKey(part, previousValues);
|
||||
|
||||
const onSelectChange = (next: string) => {
|
||||
if (next === "custom" && part.allowCustom) {
|
||||
setPart(index, `${CUSTOM_PREFIX}`);
|
||||
} else {
|
||||
setPart(index, next);
|
||||
}
|
||||
};
|
||||
const onCustomChange = (next: string) => {
|
||||
setPart(index, `${CUSTOM_PREFIX}${next}`);
|
||||
};
|
||||
const options = resolveCompositeOptions(part.options, previous);
|
||||
const labelKey = resolveCompositeLabelKey(part, previous);
|
||||
|
||||
return (
|
||||
<div key={part.id} className="flex flex-col gap-1">
|
||||
<div key={part.id} className="flex flex-col gap-1.5">
|
||||
<Select
|
||||
label={t(labelKey)}
|
||||
value={selectValue}
|
||||
options={options}
|
||||
onChange={onSelectChange}
|
||||
onChange={(next) =>
|
||||
setPart(index, next === "custom" && part.allowCustom ? CUSTOM_PREFIX : next)
|
||||
}
|
||||
/>
|
||||
{isCustom && part.allowCustom && (
|
||||
{isCustom && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
aria-label={t(labelKey)}
|
||||
placeholder={part.customPlaceholder}
|
||||
value={customText}
|
||||
inputMode="numeric"
|
||||
onChange={(e) => onCustomChange(e.target.value)}
|
||||
inputMode="decimal"
|
||||
onChange={(e) => setPart(index, `${CUSTOM_PREFIX}${e.target.value}`)}
|
||||
/>
|
||||
{part.customSuffix && (
|
||||
<span className="text-text-muted text-sm">{part.customSuffix.trim()}</span>
|
||||
@@ -229,7 +224,30 @@ export function RigEditor() {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Walk parts in declaration order; each part's resolvers see the values
|
||||
// before it, so cascading option lists, dynamic labels and hidden-when
|
||||
// predicates line up.
|
||||
const previousValues: string[] = [];
|
||||
const renderedParts: React.ReactNode[] = [];
|
||||
composite.parts.forEach((part, index) => {
|
||||
const stored = partValues[index] ?? "";
|
||||
if (!part.hiddenWhen?.(previousValues)) {
|
||||
renderedParts.push(renderPart(part, index, [...previousValues]));
|
||||
}
|
||||
previousValues.push(stored);
|
||||
});
|
||||
|
||||
return (
|
||||
<fieldset key={field.id} className="flex min-w-0 flex-col gap-2 sm:col-span-2">
|
||||
<legend className="text-text-secondary mb-1.5 text-xs font-medium">
|
||||
{t(field.labelKey)}
|
||||
</legend>
|
||||
<div className="grid gap-3 sm:grid-cols-3">{renderedParts}</div>
|
||||
{renderValidationBadge(issue)}
|
||||
</fieldset>
|
||||
);
|
||||
};
|
||||
|
||||
const renderDropdownWithVersion = (field: RigField) => {
|
||||
@@ -243,7 +261,7 @@ export function RigEditor() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div key={field.id} className="grid grid-cols-[1fr_auto] gap-2 sm:col-span-2">
|
||||
<div key={field.id} className="grid grid-cols-[1fr_8rem] gap-2 sm:col-span-2">
|
||||
<Select
|
||||
label={t(field.labelKey)}
|
||||
value={value}
|
||||
@@ -262,21 +280,30 @@ export function RigEditor() {
|
||||
};
|
||||
|
||||
return (
|
||||
// The section header ("My Rig") already names this block.
|
||||
<div className="flex flex-col gap-3">
|
||||
<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);
|
||||
const value = rig[field.id] ?? "";
|
||||
const set = (next: string) => setNested("rig", field.id, next);
|
||||
if (field.type === "gpu") {
|
||||
return (
|
||||
<GpuPicker key={field.id} label={t(field.labelKey)} value={value} onChange={set} />
|
||||
);
|
||||
}
|
||||
if (field.type === "composite_dropdown") return renderComposite(field);
|
||||
if (field.type === "dropdown_with_version") return renderDropdownWithVersion(field);
|
||||
if (field.suggestions) {
|
||||
return <SuggestedTextField key={field.id} field={field} value={value} onChange={set} />;
|
||||
}
|
||||
return (
|
||||
<Input
|
||||
key={field.id}
|
||||
label={t(field.labelKey)}
|
||||
maxLength={FIELD_LIMITS.SHORT_NAME}
|
||||
placeholder={field.placeholder}
|
||||
value={rig[field.id] ?? ""}
|
||||
onChange={(e) => setNested("rig", field.id, e.target.value)}
|
||||
value={value}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,21 +1,86 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CircleCheck, TriangleAlert, WandSparkles } from "lucide-react";
|
||||
import { Textarea } from "@components/ui/Textarea";
|
||||
import { Button } from "@components/ui/Button";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { FIELD_LIMITS } from "@config/field-limits";
|
||||
import {
|
||||
checkChapters,
|
||||
normalizeTimeline,
|
||||
parseTimeline,
|
||||
type ChapterIssue,
|
||||
} from "@engine/timeline-parser";
|
||||
|
||||
/**
|
||||
* Timestamps, with a live check against YouTube's chapter rules (first at
|
||||
* 0:00, at least three, ten seconds apart, in order) and a button that
|
||||
* rewrites pasted lists ("[00:00] – Intro", editor frame counts) into the
|
||||
* plain "0:00 Intro" form.
|
||||
*/
|
||||
export function TimestampEditor() {
|
||||
const { t } = useTranslation("ui");
|
||||
const timestamps = useEditorStore((s) => s.timestamps);
|
||||
const timestamps = useEditorStore((s) => s.timestamps) ?? "";
|
||||
const set = useEditorStore((s) => s.set);
|
||||
|
||||
const entries = useMemo(() => parseTimeline(timestamps), [timestamps]);
|
||||
const timedCount = entries.filter((e) => e.time).length;
|
||||
const issues = useMemo(() => checkChapters(entries), [entries]);
|
||||
const normalized = useMemo(() => normalizeTimeline(timestamps), [timestamps]);
|
||||
const canNormalize = timedCount > 0 && normalized !== timestamps.trim();
|
||||
|
||||
const describe = (issue: ChapterIssue): string => {
|
||||
switch (issue.kind) {
|
||||
case "firstNotZero":
|
||||
return t("editor.chapters.firstNotZero");
|
||||
case "tooFew":
|
||||
return t("editor.chapters.tooFew", { n: issue.count });
|
||||
case "tooShort":
|
||||
return t("editor.chapters.tooShort", { time: issue.time });
|
||||
case "outOfOrder":
|
||||
return t("editor.chapters.outOfOrder", { time: issue.time });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Textarea
|
||||
label={t("editor.timestamps")}
|
||||
maxLength={FIELD_LIMITS.TIMESTAMPS}
|
||||
placeholder={t("editor.timestampsPlaceholder")}
|
||||
value={timestamps ?? ""}
|
||||
onChange={(e) => set("timestamps", e.target.value)}
|
||||
rows={4}
|
||||
/>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Textarea
|
||||
label={t("editor.timestamps")}
|
||||
maxLength={FIELD_LIMITS.TIMESTAMPS}
|
||||
placeholder={t("editor.timestampsPlaceholder")}
|
||||
value={timestamps}
|
||||
onChange={(e) => set("timestamps", e.target.value)}
|
||||
rows={4}
|
||||
labelExtra={
|
||||
canNormalize ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-6 px-2"
|
||||
onClick={() => set("timestamps", normalized)}
|
||||
>
|
||||
<WandSparkles />
|
||||
{t("editor.timestampsNormalize")}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
{timedCount > 0 &&
|
||||
(issues.length === 0 ? (
|
||||
<p className="text-success flex items-center gap-1.5 text-xs">
|
||||
<CircleCheck className="size-3.5 shrink-0" aria-hidden="true" />
|
||||
{t("editor.chapters.ok", { n: timedCount })}
|
||||
</p>
|
||||
) : (
|
||||
<ul className="text-warning flex flex-col gap-0.5 text-xs" aria-live="polite">
|
||||
{issues.map((issue, i) => (
|
||||
<li key={i} className="flex items-start gap-1.5">
|
||||
<TriangleAlert className="mt-px size-3.5 shrink-0" aria-hidden="true" />
|
||||
{describe(issue)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import { useCharCount } from "@hooks/use-char-count";
|
||||
interface CharCounterProps {
|
||||
text: string;
|
||||
limit: number;
|
||||
/** Use instead of text.length where YouTube counts differently (tags). */
|
||||
count?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12,8 +14,8 @@ interface CharCounterProps {
|
||||
* - ≥80 %: yellow (close enough that the user should glance).
|
||||
* - else: muted grey.
|
||||
*/
|
||||
export function CharCounter({ text, limit }: CharCounterProps) {
|
||||
const { count, isOver, percentage } = useCharCount(text, limit);
|
||||
export function CharCounter({ text, limit, count: countOverride }: CharCounterProps) {
|
||||
const { count, isOver, percentage } = useCharCount(text, limit, countOverride);
|
||||
const isWarning = !isOver && percentage >= 80;
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Copy, Check, AlertTriangle } from "lucide-react";
|
||||
import { AlertTriangle } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import clsx from "clsx";
|
||||
import { Button } from "@components/ui/Button";
|
||||
import { CopyStateIcon } from "@components/icons/animated";
|
||||
import { useClipboard } from "@hooks/use-clipboard";
|
||||
|
||||
interface CopyButtonProps {
|
||||
@@ -10,18 +11,24 @@ interface CopyButtonProps {
|
||||
limit?: number;
|
||||
fieldLabel?: string;
|
||||
/**
|
||||
* Disable the button because *some* field in this output is over its limit —
|
||||
* not necessarily this one.
|
||||
*
|
||||
* The rule is all-or-nothing per output: if the description is 200 characters
|
||||
* too long, copying the title is blocked too. Copying two of three fields and
|
||||
* silently leaving the third behind is how a half-populated video description
|
||||
* gets published.
|
||||
* Disable the button: this field is over its YouTube limit, or Strict Mode
|
||||
* is blocking. Since v1.0.0 a field is blocked on its own — a description
|
||||
* that is too long no longer stops the (fine) title from being copied; the
|
||||
* banner above still names every field that is over.
|
||||
*/
|
||||
blocked?: boolean;
|
||||
/** Why it is blocked, shown as the button's tooltip. */
|
||||
blockedHint?: string;
|
||||
}
|
||||
|
||||
export function CopyButton({ text, label, limit, fieldLabel, blocked }: CopyButtonProps) {
|
||||
export function CopyButton({
|
||||
text,
|
||||
label,
|
||||
limit,
|
||||
fieldLabel,
|
||||
blocked,
|
||||
blockedHint,
|
||||
}: CopyButtonProps) {
|
||||
const { t } = useTranslation("ui");
|
||||
const { copy, copied } = useClipboard();
|
||||
const isOver = limit !== undefined && text.length > limit;
|
||||
@@ -36,17 +43,9 @@ export function CopyButton({ text, label, limit, fieldLabel, blocked }: CopyButt
|
||||
onClick={() => void copy(text, { limit, fieldLabel })}
|
||||
disabled={disabled}
|
||||
className={clsx((isOver || blocked) && "text-danger hover:bg-surface-2 hover:text-danger")}
|
||||
title={
|
||||
blocked ? t("output.limits.copyBlocked") : isOver ? `${text.length}/${limit}` : undefined
|
||||
}
|
||||
title={blocked ? blockedHint : isOver ? `${text.length}/${limit}` : undefined}
|
||||
>
|
||||
{isOver || blocked ? (
|
||||
<AlertTriangle className="h-4 w-4" />
|
||||
) : copied ? (
|
||||
<Check className="h-4 w-4" />
|
||||
) : (
|
||||
<Copy className="h-4 w-4" />
|
||||
)}
|
||||
{isOver || blocked ? <AlertTriangle aria-hidden="true" /> : <CopyStateIcon copied={copied} />}
|
||||
{copied ? t("output.copied") : label}
|
||||
</Button>
|
||||
);
|
||||
|
||||
@@ -8,19 +8,23 @@ import { OutputField, OutputText } from "./OutputField";
|
||||
import { YT_LIMITS } from "@engine/types";
|
||||
import type { GeneratorOutput } from "@engine/types";
|
||||
import type { OutputLimitStatus } from "@engine/limits";
|
||||
import { useCopyGate } from "@hooks/use-copy-gate";
|
||||
|
||||
interface OutputPreviewProps {
|
||||
output?: GeneratorOutput;
|
||||
/**
|
||||
* Over-limit status of the output actually shown. All three copy buttons are
|
||||
* gated on it together — see `CopyButton.blocked` for why it is
|
||||
* all-or-nothing rather than per field.
|
||||
*/
|
||||
/** Over-limit status of the output actually shown; gates each copy button. */
|
||||
status: OutputLimitStatus;
|
||||
/** Strict Mode is blocking: nothing can be copied. */
|
||||
strictBlocked?: boolean;
|
||||
}
|
||||
|
||||
export function OutputPreview({ output: outputProp, status }: OutputPreviewProps) {
|
||||
export function OutputPreview({
|
||||
output: outputProp,
|
||||
status,
|
||||
strictBlocked = false,
|
||||
}: OutputPreviewProps) {
|
||||
const { t } = useTranslation("ui");
|
||||
const gate = useCopyGate(status, strictBlocked);
|
||||
const defaultOutput = useGeneratedOutput();
|
||||
const showCharCount = useSettingsStore((s) => s.showCharCount);
|
||||
const compactTagDisplay = useSettingsStore((s) => s.compactTagDisplay);
|
||||
@@ -39,7 +43,7 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
|
||||
label={t("output.copyTitle")}
|
||||
limit={YT_LIMITS.TITLE_MAX}
|
||||
fieldLabel={t("output.title")}
|
||||
blocked={status.blocked}
|
||||
{...gate("title")}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
@@ -62,7 +66,7 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
|
||||
label={t("output.copyDescription")}
|
||||
limit={YT_LIMITS.DESCRIPTION_MAX}
|
||||
fieldLabel={t("output.description")}
|
||||
blocked={status.blocked}
|
||||
{...gate("description")}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
@@ -75,13 +79,18 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
|
||||
icon={Tags}
|
||||
actions={
|
||||
<>
|
||||
{showCharCount && <CharCounter text={output.tagString} limit={YT_LIMITS.TAGS_MAX} />}
|
||||
{showCharCount && (
|
||||
<CharCounter
|
||||
text={output.tagString}
|
||||
count={output.charCounts.tags}
|
||||
limit={YT_LIMITS.TAGS_MAX}
|
||||
/>
|
||||
)}
|
||||
<CopyButton
|
||||
text={output.tagString}
|
||||
label={t("output.copyTags")}
|
||||
limit={YT_LIMITS.TAGS_MAX}
|
||||
fieldLabel={t("output.tags")}
|
||||
blocked={status.blocked}
|
||||
{...gate("tags")}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
+530
-248
@@ -1,284 +1,566 @@
|
||||
/**
|
||||
* GPU catalog for the My Rig editor (v0.13). Three-level taxonomy:
|
||||
* GPU catalog for the My Rig editor.
|
||||
*
|
||||
* Brand → Series → Model
|
||||
* v1.0.0 rewrite. The rig used to store `"<brand>|<series>|<model>"` and
|
||||
* print `brand label + model` — so descriptions read "NVIDIA RTX 5080"
|
||||
* (no GeForce), "AMD RX 9070 XT" (no Radeon) and "Apple Silicon M4 Pro"
|
||||
* (not a product name), the picker showed three dropdowns ("NVIDIA -
|
||||
* RTX - 5080"), and the list carried cards that were never released.
|
||||
*
|
||||
* The cascading-dropdown UI in {@link RigEditor} stores the user's
|
||||
* choice as a pipe-delimited string `"<brandId>|<seriesId>|<model>"` so
|
||||
* the rig store stays a flat `Record<string, string>` (no schema
|
||||
* migration vs. v0.12). The third segment is the verbatim model display
|
||||
* string — it's stored as-is so we never need a reverse lookup table to
|
||||
* render the value back into the description output.
|
||||
* Now every model has a stable `id` and its official `name`, printed
|
||||
* verbatim. The rig stores `gpu:<id>`; anything else is the user's own
|
||||
* text. Never rename an id — saved drafts, profiles and templates point
|
||||
* at it. Removing a model is safe: its id simply stops resolving and the
|
||||
* value falls back to the text it was migrated from.
|
||||
*
|
||||
* Backward-compatibility: pre-v0.13 rigs persisted GPU as free-form text
|
||||
* (`"NVIDIA RTX 4090"`). Those values lack pipes, so `formatRigValue`
|
||||
* passes them through unchanged, and the editor renders them under the
|
||||
* `custom` brand for further editing.
|
||||
*
|
||||
* Scope: ambitious — covers the GPUs viewers commonly own in 2026,
|
||||
* which still includes 10+ years of legacy NVIDIA / AMD parts because
|
||||
* gameplay-no-commentary audiences run a wide spread of hardware ages.
|
||||
*
|
||||
* Apple Silicon is included for creators who edit on Mac and want their
|
||||
* rig listing to reflect that, even though Apple chips aren't really
|
||||
* "gaming GPUs" in the discrete-card sense.
|
||||
* Sources for what exists: the vendors' own product pages and
|
||||
* announcements (checked 2026-09-30). Deliberately absent: Radeon RX 9080
|
||||
* / RX 9090 XT and Arc B380 (rumours that never shipped), Arc B770
|
||||
* (cancelled), GeForce RTX 50 SUPER (announced but not on sale).
|
||||
*/
|
||||
|
||||
interface GpuSeries {
|
||||
/** Stable id used in the storage tuple (`<brandId>|<seriesId>|<model>`). */
|
||||
export type GpuVendorId = "nvidia" | "amd" | "intel" | "apple" | "handheld";
|
||||
|
||||
export interface GpuModel {
|
||||
/** Stable id; the rig stores `gpu:<id>`. */
|
||||
readonly id: string;
|
||||
readonly label: string;
|
||||
/** Free-form display strings — stored verbatim as the model segment. */
|
||||
readonly models: readonly string[];
|
||||
/** Official product name, printed as-is in descriptions. */
|
||||
readonly name: string;
|
||||
/** Extra words the picker's search matches (devices, codenames). */
|
||||
readonly keywords?: readonly string[];
|
||||
/** The v0.13–v0.38 model strings that mean this card (migration only). */
|
||||
readonly legacy?: readonly string[];
|
||||
}
|
||||
|
||||
export interface GpuBrand {
|
||||
export interface GpuGroup {
|
||||
readonly id: string;
|
||||
readonly vendor: GpuVendorId;
|
||||
/** Heading in the picker, e.g. "GeForce RTX 50 Series". */
|
||||
readonly label: string;
|
||||
readonly series: readonly GpuSeries[];
|
||||
readonly models: readonly GpuModel[];
|
||||
}
|
||||
|
||||
export type GpuCatalog = readonly GpuBrand[];
|
||||
const slug = (text: string): string =>
|
||||
text
|
||||
.toLowerCase()
|
||||
.replace(/[()]/g, "")
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
|
||||
const NVIDIA_SERIES: readonly GpuSeries[] = [
|
||||
{
|
||||
id: "rtx_50",
|
||||
label: "RTX 50 Series",
|
||||
models: [
|
||||
"RTX 5050",
|
||||
"RTX 5060",
|
||||
"RTX 5060 Ti",
|
||||
"RTX 5070",
|
||||
"RTX 5070 Ti",
|
||||
"RTX 5080",
|
||||
"RTX 5090",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx_40",
|
||||
label: "RTX 40 Series",
|
||||
models: [
|
||||
"RTX 4050 (laptop)",
|
||||
"RTX 4060",
|
||||
"RTX 4060 Ti",
|
||||
"RTX 4070",
|
||||
"RTX 4070 SUPER",
|
||||
"RTX 4070 Ti",
|
||||
"RTX 4070 Ti SUPER",
|
||||
"RTX 4080",
|
||||
"RTX 4080 SUPER",
|
||||
"RTX 4090",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx_30",
|
||||
label: "RTX 30 Series",
|
||||
models: [
|
||||
"RTX 3050",
|
||||
"RTX 3050 6GB",
|
||||
"RTX 3060",
|
||||
"RTX 3060 Ti",
|
||||
"RTX 3070",
|
||||
"RTX 3070 Ti",
|
||||
"RTX 3080",
|
||||
"RTX 3080 12GB",
|
||||
"RTX 3080 Ti",
|
||||
"RTX 3090",
|
||||
"RTX 3090 Ti",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx_20",
|
||||
label: "RTX 20 Series",
|
||||
models: [
|
||||
"RTX 2060",
|
||||
"RTX 2060 SUPER",
|
||||
"RTX 2070",
|
||||
"RTX 2070 SUPER",
|
||||
"RTX 2080",
|
||||
"RTX 2080 SUPER",
|
||||
"RTX 2080 Ti",
|
||||
"TITAN RTX",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx_16",
|
||||
label: "GTX 16 Series",
|
||||
models: ["GTX 1630", "GTX 1650", "GTX 1650 SUPER", "GTX 1660", "GTX 1660 SUPER", "GTX 1660 Ti"],
|
||||
},
|
||||
{
|
||||
id: "gtx_10",
|
||||
label: "GTX 10 Series",
|
||||
models: [
|
||||
"GTX 1050",
|
||||
"GTX 1050 Ti",
|
||||
"GTX 1060 3GB",
|
||||
"GTX 1060 6GB",
|
||||
"GTX 1070",
|
||||
"GTX 1070 Ti",
|
||||
"GTX 1080",
|
||||
"GTX 1080 Ti",
|
||||
"TITAN Xp",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx_900",
|
||||
label: "GTX 900 Series",
|
||||
models: ["GTX 950", "GTX 960", "GTX 970", "GTX 980", "GTX 980 Ti", "TITAN X (Maxwell)"],
|
||||
},
|
||||
{
|
||||
id: "gtx_700",
|
||||
label: "GTX 700 Series",
|
||||
models: ["GTX 750", "GTX 750 Ti", "GTX 760", "GTX 770", "GTX 780", "GTX 780 Ti", "TITAN Black"],
|
||||
},
|
||||
];
|
||||
/** `"RTX 5080"` → NVIDIA GeForce RTX 5080 (legacy string "RTX 5080"). */
|
||||
const geforce = (short: string, legacy: readonly string[] = [short]): GpuModel => ({
|
||||
id: `nvidia-${slug(short)}`,
|
||||
name: `NVIDIA GeForce ${short}`,
|
||||
legacy,
|
||||
});
|
||||
|
||||
const AMD_SERIES: readonly GpuSeries[] = [
|
||||
{
|
||||
id: "rx_9000",
|
||||
label: "Radeon RX 9000",
|
||||
models: ["RX 9060", "RX 9060 XT", "RX 9070", "RX 9070 XT", "RX 9080", "RX 9090 XT"],
|
||||
},
|
||||
{
|
||||
id: "rx_7000",
|
||||
label: "Radeon RX 7000",
|
||||
models: [
|
||||
"RX 7600",
|
||||
"RX 7600 XT",
|
||||
"RX 7700 XT",
|
||||
"RX 7800 XT",
|
||||
"RX 7900 GRE",
|
||||
"RX 7900 XT",
|
||||
"RX 7900 XTX",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx_6000",
|
||||
label: "Radeon RX 6000",
|
||||
models: [
|
||||
"RX 6400",
|
||||
"RX 6500 XT",
|
||||
"RX 6600",
|
||||
"RX 6600 XT",
|
||||
"RX 6650 XT",
|
||||
"RX 6700",
|
||||
"RX 6700 XT",
|
||||
"RX 6750 XT",
|
||||
"RX 6800",
|
||||
"RX 6800 XT",
|
||||
"RX 6900 XT",
|
||||
"RX 6950 XT",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx_5000",
|
||||
label: "Radeon RX 5000",
|
||||
models: ["RX 5500", "RX 5500 XT", "RX 5600", "RX 5600 XT", "RX 5700", "RX 5700 XT"],
|
||||
},
|
||||
{
|
||||
id: "rx_vega",
|
||||
label: "Radeon RX Vega",
|
||||
models: ["RX Vega 56", "RX Vega 64", "Radeon VII"],
|
||||
},
|
||||
{
|
||||
id: "rx_500",
|
||||
label: "Radeon RX 500",
|
||||
models: ["RX 550", "RX 560", "RX 570", "RX 580", "RX 590"],
|
||||
},
|
||||
{
|
||||
id: "rx_400",
|
||||
label: "Radeon RX 400",
|
||||
models: ["RX 460", "RX 470", "RX 480"],
|
||||
},
|
||||
{
|
||||
id: "r9_300",
|
||||
label: "Radeon R7/R9 300",
|
||||
models: [
|
||||
"R7 360",
|
||||
"R7 370",
|
||||
"R9 380",
|
||||
"R9 380X",
|
||||
"R9 390",
|
||||
"R9 390X",
|
||||
"R9 Fury",
|
||||
"R9 Fury X",
|
||||
"R9 Nano",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "r9_200",
|
||||
label: "Radeon R7/R9 200",
|
||||
models: [
|
||||
"R7 250",
|
||||
"R7 260",
|
||||
"R7 260X",
|
||||
"R9 270",
|
||||
"R9 270X",
|
||||
"R9 280",
|
||||
"R9 280X",
|
||||
"R9 290",
|
||||
"R9 290X",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "hd_7000",
|
||||
label: "Radeon HD 7000",
|
||||
models: ["HD 7750", "HD 7770", "HD 7850", "HD 7870", "HD 7950", "HD 7970"],
|
||||
},
|
||||
];
|
||||
/** TITAN cards past the GTX era are "NVIDIA TITAN …", not GeForce. */
|
||||
const nvidia = (short: string, legacy: readonly string[] = [short]): GpuModel => ({
|
||||
id: `nvidia-${slug(short)}`,
|
||||
name: `NVIDIA ${short}`,
|
||||
legacy,
|
||||
});
|
||||
|
||||
const INTEL_SERIES: readonly GpuSeries[] = [
|
||||
{
|
||||
id: "arc_b",
|
||||
label: "Arc B Series (Battlemage)",
|
||||
models: ["Arc B380", "Arc B570", "Arc B580"],
|
||||
},
|
||||
{
|
||||
id: "arc_a",
|
||||
label: "Arc A Series (Alchemist)",
|
||||
models: ["Arc A310", "Arc A380", "Arc A580", "Arc A750", "Arc A770"],
|
||||
},
|
||||
];
|
||||
const radeon = (short: string, legacy: readonly string[] = [short]): GpuModel => ({
|
||||
id: `amd-${slug(short)}`,
|
||||
name: `AMD Radeon ${short}`,
|
||||
legacy,
|
||||
});
|
||||
|
||||
const APPLE_SERIES: readonly GpuSeries[] = [
|
||||
const intel = (short: string, legacy: readonly string[] = [short]): GpuModel => ({
|
||||
id: `intel-${slug(short)}`,
|
||||
name: `Intel ${short}`,
|
||||
legacy,
|
||||
});
|
||||
|
||||
const apple = (short: string): GpuModel => ({
|
||||
id: `apple-${slug(short)}`,
|
||||
name: `Apple ${short}`,
|
||||
legacy: [short],
|
||||
});
|
||||
|
||||
export const GPU_GROUPS: readonly GpuGroup[] = [
|
||||
// ── NVIDIA ────────────────────────────────────────────────────────────
|
||||
{
|
||||
id: "m4",
|
||||
id: "rtx-50",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 50 Series",
|
||||
models: [
|
||||
geforce("RTX 5090"),
|
||||
geforce("RTX 5080"),
|
||||
geforce("RTX 5070 Ti"),
|
||||
geforce("RTX 5070"),
|
||||
geforce("RTX 5060 Ti"),
|
||||
geforce("RTX 5060 Ti 16GB", []),
|
||||
geforce("RTX 5060 Ti 8GB", []),
|
||||
geforce("RTX 5060"),
|
||||
geforce("RTX 5050"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-50-laptop",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 50 Series Laptop",
|
||||
models: [
|
||||
geforce("RTX 5090 Laptop GPU", []),
|
||||
geforce("RTX 5080 Laptop GPU", []),
|
||||
geforce("RTX 5070 Ti Laptop GPU", []),
|
||||
geforce("RTX 5070 Laptop GPU", []),
|
||||
geforce("RTX 5060 Laptop GPU", []),
|
||||
geforce("RTX 5050 Laptop GPU", []),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-40",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 40 Series",
|
||||
models: [
|
||||
geforce("RTX 4090"),
|
||||
geforce("RTX 4080 SUPER"),
|
||||
geforce("RTX 4080"),
|
||||
geforce("RTX 4070 Ti SUPER"),
|
||||
geforce("RTX 4070 Ti"),
|
||||
geforce("RTX 4070 SUPER"),
|
||||
geforce("RTX 4070"),
|
||||
geforce("RTX 4060 Ti"),
|
||||
geforce("RTX 4060 Ti 16GB", []),
|
||||
geforce("RTX 4060 Ti 8GB", []),
|
||||
geforce("RTX 4060"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-40-laptop",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 40 Series Laptop",
|
||||
models: [
|
||||
geforce("RTX 4090 Laptop GPU", []),
|
||||
geforce("RTX 4080 Laptop GPU", []),
|
||||
geforce("RTX 4070 Laptop GPU", []),
|
||||
geforce("RTX 4060 Laptop GPU", []),
|
||||
geforce("RTX 4050 Laptop GPU", ["RTX 4050 (laptop)"]),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-30",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 30 Series",
|
||||
models: [
|
||||
geforce("RTX 3090 Ti"),
|
||||
geforce("RTX 3090"),
|
||||
geforce("RTX 3080 Ti"),
|
||||
geforce("RTX 3080 12GB"),
|
||||
geforce("RTX 3080"),
|
||||
geforce("RTX 3070 Ti"),
|
||||
geforce("RTX 3070"),
|
||||
geforce("RTX 3060 Ti"),
|
||||
geforce("RTX 3060"),
|
||||
geforce("RTX 3060 8GB", []),
|
||||
geforce("RTX 3050"),
|
||||
geforce("RTX 3050 6GB"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-30-laptop",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 30 Series Laptop",
|
||||
models: [
|
||||
geforce("RTX 3080 Ti Laptop GPU", []),
|
||||
geforce("RTX 3080 Laptop GPU", []),
|
||||
geforce("RTX 3070 Ti Laptop GPU", []),
|
||||
geforce("RTX 3070 Laptop GPU", []),
|
||||
geforce("RTX 3060 Laptop GPU", []),
|
||||
geforce("RTX 3050 Ti Laptop GPU", []),
|
||||
geforce("RTX 3050 Laptop GPU", []),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rtx-20",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce RTX 20 Series",
|
||||
models: [
|
||||
nvidia("TITAN RTX"),
|
||||
geforce("RTX 2080 Ti"),
|
||||
geforce("RTX 2080 SUPER"),
|
||||
geforce("RTX 2080"),
|
||||
geforce("RTX 2070 SUPER"),
|
||||
geforce("RTX 2070"),
|
||||
geforce("RTX 2060 SUPER"),
|
||||
geforce("RTX 2060"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx-16",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce GTX 16 Series",
|
||||
models: [
|
||||
geforce("GTX 1660 Ti"),
|
||||
geforce("GTX 1660 SUPER"),
|
||||
geforce("GTX 1660"),
|
||||
geforce("GTX 1650 SUPER"),
|
||||
geforce("GTX 1650"),
|
||||
geforce("GTX 1630"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx-10",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce GTX 10 Series",
|
||||
models: [
|
||||
nvidia("TITAN Xp"),
|
||||
nvidia("TITAN X (Pascal)", []),
|
||||
geforce("GTX 1080 Ti"),
|
||||
geforce("GTX 1080"),
|
||||
geforce("GTX 1070 Ti"),
|
||||
geforce("GTX 1070"),
|
||||
geforce("GTX 1060 6GB"),
|
||||
geforce("GTX 1060 3GB"),
|
||||
geforce("GTX 1050 Ti"),
|
||||
geforce("GTX 1050"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx-900",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce GTX 900 Series",
|
||||
models: [
|
||||
geforce("GTX TITAN X", ["TITAN X (Maxwell)"]),
|
||||
geforce("GTX 980 Ti"),
|
||||
geforce("GTX 980"),
|
||||
geforce("GTX 970"),
|
||||
geforce("GTX 960"),
|
||||
geforce("GTX 950"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "gtx-700",
|
||||
vendor: "nvidia",
|
||||
label: "GeForce GTX 700 Series",
|
||||
models: [
|
||||
geforce("GTX TITAN Black", ["TITAN Black"]),
|
||||
geforce("GTX 780 Ti"),
|
||||
geforce("GTX 780"),
|
||||
geforce("GTX 770"),
|
||||
geforce("GTX 760"),
|
||||
geforce("GTX 750 Ti"),
|
||||
geforce("GTX 750"),
|
||||
],
|
||||
},
|
||||
|
||||
// ── AMD ───────────────────────────────────────────────────────────────
|
||||
{
|
||||
id: "rx-9000",
|
||||
vendor: "amd",
|
||||
label: "Radeon RX 9000 Series",
|
||||
models: [
|
||||
radeon("RX 9070 XT"),
|
||||
radeon("RX 9070"),
|
||||
radeon("RX 9070 GRE", []),
|
||||
radeon("RX 9060 XT"),
|
||||
radeon("RX 9060 XT 16GB", []),
|
||||
radeon("RX 9060 XT 8GB", []),
|
||||
radeon("RX 9060"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx-7000",
|
||||
vendor: "amd",
|
||||
label: "Radeon RX 7000 Series",
|
||||
models: [
|
||||
radeon("RX 7900 XTX"),
|
||||
radeon("RX 7900 XT"),
|
||||
radeon("RX 7900 GRE"),
|
||||
radeon("RX 7800 XT"),
|
||||
radeon("RX 7700 XT"),
|
||||
radeon("RX 7650 GRE", []),
|
||||
radeon("RX 7600 XT"),
|
||||
radeon("RX 7600"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx-6000",
|
||||
vendor: "amd",
|
||||
label: "Radeon RX 6000 Series",
|
||||
models: [
|
||||
radeon("RX 6950 XT"),
|
||||
radeon("RX 6900 XT"),
|
||||
radeon("RX 6800 XT"),
|
||||
radeon("RX 6800"),
|
||||
radeon("RX 6750 XT"),
|
||||
radeon("RX 6700 XT"),
|
||||
radeon("RX 6700"),
|
||||
radeon("RX 6650 XT"),
|
||||
radeon("RX 6600 XT"),
|
||||
radeon("RX 6600"),
|
||||
radeon("RX 6500 XT"),
|
||||
radeon("RX 6400"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx-5000",
|
||||
vendor: "amd",
|
||||
label: "Radeon RX 5000 Series",
|
||||
models: [
|
||||
radeon("RX 5700 XT"),
|
||||
radeon("RX 5700"),
|
||||
radeon("RX 5600 XT"),
|
||||
radeon("RX 5600"),
|
||||
radeon("RX 5500 XT"),
|
||||
radeon("RX 5500"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "rx-vega",
|
||||
vendor: "amd",
|
||||
label: "Radeon VII / RX Vega",
|
||||
models: [radeon("VII", ["Radeon VII"]), radeon("RX Vega 64"), radeon("RX Vega 56")],
|
||||
},
|
||||
{
|
||||
id: "rx-500-400",
|
||||
vendor: "amd",
|
||||
label: "Radeon RX 500 / 400 Series",
|
||||
models: [
|
||||
radeon("RX 590"),
|
||||
radeon("RX 580"),
|
||||
radeon("RX 570"),
|
||||
radeon("RX 560"),
|
||||
radeon("RX 550"),
|
||||
radeon("RX 480"),
|
||||
radeon("RX 470"),
|
||||
radeon("RX 460"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "r9-r7",
|
||||
vendor: "amd",
|
||||
label: "Radeon R9 / R7 Series",
|
||||
models: [
|
||||
radeon("R9 Fury X"),
|
||||
radeon("R9 Fury"),
|
||||
radeon("R9 Nano"),
|
||||
radeon("R9 390X"),
|
||||
radeon("R9 390"),
|
||||
radeon("R9 380X"),
|
||||
radeon("R9 380"),
|
||||
radeon("R9 290X"),
|
||||
radeon("R9 290"),
|
||||
radeon("R9 280X"),
|
||||
radeon("R9 280"),
|
||||
radeon("R9 270X"),
|
||||
radeon("R9 270"),
|
||||
radeon("R7 370"),
|
||||
radeon("R7 360"),
|
||||
radeon("R7 260X"),
|
||||
radeon("R7 260"),
|
||||
radeon("R7 250"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "hd-7000",
|
||||
vendor: "amd",
|
||||
label: "Radeon HD 7000 Series",
|
||||
models: [
|
||||
radeon("HD 7970"),
|
||||
radeon("HD 7950"),
|
||||
radeon("HD 7870"),
|
||||
radeon("HD 7850"),
|
||||
radeon("HD 7770"),
|
||||
radeon("HD 7750"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "amd-integrated",
|
||||
vendor: "amd",
|
||||
label: "Radeon integrated graphics",
|
||||
models: [
|
||||
{ ...radeon("8060S", []), keywords: ["Ryzen AI Max+ 395", "Strix Halo"] },
|
||||
{ ...radeon("8050S", []), keywords: ["Ryzen AI Max 390", "Strix Halo"] },
|
||||
{ ...radeon("890M", []), keywords: ["Ryzen AI 9 HX 370", "Strix Point"] },
|
||||
{ ...radeon("880M", []), keywords: ["Ryzen AI 9 365", "Strix Point"] },
|
||||
{ ...radeon("780M", []), keywords: ["Ryzen 7 7840U", "Ryzen 7 8840U", "Phoenix"] },
|
||||
{ ...radeon("760M", []), keywords: ["Ryzen 5 7640U", "Phoenix"] },
|
||||
{ ...radeon("680M", []), keywords: ["Ryzen 7 6800U", "Rembrandt"] },
|
||||
],
|
||||
},
|
||||
|
||||
// ── Intel ─────────────────────────────────────────────────────────────
|
||||
{
|
||||
id: "arc-b",
|
||||
vendor: "intel",
|
||||
label: "Intel Arc B-Series",
|
||||
models: [intel("Arc B580"), intel("Arc B570")],
|
||||
},
|
||||
{
|
||||
id: "arc-a",
|
||||
vendor: "intel",
|
||||
label: "Intel Arc A-Series",
|
||||
models: [
|
||||
intel("Arc A770"),
|
||||
intel("Arc A750"),
|
||||
intel("Arc A580"),
|
||||
intel("Arc A380"),
|
||||
intel("Arc A310"),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "intel-integrated",
|
||||
vendor: "intel",
|
||||
label: "Intel integrated graphics",
|
||||
models: [
|
||||
{ ...intel("Arc 140V", []), keywords: ["Core Ultra 7 258V", "Lunar Lake"] },
|
||||
{ ...intel("Arc 130V", []), keywords: ["Core Ultra 5 226V", "Lunar Lake"] },
|
||||
{ ...intel("Arc 140T", []), keywords: ["Core Ultra 9 285H", "Arrow Lake"] },
|
||||
{ ...intel("Arc Graphics", []), keywords: ["Core Ultra 7 155H", "Meteor Lake"] },
|
||||
intel("Iris Xe Graphics", []),
|
||||
intel("UHD Graphics 770", []),
|
||||
],
|
||||
},
|
||||
|
||||
// ── Handheld PCs ──────────────────────────────────────────────────────
|
||||
{
|
||||
id: "handheld",
|
||||
vendor: "handheld",
|
||||
label: "Handheld PCs",
|
||||
models: [
|
||||
{
|
||||
id: "amd-ryzen-z2-extreme",
|
||||
name: "AMD Ryzen Z2 Extreme",
|
||||
keywords: ["ROG Xbox Ally X", "Legion Go 2"],
|
||||
},
|
||||
{
|
||||
id: "amd-ryzen-z1-extreme",
|
||||
name: "AMD Ryzen Z1 Extreme",
|
||||
keywords: ["ROG Ally", "Legion Go"],
|
||||
},
|
||||
{ id: "amd-ryzen-z1", name: "AMD Ryzen Z1", keywords: ["ROG Ally"] },
|
||||
{
|
||||
id: "valve-steam-deck",
|
||||
name: "Steam Deck (AMD APU)",
|
||||
keywords: ["Valve", "SteamOS", "OLED", "LCD"],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ── Apple silicon ─────────────────────────────────────────────────────
|
||||
{
|
||||
id: "apple-m5",
|
||||
vendor: "apple",
|
||||
label: "Apple M5",
|
||||
models: [apple("M5"), apple("M5 Pro"), apple("M5 Max"), apple("M5 Ultra")],
|
||||
},
|
||||
{
|
||||
id: "apple-m4",
|
||||
vendor: "apple",
|
||||
label: "Apple M4",
|
||||
models: ["M4", "M4 Pro", "M4 Max"],
|
||||
models: [apple("M4"), apple("M4 Pro"), apple("M4 Max")],
|
||||
},
|
||||
{
|
||||
id: "m3",
|
||||
id: "apple-m3",
|
||||
vendor: "apple",
|
||||
label: "Apple M3",
|
||||
models: ["M3", "M3 Pro", "M3 Max", "M3 Ultra"],
|
||||
models: [apple("M3"), apple("M3 Pro"), apple("M3 Max"), apple("M3 Ultra")],
|
||||
},
|
||||
{
|
||||
id: "m2",
|
||||
id: "apple-m2",
|
||||
vendor: "apple",
|
||||
label: "Apple M2",
|
||||
models: ["M2", "M2 Pro", "M2 Max", "M2 Ultra"],
|
||||
models: [apple("M2"), apple("M2 Pro"), apple("M2 Max"), apple("M2 Ultra")],
|
||||
},
|
||||
{
|
||||
id: "m1",
|
||||
id: "apple-m1",
|
||||
vendor: "apple",
|
||||
label: "Apple M1",
|
||||
models: ["M1", "M1 Pro", "M1 Max", "M1 Ultra"],
|
||||
models: [apple("M1"), apple("M1 Pro"), apple("M1 Max"), apple("M1 Ultra")],
|
||||
},
|
||||
];
|
||||
|
||||
export const GPU_CATALOG: GpuCatalog = [
|
||||
{ id: "nvidia", label: "NVIDIA", series: NVIDIA_SERIES },
|
||||
{ id: "amd", label: "AMD", series: AMD_SERIES },
|
||||
{ id: "intel", label: "Intel", series: INTEL_SERIES },
|
||||
{ id: "apple", label: "Apple Silicon", series: APPLE_SERIES },
|
||||
{ id: "custom", label: "Custom", series: [] },
|
||||
];
|
||||
/** Prefix of a catalog value in the rig; anything else is the user's own text. */
|
||||
export const GPU_VALUE_PREFIX = "gpu:";
|
||||
|
||||
/** Stable signal that the user picked the free-text fallback. */
|
||||
export const GPU_CUSTOM_BRAND_ID = "custom";
|
||||
const MODELS_BY_ID: ReadonlyMap<string, GpuModel> = new Map(
|
||||
GPU_GROUPS.flatMap((group) => group.models.map((model) => [model.id, model] as const)),
|
||||
);
|
||||
|
||||
export function findGpuModel(id: string): GpuModel | undefined {
|
||||
return MODELS_BY_ID.get(id);
|
||||
}
|
||||
|
||||
/** The rig value for a catalog model. */
|
||||
export function gpuValue(model: Pick<GpuModel, "id">): string {
|
||||
return `${GPU_VALUE_PREFIX}${model.id}`;
|
||||
}
|
||||
|
||||
/** The catalog model a rig value points at, if it is a catalog value. */
|
||||
export function modelForGpuValue(value: string): GpuModel | undefined {
|
||||
return value.startsWith(GPU_VALUE_PREFIX)
|
||||
? findGpuModel(value.slice(GPU_VALUE_PREFIX.length))
|
||||
: undefined;
|
||||
}
|
||||
|
||||
/** Vendor ids of the v0.13 `brand|series|model` format. */
|
||||
const LEGACY_BRAND_VENDOR: Readonly<Record<string, GpuVendorId>> = {
|
||||
nvidia: "nvidia",
|
||||
amd: "amd",
|
||||
intel: "intel",
|
||||
apple: "apple",
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup a brand by id without throwing. Returns `undefined` for unknown
|
||||
* ids so callers can render a graceful fallback (legacy free-text values
|
||||
* round-trip without exploding).
|
||||
* How an unmatched legacy model reads once written out in full — the
|
||||
* pre-v1.0 description printed "AMD RX 9080"; the same text, named
|
||||
* properly, is kept as the user's own entry.
|
||||
*/
|
||||
export function findGpuBrand(brandId: string): GpuBrand | undefined {
|
||||
return GPU_CATALOG.find((b) => b.id === brandId);
|
||||
function legacyFullName(brand: string, model: string): string {
|
||||
const m = model.trim();
|
||||
if (!m) return "";
|
||||
switch (brand) {
|
||||
case "nvidia":
|
||||
return /^(RTX|GTX)\b/i.test(m) ? `NVIDIA GeForce ${m}` : `NVIDIA ${m}`;
|
||||
case "amd":
|
||||
return /^radeon\b/i.test(m) ? `AMD ${m}` : `AMD Radeon ${m}`;
|
||||
case "intel":
|
||||
return `Intel ${m}`;
|
||||
case "apple":
|
||||
return `Apple ${m}`;
|
||||
default:
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a stored GPU value to the current format:
|
||||
*
|
||||
* - `""` and `gpu:<id>` stay as they are;
|
||||
* - v0.13–v0.38 `brand|series|model` → `gpu:<id>` when the model is in the
|
||||
* catalog, otherwise its full name as free text;
|
||||
* - `custom||<text>` → `<text>`;
|
||||
* - anything else is already free text and is kept verbatim.
|
||||
*
|
||||
* Idempotent, so it is safe to run on every import and migration.
|
||||
*/
|
||||
export function migrateGpuValue(raw: string): string {
|
||||
const value = raw.trim();
|
||||
if (!value || value.startsWith(GPU_VALUE_PREFIX) || !value.includes("|")) return value;
|
||||
|
||||
const [brand = "", , model = ""] = value.split("|");
|
||||
if (brand === "custom") return model.trim();
|
||||
|
||||
const vendor = LEGACY_BRAND_VENDOR[brand];
|
||||
if (vendor) {
|
||||
const needle = model.trim().toLowerCase();
|
||||
for (const group of GPU_GROUPS) {
|
||||
if (group.vendor !== vendor) continue;
|
||||
const match = group.models.find((m) =>
|
||||
(m.legacy ?? []).some((legacy) => legacy.toLowerCase() === needle),
|
||||
);
|
||||
if (match) return gpuValue(match);
|
||||
}
|
||||
}
|
||||
return legacyFullName(brand, model);
|
||||
}
|
||||
|
||||
/** What the description prints for a stored GPU value. */
|
||||
export function formatGpuValue(raw: string): string {
|
||||
const value = migrateGpuValue(raw);
|
||||
if (!value.startsWith(GPU_VALUE_PREFIX)) return value;
|
||||
return modelForGpuValue(value)?.name ?? "";
|
||||
}
|
||||
+37
-10
@@ -11,6 +11,12 @@ export interface PlatformConfig {
|
||||
* include the game name after the app id).
|
||||
*/
|
||||
readonly normalize?: (url: string) => string;
|
||||
/**
|
||||
* How the platform appears inside tags ("Elden Ring Steam", "itch.io
|
||||
* gameplay") — the name people search for, not the store's full title.
|
||||
* Omitted where the platform isn't a searchable name (a publisher site).
|
||||
*/
|
||||
readonly tagName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,51 +27,69 @@ export interface PlatformConfig {
|
||||
* numeric id, yielding the canonical `.../app/<id>` form.
|
||||
*/
|
||||
function normalizeSteamUrl(url: string): string {
|
||||
const match = url.match(/^(https:\/\/store\.steampowered\.com\/app\/\d+)(?:\/.*)?$/i);
|
||||
const short = url.match(/^https:\/\/s\.team\/a\/(\d+)\/?$/i);
|
||||
if (short) return `https://store.steampowered.com/app/${short[1]}`;
|
||||
const match = url.match(
|
||||
/^(https:\/\/store\.steampowered\.com\/(?:app|sub|bundle)\/\d+)(?:\/.*)?$/i,
|
||||
);
|
||||
return match?.[1] ?? url;
|
||||
}
|
||||
|
||||
export const PLATFORMS: readonly PlatformConfig[] = [
|
||||
{
|
||||
id: "steam",
|
||||
tagName: "Steam",
|
||||
label: "Steam",
|
||||
urlPrefix: "https://store.steampowered.com/app/",
|
||||
// /app/<digits>, optionally followed by /<slug> or trailing slash.
|
||||
urlPattern: /^https:\/\/store\.steampowered\.com\/app\/\d+(?:\/[^\s]*)?$/i,
|
||||
// /app/, /sub/ (package) or /bundle/ + <digits>, optionally followed by
|
||||
// /<slug>; or the s.team/a/<digits> short link.
|
||||
urlPattern:
|
||||
/^https:\/\/(?:store\.steampowered\.com\/(?:app|sub|bundle)\/\d+(?:\/[^\s]*)?|s\.team\/a\/\d+\/?)$/i,
|
||||
normalize: normalizeSteamUrl,
|
||||
},
|
||||
{
|
||||
id: "epic",
|
||||
tagName: "Epic Games",
|
||||
label: "Epic Games Store",
|
||||
urlPrefix: "https://store.epicgames.com/",
|
||||
urlPattern: /^https:\/\/store\.epicgames\.com\/[^\s]+$/i,
|
||||
urlPattern: /^https:\/\/(?:store\.epicgames\.com|www\.epicgames\.com\/store)\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "ps",
|
||||
tagName: "PlayStation",
|
||||
label: "PlayStation Store",
|
||||
urlPrefix: "https://store.playstation.com/",
|
||||
urlPattern: /^https:\/\/store\.playstation\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "xbox",
|
||||
tagName: "Xbox",
|
||||
label: "Xbox / Microsoft Store",
|
||||
urlPrefix: "https://www.xbox.com/games/",
|
||||
urlPattern: /^https:\/\/www\.xbox\.com\/[^\s]+$/i,
|
||||
// xbox.com (with or without www) and the Microsoft Store web pages.
|
||||
urlPattern:
|
||||
/^https:\/\/(?:(?:www\.)?xbox\.com|apps\.microsoft\.com|www\.microsoft\.com\/[a-z-]*\/?store)\/[^\s]*$/i,
|
||||
},
|
||||
{
|
||||
id: "nintendo",
|
||||
tagName: "Nintendo Switch",
|
||||
label: "Nintendo eShop",
|
||||
urlPrefix: "https://www.nintendo.com/store/",
|
||||
urlPattern: /^https:\/\/www\.nintendo\.com\/[^\s]+$/i,
|
||||
// Every regional site: nintendo.com/us/…, nintendo.co.uk, nintendo.de,
|
||||
// store.nintendo.co.uk, nintendo.co.jp …
|
||||
urlPattern:
|
||||
/^https:\/\/(?:[a-z0-9-]+\.)*nintendo\.(?:com|co\.[a-z]{2}|com\.[a-z]{2}|[a-z]{2})\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "gog",
|
||||
tagName: "GOG",
|
||||
label: "GOG",
|
||||
urlPrefix: "https://www.gog.com/game/",
|
||||
urlPattern: /^https:\/\/www\.gog\.com\/[^\s]+$/i,
|
||||
urlPattern: /^https:\/\/(?:www\.)?gog\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "itchio",
|
||||
tagName: "itch.io",
|
||||
label: "itch.io",
|
||||
urlPrefix: "https://<dev>.itch.io/<game>",
|
||||
// itch.io games live at https://<dev>.itch.io/<game>, where <dev>
|
||||
@@ -74,15 +98,18 @@ export const PLATFORMS: readonly PlatformConfig[] = [
|
||||
},
|
||||
{
|
||||
id: "humble",
|
||||
tagName: "Humble Bundle",
|
||||
label: "Humble Bundle",
|
||||
urlPrefix: "https://www.humblebundle.com/store/",
|
||||
urlPattern: /^https:\/\/www\.humblebundle\.com\/[^\s]+$/i,
|
||||
urlPattern: /^https:\/\/(?:www\.)?humblebundle\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "amazon",
|
||||
tagName: "Amazon Luna",
|
||||
label: "Amazon Luna",
|
||||
urlPrefix: "https://www.amazon.com/luna/",
|
||||
urlPattern: /^https:\/\/www\.amazon\.com\/[^\s]+$/i,
|
||||
urlPrefix: "https://luna.amazon.com/game/",
|
||||
// Luna's own site, or the game's page on any Amazon storefront.
|
||||
urlPattern: /^https:\/\/(?:luna\.amazon\.com|(?:www\.)?amazon\.[a-z.]{2,6})\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
// Catch-all for indie / niche releases distributed only from a
|
||||
|
||||
+288
-166
@@ -1,39 +1,32 @@
|
||||
import { GPU_CATALOG, GPU_CUSTOM_BRAND_ID, findGpuBrand, type GpuCatalog } from "./gpu-catalog";
|
||||
import { formatGpuValue, migrateGpuValue } from "./gpu-catalog";
|
||||
|
||||
/**
|
||||
* Supported rig field input types.
|
||||
*
|
||||
* - `text`: plain text input (existing behaviour).
|
||||
* - `text`: plain text input, optionally with suggestions.
|
||||
* - `dropdown_with_version`: a dropdown of preset options paired with a
|
||||
* free-form version text input. The stored value is
|
||||
* `"<option_value>|<version>"` so we don't break the flat
|
||||
* `Partial<Record<string, string>>` rig shape in the editor store.
|
||||
* - `cascading_dropdown` (v0.13): three-level Brand → Series → Model
|
||||
* dropdown for GPU. Stored as `"<brand>|<series>|<model>"`. When
|
||||
* brand = `"custom"`, the UI swaps to a single free-text input and
|
||||
* stores `"custom||<freeText>"` (the model is the verbatim text the
|
||||
* user typed). Pre-v0.13 free-text values lack pipes — they pass
|
||||
* through `formatRigValue` unchanged so old profiles render the same
|
||||
* string they did before.
|
||||
* - `composite_dropdown` (v0.13): two-or-more dropdowns combined into
|
||||
* one logical field. Used by RAM (size + DDR generation). Each part
|
||||
* may opt into a free-text "Custom" override; the stored format is
|
||||
* - `gpu` (v1.0.0): the searchable GPU catalog (`@config/gpu-catalog`).
|
||||
* Stores `gpu:<model id>`, or the user's own text for anything else.
|
||||
* - `composite_dropdown`: two-or-more dropdowns combined into one logical
|
||||
* field (RAM: size + type + speed; OS: name + version + edition). Each
|
||||
* part may opt into a free-text "Custom" override; the stored format is
|
||||
* pipe-delimited in the order parts are declared.
|
||||
*/
|
||||
type RigFieldType = "text" | "dropdown_with_version" | "cascading_dropdown" | "composite_dropdown";
|
||||
type RigFieldType = "text" | "dropdown_with_version" | "gpu" | "composite_dropdown";
|
||||
|
||||
interface RigFieldOption {
|
||||
readonly value: string;
|
||||
/** Display label (not translated — software names are brand-preserved). */
|
||||
/** Display label (not translated — product names are brand-preserved). */
|
||||
readonly label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* v0.23.0: a composite part's options can now either be a static array
|
||||
* (the original RAM-style shape) OR a function that resolves the option
|
||||
* list based on previously-selected parts (the OS cascading shape, where
|
||||
* version-or-distro depends on OS name and the third slot depends on
|
||||
* both). Existing static-array call sites continue to work unchanged.
|
||||
* A composite part's options are either a static array or a function of
|
||||
* the previously-selected parts (the OS cascade, where the version list
|
||||
* depends on the OS name).
|
||||
*/
|
||||
type RigFieldOptionResolver =
|
||||
readonly RigFieldOption[] | ((previousParts: readonly string[]) => readonly RigFieldOption[]);
|
||||
@@ -45,21 +38,18 @@ export interface CompositePart {
|
||||
readonly options: RigFieldOptionResolver;
|
||||
/** When true, the part renders an extra free-text input when value === `"custom"`. */
|
||||
readonly allowCustom?: boolean;
|
||||
/** Suffix shown after the custom numeric input (e.g. " GB"). */
|
||||
/** Suffix shown after the custom input (e.g. " GB"). */
|
||||
readonly customSuffix?: string;
|
||||
/** Optional placeholder for the custom input. */
|
||||
readonly customPlaceholder?: string;
|
||||
/**
|
||||
* v0.23.0: dynamic label key override. Lets a single part show
|
||||
* "Distro" when OS = Linux but "Version" when OS = Windows / macOS.
|
||||
* Receives previously-selected parts; returns an i18n key.
|
||||
* Dynamic label key override. Lets a single part show "Distro" when
|
||||
* OS = Linux but "Version" when OS = Windows / macOS.
|
||||
*/
|
||||
readonly labelKeyResolver?: (previousParts: readonly string[]) => string;
|
||||
/**
|
||||
* v0.23.0: hide this part entirely when the resolver returns `true`
|
||||
* (e.g. macOS has no Edition slot). `formatRigValue` also skips the
|
||||
* hidden part so it doesn't leak an empty token into the joined
|
||||
* output, and the editor doesn't render the dropdown.
|
||||
* Hide this part entirely when the resolver returns `true` (macOS has no
|
||||
* edition slot). `formatRigValue` skips hidden parts too.
|
||||
*/
|
||||
readonly hiddenWhen?: (previousParts: readonly string[]) => boolean;
|
||||
}
|
||||
@@ -67,7 +57,7 @@ export interface CompositePart {
|
||||
/**
|
||||
* Helper for {@link CompositePart.options} — call sites get a plain
|
||||
* `RigFieldOption[]` whether the part declares a static array or a
|
||||
* function-of-previous-parts resolver. Pure; exported for {@link RigEditor}.
|
||||
* function-of-previous-parts resolver.
|
||||
*/
|
||||
export function resolveCompositeOptions(
|
||||
opts: RigFieldOptionResolver,
|
||||
@@ -76,11 +66,7 @@ export function resolveCompositeOptions(
|
||||
return typeof opts === "function" ? opts(previousParts) : opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for {@link CompositePart.labelKey} / {@link CompositePart.labelKeyResolver}.
|
||||
* Returns the dynamic label when present, falling back to the static
|
||||
* key on the part. Pure; exported for {@link RigEditor}.
|
||||
*/
|
||||
/** The part's label key — dynamic when it declares a resolver. */
|
||||
export function resolveCompositeLabelKey(
|
||||
part: CompositePart,
|
||||
previousParts: readonly string[],
|
||||
@@ -90,10 +76,17 @@ export function resolveCompositeLabelKey(
|
||||
|
||||
interface CompositeFieldSpec {
|
||||
readonly parts: readonly CompositePart[];
|
||||
/**
|
||||
* Whether changing a part clears the parts after it. True where later
|
||||
* option lists depend on earlier choices (OS: Windows → macOS must drop
|
||||
* "Pro"); false where parts are independent (RAM: picking 32 GB must
|
||||
* not wipe the DDR5 already chosen).
|
||||
*/
|
||||
readonly cascade: boolean;
|
||||
/**
|
||||
* Format the stored parts into the description-output string. Receives
|
||||
* resolved labels (not raw ids) — for `custom` parts the resolved value
|
||||
* is the free-text the user typed.
|
||||
* is the free text the user typed.
|
||||
*/
|
||||
readonly format: (resolvedParts: readonly string[]) => string;
|
||||
}
|
||||
@@ -105,10 +98,10 @@ export interface RigField {
|
||||
readonly placeholder?: string;
|
||||
readonly options?: readonly RigFieldOption[];
|
||||
readonly versionPlaceholder?: string;
|
||||
/** Set when {@link type} is `"cascading_dropdown"`. */
|
||||
readonly catalog?: GpuCatalog;
|
||||
/** Set when {@link type} is `"composite_dropdown"`. */
|
||||
readonly composite?: CompositeFieldSpec;
|
||||
/** `text` fields: values offered while typing (the user may type anything). */
|
||||
readonly suggestions?: readonly string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +125,7 @@ const VIDEO_EDITOR_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "other", label: "Other" },
|
||||
];
|
||||
|
||||
/** RAM size options in GB. `custom` opens a numeric free-text input. */
|
||||
/** RAM size options in GB. `custom` opens a free-text input. */
|
||||
const RAM_SIZE_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "4", label: "4 GB" },
|
||||
@@ -140,28 +133,64 @@ const RAM_SIZE_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "8", label: "8 GB" },
|
||||
{ value: "12", label: "12 GB" },
|
||||
{ value: "16", label: "16 GB" },
|
||||
{ value: "24", label: "24 GB" },
|
||||
{ value: "32", label: "32 GB" },
|
||||
{ value: "48", label: "48 GB" },
|
||||
{ value: "64", label: "64 GB" },
|
||||
{ value: "96", label: "96 GB" },
|
||||
{ value: "128", label: "128 GB" },
|
||||
{ value: "192", label: "192 GB" },
|
||||
{ value: "256", label: "256 GB" },
|
||||
{ value: "custom", label: "Custom…" },
|
||||
];
|
||||
|
||||
/** DDR generation. DDR1 stays in the list for legacy gear; users with
|
||||
* unusual rigs (DDR6/DDR7) can pick early-spec options. */
|
||||
const RAM_DDR_OPTIONS: readonly RigFieldOption[] = [
|
||||
/**
|
||||
* Memory type. Desktop DDR plus the LPDDR generations laptops, handhelds
|
||||
* and Macs use. There is no DDR6/DDR7 system memory (GDDR7 is graphics
|
||||
* memory), so those entries are gone; the first generation is plain "DDR"
|
||||
* (value kept as "DDR1" so old drafts still resolve).
|
||||
*/
|
||||
const RAM_TYPE_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "DDR1", label: "DDR1" },
|
||||
{ value: "DDR2", label: "DDR2" },
|
||||
{ value: "DDR3", label: "DDR3" },
|
||||
{ value: "DDR4", label: "DDR4" },
|
||||
{ value: "DDR5", label: "DDR5" },
|
||||
{ value: "DDR6", label: "DDR6" },
|
||||
{ value: "DDR7", label: "DDR7" },
|
||||
{ value: "DDR4", label: "DDR4" },
|
||||
{ value: "DDR3", label: "DDR3" },
|
||||
{ value: "DDR2", label: "DDR2" },
|
||||
{ value: "DDR1", label: "DDR" },
|
||||
{ value: "LPDDR5X", label: "LPDDR5X" },
|
||||
{ value: "LPDDR5", label: "LPDDR5" },
|
||||
{ value: "LPDDR4X", label: "LPDDR4X" },
|
||||
{ value: "LPDDR4", label: "LPDDR4" },
|
||||
];
|
||||
|
||||
/** Data rate in MT/s (what the "DDR5-6000" number means). */
|
||||
const RAM_SPEED_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
...[
|
||||
"2133",
|
||||
"2400",
|
||||
"2666",
|
||||
"3000",
|
||||
"3200",
|
||||
"3600",
|
||||
"4000",
|
||||
"4266",
|
||||
"4800",
|
||||
"5200",
|
||||
"5600",
|
||||
"6000",
|
||||
"6400",
|
||||
"6800",
|
||||
"7200",
|
||||
"7500",
|
||||
"8000",
|
||||
"8533",
|
||||
].map((v) => ({ value: v, label: v })),
|
||||
{ value: "custom", label: "Custom…" },
|
||||
];
|
||||
|
||||
const RAM_COMPOSITE: CompositeFieldSpec = {
|
||||
cascade: false,
|
||||
parts: [
|
||||
{
|
||||
id: "size",
|
||||
@@ -169,35 +198,31 @@ const RAM_COMPOSITE: CompositeFieldSpec = {
|
||||
options: RAM_SIZE_OPTIONS,
|
||||
allowCustom: true,
|
||||
customSuffix: " GB",
|
||||
customPlaceholder: "48",
|
||||
customPlaceholder: "40",
|
||||
},
|
||||
{ id: "ddr", labelKey: "editor.ram_ddr", options: RAM_TYPE_OPTIONS },
|
||||
{
|
||||
id: "ddr",
|
||||
labelKey: "editor.ram_ddr",
|
||||
options: RAM_DDR_OPTIONS,
|
||||
id: "speed",
|
||||
labelKey: "editor.ram_speed",
|
||||
options: RAM_SPEED_OPTIONS,
|
||||
allowCustom: true,
|
||||
customPlaceholder: "6200",
|
||||
},
|
||||
],
|
||||
format: ([size = "", ddr = ""]) => {
|
||||
if (!size && !ddr) return "";
|
||||
if (!size) return ddr;
|
||||
if (!ddr) return size;
|
||||
return `${size} ${ddr}`;
|
||||
// "32 GB DDR5-6000" — the way RAM kits are named. Without a type the
|
||||
// speed gets its unit: "32 GB 6000 MT/s".
|
||||
format: ([size = "", type = "", speed = ""]) => {
|
||||
const memory = type && speed ? `${type}-${speed}` : type || (speed ? `${speed} MT/s` : "");
|
||||
return [size, memory].filter(Boolean).join(" ");
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* OS composite (v0.22.0, extended v0.23.0). Three dropdowns combined
|
||||
* into one logical field. The slot semantics now adapt to the chosen
|
||||
* OS family:
|
||||
* OS composite. The slot semantics adapt to the chosen OS family:
|
||||
*
|
||||
* - Windows: name → version (10/11) → edition (Home/Pro/…)
|
||||
* - macOS: name → version (10/11/12/13/14/15/26) → (hidden — Apple has no editions)
|
||||
* - Linux: name → distro (Ubuntu/Fedora/…) → version (per-distro)
|
||||
*
|
||||
* Stored pipe-delimited; format function joins all non-empty parts
|
||||
* with single spaces. v0.22.0 stored values like `"windows|11|pro"`
|
||||
* round-trip unchanged through the new resolver because the static
|
||||
* Windows path remains the default for `name === "windows"`.
|
||||
* - macOS: name → version → (hidden — Apple has no editions)
|
||||
* - Linux: name → distro → version (per distro)
|
||||
*/
|
||||
const OS_NAME_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
@@ -208,80 +233,109 @@ const OS_NAME_OPTIONS: readonly RigFieldOption[] = [
|
||||
|
||||
const WINDOWS_VERSION_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "10", label: "10" },
|
||||
{ value: "11", label: "11" },
|
||||
{ value: "10", label: "10" },
|
||||
];
|
||||
|
||||
/**
|
||||
* macOS major versions. Apple jumped from 15 (Sequoia, 2024) to 26
|
||||
* (Tahoe, 2025) to year-align the marketing number, so the list is
|
||||
* intentionally non-contiguous.
|
||||
* macOS versions. Apple jumped from 15 (Sequoia, 2024) to 26 (Tahoe, 2025)
|
||||
* to year-align the number, so the list is intentionally non-contiguous.
|
||||
* "10" is the pre-v1.0 catch-all for the 10.x era, kept so old drafts
|
||||
* still resolve.
|
||||
*/
|
||||
const MACOS_VERSION_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "10", label: "10 (Mojave era)" },
|
||||
{ value: "11 Big Sur", label: "11 Big Sur" },
|
||||
{ value: "12 Monterey", label: "12 Monterey" },
|
||||
{ value: "13 Ventura", label: "13 Ventura" },
|
||||
{ value: "14 Sonoma", label: "14 Sonoma" },
|
||||
{ value: "15 Sequoia", label: "15 Sequoia" },
|
||||
{ value: "26 Tahoe", label: "26 Tahoe" },
|
||||
{ value: "15 Sequoia", label: "15 Sequoia" },
|
||||
{ value: "14 Sonoma", label: "14 Sonoma" },
|
||||
{ value: "13 Ventura", label: "13 Ventura" },
|
||||
{ value: "12 Monterey", label: "12 Monterey" },
|
||||
{ value: "11 Big Sur", label: "11 Big Sur" },
|
||||
{ value: "10.15 Catalina", label: "10.15 Catalina" },
|
||||
{ value: "10", label: "10.x" },
|
||||
];
|
||||
|
||||
/** Linux distros gameplay creators actually use via Proton. */
|
||||
/** Linux distros gameplay creators actually use (Proton, handhelds). */
|
||||
const LINUX_DISTRO_OPTIONS: readonly RigFieldOption[] = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "steamos", label: "SteamOS" },
|
||||
{ value: "bazzite", label: "Bazzite" },
|
||||
{ value: "cachyos", label: "CachyOS" },
|
||||
{ value: "nobara", label: "Nobara" },
|
||||
{ value: "ubuntu", label: "Ubuntu" },
|
||||
{ value: "fedora", label: "Fedora" },
|
||||
{ value: "debian", label: "Debian" },
|
||||
{ value: "arch", label: "Arch" },
|
||||
{ value: "arch", label: "Arch Linux" },
|
||||
{ value: "manjaro", label: "Manjaro" },
|
||||
{ value: "popos", label: "Pop!_OS" },
|
||||
{ value: "mint", label: "Linux Mint" },
|
||||
{ value: "opensuse", label: "openSUSE" },
|
||||
];
|
||||
|
||||
const ROLLING = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "rolling", label: "rolling" },
|
||||
] as const;
|
||||
|
||||
const LATEST = [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "latest", label: "latest stable" },
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Per-distro version lists. The map key matches the distro id from
|
||||
* {@link LINUX_DISTRO_OPTIONS}; values are stored verbatim (e.g. the
|
||||
* stored Ubuntu version is "22.04 LTS"). Rolling distros surface a
|
||||
* single "rolling" / "latest" placeholder so the dropdown isn't empty.
|
||||
* {@link LINUX_DISTRO_OPTIONS}; values are stored verbatim. Rolling or
|
||||
* image-based distros get a single placeholder so the dropdown isn't empty.
|
||||
*/
|
||||
const LINUX_VERSION_BY_DISTRO: Record<string, readonly RigFieldOption[]> = {
|
||||
steamos: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "3", label: "3" },
|
||||
],
|
||||
bazzite: LATEST,
|
||||
cachyos: ROLLING,
|
||||
nobara: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "42", label: "42" },
|
||||
{ value: "41", label: "41" },
|
||||
],
|
||||
ubuntu: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "20.04 LTS", label: "20.04 LTS" },
|
||||
{ value: "22.04 LTS", label: "22.04 LTS" },
|
||||
{ value: "24.04 LTS", label: "24.04 LTS" },
|
||||
{ value: "26.04 LTS", label: "26.04 LTS" },
|
||||
{ value: "24.04 LTS", label: "24.04 LTS" },
|
||||
{ value: "22.04 LTS", label: "22.04 LTS" },
|
||||
{ value: "20.04 LTS", label: "20.04 LTS" },
|
||||
],
|
||||
fedora: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "40", label: "40" },
|
||||
{ value: "41", label: "41" },
|
||||
{ value: "44", label: "44" },
|
||||
{ value: "43", label: "43" },
|
||||
{ value: "42", label: "42" },
|
||||
{ value: "41", label: "41" },
|
||||
{ value: "40", label: "40" },
|
||||
],
|
||||
debian: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "12 Bookworm", label: "12 Bookworm" },
|
||||
{ value: "13 Trixie", label: "13 Trixie" },
|
||||
{ value: "12 Bookworm", label: "12 Bookworm" },
|
||||
],
|
||||
arch: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "rolling", label: "rolling" },
|
||||
],
|
||||
manjaro: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "latest", label: "latest stable" },
|
||||
],
|
||||
arch: ROLLING,
|
||||
manjaro: LATEST,
|
||||
popos: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "22.04 LTS", label: "22.04 LTS" },
|
||||
{ value: "24.04 LTS", label: "24.04 LTS" },
|
||||
{ value: "22.04 LTS", label: "22.04 LTS" },
|
||||
],
|
||||
mint: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "21", label: "21" },
|
||||
{ value: "22", label: "22" },
|
||||
{ value: "21", label: "21" },
|
||||
],
|
||||
opensuse: [
|
||||
{ value: "", label: "—" },
|
||||
{ value: "Tumbleweed", label: "Tumbleweed" },
|
||||
{ value: "Leap 16", label: "Leap 16" },
|
||||
{ value: "Leap 15.6", label: "Leap 15.6" },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -297,12 +351,12 @@ const OS_EDITION_OPTIONS: readonly RigFieldOption[] = [
|
||||
const EMPTY_OPTIONS: readonly RigFieldOption[] = [{ value: "", label: "—" }];
|
||||
|
||||
const OS_COMPOSITE: CompositeFieldSpec = {
|
||||
cascade: true,
|
||||
parts: [
|
||||
{ id: "name", labelKey: "editor.os_name", options: OS_NAME_OPTIONS },
|
||||
{
|
||||
// Slot 2: Windows/macOS use this as "Version", Linux re-purposes it
|
||||
// as "Distro". The labelKeyResolver swaps the label so the editor
|
||||
// form reads naturally for each OS family.
|
||||
// as "Distro".
|
||||
id: "version_or_distro",
|
||||
labelKey: "editor.os_version",
|
||||
labelKeyResolver: ([name = ""]) =>
|
||||
@@ -316,7 +370,7 @@ const OS_COMPOSITE: CompositeFieldSpec = {
|
||||
},
|
||||
{
|
||||
// Slot 3: Windows uses "Edition"; Linux re-purposes it as "Version"
|
||||
// (per-distro). macOS doesn't have a third slot at all — hidden.
|
||||
// (per distro). macOS doesn't have a third slot at all — hidden.
|
||||
id: "edition_or_linux_version",
|
||||
labelKey: "editor.os_edition",
|
||||
labelKeyResolver: ([name = ""]) =>
|
||||
@@ -329,72 +383,147 @@ const OS_COMPOSITE: CompositeFieldSpec = {
|
||||
},
|
||||
},
|
||||
],
|
||||
format: (parts) => parts.filter((p) => p.trim() !== "").join(" "),
|
||||
// "Windows 11 Pro", "macOS 26 Tahoe" — and for Linux just the distro,
|
||||
// the way people name it: "Ubuntu 24.04 LTS", "Arch Linux (rolling)".
|
||||
format: ([name = "", second = "", third = ""]) => {
|
||||
if (name === "Linux" && second) {
|
||||
if (third === "rolling" || third === "latest stable") return `${second} (${third})`;
|
||||
return [second, third].filter(Boolean).join(" ");
|
||||
}
|
||||
return [name, second, third].filter((p) => p.trim() !== "").join(" ");
|
||||
},
|
||||
};
|
||||
|
||||
/** Suggestions for the CPU field; any other text is accepted as typed. */
|
||||
export const CPU_SUGGESTIONS: readonly string[] = [
|
||||
"AMD Ryzen 7 9800X3D",
|
||||
"AMD Ryzen 9 9950X3D",
|
||||
"AMD Ryzen 9 9950X",
|
||||
"AMD Ryzen 9 9900X",
|
||||
"AMD Ryzen 7 9700X",
|
||||
"AMD Ryzen 5 9600X",
|
||||
"AMD Ryzen 7 7800X3D",
|
||||
"AMD Ryzen 9 7950X3D",
|
||||
"AMD Ryzen 9 7950X",
|
||||
"AMD Ryzen 9 7900X",
|
||||
"AMD Ryzen 7 7700X",
|
||||
"AMD Ryzen 5 7600X",
|
||||
"AMD Ryzen 5 7600",
|
||||
"AMD Ryzen 7 5800X3D",
|
||||
"AMD Ryzen 7 5700X3D",
|
||||
"AMD Ryzen 9 5950X",
|
||||
"AMD Ryzen 9 5900X",
|
||||
"AMD Ryzen 7 5800X",
|
||||
"AMD Ryzen 7 5700X",
|
||||
"AMD Ryzen 5 5600X",
|
||||
"AMD Ryzen 5 5600",
|
||||
"AMD Ryzen 7 3700X",
|
||||
"AMD Ryzen 5 3600",
|
||||
"AMD Ryzen AI 9 HX 370",
|
||||
"AMD Ryzen AI Max+ 395",
|
||||
"AMD Ryzen 7 8845HS",
|
||||
"AMD Ryzen 7 7840HS",
|
||||
"Intel Core Ultra 9 285K",
|
||||
"Intel Core Ultra 7 265K",
|
||||
"Intel Core Ultra 5 245K",
|
||||
"Intel Core i9-14900K",
|
||||
"Intel Core i7-14700K",
|
||||
"Intel Core i5-14600K",
|
||||
"Intel Core i5-14400F",
|
||||
"Intel Core i9-13900K",
|
||||
"Intel Core i7-13700K",
|
||||
"Intel Core i5-13600K",
|
||||
"Intel Core i5-13400F",
|
||||
"Intel Core i9-12900K",
|
||||
"Intel Core i7-12700K",
|
||||
"Intel Core i5-12600K",
|
||||
"Intel Core i5-12400F",
|
||||
"Intel Core i7-11700K",
|
||||
"Intel Core i5-11400F",
|
||||
"Intel Core i9-10900K",
|
||||
"Intel Core i7-10700K",
|
||||
"Intel Core i5-10400F",
|
||||
"Intel Core i9-9900K",
|
||||
"Intel Core i7-9700K",
|
||||
"Intel Core i7-8700K",
|
||||
"Intel Core Ultra 7 258V",
|
||||
"Intel Core Ultra 7 155H",
|
||||
"Apple M5",
|
||||
"Apple M4 Pro",
|
||||
"Apple M4",
|
||||
];
|
||||
|
||||
/**
|
||||
* Tidy a CPU name pasted from Windows or a spec sheet:
|
||||
* `"12th Gen Intel(R) Core(TM) i7-12700K"` → `"Intel Core i7-12700K"`,
|
||||
* `"AMD Ryzen 7 7800X3D 8-Core Processor"` → `"AMD Ryzen 7 7800X3D"`,
|
||||
* `"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz"` → `"Intel Core i9-9900K"`.
|
||||
* Text it doesn't recognise is only trimmed and de-duplicated of spaces.
|
||||
*/
|
||||
export function cleanCpuName(raw: string): string {
|
||||
return raw
|
||||
.replace(/\((?:R|TM|C)\)|[®™©]/gi, "")
|
||||
.replace(/^\s*\d{1,2}(?:st|nd|rd|th)\s+Gen\s+/i, "")
|
||||
.replace(/\s+CPU\s*@\s*[\d.]+\s*[GM]Hz\b/i, "")
|
||||
.replace(/\s+@\s*[\d.]+\s*[GM]Hz\b/i, "")
|
||||
.replace(/\s+\d{1,3}-Core\s+Processor\b/i, "")
|
||||
.replace(/\s+(?:with\s+Radeon(?:\s+\w+)?\s+Graphics|Processor)\s*$/i, "")
|
||||
.replace(/\s{2,}/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* The rig fields, in the order both the editor and the description show
|
||||
* them: the parts a viewer compares first (CPU, GPU, RAM), then the rest.
|
||||
*/
|
||||
export const RIG_FIELDS: readonly RigField[] = [
|
||||
{ id: "os", labelKey: "rig.os", type: "composite_dropdown", composite: OS_COMPOSITE },
|
||||
{
|
||||
id: "cpu",
|
||||
labelKey: "rig.cpu",
|
||||
type: "text",
|
||||
placeholder: "Intel i9-14900K / AMD Ryzen 9 7950X",
|
||||
placeholder: "AMD Ryzen 7 9800X3D",
|
||||
suggestions: CPU_SUGGESTIONS,
|
||||
},
|
||||
{
|
||||
id: "gpu",
|
||||
labelKey: "rig.gpu",
|
||||
type: "cascading_dropdown",
|
||||
catalog: GPU_CATALOG,
|
||||
},
|
||||
{
|
||||
id: "ram",
|
||||
labelKey: "rig.ram",
|
||||
type: "composite_dropdown",
|
||||
composite: RAM_COMPOSITE,
|
||||
},
|
||||
{ id: "storage", labelKey: "rig.storage", type: "text", placeholder: "2TB Samsung 990 PRO NVMe" },
|
||||
{ id: "monitor", labelKey: "rig.monitor", type: "text", placeholder: 'LG 27GP950 27" 4K 144Hz' },
|
||||
{ id: "capture", labelKey: "rig.capture", type: "text", placeholder: "OBS Studio 30.x" },
|
||||
{ id: "gpu", labelKey: "rig.gpu", type: "gpu" },
|
||||
{ id: "ram", labelKey: "rig.ram", type: "composite_dropdown", composite: RAM_COMPOSITE },
|
||||
{
|
||||
id: "motherboard",
|
||||
labelKey: "rig.motherboard",
|
||||
type: "text",
|
||||
placeholder: "ASUS ROG Maximus Z790 Hero",
|
||||
placeholder: "ASUS ROG Strix X870E-E Gaming",
|
||||
},
|
||||
{ id: "storage", labelKey: "rig.storage", type: "text", placeholder: "2TB Samsung 990 PRO NVMe" },
|
||||
{ id: "os", labelKey: "rig.os", type: "composite_dropdown", composite: OS_COMPOSITE },
|
||||
{ id: "monitor", labelKey: "rig.monitor", type: "text", placeholder: 'LG 27GP950 27" 4K 144Hz' },
|
||||
{ id: "capture", labelKey: "rig.capture", type: "text", placeholder: "OBS Studio 31" },
|
||||
{
|
||||
id: "controller",
|
||||
labelKey: "rig.controller",
|
||||
type: "text",
|
||||
placeholder: "DualSense / Xbox Elite Series 2",
|
||||
placeholder: "DualSense / Xbox Wireless Controller",
|
||||
},
|
||||
{
|
||||
id: "video_editor",
|
||||
labelKey: "rig.video_editor",
|
||||
type: "dropdown_with_version",
|
||||
options: VIDEO_EDITOR_OPTIONS,
|
||||
versionPlaceholder: "19.1 / 2024 / v5.0",
|
||||
versionPlaceholder: "20 / 2026 / v25",
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Parse a cascading-dropdown stored value into its three segments.
|
||||
* Empty segments stay as empty strings. Pipeless legacy values are
|
||||
* returned as `["", "", raw]` so the caller can render them under the
|
||||
* Custom brand without losing the original text.
|
||||
* A stored rig object brought up to date: string values only (an imported
|
||||
* profile may carry `rig: null` or numbers) and the GPU in the v1.0
|
||||
* catalog format. Idempotent — used by the store migrations and imports.
|
||||
*/
|
||||
export function parseCascadingValue(raw: string): {
|
||||
brand: string;
|
||||
series: string;
|
||||
model: string;
|
||||
isLegacy: boolean;
|
||||
} {
|
||||
if (!raw) return { brand: "", series: "", model: "", isLegacy: false };
|
||||
if (!raw.includes("|")) {
|
||||
// Pre-v0.13 free-text. Treat as Custom + verbatim model.
|
||||
return { brand: GPU_CUSTOM_BRAND_ID, series: "", model: raw, isLegacy: true };
|
||||
export function migrateRig(rig: unknown): Record<string, string> {
|
||||
if (!rig || typeof rig !== "object") return {};
|
||||
const out: Record<string, string> = {};
|
||||
for (const [key, value] of Object.entries(rig as Record<string, unknown>)) {
|
||||
if (typeof value !== "string") continue;
|
||||
out[key] = key === "gpu" ? migrateGpuValue(value) : value;
|
||||
}
|
||||
const [brand = "", series = "", model = ""] = raw.split("|");
|
||||
return { brand, series, model, isLegacy: false };
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,17 +541,26 @@ export function parseCompositeValue(raw: string): {
|
||||
return { parts: raw.split("|"), isLegacy: false };
|
||||
}
|
||||
|
||||
const escapeRegExp = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
|
||||
/** Custom text plus the part's unit, unless the user typed it ("48GB" → "48 GB"). */
|
||||
function withSuffix(text: string, suffix: string): string {
|
||||
const unit = suffix.trim();
|
||||
if (!unit) return text;
|
||||
const bare = text.replace(new RegExp(`\\s*${escapeRegExp(unit)}$`, "i"), "");
|
||||
return bare ? `${bare}${suffix}` : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a stored rig value for display in the description output.
|
||||
*
|
||||
* - `gpu` ("gpu:nvidia-rtx-5080") → "NVIDIA GeForce RTX 5080"; the
|
||||
* pre-v1.0 `brand|series|model` values are converted on the fly; free
|
||||
* text passes through.
|
||||
* - `dropdown_with_version` ("davinci_resolve_studio|19.1") →
|
||||
* `"DaVinci Resolve Studio 19.1"`.
|
||||
* - `cascading_dropdown` ("nvidia|rtx_40|RTX 4090") →
|
||||
* `"NVIDIA RTX 4090"` (series label dropped — the model string is
|
||||
* already verbose enough). Custom brand returns the verbatim model.
|
||||
* Legacy pipeless values pass through unchanged.
|
||||
* - `composite_dropdown` ("16|DDR5", "custom:48|DDR5") →
|
||||
* `"16 GB DDR5"` / `"48 GB DDR5"` via the field's
|
||||
* "DaVinci Resolve Studio 19.1".
|
||||
* - `composite_dropdown` ("32|DDR5|6000", "custom:48|DDR5|") →
|
||||
* "32 GB DDR5-6000" / "48 GB DDR5" via the field's
|
||||
* {@link CompositeFieldSpec.format}.
|
||||
* - All other field types pass the raw value through.
|
||||
*/
|
||||
@@ -430,6 +568,8 @@ export function formatRigValue(fieldId: string, raw: string): string {
|
||||
const field = RIG_FIELDS.find((f) => f.id === fieldId);
|
||||
if (!field) return raw;
|
||||
|
||||
if (field.type === "gpu") return formatGpuValue(raw);
|
||||
|
||||
if (field.type === "dropdown_with_version") {
|
||||
const [value = "", version = ""] = raw.split("|");
|
||||
const trimmedVersion = version.trim();
|
||||
@@ -445,43 +585,25 @@ export function formatRigValue(fieldId: string, raw: string): string {
|
||||
return trimmedVersion ? `${label} ${trimmedVersion}` : label;
|
||||
}
|
||||
|
||||
if (field.type === "cascading_dropdown") {
|
||||
const { brand, model, isLegacy } = parseCascadingValue(raw);
|
||||
if (isLegacy) return raw;
|
||||
if (!brand && !model) return "";
|
||||
if (brand === GPU_CUSTOM_BRAND_ID) return model.trim();
|
||||
const brandLabel = findGpuBrand(brand)?.label ?? brand;
|
||||
if (!model.trim()) return brandLabel;
|
||||
return `${brandLabel} ${model.trim()}`;
|
||||
}
|
||||
|
||||
if (field.type === "composite_dropdown" && field.composite) {
|
||||
const { parts, isLegacy } = parseCompositeValue(raw);
|
||||
if (isLegacy) return raw;
|
||||
if (parts.length === 0) return "";
|
||||
|
||||
// Resolve each declared part. v0.23.0: parts may declare a dynamic
|
||||
// option resolver and/or a `hiddenWhen` predicate (used by the OS
|
||||
// composite where macOS has no third slot). We walk parts in order
|
||||
// so each resolver sees the previously-stored values, and we skip
|
||||
// hidden parts entirely so they don't leak an empty token into the
|
||||
// `composite.format` join. `custom:<value>` segments still collapse
|
||||
// to the free-text payload (without the `custom:` prefix).
|
||||
// Walk parts in order so each resolver sees the previously-stored
|
||||
// values; hidden parts contribute nothing; `custom:<text>` collapses to
|
||||
// the text (plus the part's unit).
|
||||
const previousStored: string[] = [];
|
||||
const resolved = field.composite.parts.map((spec, i) => {
|
||||
const stored = (parts[i] ?? "").trim();
|
||||
if (spec.hiddenWhen?.(previousStored)) {
|
||||
previousStored.push("");
|
||||
return "";
|
||||
}
|
||||
if (!stored) {
|
||||
if (!stored || spec.hiddenWhen?.(previousStored)) {
|
||||
previousStored.push("");
|
||||
return "";
|
||||
}
|
||||
if (spec.allowCustom && stored.startsWith("custom:")) {
|
||||
const txt = stored.slice("custom:".length).trim();
|
||||
previousStored.push(stored);
|
||||
return txt ? `${txt}${spec.customSuffix ?? ""}` : "";
|
||||
return txt ? withSuffix(txt, spec.customSuffix ?? "") : "";
|
||||
}
|
||||
const opts = resolveCompositeOptions(spec.options, previousStored);
|
||||
const opt = opts.find((o) => o.value === stored);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SOCIAL_FIELDS } from "@config/social-fields";
|
||||
import { formatRigValue } from "@config/rig-fields";
|
||||
import { DEFAULT_GACHA_QUEST_TYPE } from "@config/gacha-quest-types";
|
||||
import { ordinalSuffix } from "./title-builder";
|
||||
import { buildRigLines } from "./rig-block";
|
||||
import { parseTimeline, renderTimeline } from "./timeline-parser";
|
||||
import { formatEndingEntry, sliceEndingsForVideo } from "./endings-format";
|
||||
import { sanitizeHashtag } from "@utils/sanitize";
|
||||
@@ -257,6 +258,8 @@ export interface BuildDescriptionOptions {
|
||||
* each (single-language) tab doesn't show `EN · LOCAL` content blocks.
|
||||
* Defaults to true. v0.29.3. */
|
||||
bilingualContentBlocks?: boolean;
|
||||
/** Year for the copyright line; the current year when omitted. */
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export function buildDescription(
|
||||
@@ -275,6 +278,7 @@ export function buildDescription(
|
||||
showTranslationQuality = false,
|
||||
tEn,
|
||||
bilingualContentBlocks = true,
|
||||
year = new Date().getFullYear(),
|
||||
} = options;
|
||||
// Multi-language Output tabs set this false: each tab is one target
|
||||
// language, so the v0.11/v0.12 content blocks must NOT render `EN · LOCAL`.
|
||||
@@ -490,16 +494,10 @@ export function buildDescription(
|
||||
// above (slot 1.5) in v0.12. Kept here as a no-op placeholder so the
|
||||
// numbering of subsequent comments stays stable.
|
||||
|
||||
// 6. Rig
|
||||
if (hasEntries(input.rig)) {
|
||||
const rigLines = Object.entries(input.rig)
|
||||
.map(([k, v]) => [k, formatRigValue(k, v ?? "")] as const)
|
||||
.filter(([, v]) => v && v.trim() !== "")
|
||||
.map(([k, v]) => `${k.replace(/_/g, " ").toUpperCase()}: ${v}`)
|
||||
.join("\n");
|
||||
if (rigLines) {
|
||||
sections.push(`${t("description.sections.rig")}\n${rigLines}`);
|
||||
}
|
||||
// 6. Rig — translated labels in a fixed order (see buildRigLines).
|
||||
const rigLines = buildRigLines(input.rig, t);
|
||||
if (rigLines.length > 0) {
|
||||
sections.push(`${t("description.sections.rig")}\n${rigLines.join("\n")}`);
|
||||
}
|
||||
|
||||
// 6.5 Mod list — only meaningful for the `mods` videoType. Free-form
|
||||
@@ -695,7 +693,6 @@ export function buildDescription(
|
||||
// 13.5 Copyright line — auto-generated from channelName + current year.
|
||||
// Skipped when the creator hasn't set a channel name (nothing to claim).
|
||||
if (showCopyright && input.channelName.trim()) {
|
||||
const year = new Date().getFullYear();
|
||||
sections.push(
|
||||
t("description.sections.copyright", {
|
||||
year: String(year),
|
||||
@@ -718,7 +715,8 @@ export function buildDescription(
|
||||
`#${sanitizeHashtag(gameName)}`,
|
||||
"#GameplayNoCommentary",
|
||||
...(primaryGenre ? [`#${sanitizeHashtag(primaryGenre)}`] : []),
|
||||
];
|
||||
// A name made only of symbols (or no name yet) leaves a bare "#".
|
||||
].filter((tag) => tag.length > 1);
|
||||
sections.push(allHashtags.slice(0, hashtagCount).join(" "));
|
||||
|
||||
return sections.join("\n\n");
|
||||
@@ -844,7 +842,9 @@ function buildPlaythroughNotesSection(
|
||||
const structured = Array.isArray(input.endings) ? input.endings : [];
|
||||
const sliced = sliceEndingsForVideo(structured, input);
|
||||
if (sliced.length > 0) {
|
||||
const formatted = sliced.map(formatEndingEntry).filter((s): s is string => !!s);
|
||||
const formatted = sliced
|
||||
.map((entry) => formatEndingEntry(entry, t))
|
||||
.filter((s): s is string => !!s);
|
||||
if (formatted.length > 0) {
|
||||
const joined = formatted.join(", ");
|
||||
const b = bullet("description.playthroughNotes.labels.endings", joined, joined);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { EndingEntry, EndingVideoRange, GeneratorInput } from "./types";
|
||||
import type { EndingEntry, EndingVideoRange, GeneratorInput, TranslationFn } from "./types";
|
||||
|
||||
/**
|
||||
* Render a single {@link EndingEntry} into its display string.
|
||||
@@ -8,22 +8,24 @@ import type { EndingEntry, EndingVideoRange, GeneratorInput } from "./types";
|
||||
* - name only → `"{{name}}"`
|
||||
* - neither → `null` (entry should be dropped)
|
||||
*
|
||||
* The English literal "Ending" is hard-coded here intentionally: the
|
||||
* label feeds into both the description bullet *and* the
|
||||
* preview-in-editor live formatter, where localising "Ending" would
|
||||
* require routing through i18next from a pure module. Templates can
|
||||
* still override the surrounding bullet label via
|
||||
* `description.playthroughNotes.labels.endings` — only the per-entry
|
||||
* "Ending N" prefix stays in English.
|
||||
* With `t` (the output language), "Ending N" comes from
|
||||
* `timeline.keywords.ending` — the same word the timestamps use — so a
|
||||
* Vietnamese description says "Kết thúc 3". Without it (the editor's live
|
||||
* preview) the English form is used.
|
||||
*
|
||||
* Pure — exported for unit tests + direct use from React components.
|
||||
*/
|
||||
export function formatEndingEntry(entry: EndingEntry): string | null {
|
||||
export function formatEndingEntry(entry: EndingEntry, t?: TranslationFn): string | null {
|
||||
const num =
|
||||
typeof entry.number === "number" && Number.isFinite(entry.number) ? entry.number : null;
|
||||
const name = (entry.name ?? "").trim();
|
||||
if (num !== null && name) return `Ending ${num}: ${name}`;
|
||||
if (num !== null) return `Ending ${num}`;
|
||||
const label = (n: number): string => {
|
||||
const key = "timeline.keywords.ending";
|
||||
const localized = t?.(key, { n: String(n) }).trim();
|
||||
return localized && localized !== key ? localized : `Ending ${n}`;
|
||||
};
|
||||
if (num !== null && name) return `${label(num)}: ${name}`;
|
||||
if (num !== null) return label(num);
|
||||
if (name) return name;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -81,3 +81,30 @@ export function mergeLimitStatus(statuses: readonly OutputLimitStatus[]): Output
|
||||
if (worst.size === 0) return EMPTY_LIMIT_STATUS;
|
||||
return { blocked: true, overflows: [...worst.values()].sort(byFieldOrder) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Fields YouTube will refuse because they contain "<" or ">" (Studio rejects
|
||||
* both characters in titles and descriptions). A game or chapter name typed
|
||||
* with them used to go through unremarked and fail on upload.
|
||||
*/
|
||||
export function fieldsWithForbiddenChars(
|
||||
output: Pick<GeneratorOutput, "title" | "description">,
|
||||
): Array<"title" | "description"> {
|
||||
const fields: Array<"title" | "description"> = [];
|
||||
if (/[<>]/.test(output.title)) fields.push("title");
|
||||
if (/[<>]/.test(output.description)) fields.push("description");
|
||||
return fields;
|
||||
}
|
||||
|
||||
/** Whether one field of an output is over its YouTube limit. */
|
||||
export function isFieldOver(status: OutputLimitStatus, field: LimitedField): boolean {
|
||||
return status.overflows.some((o) => o.field === field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy All is title + description, so it is blocked by either of those —
|
||||
* but not by the tags, which it doesn't include.
|
||||
*/
|
||||
export function isCopyAllBlocked(status: OutputLimitStatus): boolean {
|
||||
return isFieldOver(status, "title") || isFieldOver(status, "description");
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { RIG_FIELDS, formatRigValue } from "@config/rig-fields";
|
||||
import type { TranslationFn } from "./types";
|
||||
|
||||
/**
|
||||
* The rig as "Label: value" lines, shared by the description and the
|
||||
* social captions.
|
||||
*
|
||||
* Labels come from the output language (`description.rigLabels.*`) and the
|
||||
* order is {@link RIG_FIELDS}'. Both used to come from the stored object:
|
||||
* every language printed English keys in capitals ("VIDEO EDITOR:"), in
|
||||
* whatever order the fields had first been filled in.
|
||||
*/
|
||||
export function buildRigLines(
|
||||
rig: Partial<Record<string, string>> | undefined,
|
||||
t: TranslationFn,
|
||||
): string[] {
|
||||
if (!rig) return [];
|
||||
const known = new Set(RIG_FIELDS.map((field) => field.id));
|
||||
|
||||
const lines = RIG_FIELDS.flatMap((field) => {
|
||||
const value = formatRigValue(field.id, rig[field.id] ?? "").trim();
|
||||
return value ? [`${t(`description.rigLabels.${field.id}`)}: ${value}`] : [];
|
||||
});
|
||||
|
||||
// Keys that aren't rig fields any more (older versions, hand-edited
|
||||
// imports) are still printed rather than silently dropped.
|
||||
for (const [key, raw] of Object.entries(rig)) {
|
||||
const value = (raw ?? "").trim();
|
||||
if (!known.has(key) && value) lines.push(`${key.replace(/_/g, " ")}: ${value}`);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import type { GeneratorInput, TranslationFn } from "./types";
|
||||
import type { SocialPlatform } from "@config/social-platforms";
|
||||
import { buildTitle } from "./title-builder";
|
||||
import { buildBilingualBulletSection } from "./description-builder";
|
||||
import { formatRigValue } from "@config/rig-fields";
|
||||
import { buildRigLines } from "./rig-block";
|
||||
import { sanitizeHashtag } from "@utils/sanitize";
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ import { sanitizeHashtag } from "@utils/sanitize";
|
||||
* short-form caption for TikTok / Instagram Reels / Facebook Reels.
|
||||
*
|
||||
* Reuses leaf engine pieces rather than the full description renderer:
|
||||
* {@link buildTitle} (badge suppressed), {@link formatRigValue}, the
|
||||
* {@link buildTitle} (badge suppressed), {@link buildRigLines}, the
|
||||
* shared {@link buildBilingualBulletSection} (content warnings), the
|
||||
* `description.sections.*` copyright / sponsor templates, and
|
||||
* {@link sanitizeHashtag}. The YouTube description output is therefore
|
||||
@@ -32,6 +32,8 @@ export interface SocialPostOptions {
|
||||
showSponsorCredit?: boolean;
|
||||
/** English-fixed `t` for the bilingual content-warnings block. */
|
||||
tEn?: TranslationFn;
|
||||
/** Year for the copyright line; the current year when omitted. */
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export interface SocialPostOutput {
|
||||
@@ -53,14 +55,9 @@ type BlockId = (typeof DISPLAY_ORDER)[number];
|
||||
const DROP_ORDER: readonly BlockId[] = ["warnings", "copyright", "thanks", "rig"];
|
||||
|
||||
function buildRigBlock(input: GeneratorInput, t: TranslationFn): string {
|
||||
// Mirrors the description-builder rig block: id → formatted value,
|
||||
// skipping empties, `KEY: value` per line under the localized header.
|
||||
const rigLines = Object.entries(input.rig ?? {})
|
||||
.map(([k, v]) => [k, formatRigValue(k, v ?? "")] as const)
|
||||
.filter(([, v]) => v && v.trim() !== "")
|
||||
.map(([k, v]) => `${k.replace(/_/g, " ").toUpperCase()}: ${v}`)
|
||||
.join("\n");
|
||||
return rigLines ? `${t("description.sections.rig")}\n${rigLines}` : "";
|
||||
// The same lines as the description's rig block.
|
||||
const rigLines = buildRigLines(input.rig, t);
|
||||
return rigLines.length > 0 ? `${t("description.sections.rig")}\n${rigLines.join("\n")}` : "";
|
||||
}
|
||||
|
||||
function dedupeHashtags(tags: readonly string[]): string[] {
|
||||
@@ -82,7 +79,7 @@ function buildHashtagLine(input: GeneratorInput, popular: readonly string[]): st
|
||||
`#${sanitizeHashtag(gameName)}`,
|
||||
"#GameplayNoCommentary",
|
||||
...(primaryGenre ? [`#${sanitizeHashtag(primaryGenre)}`] : []),
|
||||
];
|
||||
].filter((tag) => tag.length > 1);
|
||||
return dedupeHashtags([...derived, ...popular]).join(" ");
|
||||
}
|
||||
|
||||
@@ -91,7 +88,14 @@ export function buildSocialPost(
|
||||
t: TranslationFn,
|
||||
options: SocialPostOptions,
|
||||
): SocialPostOutput {
|
||||
const { charLimit, popularHashtags, showCopyright, showSponsorCredit, tEn } = options;
|
||||
const {
|
||||
charLimit,
|
||||
popularHashtags,
|
||||
showCopyright,
|
||||
showSponsorCredit,
|
||||
tEn,
|
||||
year = new Date().getFullYear(),
|
||||
} = options;
|
||||
|
||||
// Title — short-form, so the `[2K 60FPS]` badge is suppressed.
|
||||
const title = buildTitle(input, t, { showQualityBadge: false });
|
||||
@@ -116,7 +120,7 @@ export function buildSocialPost(
|
||||
copyright:
|
||||
showCopyright && input.channelName.trim()
|
||||
? t("description.sections.copyright", {
|
||||
year: String(new Date().getFullYear()),
|
||||
year: String(year),
|
||||
channelName: input.channelName.trim(),
|
||||
})
|
||||
: "",
|
||||
@@ -169,6 +173,7 @@ export function buildAllSocialPosts(
|
||||
showCopyright?: boolean;
|
||||
showSponsorCredit?: boolean;
|
||||
tEn?: TranslationFn;
|
||||
year?: number;
|
||||
},
|
||||
): Record<string, SocialPostOutput> {
|
||||
const out: Record<string, SocialPostOutput> = {};
|
||||
@@ -179,6 +184,7 @@ export function buildAllSocialPosts(
|
||||
showCopyright: shared.showCopyright,
|
||||
showSponsorCredit: shared.showSponsorCredit,
|
||||
tEn: shared.tEn,
|
||||
year: shared.year,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
|
||||
+96
-38
@@ -1,6 +1,21 @@
|
||||
import type { GeneratorInput, SupportedLanguage } from "./types";
|
||||
import { YT_LIMITS } from "./types";
|
||||
import { humanizeId } from "@utils/sanitize";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
|
||||
/**
|
||||
* Length of a tag list as YouTube counts it against the 500-character
|
||||
* limit: each tag, plus the quotes YouTube wraps around any tag containing
|
||||
* a space, plus one comma between tags.
|
||||
*
|
||||
* The tool used to measure its own ", "-joined string instead, which
|
||||
* ignores the quotes — 15 of 51 real tag sets it produced were over 500 by
|
||||
* YouTube's count (up to 509) while showing as under.
|
||||
*/
|
||||
export function youtubeTagsLength(tags: readonly string[]): number {
|
||||
if (tags.length === 0) return 0;
|
||||
const chars = tags.reduce((sum, tag) => sum + tag.length + (/\s/.test(tag) ? 2 : 0), 0);
|
||||
return chars + tags.length - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reserve a 9-char tail for the most common composite suffix (" gameplay").
|
||||
@@ -74,7 +89,7 @@ export function tagFriendlyGameName(name: string, budget: number): string {
|
||||
* all regions). Language-specific tags come from CORE_TAGS_BY_LANG and
|
||||
* MULTILINGUAL_TAGS.
|
||||
*/
|
||||
const GENRE_TAG_REGISTRY: Record<string, (gameName: string) => string[]> = {
|
||||
export const GENRE_TAG_REGISTRY: Record<string, (gameName: string) => string[]> = {
|
||||
action: (g) => [
|
||||
`${g} action`,
|
||||
"action game no commentary",
|
||||
@@ -87,13 +102,7 @@ const GENRE_TAG_REGISTRY: Record<string, (gameName: string) => string[]> = {
|
||||
"survival horror gameplay",
|
||||
`${g} scary`,
|
||||
],
|
||||
rpg: (g) => [
|
||||
`${g} RPG`,
|
||||
"RPG no commentary",
|
||||
"RPG gameplay",
|
||||
"JRPG no commentary",
|
||||
`${g} role playing`,
|
||||
],
|
||||
rpg: (g) => [`${g} RPG`, "RPG no commentary", "RPG gameplay", `${g} role playing`],
|
||||
fps: (g) => [`${g} FPS`, "FPS no commentary", "shooter gameplay no commentary", `${g} shooter`],
|
||||
openworld: (g) => [
|
||||
`${g} open world`,
|
||||
@@ -125,7 +134,7 @@ const GENRE_TAG_REGISTRY: Record<string, (gameName: string) => string[]> = {
|
||||
simulation: (g) => [
|
||||
`${g} simulation`,
|
||||
"simulation game no commentary",
|
||||
"strategy gameplay",
|
||||
"simulation gameplay",
|
||||
`${g} sim`,
|
||||
],
|
||||
fighting: (g) => [`${g} fighting`, "fighting game no commentary", "combo gameplay", `${g} fight`],
|
||||
@@ -162,12 +171,7 @@ const GENRE_TAG_REGISTRY: Record<string, (gameName: string) => string[]> = {
|
||||
"TD gameplay",
|
||||
`${g} strategy`,
|
||||
],
|
||||
card_game: (g) => [
|
||||
`${g} card game`,
|
||||
"deck builder no commentary",
|
||||
"card game gameplay",
|
||||
`${g} TCG`,
|
||||
],
|
||||
card_game: (g) => [`${g} card game`, "card game no commentary", "card game gameplay", `${g} TCG`],
|
||||
battle_royale: (g) => [
|
||||
`${g} battle royale`,
|
||||
"battle royale no commentary",
|
||||
@@ -420,15 +424,63 @@ export const MULTILINGUAL_TAGS: Record<SupportedLanguage, (gameName: string) =>
|
||||
};
|
||||
|
||||
function getPlatformTags(gameName: string, platform: string): string[] {
|
||||
if (!platform) return [];
|
||||
const platformLabel = platform.toUpperCase();
|
||||
return [
|
||||
`${gameName} ${platformLabel}`,
|
||||
`${platformLabel} gameplay`,
|
||||
`${gameName} ${platformLabel} gameplay`,
|
||||
];
|
||||
// The name people search for ("Steam", "itch.io"), not the id in capitals
|
||||
// ("STEAM", "ITCHIO"). A publisher's own site isn't a search term at all.
|
||||
const name = PLATFORMS.find((p) => p.id === platform)?.tagName;
|
||||
if (!name) return [];
|
||||
return [`${gameName} ${name}`, `${name} gameplay`, `${gameName} ${name} gameplay`];
|
||||
}
|
||||
|
||||
/**
|
||||
* The English search term for a genre, as used in "best … games" tags.
|
||||
* `humanizeId` gave "best Openworld games" and "best Survival_craft
|
||||
* games"; these are the words people actually type.
|
||||
*/
|
||||
export const GENRE_SEARCH_TERMS: Readonly<Record<string, string>> = {
|
||||
action: "action",
|
||||
hack_slash: "hack and slash",
|
||||
beatemup: "beat em up",
|
||||
platformer: "platformer",
|
||||
horror: "horror",
|
||||
survival_horror: "survival horror",
|
||||
psychological_horror: "psychological horror",
|
||||
rpg: "RPG",
|
||||
jrpg: "JRPG",
|
||||
action_rpg: "action RPG",
|
||||
crpg: "CRPG",
|
||||
fps: "FPS",
|
||||
arena_shooter: "arena shooter",
|
||||
tactical_fps: "tactical shooter",
|
||||
boomer_shooter: "boomer shooter",
|
||||
extraction_shooter: "extraction shooter",
|
||||
shmup: "shmup",
|
||||
openworld: "open world",
|
||||
indie: "indie",
|
||||
soulslike: "soulslike",
|
||||
racing: "racing",
|
||||
story: "story",
|
||||
simulation: "simulation",
|
||||
city_builder: "city builder",
|
||||
fighting: "fighting",
|
||||
stealth: "stealth",
|
||||
survival_craft: "survival",
|
||||
roguelike: "roguelike",
|
||||
metroidvania: "metroidvania",
|
||||
mmo: "MMO",
|
||||
rhythm: "rhythm",
|
||||
puzzle: "puzzle",
|
||||
tower_defense: "tower defense",
|
||||
card_game: "card",
|
||||
deck_builder: "deck builder",
|
||||
auto_battler: "auto battler",
|
||||
battle_royale: "battle royale",
|
||||
tactical: "tactics",
|
||||
space: "space",
|
||||
farming: "farming",
|
||||
fmv: "FMV",
|
||||
visual_novel: "visual novel",
|
||||
};
|
||||
|
||||
function getQualityTags(gameName: string, resolution?: string, fps?: string): string[] {
|
||||
const tags: string[] = [];
|
||||
if (resolution && resolution !== "1080p") {
|
||||
@@ -443,23 +495,24 @@ function getQualityTags(gameName: string, resolution?: string, fps?: string): st
|
||||
return tags;
|
||||
}
|
||||
|
||||
function getTrendingTags(gameName: string, genre: string): string[] {
|
||||
const year = new Date().getFullYear().toString();
|
||||
const genreLabel = humanizeId(genre);
|
||||
return [
|
||||
`${gameName} ${year}`,
|
||||
`best ${genreLabel} games ${year}`,
|
||||
`${genreLabel} gameplay ${year}`,
|
||||
];
|
||||
function getTrendingTags(gameName: string, genre: string, year: number): string[] {
|
||||
const term = GENRE_SEARCH_TERMS[genre] ?? genre.replace(/_/g, " ");
|
||||
return [`${gameName} ${year}`, `best ${term} games ${year}`, `${term} gameplay ${year}`];
|
||||
}
|
||||
|
||||
export interface TagOptions {
|
||||
includeMultilingualTags?: boolean;
|
||||
includeTrendingTags?: boolean;
|
||||
/** Year for the trending tags; the current year when omitted. */
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export function generateTags(input: GeneratorInput, options?: TagOptions): string[] {
|
||||
const { includeMultilingualTags = true, includeTrendingTags = true } = options ?? {};
|
||||
const {
|
||||
includeMultilingualTags = true,
|
||||
includeTrendingTags = true,
|
||||
year = new Date().getFullYear(),
|
||||
} = options ?? {};
|
||||
const rawName = sanitizeForTag(input.gameNameLocalized?.[input.language] ?? input.gameName);
|
||||
|
||||
// Two friendly forms of the game name:
|
||||
@@ -523,7 +576,7 @@ export function generateTags(input: GeneratorInput, options?: TagOptions): strin
|
||||
// one headline category that searchers use.
|
||||
const primaryGenre = input.genres[0];
|
||||
if (includeTrendingTags && primaryGenre) {
|
||||
allTags.push(...getTrendingTags(composeName, primaryGenre));
|
||||
allTags.push(...getTrendingTags(composeName, primaryGenre, year));
|
||||
}
|
||||
|
||||
// Publisher / Developer name (v0.10) — emitted as a bare tag only.
|
||||
@@ -552,16 +605,21 @@ export function generateTags(input: GeneratorInput, options?: TagOptions): strin
|
||||
return trimToCharLimit(deduped, YT_LIMITS.TAGS_MAX);
|
||||
}
|
||||
|
||||
function trimToCharLimit(tags: string[], maxChars: number): string[] {
|
||||
/**
|
||||
* Keep tags, in priority order, while the list fits YouTube's limit as
|
||||
* YouTube counts it ({@link youtubeTagsLength}). A tag that doesn't fit is
|
||||
* skipped and the shorter ones after it are still tried — the old loop
|
||||
* stopped at the first miss and left budget unused.
|
||||
*/
|
||||
export function trimToCharLimit(tags: string[], maxChars: number): string[] {
|
||||
const result: string[] = [];
|
||||
let totalLength = 0;
|
||||
|
||||
for (const tag of tags) {
|
||||
const separatorLength = result.length > 0 ? 2 : 0; // ", "
|
||||
const newLength = totalLength + separatorLength + tag.length;
|
||||
if (newLength > maxChars) break;
|
||||
const cost = tag.length + (/\s/.test(tag) ? 2 : 0) + (result.length > 0 ? 1 : 0);
|
||||
if (totalLength + cost > maxChars) continue;
|
||||
result.push(tag);
|
||||
totalLength = newLength;
|
||||
totalLength += cost;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
} from "./types";
|
||||
import { buildTitle, checkTitleWarning } from "./title-builder";
|
||||
import { buildDescription, checkDescriptionWarning } from "./description-builder";
|
||||
import { generateTags, formatTagString, type TagOptions } from "./tag-generator";
|
||||
import { generateTags, formatTagString, youtubeTagsLength, type TagOptions } from "./tag-generator";
|
||||
import { YT_LIMITS } from "./types";
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ import { YT_LIMITS } from "./types";
|
||||
* which makes a forgotten key a compile error rather than a silent omission.
|
||||
* See `src/hooks/use-render-options.ts` and its parity test.
|
||||
*/
|
||||
export interface SettingsRenderOptions extends TagOptions {
|
||||
export interface SettingsRenderOptions extends Omit<TagOptions, "year"> {
|
||||
hashtagCount?: number;
|
||||
/**
|
||||
* When true, buildTitle appends a `[2K 60FPS]`-style badge to the
|
||||
@@ -103,6 +103,12 @@ export interface RenderOptionOverrides {
|
||||
* unaffected and stays bilingual. Defaults to true. v0.29.3.
|
||||
*/
|
||||
bilingualContentBlocks?: boolean;
|
||||
/**
|
||||
* The year for the copyright line and the trending tags. Passed in so the
|
||||
* engine never reads the clock itself (and tests are deterministic); the
|
||||
* current year when omitted.
|
||||
*/
|
||||
year?: number;
|
||||
}
|
||||
|
||||
export interface RenderOptions extends SettingsRenderOptions, RenderOptionOverrides {}
|
||||
@@ -129,14 +135,18 @@ export function renderAll(
|
||||
showTranslationQuality: options?.showTranslationQuality,
|
||||
tEn: options?.tEn,
|
||||
bilingualContentBlocks: options?.bilingualContentBlocks,
|
||||
year: options?.year,
|
||||
});
|
||||
const tags = generateTags(input, options);
|
||||
const tagString = formatTagString(tags);
|
||||
// YouTube's own count (quotes around multi-word tags, one comma between
|
||||
// tags) — not the length of the ", "-joined string we hand to the clipboard.
|
||||
const tagsLength = youtubeTagsLength(tags);
|
||||
|
||||
const charCounts = {
|
||||
title: title.length,
|
||||
description: description.length,
|
||||
tags: tagString.length,
|
||||
tags: tagsLength,
|
||||
};
|
||||
|
||||
const warnings: CharLimitWarning[] = [];
|
||||
@@ -147,12 +157,12 @@ export function renderAll(
|
||||
const descWarning = checkDescriptionWarning(description);
|
||||
if (descWarning) warnings.push(descWarning);
|
||||
|
||||
if (tagString.length > YT_LIMITS.TAGS_MAX) {
|
||||
if (tagsLength > YT_LIMITS.TAGS_MAX) {
|
||||
warnings.push({
|
||||
field: "tags",
|
||||
current: tagString.length,
|
||||
current: tagsLength,
|
||||
limit: YT_LIMITS.TAGS_MAX,
|
||||
message: `Tags exceed ${YT_LIMITS.TAGS_MAX} characters (${tagString.length}/${YT_LIMITS.TAGS_MAX})`,
|
||||
message: `Tags exceed ${YT_LIMITS.TAGS_MAX} characters (${tagsLength}/${YT_LIMITS.TAGS_MAX})`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+116
-20
@@ -8,7 +8,7 @@ type TimelineKeyword =
|
||||
"chapter" | "part" | "boss" | "final_boss" | "intro" | "ending" | "tutorial" | "credits";
|
||||
|
||||
export interface TimelineEntry {
|
||||
/** Raw timecode as it appeared in the input (e.g. "0:00", "1:23:45"). */
|
||||
/** Timecode as written, minus brackets and frames (e.g. "0:00", "1:23:45"). */
|
||||
time: string;
|
||||
/** Entire label portion after the timecode (trimmed). */
|
||||
rawLabel: string;
|
||||
@@ -20,8 +20,14 @@ export interface TimelineEntry {
|
||||
rest?: string;
|
||||
}
|
||||
|
||||
// Regex for extracting time + label from a line. Accepts MM:SS or HH:MM:SS.
|
||||
const LINE_RE = /^\s*((?:\d{1,2}:)?\d{1,2}:\d{2})\s+(.+?)\s*$/;
|
||||
/**
|
||||
* A timestamp line: an optional `[` / `(`, M:SS / MM:SS / H:MM:SS (with
|
||||
* frames `:FF` dropped, as editors export them), an optional `]` / `)`,
|
||||
* an optional separator (`-`, `–`, `—`, `:`, `|`, `•`) and the label.
|
||||
* "[0:00] Intro", "0:00 - Intro" and "00:00:00:12 Intro" all parse.
|
||||
*/
|
||||
const LINE_RE =
|
||||
/^\s*[[(]?((?:\d{1,2}:)?\d{1,2}:\d{2})(?::\d{2})?[\])]?\s*(?:[-–—:|•·]\s*)?(\S.*?)\s*$/u;
|
||||
|
||||
// Keyword patterns. Order matters — "final boss" must be tried before "boss".
|
||||
// Each regex captures the optional number group when applicable.
|
||||
@@ -31,56 +37,78 @@ interface KeywordPattern {
|
||||
hasNumber: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* After a Latin-script keyword, the next character must not be a letter:
|
||||
* "Part 2" is a part, "Party" is not; "Intro" is an intro, "Introspection"
|
||||
* is not. Scripts written without spaces (Japanese, Chinese, Korean) are
|
||||
* matched without this guard.
|
||||
*/
|
||||
const END = "(?!\\p{L})";
|
||||
|
||||
const kw = (source: string): RegExp => new RegExp(source, "iu");
|
||||
|
||||
const KEYWORD_PATTERNS: KeywordPattern[] = [
|
||||
// Final boss (multi-language, no number). Must come BEFORE "boss".
|
||||
{
|
||||
re: /^(final\s+boss|boss\s+cuối\s+cùng|boss\s+cuối|ラスボス|最終\s*ボス|jefe\s+final|최종\s*보스|最终\s*boss|最终\s*首领)(.*)$/i,
|
||||
re: kw(
|
||||
`^((?:final\\s+boss|boss\\s+cuối\\s+cùng|boss\\s+cuối|jefe\\s+final|chefe\\s+final|bos\\s+terakhir)${END}|ラスボス|最終\\s*ボス|최종\\s*보스|最终\\s*boss|最终\\s*首领)(.*)$`,
|
||||
),
|
||||
keyword: "final_boss",
|
||||
hasNumber: false,
|
||||
},
|
||||
// Chapter — captures various CJK/Latin forms
|
||||
{
|
||||
re: /^(?:chapter|chap\.?|chương|chuong|capítulo|capitulo|第\s*(\d+)\s*章|제\s*(\d+)\s*장|章|장)\s*(\d+)?(.*)$/i,
|
||||
re: kw(
|
||||
`^(?:(?:chapter|chap\\.|chap|chương|chuong|capítulo|capitulo|bab)${END}|第\\s*(\\d+)\\s*章|제\\s*(\\d+)\\s*장|章|장)\\s*(\\d+)?(.*)$`,
|
||||
),
|
||||
keyword: "chapter",
|
||||
hasNumber: true,
|
||||
},
|
||||
// Part
|
||||
{
|
||||
re: /^(?:part|phần|phan|パート|parte|파트|第\s*(\d+)\s*部|部分)\s*(\d+)?(.*)$/i,
|
||||
re: kw(
|
||||
`^(?:(?:part|phần|phan|parte|bagian)${END}|パート|파트|第\\s*(\\d+)\\s*部|部分)\\s*(\\d+)?(.*)$`,
|
||||
),
|
||||
keyword: "part",
|
||||
hasNumber: true,
|
||||
},
|
||||
// Boss (single, with optional number)
|
||||
{
|
||||
re: /^(?:boss|ボス|jefe|보스)\s*(\d+)?(.*)$/i,
|
||||
re: kw(`^(?:(?:boss|jefe|chefe|bos)${END}|ボス|보스)\\s*(\\d+)?(.*)$`),
|
||||
keyword: "boss",
|
||||
hasNumber: true,
|
||||
},
|
||||
// Intro
|
||||
{
|
||||
re: /^(intro|introduction|mở\s+đầu|mo\s+dau|オープニング|オープン|introducción|introduccion|인트로|开场|序幕)(.*)$/i,
|
||||
re: kw(
|
||||
`^((?:introduction|introducción|introduccion|introdução|introducao|intro|mở\\s+đầu|mo\\s+dau|pembukaan)${END}|オープニング|인트로|开场|序幕)(.*)$`,
|
||||
),
|
||||
keyword: "intro",
|
||||
hasNumber: false,
|
||||
},
|
||||
// Ending — v0.16.0 now captures an optional ordinal so timeline
|
||||
// entries like "Ending 1" / "Ending 3: Best End" can be matched
|
||||
// back to the structured `endings[]` array in the editor. The "rest"
|
||||
// tail keeps any trailing label so the renderer still emits the
|
||||
// creator's exact text on round-trip.
|
||||
// Ending — captures an optional ordinal so "Ending 1" / "Ending 3: Best
|
||||
// End" can be matched back to the structured `endings[]` array. Bare
|
||||
// "Final" (Spanish / Portuguese for ending) only counts when nothing but
|
||||
// a number or punctuation follows it — "Final Fantasy VII" is a game,
|
||||
// not an ending.
|
||||
{
|
||||
re: /^(?:ending|kết\s+thúc|ket\s+thuc|エンディング|final|엔딩|结局|结尾)\s*(\d+)?(.*)$/i,
|
||||
re: kw(
|
||||
`^(?:(?:ending|kết\\s+thúc|ket\\s+thuc|desfecho|tamat)${END}|final(?=\\s*(?:$|\\d|[:\\-–—(]))|エンディング|엔딩|结局|结尾)\\s*(\\d+)?(.*)$`,
|
||||
),
|
||||
keyword: "ending",
|
||||
hasNumber: true,
|
||||
},
|
||||
// Tutorial
|
||||
{
|
||||
re: /^(tutorial|hướng\s+dẫn|huong\s+dan|チュートリアル|튜토리얼|教程)(.*)$/i,
|
||||
re: kw(`^((?:tutorial|hướng\\s+dẫn|huong\\s+dan)${END}|チュートリアル|튜토리얼|教程)(.*)$`),
|
||||
keyword: "tutorial",
|
||||
hasNumber: false,
|
||||
},
|
||||
// Credits
|
||||
{
|
||||
re: /^(credits|credit|クレジット|créditos|creditos|크레딧|片尾|职员表)(.*)$/i,
|
||||
re: kw(
|
||||
`^((?:credits|credit|créditos|creditos|kredit)${END}|クレジット|크레딧|片尾|职员表)(.*)$`,
|
||||
),
|
||||
keyword: "credits",
|
||||
hasNumber: false,
|
||||
},
|
||||
@@ -169,10 +197,8 @@ export function renderTimeline(
|
||||
}
|
||||
|
||||
const numberVar = entry.number != null ? String(entry.number) : "";
|
||||
// v0.16.0: collapse the trailing whitespace that creeps in when a
|
||||
// numbered keyword pattern (`"Boss {{n}}"`) interpolates with an
|
||||
// empty `n` (e.g. a bare "boss" line with no ordinal). Without
|
||||
// this, the renderer emits "0:42 Boss rest" with a double space.
|
||||
// Collapse the trailing whitespace that creeps in when a numbered
|
||||
// keyword pattern (`"Boss {{n}}"`) interpolates with an empty `n`.
|
||||
const translated = t(`timeline.keywords.${entry.keyword}`, { n: numberVar })
|
||||
.replace(/\s+$/u, "")
|
||||
.replace(/\s{2,}/gu, " ");
|
||||
@@ -182,3 +208,73 @@ export function renderTimeline(
|
||||
|
||||
return rendered.join("\n");
|
||||
}
|
||||
|
||||
/** Seconds in a timecode ("1:02:03" → 3723), or NaN when it isn't one. */
|
||||
export function timecodeSeconds(time: string): number {
|
||||
const parts = time.split(":").map((p) => Number(p));
|
||||
if (parts.length < 2 || parts.length > 3 || parts.some((p) => !Number.isInteger(p) || p < 0)) {
|
||||
return Number.NaN;
|
||||
}
|
||||
return parts.reduce((total, part) => total * 60 + part, 0);
|
||||
}
|
||||
|
||||
/** Canonical YouTube form: "0:05", "12:34", "1:02:03". */
|
||||
export function formatTimecode(seconds: number): string {
|
||||
const h = Math.floor(seconds / 3600);
|
||||
const m = Math.floor((seconds % 3600) / 60);
|
||||
const s = seconds % 60;
|
||||
const ss = String(s).padStart(2, "0");
|
||||
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${ss}` : `${m}:${ss}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrite a timestamp list in the form YouTube reads most reliably: one
|
||||
* "M:SS label" per line, brackets / frames / separators removed, times
|
||||
* without leading zeros. Lines that aren't timestamps are kept as they are.
|
||||
*/
|
||||
export function normalizeTimeline(raw: string): string {
|
||||
return parseTimeline(raw)
|
||||
.map((entry) => {
|
||||
if (!entry.time) return entry.rawLabel;
|
||||
const seconds = timecodeSeconds(entry.time);
|
||||
const time = Number.isNaN(seconds) ? entry.time : formatTimecode(seconds);
|
||||
return `${time} ${entry.rawLabel}`;
|
||||
})
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
/** Why YouTube wouldn't turn a timestamp list into chapters. */
|
||||
export type ChapterIssue =
|
||||
| { kind: "firstNotZero" }
|
||||
| { kind: "tooFew"; count: number }
|
||||
| { kind: "tooShort"; time: string }
|
||||
| { kind: "outOfOrder"; time: string };
|
||||
|
||||
/** YouTube's own rules for video chapters. */
|
||||
export const CHAPTER_RULES = { minCount: 3, minSeconds: 10 } as const;
|
||||
|
||||
/**
|
||||
* Check a timestamp list against YouTube's chapter rules: the first
|
||||
* timestamp at 0:00, at least three of them, in ascending order, each
|
||||
* chapter at least ten seconds long. An empty list has no issues — chapters
|
||||
* are optional.
|
||||
*/
|
||||
export function checkChapters(entries: readonly TimelineEntry[]): ChapterIssue[] {
|
||||
const timed = entries.filter((e) => e.time);
|
||||
if (timed.length === 0) return [];
|
||||
|
||||
const issues: ChapterIssue[] = [];
|
||||
const seconds = timed.map((e) => timecodeSeconds(e.time));
|
||||
if (seconds[0] !== 0) issues.push({ kind: "firstNotZero" });
|
||||
if (timed.length < CHAPTER_RULES.minCount) {
|
||||
issues.push({ kind: "tooFew", count: timed.length });
|
||||
}
|
||||
for (let i = 1; i < timed.length; i++) {
|
||||
const prev = seconds[i - 1] ?? 0;
|
||||
const cur = seconds[i] ?? 0;
|
||||
const time = timed[i]?.time ?? "";
|
||||
if (cur <= prev) issues.push({ kind: "outOfOrder", time });
|
||||
else if (cur - prev < CHAPTER_RULES.minSeconds) issues.push({ kind: "tooShort", time });
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ function buildStructuredEndingLabel(input: GeneratorInput, t: TranslationFn): st
|
||||
|
||||
if (usable.length === 1) {
|
||||
const only = usable[0];
|
||||
return only ? formatEndingEntry(only) : null;
|
||||
return only ? formatEndingEntry(only, t) : null;
|
||||
}
|
||||
|
||||
// Multi-entry: prefer named comma-join when every entry has a name.
|
||||
|
||||
+10
-10
@@ -7,14 +7,14 @@ interface CharCountResult {
|
||||
percentage: number;
|
||||
}
|
||||
|
||||
export function useCharCount(text: string, limit: number): CharCountResult {
|
||||
return useMemo(
|
||||
() => ({
|
||||
count: text.length,
|
||||
limit,
|
||||
isOver: text.length > limit,
|
||||
percentage: Math.min((text.length / limit) * 100, 100),
|
||||
}),
|
||||
[text, limit],
|
||||
);
|
||||
/**
|
||||
* `count` overrides `text.length` where YouTube measures differently from
|
||||
* the string we display — tags, whose limit counts quotes around multi-word
|
||||
* tags and one comma between tags (see `youtubeTagsLength`).
|
||||
*/
|
||||
export function useCharCount(text: string, limit: number, count?: number): CharCountResult {
|
||||
return useMemo(() => {
|
||||
const n = count ?? text.length;
|
||||
return { count: n, limit, isOver: n > limit, percentage: Math.min((n / limit) * 100, 100) };
|
||||
}, [text, limit, count]);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { LimitedField, OutputLimitStatus } from "@engine/limits";
|
||||
|
||||
export interface CopyGate {
|
||||
blocked: boolean;
|
||||
blockedHint?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-field copy gating: a field can't be copied while it is over its
|
||||
* YouTube limit, or while Strict Mode is blocking — each with the reason as
|
||||
* the button's tooltip. Other fields stay copyable.
|
||||
*/
|
||||
export function useCopyGate(
|
||||
status: OutputLimitStatus,
|
||||
strictBlocked: boolean,
|
||||
): (field: LimitedField) => CopyGate {
|
||||
const { t } = useTranslation("ui");
|
||||
return useCallback(
|
||||
(field: LimitedField): CopyGate => {
|
||||
if (strictBlocked) return { blocked: true, blockedHint: t("strict.copyBlocked") };
|
||||
const over = status.overflows.find((o) => o.field === field);
|
||||
if (!over) return { blocked: false };
|
||||
return {
|
||||
blocked: true,
|
||||
blockedHint: t("output.limits.fieldLine", {
|
||||
field: t(`output.${field}`),
|
||||
count: over.current,
|
||||
limit: over.limit,
|
||||
}),
|
||||
};
|
||||
},
|
||||
[status, strictBlocked, t],
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import { getOutputLimitStatus } from "@engine/limits";
|
||||
import { getOutputLimitStatus, isCopyAllBlocked, isFieldOver } from "@engine/limits";
|
||||
import { YT_LIMITS } from "@engine/types";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { useGeneratedOutput } from "./use-generated-output";
|
||||
@@ -13,9 +13,9 @@ 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.)
|
||||
* buttons: nothing while Strict Mode is blocking, and not a field that is
|
||||
* over its YouTube limit (Copy All: title or description). The shortcut used
|
||||
* to copy title + description past both gates.
|
||||
*/
|
||||
export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean> {
|
||||
const { t } = useTranslation("ui");
|
||||
@@ -34,7 +34,9 @@ export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean>
|
||||
toast.error(t("strict.copyBlocked"));
|
||||
return false;
|
||||
}
|
||||
if (getOutputLimitStatus(output).blocked) {
|
||||
const status = getOutputLimitStatus(output);
|
||||
const blocked = target === "all" ? isCopyAllBlocked(status) : isFieldOver(status, target);
|
||||
if (blocked) {
|
||||
toast.error(t("output.limits.bannerTitle"));
|
||||
return false;
|
||||
}
|
||||
@@ -47,10 +49,9 @@ export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean>
|
||||
fieldLabel: t("output.description"),
|
||||
});
|
||||
case "tags":
|
||||
return copy(output.tagString, {
|
||||
limit: YT_LIMITS.TAGS_MAX,
|
||||
fieldLabel: t("output.tags"),
|
||||
});
|
||||
// No raw-length backstop: YouTube counts tags differently from the
|
||||
// joined string, and the check above already used its count.
|
||||
return copy(output.tagString);
|
||||
case "all":
|
||||
return copy(`${output.title}\n\n${output.description}`);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,8 @@ export function useRenderOptions(
|
||||
if (bilingualContentBlocks !== undefined) {
|
||||
overrides.bilingualContentBlocks = bilingualContentBlocks;
|
||||
}
|
||||
// The engine doesn't read the clock; the UI hands it the year.
|
||||
overrides.year = new Date().getFullYear();
|
||||
return buildRenderOptions(
|
||||
{
|
||||
includeMultilingualTags,
|
||||
|
||||
@@ -37,6 +37,7 @@ export function useSocialPosts(
|
||||
showCopyright,
|
||||
showSponsorCredit,
|
||||
tEn,
|
||||
year: new Date().getFullYear(),
|
||||
}),
|
||||
[ready, input, t, tEn, showCopyright, showSponsorCredit],
|
||||
);
|
||||
|
||||
@@ -87,10 +87,7 @@
|
||||
"anniversaryYearOption",
|
||||
"gachaVersion",
|
||||
"gachaVersionPlaceholder",
|
||||
"gpu_brand",
|
||||
"gpu_series",
|
||||
"gpu_model",
|
||||
"gpu_custom",
|
||||
|
||||
"ram_size",
|
||||
"ram_ddr",
|
||||
"os_name",
|
||||
@@ -138,7 +135,7 @@
|
||||
"timestampsPlaceholder",
|
||||
"storeLinks",
|
||||
"storeLinkType",
|
||||
"rig",
|
||||
|
||||
"social",
|
||||
"warnings",
|
||||
"playlistLink",
|
||||
@@ -202,7 +199,16 @@
|
||||
"genreAdd",
|
||||
"genreQuickSets",
|
||||
"genreRemove",
|
||||
"selectedCount"
|
||||
"selectedCount",
|
||||
"ram_speed",
|
||||
"gpuPick",
|
||||
"gpuSearch",
|
||||
"gpuNoMatch",
|
||||
"gpuCustom",
|
||||
"gpuNone",
|
||||
"gpuCustomLabel",
|
||||
"gpuCustomChosen",
|
||||
"timestampsNormalize"
|
||||
],
|
||||
"editor.genreGroups": ["rpg", "shooter", "horror"],
|
||||
"editor.graphicsPresetOptions": [
|
||||
@@ -269,14 +275,7 @@
|
||||
],
|
||||
"editor.toast": ["urlAutoFilled"],
|
||||
"editor.warning": ["linkNameMismatch"],
|
||||
"editor.validation": [
|
||||
"gpuMissingSeries",
|
||||
"gpuMissingModel",
|
||||
"gpuCustomEmpty",
|
||||
"ramMissingDdr",
|
||||
"ramMissingSize",
|
||||
"ramCustomEmpty"
|
||||
],
|
||||
"editor.validation": ["ramMissingDdr", "ramMissingSize", "ramCustomEmpty"],
|
||||
"editor.playtest": ["heading", "linkLabel", "platformLabel", "invitesLabel", "invitesHelp"],
|
||||
"editor.playthroughOptions": ["none", "blind", "replay", "newgame_plus", "postgame"],
|
||||
"editor.difficultyOptions": ["none", "easy", "normal", "hard", "nightmare", "custom"],
|
||||
@@ -695,7 +694,8 @@
|
||||
"saveAsTemplate",
|
||||
"previewingVideo",
|
||||
"emptyTitle",
|
||||
"emptyHint"
|
||||
"emptyHint",
|
||||
"forbiddenChars"
|
||||
],
|
||||
"output.variants": ["default", "typeFirst", "qualityFirst"],
|
||||
"output.copy": ["overLimit", "fieldGeneric", "failed", "empty"],
|
||||
@@ -703,7 +703,7 @@
|
||||
"bannerTitle",
|
||||
"fieldLine",
|
||||
"bannerHint",
|
||||
"copyBlocked",
|
||||
|
||||
"batchRowBlocked",
|
||||
"batchAllBlocked"
|
||||
],
|
||||
@@ -1108,7 +1108,8 @@
|
||||
"copyright",
|
||||
"code",
|
||||
"sponsor"
|
||||
]
|
||||
],
|
||||
"editor.chapters": ["ok", "firstNotZero", "tooFew", "tooShort", "outOfOrder"]
|
||||
},
|
||||
"templates": {
|
||||
"title": ["separator", "suffix"],
|
||||
@@ -1669,6 +1670,18 @@
|
||||
"ending",
|
||||
"tutorial",
|
||||
"credits"
|
||||
],
|
||||
"description.rigLabels": [
|
||||
"cpu",
|
||||
"gpu",
|
||||
"ram",
|
||||
"motherboard",
|
||||
"storage",
|
||||
"os",
|
||||
"monitor",
|
||||
"capture",
|
||||
"controller",
|
||||
"video_editor"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 LIVE on {{time}}",
|
||||
"watchLine": "Watch / replay: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "Motherboard",
|
||||
"storage": "Storage",
|
||||
"os": "Operating System",
|
||||
"monitor": "Monitor",
|
||||
"capture": "Capture Software",
|
||||
"controller": "Controller",
|
||||
"video_editor": "Video Editor"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "Year {{count}}",
|
||||
"gachaVersion": "Game Version",
|
||||
"gachaVersionPlaceholder": "e.g. 1.2, 2.4",
|
||||
"gpu_brand": "Brand",
|
||||
"gpu_series": "Series",
|
||||
"gpu_model": "Model",
|
||||
"gpu_custom": "Custom GPU",
|
||||
"ram_size": "RAM Size",
|
||||
"ram_ddr": "DDR Generation",
|
||||
"ram_ddr": "Memory type",
|
||||
"os_name": "OS",
|
||||
"os_version": "Version",
|
||||
"os_edition": "Edition",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 Intro\n5:30 Chapter 1\n15:00 Boss Fight",
|
||||
"storeLinks": "Store Links",
|
||||
"storeLinkType": "Type",
|
||||
"rig": "My Rig",
|
||||
"social": "Social & Donate Links",
|
||||
"warnings": "Content warnings",
|
||||
"playlistLink": "Playlist Link",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "Search genres",
|
||||
"genreSearchNoResults": "No matching genres",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "Pick a series to complete the GPU.",
|
||||
"gpuMissingModel": "Pick a model to complete the GPU.",
|
||||
"gpuCustomEmpty": "Enter a GPU name or pick from the catalog.",
|
||||
"ramMissingDdr": "Pick a DDR generation.",
|
||||
"ramMissingDdr": "Pick the memory type.",
|
||||
"ramMissingSize": "Pick a RAM size.",
|
||||
"ramCustomEmpty": "Enter a RAM size in GB."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "Add",
|
||||
"genreQuickSets": "Quick sets",
|
||||
"genreRemove": "Remove {{genre}}",
|
||||
"selectedCount": "{{n}} selected"
|
||||
"selectedCount": "{{n}} selected",
|
||||
"ram_speed": "Speed (MT/s)",
|
||||
"gpuPick": "Choose a graphics card…",
|
||||
"gpuSearch": "Search — e.g. 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "Not in the list — use “Type my own”.",
|
||||
"gpuCustom": "Type my own",
|
||||
"gpuNone": "No GPU",
|
||||
"gpuCustomLabel": "GPU, as it should appear",
|
||||
"gpuCustomChosen": "Own entry",
|
||||
"timestampsNormalize": "Tidy up",
|
||||
"chapters": {
|
||||
"ok": "YouTube will show these as {{n}} chapters.",
|
||||
"firstNotZero": "YouTube only shows chapters when the first timestamp is 0:00.",
|
||||
"tooFew": "YouTube needs at least 3 timestamps for chapters ({{n}} so far).",
|
||||
"tooShort": "{{time}}: each chapter must be at least 10 seconds long.",
|
||||
"outOfOrder": "{{time}} comes before the timestamp above it."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "Title",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "Copying is blocked — over the YouTube limit",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} characters",
|
||||
"bannerHint": "Shorten the field above, then copy again.",
|
||||
"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"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"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”."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube doesn't accept the characters < and > — remove them before uploading."
|
||||
},
|
||||
"common": {
|
||||
"save": "Save",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 EN VIVO el {{time}}",
|
||||
"watchLine": "Ver / repetir: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "Placa Base",
|
||||
"storage": "Almacenamiento",
|
||||
"os": "Sistema Operativo",
|
||||
"monitor": "Monitor",
|
||||
"capture": "Software de Captura",
|
||||
"controller": "Mando",
|
||||
"video_editor": "Editor de Video"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "Año {{count}}",
|
||||
"gachaVersion": "Versión del juego",
|
||||
"gachaVersionPlaceholder": "ej. 1.2, 2.4",
|
||||
"gpu_brand": "Marca",
|
||||
"gpu_series": "Serie",
|
||||
"gpu_model": "Modelo",
|
||||
"gpu_custom": "GPU personalizada",
|
||||
"ram_size": "Tamaño RAM",
|
||||
"ram_ddr": "Generación DDR",
|
||||
"ram_ddr": "Tipo de memoria",
|
||||
"os_name": "SO",
|
||||
"os_version": "Versión",
|
||||
"os_edition": "Edición",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 Intro\n5:30 Capítulo 1\n15:00 Pelea de Jefe",
|
||||
"storeLinks": "Enlaces de Tienda",
|
||||
"storeLinkType": "Tipo",
|
||||
"rig": "Mi Equipo",
|
||||
"social": "Redes Sociales y Donaciones",
|
||||
"warnings": "Advertencias de contenido",
|
||||
"playlistLink": "Enlace de Lista de Reproducción",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "Buscar géneros",
|
||||
"genreSearchNoResults": "No se encontraron géneros",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "Selecciona la serie del GPU.",
|
||||
"gpuMissingModel": "Selecciona el modelo del GPU.",
|
||||
"gpuCustomEmpty": "Introduce el nombre del GPU o elige uno del catálogo.",
|
||||
"ramMissingDdr": "Selecciona la generación DDR.",
|
||||
"ramMissingDdr": "Elige el tipo de memoria.",
|
||||
"ramMissingSize": "Selecciona la cantidad de RAM.",
|
||||
"ramCustomEmpty": "Introduce la cantidad de RAM (GB)."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "Añadir",
|
||||
"genreQuickSets": "Conjuntos rápidos",
|
||||
"genreRemove": "Quitar {{genre}}",
|
||||
"selectedCount": "{{n}} seleccionados"
|
||||
"selectedCount": "{{n}} seleccionados",
|
||||
"ram_speed": "Velocidad (MT/s)",
|
||||
"gpuPick": "Elige una tarjeta gráfica…",
|
||||
"gpuSearch": "Buscar — p. ej. 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "No está en la lista: usa «Escribir el mío».",
|
||||
"gpuCustom": "Escribir el mío",
|
||||
"gpuNone": "Sin GPU",
|
||||
"gpuCustomLabel": "GPU (tal como debe aparecer)",
|
||||
"gpuCustomChosen": "Entrada propia",
|
||||
"timestampsNormalize": "Ordenar",
|
||||
"chapters": {
|
||||
"ok": "YouTube mostrará {{n}} capítulos.",
|
||||
"firstNotZero": "YouTube solo muestra capítulos si la primera marca es 0:00.",
|
||||
"tooFew": "YouTube necesita al menos 3 marcas para crear capítulos (llevas {{n}}).",
|
||||
"tooShort": "{{time}}: cada capítulo debe durar al menos 10 segundos.",
|
||||
"outOfOrder": "{{time}} es anterior a la marca de arriba."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "Título",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "Copia bloqueada: supera el límite de YouTube",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} caracteres",
|
||||
"bannerHint": "Acorta el campo indicado y vuelve a copiar.",
|
||||
"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"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"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»."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube no acepta los caracteres < y >; quítalos antes de subir el vídeo."
|
||||
},
|
||||
"common": {
|
||||
"save": "Guardar",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 LIVE pada {{time}}",
|
||||
"watchLine": "Tonton / ulang: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "Motherboard",
|
||||
"storage": "Penyimpanan",
|
||||
"os": "Sistem Operasi",
|
||||
"monitor": "Monitor",
|
||||
"capture": "Software Perekam",
|
||||
"controller": "Kontroler",
|
||||
"video_editor": "Editor Video"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "Tahun {{count}}",
|
||||
"gachaVersion": "Versi Game",
|
||||
"gachaVersionPlaceholder": "mis. 1.2, 2.4",
|
||||
"gpu_brand": "Merek",
|
||||
"gpu_series": "Seri",
|
||||
"gpu_model": "Model",
|
||||
"gpu_custom": "GPU Kustom",
|
||||
"ram_size": "Kapasitas RAM",
|
||||
"ram_ddr": "Generasi DDR",
|
||||
"ram_ddr": "Jenis memori",
|
||||
"os_name": "OS",
|
||||
"os_version": "Versi",
|
||||
"os_edition": "Edisi",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 Intro\n5:30 Bab 1\n15:00 Pertarungan Boss",
|
||||
"storeLinks": "Tautan Toko",
|
||||
"storeLinkType": "Jenis",
|
||||
"rig": "Spek PC Saya",
|
||||
"social": "Tautan Sosial & Donasi",
|
||||
"warnings": "Peringatan konten",
|
||||
"playlistLink": "Tautan Playlist",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "Cari genre",
|
||||
"genreSearchNoResults": "Tidak ada genre yang cocok",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "Pilih seri untuk melengkapi GPU.",
|
||||
"gpuMissingModel": "Pilih model untuk melengkapi GPU.",
|
||||
"gpuCustomEmpty": "Masukkan nama GPU atau pilih dari katalog.",
|
||||
"ramMissingDdr": "Pilih generasi DDR.",
|
||||
"ramMissingDdr": "Pilih jenis memori.",
|
||||
"ramMissingSize": "Pilih kapasitas RAM.",
|
||||
"ramCustomEmpty": "Masukkan kapasitas RAM dalam GB."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "Tambah",
|
||||
"genreQuickSets": "Set cepat",
|
||||
"genreRemove": "Hapus {{genre}}",
|
||||
"selectedCount": "{{n}} dipilih"
|
||||
"selectedCount": "{{n}} dipilih",
|
||||
"ram_speed": "Kecepatan (MT/s)",
|
||||
"gpuPick": "Pilih kartu grafis…",
|
||||
"gpuSearch": "Cari — mis. 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "Tidak ada di daftar — gunakan “Ketik sendiri”.",
|
||||
"gpuCustom": "Ketik sendiri",
|
||||
"gpuNone": "Kosongkan",
|
||||
"gpuCustomLabel": "GPU (sesuai yang ditampilkan)",
|
||||
"gpuCustomChosen": "Isian sendiri",
|
||||
"timestampsNormalize": "Rapikan",
|
||||
"chapters": {
|
||||
"ok": "YouTube akan menampilkannya sebagai {{n}} bab.",
|
||||
"firstNotZero": "YouTube hanya menampilkan bab jika stempel waktu pertama adalah 0:00.",
|
||||
"tooFew": "YouTube memerlukan minimal 3 stempel waktu untuk bab (saat ini {{n}}).",
|
||||
"tooShort": "{{time}}: setiap bab harus berdurasi minimal 10 detik.",
|
||||
"outOfOrder": "{{time}} lebih awal dari stempel waktu di atasnya."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "Judul",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "Penyalinan diblokir — melebihi batas YouTube",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} karakter",
|
||||
"bannerHint": "Persingkat kolom di atas, lalu salin lagi.",
|
||||
"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"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"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”."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube tidak menerima karakter < dan > — hapus sebelum mengunggah."
|
||||
},
|
||||
"common": {
|
||||
"save": "Simpan",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 LIVE 配信日時: {{time}}",
|
||||
"watchLine": "視聴・見逃し配信: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "マザーボード",
|
||||
"storage": "ストレージ",
|
||||
"os": "OS",
|
||||
"monitor": "モニター",
|
||||
"capture": "キャプチャソフト",
|
||||
"controller": "コントローラー",
|
||||
"video_editor": "動画編集ソフト"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "{{count}}周年",
|
||||
"gachaVersion": "ゲームバージョン",
|
||||
"gachaVersionPlaceholder": "例:1.2、2.4",
|
||||
"gpu_brand": "メーカー",
|
||||
"gpu_series": "シリーズ",
|
||||
"gpu_model": "モデル",
|
||||
"gpu_custom": "カスタムGPU",
|
||||
"ram_size": "RAM容量",
|
||||
"ram_ddr": "DDR世代",
|
||||
"ram_ddr": "メモリ規格",
|
||||
"os_name": "OS",
|
||||
"os_version": "バージョン",
|
||||
"os_edition": "エディション",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 イントロ\n5:30 チャプター1\n15:00 ボス戦",
|
||||
"storeLinks": "購入リンク",
|
||||
"storeLinkType": "種別",
|
||||
"rig": "PC構成",
|
||||
"social": "SNS・寄付リンク",
|
||||
"warnings": "コンテンツ警告",
|
||||
"playlistLink": "プレイリストリンク",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "ジャンルを検索",
|
||||
"genreSearchNoResults": "該当するジャンルはありません",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "シリーズを選択してください。",
|
||||
"gpuMissingModel": "モデルを選択してください。",
|
||||
"gpuCustomEmpty": "GPU名を入力するか、カタログから選択してください。",
|
||||
"ramMissingDdr": "DDR世代を選択してください。",
|
||||
"ramMissingDdr": "メモリ規格を選んでください。",
|
||||
"ramMissingSize": "RAM容量を選択してください。",
|
||||
"ramCustomEmpty": "RAM容量(GB)を入力してください。"
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "追加",
|
||||
"genreQuickSets": "クイックセット",
|
||||
"genreRemove": "{{genre}} を外す",
|
||||
"selectedCount": "{{n}} 件選択中"
|
||||
"selectedCount": "{{n}} 件選択中",
|
||||
"ram_speed": "速度 (MT/s)",
|
||||
"gpuPick": "グラフィックカードを選択…",
|
||||
"gpuSearch": "検索 — 例: 5080、9070 XT、M4 Pro、ROG Ally",
|
||||
"gpuNoMatch": "一覧にありません —「自分で入力」を使ってください。",
|
||||
"gpuCustom": "自分で入力",
|
||||
"gpuNone": "指定しない",
|
||||
"gpuCustomLabel": "GPU(表示する名前)",
|
||||
"gpuCustomChosen": "手入力",
|
||||
"timestampsNormalize": "整える",
|
||||
"chapters": {
|
||||
"ok": "YouTube で {{n}} 個のチャプターとして表示されます。",
|
||||
"firstNotZero": "最初のタイムスタンプが 0:00 でないと、YouTube はチャプターを表示しません。",
|
||||
"tooFew": "チャプターには 3 つ以上のタイムスタンプが必要です(現在 {{n}} 個)。",
|
||||
"tooShort": "{{time}}:各チャプターは 10 秒以上必要です。",
|
||||
"outOfOrder": "{{time}} が上の行より前の時間になっています。"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "タイトル",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "コピーできません — YouTube の上限を超えています",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} 文字",
|
||||
"bannerHint": "上記の項目を短くしてから、もう一度コピーしてください。",
|
||||
"copyBlocked": "ブロック中: 他の項目が YouTube の上限を超えています",
|
||||
"batchRowBlocked": "このパートは上限を超えています — コピーできません。",
|
||||
"batchAllBlocked": "すべてコピーはできません — 上限を超えたパートがあります"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"more": "…もっと見る",
|
||||
"titleCut": "検索結果やおすすめではタイトルが約 {{chars}} 文字で切れます — 重要な語を先頭に置きましょう。",
|
||||
"foldHint": "「…もっと見る」の前に表示されるのは説明文の最初の約 {{chars}} 文字だけです。"
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}:YouTube は < と > を受け付けません。アップロード前に削除してください。"
|
||||
},
|
||||
"common": {
|
||||
"save": "保存",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 LIVE 방송 일시: {{time}}",
|
||||
"watchLine": "시청 / 다시보기: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "메인보드",
|
||||
"storage": "저장장치",
|
||||
"os": "운영체제",
|
||||
"monitor": "모니터",
|
||||
"capture": "캡처 소프트웨어",
|
||||
"controller": "컨트롤러",
|
||||
"video_editor": "영상 편집 프로그램"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "{{count}}주년",
|
||||
"gachaVersion": "게임 버전",
|
||||
"gachaVersionPlaceholder": "예: 1.2, 2.4",
|
||||
"gpu_brand": "제조사",
|
||||
"gpu_series": "시리즈",
|
||||
"gpu_model": "모델",
|
||||
"gpu_custom": "사용자 GPU",
|
||||
"ram_size": "RAM 용량",
|
||||
"ram_ddr": "DDR 세대",
|
||||
"ram_ddr": "메모리 규격",
|
||||
"os_name": "OS",
|
||||
"os_version": "버전",
|
||||
"os_edition": "에디션",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 인트로\n5:30 챕터 1\n15:00 보스전",
|
||||
"storeLinks": "스토어 링크",
|
||||
"storeLinkType": "유형",
|
||||
"rig": "내 장비",
|
||||
"social": "소셜 및 후원 링크",
|
||||
"warnings": "콘텐츠 경고",
|
||||
"playlistLink": "재생목록 링크",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "장르 검색",
|
||||
"genreSearchNoResults": "일치하는 장르 없음",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "GPU 시리즈를 선택하세요.",
|
||||
"gpuMissingModel": "GPU 모델을 선택하세요.",
|
||||
"gpuCustomEmpty": "GPU 이름을 입력하거나 목록에서 선택하세요.",
|
||||
"ramMissingDdr": "DDR 세대를 선택하세요.",
|
||||
"ramMissingDdr": "메모리 규격을 선택하세요.",
|
||||
"ramMissingSize": "RAM 용량을 선택하세요.",
|
||||
"ramCustomEmpty": "RAM 용량(GB)을 입력하세요."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "추가",
|
||||
"genreQuickSets": "빠른 세트",
|
||||
"genreRemove": "{{genre}} 제거",
|
||||
"selectedCount": "{{n}}개 선택됨"
|
||||
"selectedCount": "{{n}}개 선택됨",
|
||||
"ram_speed": "속도 (MT/s)",
|
||||
"gpuPick": "그래픽카드 선택…",
|
||||
"gpuSearch": "검색 — 예: 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "목록에 없습니다 — “직접 입력”을 사용하세요.",
|
||||
"gpuCustom": "직접 입력",
|
||||
"gpuNone": "지정 안 함",
|
||||
"gpuCustomLabel": "GPU (표시될 이름)",
|
||||
"gpuCustomChosen": "직접 입력",
|
||||
"timestampsNormalize": "정리",
|
||||
"chapters": {
|
||||
"ok": "YouTube에서 챕터 {{n}}개로 표시됩니다.",
|
||||
"firstNotZero": "첫 타임스탬프가 0:00이어야 YouTube에 챕터가 표시됩니다.",
|
||||
"tooFew": "챕터를 만들려면 타임스탬프가 3개 이상 필요합니다(현재 {{n}}개).",
|
||||
"tooShort": "{{time}}: 각 챕터는 10초 이상이어야 합니다.",
|
||||
"outOfOrder": "{{time}}이(가) 위 타임스탬프보다 앞입니다."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "제목",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "복사 차단됨 — YouTube 제한 초과",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}}자",
|
||||
"bannerHint": "위 항목을 줄인 뒤 다시 복사하세요.",
|
||||
"copyBlocked": "차단됨: 다른 항목이 YouTube 제한을 초과했습니다",
|
||||
"batchRowBlocked": "이 파트가 제한을 초과했습니다 — 복사할 수 없습니다.",
|
||||
"batchAllBlocked": "전체 복사 차단됨 — 제한을 초과한 파트가 있습니다"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"more": "…더보기",
|
||||
"titleCut": "검색 결과와 추천 영상에서는 제목이 약 {{chars}}자에서 잘립니다 — 핵심 단어를 앞에 두세요.",
|
||||
"foldHint": "시청자는 “…더보기” 전에 설명의 처음 약 {{chars}}자만 봅니다."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube는 < 와 > 문자를 허용하지 않습니다. 업로드 전에 지우세요."
|
||||
},
|
||||
"common": {
|
||||
"save": "저장",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 AO VIVO em {{time}}",
|
||||
"watchLine": "Assistir / rever: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "Placa-mãe",
|
||||
"storage": "Armazenamento",
|
||||
"os": "Sistema operacional",
|
||||
"monitor": "Monitor",
|
||||
"capture": "Software de captura",
|
||||
"controller": "Controle",
|
||||
"video_editor": "Editor de vídeo"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "Ano {{count}}",
|
||||
"gachaVersion": "Versão do jogo",
|
||||
"gachaVersionPlaceholder": "ex.: 1.2, 2.4",
|
||||
"gpu_brand": "Marca",
|
||||
"gpu_series": "Série",
|
||||
"gpu_model": "Modelo",
|
||||
"gpu_custom": "GPU personalizada",
|
||||
"ram_size": "Tamanho da RAM",
|
||||
"ram_ddr": "Geração DDR",
|
||||
"ram_ddr": "Tipo de memória",
|
||||
"os_name": "SO",
|
||||
"os_version": "Versão",
|
||||
"os_edition": "Edição",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 Introdução\n5:30 Capítulo 1\n15:00 Luta contra chefe",
|
||||
"storeLinks": "Links de loja",
|
||||
"storeLinkType": "Tipo",
|
||||
"rig": "Meu setup",
|
||||
"social": "Links sociais e de doação",
|
||||
"warnings": "Avisos de conteúdo",
|
||||
"playlistLink": "Link da playlist",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "Buscar gêneros",
|
||||
"genreSearchNoResults": "Nenhum gênero correspondente",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "Escolha uma série para completar a GPU.",
|
||||
"gpuMissingModel": "Escolha um modelo para completar a GPU.",
|
||||
"gpuCustomEmpty": "Digite o nome da GPU ou escolha no catálogo.",
|
||||
"ramMissingDdr": "Escolha uma geração DDR.",
|
||||
"ramMissingDdr": "Escolha o tipo de memória.",
|
||||
"ramMissingSize": "Escolha um tamanho de RAM.",
|
||||
"ramCustomEmpty": "Digite o tamanho da RAM em GB."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "Adicionar",
|
||||
"genreQuickSets": "Conjuntos rápidos",
|
||||
"genreRemove": "Remover {{genre}}",
|
||||
"selectedCount": "{{n}} selecionados"
|
||||
"selectedCount": "{{n}} selecionados",
|
||||
"ram_speed": "Velocidade (MT/s)",
|
||||
"gpuPick": "Escolha uma placa de vídeo…",
|
||||
"gpuSearch": "Pesquisar — ex.: 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "Não está na lista — use “Digitar o meu”.",
|
||||
"gpuCustom": "Digitar o meu",
|
||||
"gpuNone": "Sem GPU",
|
||||
"gpuCustomLabel": "GPU (como deve aparecer)",
|
||||
"gpuCustomChosen": "Entrada própria",
|
||||
"timestampsNormalize": "Arrumar",
|
||||
"chapters": {
|
||||
"ok": "O YouTube vai mostrar {{n}} capítulos.",
|
||||
"firstNotZero": "O YouTube só mostra capítulos quando a primeira marcação é 0:00.",
|
||||
"tooFew": "O YouTube precisa de pelo menos 3 marcações para criar capítulos ({{n}} até agora).",
|
||||
"tooShort": "{{time}}: cada capítulo precisa ter pelo menos 10 segundos.",
|
||||
"outOfOrder": "{{time}} vem antes da marcação acima."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "Título",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "Cópia bloqueada — acima do limite do YouTube",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} caracteres",
|
||||
"bannerHint": "Reduza o campo acima e copie de novo.",
|
||||
"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"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"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”."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: o YouTube não aceita os caracteres < e > — remova-os antes de enviar."
|
||||
},
|
||||
"common": {
|
||||
"save": "Salvar",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 LIVE vào {{time}}",
|
||||
"watchLine": "Xem / xem lại: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "RAM",
|
||||
"motherboard": "Bo mạch chủ",
|
||||
"storage": "Ổ cứng",
|
||||
"os": "Hệ điều hành",
|
||||
"monitor": "Màn hình",
|
||||
"capture": "Phần mềm quay",
|
||||
"controller": "Tay cầm",
|
||||
"video_editor": "Phần mềm dựng video"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "Năm {{count}}",
|
||||
"gachaVersion": "Phiên bản game",
|
||||
"gachaVersionPlaceholder": "vd: 1.2, 2.4",
|
||||
"gpu_brand": "Hãng",
|
||||
"gpu_series": "Dòng",
|
||||
"gpu_model": "Model",
|
||||
"gpu_custom": "GPU tự nhập",
|
||||
"ram_size": "Dung lượng RAM",
|
||||
"ram_ddr": "Thế hệ DDR",
|
||||
"ram_ddr": "Loại RAM",
|
||||
"os_name": "Hệ điều hành",
|
||||
"os_version": "Phiên bản",
|
||||
"os_edition": "Bản",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 Giới thiệu\n5:30 Chương 1\n15:00 Đánh Boss",
|
||||
"storeLinks": "Link mua game",
|
||||
"storeLinkType": "Loại",
|
||||
"rig": "Cấu hình máy",
|
||||
"social": "Mạng xã hội & Donate",
|
||||
"warnings": "Cảnh báo nội dung",
|
||||
"playlistLink": "Link Playlist",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "Tìm thể loại",
|
||||
"genreSearchNoResults": "Không có thể loại phù hợp",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "Chọn dòng để hoàn tất GPU.",
|
||||
"gpuMissingModel": "Chọn model để hoàn tất GPU.",
|
||||
"gpuCustomEmpty": "Nhập tên GPU hoặc chọn từ danh sách.",
|
||||
"ramMissingDdr": "Chọn thế hệ DDR.",
|
||||
"ramMissingDdr": "Chọn loại RAM.",
|
||||
"ramMissingSize": "Chọn dung lượng RAM.",
|
||||
"ramCustomEmpty": "Nhập dung lượng RAM (GB)."
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "Thêm",
|
||||
"genreQuickSets": "Bộ chọn nhanh",
|
||||
"genreRemove": "Bỏ {{genre}}",
|
||||
"selectedCount": "Đã chọn {{n}}"
|
||||
"selectedCount": "Đã chọn {{n}}",
|
||||
"ram_speed": "Bus (MT/s)",
|
||||
"gpuPick": "Chọn card đồ họa…",
|
||||
"gpuSearch": "Tìm — vd: 5080, 9070 XT, M4 Pro, ROG Ally",
|
||||
"gpuNoMatch": "Không có trong danh sách — chọn “Tự nhập”.",
|
||||
"gpuCustom": "Tự nhập",
|
||||
"gpuNone": "Bỏ trống",
|
||||
"gpuCustomLabel": "GPU (hiển thị đúng như bạn nhập)",
|
||||
"gpuCustomChosen": "Tự nhập",
|
||||
"timestampsNormalize": "Chuẩn hóa",
|
||||
"chapters": {
|
||||
"ok": "YouTube sẽ hiển thị thành {{n}} chương.",
|
||||
"firstNotZero": "YouTube chỉ hiện chương khi mốc đầu tiên là 0:00.",
|
||||
"tooFew": "YouTube cần ít nhất 3 mốc để tạo chương (hiện có {{n}}).",
|
||||
"tooShort": "{{time}}: mỗi chương phải dài ít nhất 10 giây.",
|
||||
"outOfOrder": "{{time}} đứng trước mốc ở dòng trên."
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "Tiêu đề",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "Không thể sao chép — vượt giới hạn của YouTube",
|
||||
"fieldLine": "{{field}}: {{count}} / {{limit}} ký tự",
|
||||
"bannerHint": "Hãy rút ngắn trường ở trên rồi sao chép lại.",
|
||||
"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"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"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”."
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube không chấp nhận ký tự < và > — hãy xóa chúng trước khi tải lên."
|
||||
},
|
||||
"common": {
|
||||
"save": "Lưu",
|
||||
|
||||
@@ -570,6 +570,18 @@
|
||||
"livestream": {
|
||||
"scheduledLine": "🔴 直播时间: {{time}}",
|
||||
"watchLine": "观看 / 回放: {{link}}"
|
||||
},
|
||||
"rigLabels": {
|
||||
"cpu": "CPU",
|
||||
"gpu": "GPU",
|
||||
"ram": "内存",
|
||||
"motherboard": "主板",
|
||||
"storage": "存储",
|
||||
"os": "操作系统",
|
||||
"monitor": "显示器",
|
||||
"capture": "录制软件",
|
||||
"controller": "手柄",
|
||||
"video_editor": "视频编辑软件"
|
||||
}
|
||||
},
|
||||
"pinnedComment": {
|
||||
|
||||
+21
-13
@@ -147,12 +147,8 @@
|
||||
"anniversaryYearOption": "{{count}}周年",
|
||||
"gachaVersion": "游戏版本",
|
||||
"gachaVersionPlaceholder": "例:1.2、2.4",
|
||||
"gpu_brand": "品牌",
|
||||
"gpu_series": "系列",
|
||||
"gpu_model": "型号",
|
||||
"gpu_custom": "自定义 GPU",
|
||||
"ram_size": "内存容量",
|
||||
"ram_ddr": "DDR 代",
|
||||
"ram_ddr": "内存类型",
|
||||
"os_name": "系统",
|
||||
"os_version": "版本",
|
||||
"os_edition": "版本类型",
|
||||
@@ -302,7 +298,6 @@
|
||||
"timestampsPlaceholder": "0:00 开场\n5:30 第一章\n15:00 Boss战",
|
||||
"storeLinks": "商店链接",
|
||||
"storeLinkType": "类型",
|
||||
"rig": "我的配置",
|
||||
"social": "社交与赞助链接",
|
||||
"warnings": "内容警告",
|
||||
"playlistLink": "播放列表链接",
|
||||
@@ -724,10 +719,7 @@
|
||||
"genreSearchPlaceholder": "搜索类型",
|
||||
"genreSearchNoResults": "未找到类型",
|
||||
"validation": {
|
||||
"gpuMissingSeries": "请选择 GPU 系列。",
|
||||
"gpuMissingModel": "请选择 GPU 型号。",
|
||||
"gpuCustomEmpty": "请输入 GPU 名称或从列表选择。",
|
||||
"ramMissingDdr": "请选择 DDR 代。",
|
||||
"ramMissingDdr": "请选择内存类型。",
|
||||
"ramMissingSize": "请选择内存容量。",
|
||||
"ramCustomEmpty": "请输入内存容量(GB)。"
|
||||
},
|
||||
@@ -751,7 +743,23 @@
|
||||
"genreAdd": "添加",
|
||||
"genreQuickSets": "快速组合",
|
||||
"genreRemove": "移除 {{genre}}",
|
||||
"selectedCount": "已选 {{n}} 项"
|
||||
"selectedCount": "已选 {{n}} 项",
|
||||
"ram_speed": "频率 (MT/s)",
|
||||
"gpuPick": "选择显卡…",
|
||||
"gpuSearch": "搜索 — 例如 5080、9070 XT、M4 Pro、ROG Ally",
|
||||
"gpuNoMatch": "列表中没有 — 请使用“自行输入”。",
|
||||
"gpuCustom": "自行输入",
|
||||
"gpuNone": "不填写",
|
||||
"gpuCustomLabel": "显卡(按此显示)",
|
||||
"gpuCustomChosen": "自行输入",
|
||||
"timestampsNormalize": "整理格式",
|
||||
"chapters": {
|
||||
"ok": "YouTube 会显示为 {{n}} 个章节。",
|
||||
"firstNotZero": "第一个时间戳必须是 0:00,YouTube 才会显示章节。",
|
||||
"tooFew": "YouTube 至少需要 3 个时间戳才能生成章节(当前 {{n}} 个)。",
|
||||
"tooShort": "{{time}}:每个章节至少要 10 秒。",
|
||||
"outOfOrder": "{{time}} 早于上一行的时间戳。"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"title": "标题",
|
||||
@@ -789,7 +797,6 @@
|
||||
"bannerTitle": "已阻止复制 — 超出 YouTube 上限",
|
||||
"fieldLine": "{{field}}:{{count}} / {{limit}} 个字符",
|
||||
"bannerHint": "请缩短上述字段后再复制。",
|
||||
"copyBlocked": "已阻止:另一个字段超出 YouTube 上限",
|
||||
"batchRowBlocked": "该部分超出上限 — 已阻止复制。",
|
||||
"batchAllBlocked": "已阻止复制全部 — 至少有一个部分超出上限"
|
||||
},
|
||||
@@ -801,7 +808,8 @@
|
||||
"more": "…更多",
|
||||
"titleCut": "搜索结果和推荐中的标题约在 {{chars}} 个字符处被截断 — 请把关键词放在前面。",
|
||||
"foldHint": "观众在“…更多”之前只能看到描述的前约 {{chars}} 个字符。"
|
||||
}
|
||||
},
|
||||
"forbiddenChars": "{{field}}:YouTube 不接受 < 和 > 字符,请在上传前删除。"
|
||||
},
|
||||
"common": {
|
||||
"save": "保存",
|
||||
|
||||
+19
-11
@@ -26,7 +26,13 @@ import { useRenderOptions } from "@hooks/use-render-options";
|
||||
import { validateBatchRange } from "@utils/validation";
|
||||
import { useStrictBlock } from "@hooks/use-strict-block";
|
||||
import { StrictModeBanner } from "@components/ui/StrictModeBanner";
|
||||
import { getOutputLimitStatus, mergeLimitStatus, type OutputLimitStatus } from "@engine/limits";
|
||||
import {
|
||||
getOutputLimitStatus,
|
||||
isCopyAllBlocked,
|
||||
isFieldOver,
|
||||
mergeLimitStatus,
|
||||
type OutputLimitStatus,
|
||||
} from "@engine/limits";
|
||||
|
||||
interface BatchLanguageRow {
|
||||
language: SupportedLanguage;
|
||||
@@ -144,10 +150,9 @@ export function BatchPage() {
|
||||
[results, t],
|
||||
);
|
||||
|
||||
// Copy All Batch concatenates every row, so one over-limit part poisons the
|
||||
// whole blob. Scoped deliberately: a single bad part disables Copy All and
|
||||
// that part's own buttons, but NOT the other 99 parts' buttons — freezing an
|
||||
// entire batch because part 7 is three characters long would be useless.
|
||||
// Copy All Batch concatenates every row's title and description, so one
|
||||
// part over on either poisons the whole blob. A part over the limit only
|
||||
// disables its own offending field — never the other parts.
|
||||
const batchStatus = useMemo(
|
||||
() => mergeLimitStatus(results.flatMap((r) => r.languages.map((l) => l.status))),
|
||||
[results],
|
||||
@@ -223,7 +228,7 @@ export function BatchPage() {
|
||||
<CopyButton
|
||||
text={allCombined}
|
||||
label={t("batch.copyAllBatch")}
|
||||
blocked={batchStatus.blocked}
|
||||
blocked={isCopyAllBlocked(batchStatus)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -248,7 +253,7 @@ export function BatchPage() {
|
||||
label={t("output.copyTitle")}
|
||||
limit={YT_LIMITS.TITLE_MAX}
|
||||
fieldLabel={t("output.title")}
|
||||
blocked={lang.status.blocked}
|
||||
blocked={isFieldOver(lang.status, "title")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -268,7 +273,11 @@ export function BatchPage() {
|
||||
limit={YT_LIMITS.DESCRIPTION_MAX}
|
||||
/>
|
||||
<span className="text-text-muted text-xs">{t("output.tags")}</span>
|
||||
<CharCounter text={lang.output.tagString} limit={YT_LIMITS.TAGS_MAX} />
|
||||
<CharCounter
|
||||
text={lang.output.tagString}
|
||||
count={lang.output.charCounts.tags}
|
||||
limit={YT_LIMITS.TAGS_MAX}
|
||||
/>
|
||||
</div>
|
||||
{lang.status.blocked && (
|
||||
<p role="alert" className="text-danger mb-2 text-xs font-medium">
|
||||
@@ -281,14 +290,13 @@ export function BatchPage() {
|
||||
label={t("output.copyDescription")}
|
||||
limit={YT_LIMITS.DESCRIPTION_MAX}
|
||||
fieldLabel={t("output.description")}
|
||||
blocked={lang.status.blocked}
|
||||
blocked={isFieldOver(lang.status, "description")}
|
||||
/>
|
||||
<CopyButton
|
||||
text={lang.output.tagString}
|
||||
label={t("output.copyTags")}
|
||||
limit={YT_LIMITS.TAGS_MAX}
|
||||
fieldLabel={t("output.tags")}
|
||||
blocked={lang.status.blocked}
|
||||
blocked={isFieldOver(lang.status, "tags")}
|
||||
/>
|
||||
{lang.pinnedComment && (
|
||||
<CopyButton
|
||||
|
||||
@@ -51,7 +51,7 @@ import { VIDEO_TYPES } from "@config/video-types";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import { useDocumentTitle } from "@hooks/use-document-title";
|
||||
import { validatePlaylistUrl } from "@utils/validation";
|
||||
import { normalizePlaylistUrl, validatePlaylistUrl } from "@utils/validation";
|
||||
|
||||
interface Section {
|
||||
id: string;
|
||||
@@ -72,7 +72,7 @@ function PlaylistLinkField() {
|
||||
maxLength={FIELD_LIMITS.URL}
|
||||
placeholder={t("editor.playlistLinkPlaceholder")}
|
||||
value={playlistLink ?? ""}
|
||||
onChange={(v) => set("playlistLink", v)}
|
||||
onChange={(v) => set("playlistLink", normalizePlaylistUrl(v))}
|
||||
validate={validatePlaylistUrl}
|
||||
inputMode="url"
|
||||
autoComplete="off"
|
||||
|
||||
+27
-14
@@ -23,6 +23,7 @@ import { useSettingsStore } from "@store/settings-store";
|
||||
import { SUPPORTED_LANGUAGES } from "@i18n/index";
|
||||
import type { GeneratorOutput, SupportedLanguage } from "@engine/types";
|
||||
import { useOutputLimits } from "@hooks/use-output-limits";
|
||||
import { fieldsWithForbiddenChars, isCopyAllBlocked } from "@engine/limits";
|
||||
import { useStrictBlock } from "@hooks/use-strict-block";
|
||||
import { useClipboard } from "@hooks/use-clipboard";
|
||||
import { StrictModeBanner } from "@components/ui/StrictModeBanner";
|
||||
@@ -77,17 +78,10 @@ export function OutputPage() {
|
||||
const tabStatus = useOutputLimits(shownOutputs);
|
||||
const allStatus = useOutputLimits(everyOutput);
|
||||
|
||||
// Strict Mode folds into the same "blocked" signal the char-limit gate
|
||||
// uses, so a copy button has one reason to be disabled, not two.
|
||||
// Strict Mode blocks every copy; the limits block only the field that is
|
||||
// over (Copy All = title + description, so not the tags).
|
||||
const strictBlocked = useStrictBlock();
|
||||
const tabBlocked = useMemo(
|
||||
() => (strictBlocked ? { ...tabStatus, blocked: true } : tabStatus),
|
||||
[strictBlocked, tabStatus],
|
||||
);
|
||||
const allBlocked = useMemo(
|
||||
() => (strictBlocked ? { ...allStatus, blocked: true } : allStatus),
|
||||
[strictBlocked, allStatus],
|
||||
);
|
||||
const copyAllBlocked = strictBlocked || isCopyAllBlocked(allStatus);
|
||||
|
||||
// At least one language stays selected; the active tab follows a removal.
|
||||
const changeLangs = (next: SupportedLanguage[]) => {
|
||||
@@ -96,9 +90,19 @@ export function OutputPage() {
|
||||
if (!next.includes(activeTab)) setActiveTab(next[0] as SupportedLanguage);
|
||||
};
|
||||
|
||||
// Record what was generated. The store updates an existing entry for the
|
||||
// same video instead of adding another, so this may run on every visit and
|
||||
// whenever the description changes (a setting toggled while here).
|
||||
useEffect(() => {
|
||||
if (!gameName || !defaultOutput.title) return;
|
||||
const key = `${gameName}-${videoType}-${language}-${defaultOutput.title}`;
|
||||
const key = [
|
||||
gameName,
|
||||
videoType,
|
||||
language,
|
||||
defaultOutput.title,
|
||||
defaultOutput.description,
|
||||
defaultOutput.tagString,
|
||||
].join("\n");
|
||||
if (savedRef.current === key) return;
|
||||
savedRef.current = key;
|
||||
addEntry(
|
||||
@@ -142,7 +146,7 @@ export function OutputPage() {
|
||||
|
||||
${defaultOutput.description}`;
|
||||
const copyAll = () => void copy(copyAllText);
|
||||
const copyAllDisabled = allBlocked.blocked || !gameName;
|
||||
const copyAllDisabled = copyAllBlocked || !gameName;
|
||||
|
||||
const shownOutput = currentOutput ?? defaultOutput;
|
||||
|
||||
@@ -183,6 +187,11 @@ ${defaultOutput.description}`;
|
||||
|
||||
<StrictModeBanner />
|
||||
<LimitBlockBanner status={allStatus} />
|
||||
{fieldsWithForbiddenChars(shownOutput).map((field) => (
|
||||
<Banner key={field} tone="warning">
|
||||
{t("output.forbiddenChars", { field: t(`output.${field}`) })}
|
||||
</Banner>
|
||||
))}
|
||||
|
||||
{!gameName ? (
|
||||
<EmptyState
|
||||
@@ -233,13 +242,17 @@ ${defaultOutput.description}`;
|
||||
{selectedLangs.map((lang) => (
|
||||
<TabPanel key={lang} value={lang} className="flex flex-col gap-4 pt-4">
|
||||
{multilangOutputs[lang] && (
|
||||
<OutputPreview output={multilangOutputs[lang]} status={tabBlocked} />
|
||||
<OutputPreview
|
||||
output={multilangOutputs[lang]}
|
||||
status={tabStatus}
|
||||
strictBlocked={strictBlocked}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
))}
|
||||
</Tabs>
|
||||
) : (
|
||||
<OutputPreview status={tabBlocked} />
|
||||
<OutputPreview status={tabStatus} strictBlocked={strictBlocked} />
|
||||
)}
|
||||
|
||||
<YouTubePreview
|
||||
|
||||
@@ -173,6 +173,7 @@ export function SocialPage() {
|
||||
showCopyright,
|
||||
showSponsorCredit,
|
||||
tEn,
|
||||
year: new Date().getFullYear(),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
DEFAULT_PLAYTEST_PLATFORM,
|
||||
} from "@config/playtest-platforms";
|
||||
import { DEFAULTS } from "@config/defaults";
|
||||
import { migrateRig } from "@config/rig-fields";
|
||||
import { FIELD_LIMITS, clampField } from "@config/field-limits";
|
||||
|
||||
export interface EditorData {
|
||||
@@ -228,6 +229,9 @@ function normalizeEditorPatch(patch: Partial<EditorData> | null | undefined): Pa
|
||||
// become a no-op instead of crashing.
|
||||
if (!patch || typeof patch !== "object") return {};
|
||||
const out: Partial<EditorData> = { ...patch };
|
||||
// v1.0.0: profiles and templates saved before the GPU catalog rewrite
|
||||
// carry `brand|series|model` (or `rig: null` when hand-edited).
|
||||
if ("rig" in patch) out.rig = migrateRig((patch as { rig?: unknown }).rig);
|
||||
const raw: unknown = (patch as { graphicsPreset?: unknown }).graphicsPreset;
|
||||
if (typeof raw === "string" && !(GRAPHICS_PRESETS as readonly string[]).includes(raw)) {
|
||||
const { preset, custom } = legacyGraphicsPresetToEnum(raw);
|
||||
@@ -588,7 +592,7 @@ export const useEditorStore = create<EditorState>()(
|
||||
// settings toggle is on. Additive: both back-fill to "".
|
||||
// Non-string values coerce to "". The existing `contactEmail`
|
||||
// is reused as the general-contact line, so no data moves.
|
||||
version: 18,
|
||||
version: 19,
|
||||
migrate: (persistedState, version) => migrateEditorState(persistedState, version),
|
||||
partialize: (state) => ({
|
||||
videoType: state.videoType,
|
||||
@@ -933,6 +937,11 @@ export function migrateEditorState(persistedState: unknown, version: number): Ed
|
||||
if (typeof state.adEmail !== "string") state.adEmail = "";
|
||||
if (typeof state.gameKeyEmail !== "string") state.gameKeyEmail = "";
|
||||
}
|
||||
if (version < 19) {
|
||||
// v1.0.0 GPU catalog: `brand|series|model` → `gpu:<id>` (or the full
|
||||
// name as the user's own text when the card isn't in the catalog).
|
||||
state.rig = migrateRig(state.rig);
|
||||
}
|
||||
return { ...initialState, ...state } as EditorData;
|
||||
}
|
||||
|
||||
|
||||
+59
-15
@@ -34,20 +34,61 @@ function normaliseEntry(e: LegacyEntry): HistoryEntry {
|
||||
return { ...rest, genres: [fallback] } as HistoryEntry;
|
||||
}
|
||||
|
||||
/** Same bounds as the History Limit setting. */
|
||||
const LIMIT_MIN = 10;
|
||||
const LIMIT_MAX = 500;
|
||||
|
||||
/**
|
||||
* Which video an entry is about: the same game, type, language and title
|
||||
* (the title carries the part number, boss name…) is the same video, even
|
||||
* if its description has changed since.
|
||||
*/
|
||||
export function historyKey(
|
||||
entry: Pick<HistoryEntry, "gameName" | "videoType" | "language" | "title">,
|
||||
): string {
|
||||
return [
|
||||
entry.gameName.trim().toLowerCase(),
|
||||
entry.videoType,
|
||||
entry.language,
|
||||
entry.title.trim(),
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
/** Newest-first entries with every video listed once (its newest entry). */
|
||||
export function dedupeHistory(entries: readonly HistoryEntry[]): HistoryEntry[] {
|
||||
const seen = new Set<string>();
|
||||
return entries.filter((entry) => {
|
||||
const key = historyKey(entry);
|
||||
if (seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export const useHistoryStore = create<HistoryState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
entries: [],
|
||||
|
||||
/**
|
||||
* Record a generated output. The Output page calls this every time it
|
||||
* renders a new result — it used to add a new entry on every visit, so
|
||||
* one video filled the history many times over. A video already in the
|
||||
* history is now updated in place (latest description and tags) and
|
||||
* moved to the top.
|
||||
*/
|
||||
addEntry: (data, limit = 100) => {
|
||||
const entry: HistoryEntry = {
|
||||
...data,
|
||||
id: generateId(),
|
||||
createdAt: new Date().toISOString(),
|
||||
};
|
||||
set((state) => {
|
||||
const updated = [entry, ...state.entries];
|
||||
return { entries: updated.slice(0, limit) };
|
||||
const key = historyKey(data);
|
||||
const existing = state.entries.find((e) => historyKey(e) === key);
|
||||
const entry: HistoryEntry = {
|
||||
...data,
|
||||
id: existing?.id ?? generateId(),
|
||||
createdAt: new Date().toISOString(),
|
||||
};
|
||||
const others = state.entries.filter((e) => historyKey(e) !== key);
|
||||
const cap = Math.min(LIMIT_MAX, Math.max(LIMIT_MIN, Math.round(limit) || 100));
|
||||
return { entries: [entry, ...others].slice(0, cap) };
|
||||
});
|
||||
},
|
||||
|
||||
@@ -60,15 +101,18 @@ export const useHistoryStore = create<HistoryState>()(
|
||||
{
|
||||
name: "ytdescgen-history",
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
// v1 → v2 upgrade: HistoryEntry.genre (single) became genres[] in v0.5.
|
||||
version: 2,
|
||||
// v1 → v2: HistoryEntry.genre (single) became genres[] in v0.5.
|
||||
// v2 → v3: v1.0.0 folds the duplicates earlier versions piled up (one
|
||||
// per Output visit) into one entry per video, keeping the newest.
|
||||
version: 3,
|
||||
migrate: (persistedState: unknown, version: number) => {
|
||||
if (version < 2 && persistedState && typeof persistedState === "object") {
|
||||
const state = persistedState as { entries?: LegacyEntry[] };
|
||||
if (Array.isArray(state.entries)) {
|
||||
state.entries = state.entries.map(normaliseEntry);
|
||||
}
|
||||
}
|
||||
if (!persistedState || typeof persistedState !== "object") return persistedState;
|
||||
const state = persistedState as { entries?: LegacyEntry[] };
|
||||
if (!Array.isArray(state.entries)) return persistedState;
|
||||
let entries = state.entries;
|
||||
if (version < 2) entries = entries.map(normaliseEntry);
|
||||
if (version < 3) entries = dedupeHistory(entries as HistoryEntry[]);
|
||||
state.entries = entries;
|
||||
return persistedState as { entries: HistoryEntry[] };
|
||||
},
|
||||
partialize: (state) => ({ entries: state.entries }),
|
||||
|
||||
@@ -2,6 +2,7 @@ import { create } from "zustand";
|
||||
import { persist, createJSONStorage } from "zustand/middleware";
|
||||
import { generateId } from "@utils/uuid";
|
||||
import { saveSettings } from "@utils/storage-adapter";
|
||||
import { migrateRig } from "@config/rig-fields";
|
||||
import type { GraphicsPreset } from "@config/graphics-settings";
|
||||
|
||||
/**
|
||||
@@ -110,7 +111,8 @@ export const useProfileStore = create<ProfileState>()(
|
||||
// as "pre-v0.11" and gets the empty-string back-fill.
|
||||
// v1 → v2: v0.34.0 added `adEmail` / `gameKeyEmail` (email split).
|
||||
// Additive — pre-v0.34 profiles get a `""` back-fill.
|
||||
version: 2,
|
||||
// v2 → v3: v1.0.0 GPU catalog (`brand|series|model` → `gpu:<id>`).
|
||||
version: 3,
|
||||
migrate: (persistedState: unknown, version: number) => {
|
||||
if (!persistedState || typeof persistedState !== "object") return persistedState;
|
||||
const state = persistedState as { profiles?: Array<Record<string, unknown>> };
|
||||
@@ -126,6 +128,9 @@ export const useProfileStore = create<ProfileState>()(
|
||||
gameKeyEmail: typeof p.gameKeyEmail === "string" ? p.gameKeyEmail : "",
|
||||
}));
|
||||
}
|
||||
if (version < 3 && Array.isArray(state.profiles)) {
|
||||
state.profiles = state.profiles.map((p) => ({ ...p, rig: migrateRig(p.rig) }));
|
||||
}
|
||||
return persistedState as { profiles: Profile[] };
|
||||
},
|
||||
partialize: (state) => ({ profiles: state.profiles }),
|
||||
|
||||
@@ -274,6 +274,14 @@ export function healSettings(raw: unknown): SettingsData {
|
||||
incoming.logRetentionDays = Math.max(1, Math.min(90, Math.floor(incoming.logRetentionDays)));
|
||||
}
|
||||
|
||||
// v1.0.0: the History Limit is clamped like the retention above — a
|
||||
// hand-edited or imported 0 or 1e9 would otherwise reach the history store.
|
||||
if (typeof incoming.historyLimit === "number" && Number.isFinite(incoming.historyLimit)) {
|
||||
incoming.historyLimit = Math.max(10, Math.min(500, Math.floor(incoming.historyLimit)));
|
||||
} else {
|
||||
incoming.historyLimit = initialSettings.historyLimit;
|
||||
}
|
||||
|
||||
// v0.28.0: `legalConsentVersion` added. A non-number / non-finite / negative
|
||||
// value must fall through to "never accepted" (0) so a corrupt or
|
||||
// hand-edited file re-shows the consent gate rather than silently skipping
|
||||
|
||||
@@ -106,6 +106,12 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
// lockstep — nothing enforces that mechanically.
|
||||
version: 12,
|
||||
migrate: (persistedState: unknown): SettingsData => healSettings(persistedState),
|
||||
// Heal on EVERY load, not only on a version change (which is all
|
||||
// `migrate` covers): a hand-edited value must never reach the app.
|
||||
merge: (persistedState, currentState) => ({
|
||||
...currentState,
|
||||
...healSettings(persistedState),
|
||||
}),
|
||||
partialize: (state) => extractData(state),
|
||||
onRehydrateStorage: () => {
|
||||
return () => {
|
||||
|
||||
@@ -26,6 +26,7 @@ import type {
|
||||
} from "@config/graphics-settings";
|
||||
import { coerceUpscaleQuality, coerceFrameGenMultiplier } from "@engine/graphics-vendor";
|
||||
import type { GachaQuestType } from "@config/gacha-quest-types";
|
||||
import { migrateRig } from "@config/rig-fields";
|
||||
|
||||
/**
|
||||
* Full snapshot of the editor form. Matches the `partialize` output of
|
||||
@@ -219,9 +220,20 @@ export const useTemplateStore = create<TemplateState>()(
|
||||
// doesn't push a stale value into the editor's Select. The
|
||||
// editor's own normalizeEditorPatch repeats this coercion as a
|
||||
// belt-and-suspenders measure.
|
||||
version: 1,
|
||||
// v1 → v2: v1.0.0 GPU catalog (`brand|series|model` → `gpu:<id>`).
|
||||
version: 2,
|
||||
migrate: (persistedState: unknown, version: number) => {
|
||||
if (!persistedState || typeof persistedState !== "object") return persistedState;
|
||||
if (version < 2) {
|
||||
const state = persistedState as { templates?: EditorTemplate[] };
|
||||
if (Array.isArray(state.templates)) {
|
||||
for (const tpl of state.templates) {
|
||||
if (tpl?.snapshot && typeof tpl.snapshot === "object") {
|
||||
tpl.snapshot.rig = migrateRig(tpl.snapshot.rig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version < 1) {
|
||||
const state = persistedState as { templates?: EditorTemplate[] };
|
||||
if (Array.isArray(state.templates)) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { parseCascadingValue, parseCompositeValue } from "@config/rig-fields";
|
||||
import { GPU_CUSTOM_BRAND_ID } from "@config/gpu-catalog";
|
||||
import { parseCompositeValue } from "@config/rig-fields";
|
||||
|
||||
/**
|
||||
* Validation outcome for a rig field. `kind` carries the i18n key used
|
||||
@@ -8,51 +7,18 @@ import { GPU_CUSTOM_BRAND_ID } from "@config/gpu-catalog";
|
||||
*/
|
||||
export interface RigValidationIssue {
|
||||
kind: "incomplete" | "invalid";
|
||||
/** i18n key under `editor.validation.*` (e.g. `editor.validation.incompleteGpu`). */
|
||||
/** i18n key under `editor.validation.*` (e.g. `editor.validation.ramMissingDdr`). */
|
||||
messageKey: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* GPU cascading-dropdown validator (v0.13). Surfaces a soft warning
|
||||
* when the user picks a brand but hasn't drilled down to a concrete
|
||||
* model — partial selections cause "AMD" / "NVIDIA" to appear alone in
|
||||
* the description, which is technically valid but rarely intentional.
|
||||
*
|
||||
* Custom brand: requires a non-empty free-text value, otherwise the
|
||||
* stored `"custom||"` collapses to nothing in the description.
|
||||
*
|
||||
* Returns `null` when the value is fully blank (no selection at all is
|
||||
* a deliberate "skip rig field" state and shouldn't trip the badge).
|
||||
*/
|
||||
export function validateGpuValue(raw: string): RigValidationIssue | null {
|
||||
if (!raw) return null;
|
||||
const { brand, series, model, isLegacy } = parseCascadingValue(raw);
|
||||
if (isLegacy) return null;
|
||||
|
||||
if (brand === GPU_CUSTOM_BRAND_ID) {
|
||||
if (!model.trim()) {
|
||||
return { kind: "incomplete", messageKey: "editor.validation.gpuCustomEmpty" };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (brand && !series) {
|
||||
return { kind: "incomplete", messageKey: "editor.validation.gpuMissingSeries" };
|
||||
}
|
||||
if (brand && series && !model) {
|
||||
return { kind: "incomplete", messageKey: "editor.validation.gpuMissingModel" };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* RAM composite-dropdown validator (v0.13). Surfaces a warning when the
|
||||
* user picks a size but no DDR generation, or vice-versa — the resulting
|
||||
* user picks a size but no memory type, or vice-versa — the resulting
|
||||
* description line ("32 GB" or just "DDR5") is awkward enough that we
|
||||
* nudge the creator to fill in the other half.
|
||||
* nudge the creator to fill in the other half. The speed is optional.
|
||||
*
|
||||
* Custom size with empty numeric input is also flagged so the user
|
||||
* doesn't accidentally render a `"GB"` with no number.
|
||||
* Custom size with an empty input is also flagged so the user doesn't
|
||||
* accidentally render a "GB" with no number.
|
||||
*/
|
||||
export function validateRamValue(raw: string): RigValidationIssue | null {
|
||||
if (!raw) return null;
|
||||
|
||||
+30
-3
@@ -1,5 +1,7 @@
|
||||
// The domain must have a dot and a letters-only TLD: "name@localhost" or
|
||||
// "name@gmail" are typos in a description, not addresses (v1.0.0).
|
||||
const EMAIL_REGEX =
|
||||
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
||||
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,63}$/;
|
||||
|
||||
const URL_REGEX =
|
||||
/^https?:\/\/[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)+([/?#].*)?$/;
|
||||
@@ -91,6 +93,18 @@ export function validateUrl(input: string): ValidationResult {
|
||||
return { valid: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL reduced for prefix comparison: lower-case, no `www.` / `m.` /
|
||||
* `mobile.` host prefix, and twitter.com read as x.com — so
|
||||
* "https://www.instagram.com/me" matches the prefix "https://instagram.com/".
|
||||
*/
|
||||
function comparableUrl(url: string): string {
|
||||
return url
|
||||
.toLowerCase()
|
||||
.replace(/^(https?:\/\/)(?:www\.|m\.|mobile\.)/, "$1")
|
||||
.replace(/^(https?:\/\/)twitter\.com\//, "$1x.com/");
|
||||
}
|
||||
|
||||
export function validateUrlWithPrefix(input: string, expectedPrefix: string): ValidationResult {
|
||||
const baseResult = validateUrl(input);
|
||||
if (!baseResult.valid) return baseResult;
|
||||
@@ -98,7 +112,7 @@ export function validateUrlWithPrefix(input: string, expectedPrefix: string): Va
|
||||
const trimmed = input.trim();
|
||||
if (!trimmed) return { valid: true };
|
||||
|
||||
if (expectedPrefix && !trimmed.startsWith(expectedPrefix)) {
|
||||
if (expectedPrefix && !comparableUrl(trimmed).startsWith(comparableUrl(expectedPrefix))) {
|
||||
return {
|
||||
valid: true,
|
||||
error: "validation.urlPrefixMismatch",
|
||||
@@ -145,9 +159,22 @@ export function validateUrlWithPattern(input: string, pattern: RegExp): Validati
|
||||
* the path must be exactly `/playlist`.
|
||||
*/
|
||||
const YT_PLAYLIST_REGEX =
|
||||
/^https:\/\/(?:www\.)?youtube\.com\/playlist\?(?:[^#]*&)?list=[A-Za-z0-9_-]+(?:&[^#]*)?(?:#.*)?$/;
|
||||
/^https:\/\/(?:www\.|m\.|music\.)?youtube\.com\/(?:playlist|watch)\?(?:[^#]*&)?list=[A-Za-z0-9_-]+(?:&[^#]*)?(?:#.*)?$/;
|
||||
const PLAYLIST_URL_EXPECTED = "https://www.youtube.com/playlist?list=[id]";
|
||||
|
||||
/**
|
||||
* The canonical playlist page for any accepted playlist URL — a phone
|
||||
* (`m.`), YouTube Music or "video in a playlist" (`watch?v=…&list=…`)
|
||||
* link becomes `https://www.youtube.com/playlist?list=<id>`, which is what
|
||||
* the description should point at. Anything else is returned unchanged.
|
||||
*/
|
||||
export function normalizePlaylistUrl(input: string): string {
|
||||
const trimmed = input.trim();
|
||||
if (!YT_PLAYLIST_REGEX.test(trimmed)) return input;
|
||||
const id = /[?&]list=([A-Za-z0-9_-]+)/.exec(trimmed)?.[1];
|
||||
return id ? `https://www.youtube.com/playlist?list=${id}` : input;
|
||||
}
|
||||
|
||||
export function validatePlaylistUrl(input: string): ValidationResult {
|
||||
const trimmed = input.trim();
|
||||
if (!trimmed) return { valid: true };
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
GPU_GROUPS,
|
||||
findGpuModel,
|
||||
formatGpuValue,
|
||||
gpuValue,
|
||||
migrateGpuValue,
|
||||
modelForGpuValue,
|
||||
} from "@config/gpu-catalog";
|
||||
|
||||
const ALL = GPU_GROUPS.flatMap((g) => g.models);
|
||||
|
||||
describe("GPU catalog", () => {
|
||||
it("has unique ids and names", () => {
|
||||
expect(new Set(ALL.map((m) => m.id)).size).toBe(ALL.length);
|
||||
expect(new Set(ALL.map((m) => m.name)).size).toBe(ALL.length);
|
||||
});
|
||||
|
||||
it("uses each vendor's own naming", () => {
|
||||
for (const group of GPU_GROUPS) {
|
||||
for (const model of group.models) {
|
||||
if (group.vendor === "nvidia") expect(model.name).toMatch(/^NVIDIA (GeForce |TITAN)/);
|
||||
if (group.vendor === "amd") expect(model.name).toMatch(/^AMD Radeon /);
|
||||
if (group.vendor === "intel") expect(model.name).toMatch(/^Intel /);
|
||||
if (group.vendor === "apple") expect(model.name).toMatch(/^Apple M\d/);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("does not list cards that never shipped", () => {
|
||||
const names = ALL.map((m) => m.name);
|
||||
for (const ghost of ["RX 9080", "RX 9090 XT", "Arc B380", "Arc B770", "RTX 5080 SUPER"]) {
|
||||
expect(names.some((n) => n.endsWith(ghost))).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it("includes laptop, integrated, handheld and current Apple parts", () => {
|
||||
for (const id of [
|
||||
"nvidia-rtx-5070-laptop-gpu",
|
||||
"nvidia-rtx-4050-laptop-gpu",
|
||||
"amd-rx-9070-gre",
|
||||
"amd-890m",
|
||||
"amd-8060s",
|
||||
"intel-arc-140v",
|
||||
"amd-ryzen-z2-extreme",
|
||||
"valve-steam-deck",
|
||||
"apple-m5-max",
|
||||
]) {
|
||||
expect(findGpuModel(id), id).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("round-trips a catalog value", () => {
|
||||
const model = findGpuModel("nvidia-rtx-5080");
|
||||
expect(model).toBeDefined();
|
||||
if (!model) return;
|
||||
expect(modelForGpuValue(gpuValue(model))).toBe(model);
|
||||
expect(formatGpuValue(gpuValue(model))).toBe("NVIDIA GeForce RTX 5080");
|
||||
});
|
||||
});
|
||||
|
||||
describe("migrateGpuValue", () => {
|
||||
it("maps every v0.13 catalog model to a current id", () => {
|
||||
const cases: Array<[string, string]> = [
|
||||
["nvidia|rtx_50|RTX 5080", "gpu:nvidia-rtx-5080"],
|
||||
["nvidia|rtx_40|RTX 4060 Ti", "gpu:nvidia-rtx-4060-ti"],
|
||||
["nvidia|rtx_20|TITAN RTX", "gpu:nvidia-titan-rtx"],
|
||||
["nvidia|gtx_900|TITAN X (Maxwell)", "gpu:nvidia-gtx-titan-x"],
|
||||
["nvidia|gtx_700|TITAN Black", "gpu:nvidia-gtx-titan-black"],
|
||||
["amd|rx_9000|RX 9070 XT", "gpu:amd-rx-9070-xt"],
|
||||
["amd|rx_vega|Radeon VII", "gpu:amd-vii"],
|
||||
["amd|hd_7000|HD 7970", "gpu:amd-hd-7970"],
|
||||
["intel|arc_b|Arc B580", "gpu:intel-arc-b580"],
|
||||
["apple|m1|M1 Ultra", "gpu:apple-m1-ultra"],
|
||||
];
|
||||
for (const [legacy, current] of cases) expect(migrateGpuValue(legacy), legacy).toBe(current);
|
||||
});
|
||||
|
||||
it("keeps an unmatched card as its full name", () => {
|
||||
expect(migrateGpuValue("amd|rx_9000|RX 9080")).toBe("AMD Radeon RX 9080");
|
||||
expect(migrateGpuValue("intel|arc_b|Arc B380")).toBe("Intel Arc B380");
|
||||
expect(migrateGpuValue("nvidia|rtx_40|RTX 4090 D")).toBe("NVIDIA GeForce RTX 4090 D");
|
||||
});
|
||||
|
||||
it("unwraps the old Custom brand and clears half-picked values", () => {
|
||||
expect(migrateGpuValue("custom||My GPU")).toBe("My GPU");
|
||||
expect(migrateGpuValue("nvidia|rtx_40|")).toBe("");
|
||||
expect(migrateGpuValue("||")).toBe("");
|
||||
});
|
||||
|
||||
it("leaves current values and free text alone", () => {
|
||||
expect(migrateGpuValue("gpu:amd-rx-7800-xt")).toBe("gpu:amd-rx-7800-xt");
|
||||
expect(migrateGpuValue("GeForce RTX 3060 12GB")).toBe("GeForce RTX 3060 12GB");
|
||||
expect(migrateGpuValue("")).toBe("");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,71 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
|
||||
const platform = (id: string) => {
|
||||
const p = PLATFORMS.find((x) => x.id === id);
|
||||
if (!p) throw new Error(`no platform ${id}`);
|
||||
return p;
|
||||
};
|
||||
|
||||
describe("store URL patterns (v1.0.0)", () => {
|
||||
it("accepts Steam apps, packages, bundles and short links", () => {
|
||||
const steam = platform("steam");
|
||||
for (const url of [
|
||||
"https://store.steampowered.com/app/1245620/ELDEN_RING/",
|
||||
"https://store.steampowered.com/sub/469080/",
|
||||
"https://store.steampowered.com/bundle/5699/Portal_Bundle/",
|
||||
"https://s.team/a/1245620",
|
||||
]) {
|
||||
expect(steam.urlPattern.test(url), url).toBe(true);
|
||||
}
|
||||
expect(steam.urlPattern.test("https://store.steampowered.com/search/?term=elden")).toBe(false);
|
||||
});
|
||||
|
||||
it("normalises Steam links to the canonical page", () => {
|
||||
const normalize = platform("steam").normalize;
|
||||
expect(normalize?.("https://store.steampowered.com/app/1245620/ELDEN_RING/")).toBe(
|
||||
"https://store.steampowered.com/app/1245620",
|
||||
);
|
||||
expect(normalize?.("https://s.team/a/1245620")).toBe(
|
||||
"https://store.steampowered.com/app/1245620",
|
||||
);
|
||||
expect(normalize?.("https://store.steampowered.com/sub/469080/")).toBe(
|
||||
"https://store.steampowered.com/sub/469080",
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts store hosts with or without www", () => {
|
||||
expect(platform("gog").urlPattern.test("https://gog.com/en/game/cyberpunk_2077")).toBe(true);
|
||||
expect(platform("humble").urlPattern.test("https://humblebundle.com/store/hades")).toBe(true);
|
||||
expect(
|
||||
platform("xbox").urlPattern.test("https://xbox.com/en-US/games/store/x/9NBLGGH4R315"),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("accepts the Microsoft Store and every regional Nintendo site", () => {
|
||||
expect(platform("xbox").urlPattern.test("https://apps.microsoft.com/detail/9nblggh4r315")).toBe(
|
||||
true,
|
||||
);
|
||||
for (const url of [
|
||||
"https://www.nintendo.com/us/store/products/hades-switch/",
|
||||
"https://www.nintendo.co.uk/Games/Nintendo-Switch-download-software/Hades-1839136.html",
|
||||
"https://www.nintendo.de/Spiele/Hades-1839136.html",
|
||||
"https://store.nintendo.co.uk/en_gb/hades",
|
||||
"https://www.nintendo.co.jp/switch/aqfta/",
|
||||
]) {
|
||||
expect(platform("nintendo").urlPattern.test(url), url).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("accepts Amazon Luna's own site", () => {
|
||||
expect(platform("amazon").urlPattern.test("https://luna.amazon.com/game/fortnite/B0C1")).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("gives every searchable platform a tag name", () => {
|
||||
for (const p of PLATFORMS) {
|
||||
if (p.id !== "publisher") expect(p.tagName, p.id).toBeTruthy();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -710,14 +710,46 @@ describe("buildDescription", () => {
|
||||
expect(result).toContain("GPU: RTX 4090");
|
||||
});
|
||||
|
||||
it("humanises snake_case rig keys (e.g. video_editor → VIDEO EDITOR)", () => {
|
||||
it("labels rig lines in the output language, not as capitalised keys", () => {
|
||||
const rig = { video_editor: "davinci_resolve_studio|19.1", storage: "2TB NVMe" };
|
||||
const en = buildDescription(makeInput({ rig }), createMockT("en"));
|
||||
expect(en).toContain("Video Editor: DaVinci Resolve Studio 19.1");
|
||||
expect(en).not.toContain("VIDEO EDITOR");
|
||||
expect(en).not.toContain("VIDEO_EDITOR");
|
||||
|
||||
const vi = buildDescription(makeInput({ language: "vi", rig }), createMockT("vi"));
|
||||
expect(vi).toContain("Phần mềm dựng video: DaVinci Resolve Studio 19.1");
|
||||
expect(vi).toContain("Ổ cứng: 2TB NVMe");
|
||||
});
|
||||
|
||||
it("prints rig lines in a fixed order, whatever order they were filled in", () => {
|
||||
const t = createMockT("en");
|
||||
const result = buildDescription(
|
||||
makeInput({ rig: { video_editor: "davinci_resolve_studio|19.1" } }),
|
||||
makeInput({
|
||||
rig: {
|
||||
os: "windows|11|pro",
|
||||
ram: "32|DDR5|6000",
|
||||
gpu: "gpu:nvidia-rtx-5080",
|
||||
cpu: "AMD Ryzen 7 9800X3D",
|
||||
},
|
||||
}),
|
||||
t,
|
||||
);
|
||||
expect(result).toContain("VIDEO EDITOR: DaVinci Resolve Studio 19.1");
|
||||
expect(result).not.toContain("VIDEO_EDITOR");
|
||||
const block = result.slice(result.indexOf("MY RIG"));
|
||||
const order = ["CPU:", "GPU:", "RAM:", "Operating System:"].map((label) =>
|
||||
block.indexOf(label),
|
||||
);
|
||||
expect(order.every((i) => i > 0)).toBe(true);
|
||||
expect([...order].sort((a, b) => a - b)).toEqual(order);
|
||||
expect(block).toContain("GPU: NVIDIA GeForce RTX 5080");
|
||||
expect(block).toContain("RAM: 32 GB DDR5-6000");
|
||||
});
|
||||
|
||||
it("names a pre-v1.0 GPU value properly", () => {
|
||||
const t = createMockT("en");
|
||||
const result = buildDescription(makeInput({ rig: { gpu: "amd|rx_9000|RX 9070 XT" } }), t);
|
||||
expect(result).toContain("GPU: AMD Radeon RX 9070 XT");
|
||||
expect(result).not.toContain("GPU: AMD RX");
|
||||
});
|
||||
|
||||
it("legacy spoilerWarning boolean no longer renders a standalone block (v0.11 deprecation)", () => {
|
||||
|
||||
@@ -3,6 +3,9 @@ import {
|
||||
getOutputLimitStatus,
|
||||
mergeLimitStatus,
|
||||
EMPTY_LIMIT_STATUS,
|
||||
fieldsWithForbiddenChars,
|
||||
isFieldOver,
|
||||
isCopyAllBlocked,
|
||||
type OutputLimitStatus,
|
||||
} from "@engine/limits";
|
||||
import { renderAll } from "@engine/template-renderer";
|
||||
@@ -129,3 +132,33 @@ describe("integration with renderAll", () => {
|
||||
expect(getOutputLimitStatus({ warnings: [] }).blocked).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("fieldsWithForbiddenChars", () => {
|
||||
it("names the fields YouTube would refuse", () => {
|
||||
expect(fieldsWithForbiddenChars({ title: "A <3 B", description: "ok" })).toEqual(["title"]);
|
||||
expect(fieldsWithForbiddenChars({ title: "ok", description: "x > y" })).toEqual([
|
||||
"description",
|
||||
]);
|
||||
expect(fieldsWithForbiddenChars({ title: "ok", description: "ok" })).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("per-field copy gating (v1.0.0)", () => {
|
||||
const status: OutputLimitStatus = {
|
||||
blocked: true,
|
||||
overflows: [{ field: "tags", current: 520, limit: 500 }],
|
||||
};
|
||||
it("blocks only the field that is over", () => {
|
||||
expect(isFieldOver(status, "tags")).toBe(true);
|
||||
expect(isFieldOver(status, "title")).toBe(false);
|
||||
});
|
||||
it("doesn't block Copy All for tags it doesn't contain", () => {
|
||||
expect(isCopyAllBlocked(status)).toBe(false);
|
||||
expect(
|
||||
isCopyAllBlocked({
|
||||
blocked: true,
|
||||
overflows: [{ field: "description", current: 5100, limit: 5000 }],
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
+107
-67
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { formatRigValue, RIG_FIELDS } from "@config/rig-fields";
|
||||
import { cleanCpuName, formatRigValue, migrateRig, RIG_FIELDS } from "@config/rig-fields";
|
||||
|
||||
describe("formatRigValue", () => {
|
||||
it("passes text fields through unchanged", () => {
|
||||
@@ -37,44 +37,76 @@ describe("formatRigValue", () => {
|
||||
expect(field?.options?.length).toBeGreaterThan(3);
|
||||
});
|
||||
|
||||
describe("cascading_dropdown (GPU, v0.13)", () => {
|
||||
it("formats brand + model and drops the redundant series label", () => {
|
||||
expect(formatRigValue("gpu", "nvidia|rtx_40|RTX 4090")).toBe("NVIDIA RTX 4090");
|
||||
it("orders the fields CPU, GPU, RAM first", () => {
|
||||
expect(RIG_FIELDS.slice(0, 3).map((f) => f.id)).toEqual(["cpu", "gpu", "ram"]);
|
||||
});
|
||||
|
||||
describe("GPU (v1.0.0 catalog)", () => {
|
||||
it("prints the official name of a catalog card", () => {
|
||||
expect(formatRigValue("gpu", "gpu:nvidia-rtx-5080")).toBe("NVIDIA GeForce RTX 5080");
|
||||
expect(formatRigValue("gpu", "gpu:amd-rx-9070-xt")).toBe("AMD Radeon RX 9070 XT");
|
||||
expect(formatRigValue("gpu", "gpu:apple-m4-pro")).toBe("Apple M4 Pro");
|
||||
expect(formatRigValue("gpu", "gpu:nvidia-titan-rtx")).toBe("NVIDIA TITAN RTX");
|
||||
});
|
||||
|
||||
it("returns the verbatim model for the Custom brand", () => {
|
||||
it("names pre-v1.0 values properly", () => {
|
||||
expect(formatRigValue("gpu", "nvidia|rtx_40|RTX 4090")).toBe("NVIDIA GeForce RTX 4090");
|
||||
expect(formatRigValue("gpu", "apple|m4|M4 Pro")).toBe("Apple M4 Pro");
|
||||
expect(formatRigValue("gpu", "nvidia|rtx_40|RTX 4050 (laptop)")).toBe(
|
||||
"NVIDIA GeForce RTX 4050 Laptop GPU",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns the verbatim text for the old Custom brand", () => {
|
||||
expect(formatRigValue("gpu", "custom||RX 7800 XT (OC)")).toBe("RX 7800 XT (OC)");
|
||||
});
|
||||
|
||||
it("renders just the brand label when model is empty", () => {
|
||||
expect(formatRigValue("gpu", "amd|rx_7000|")).toBe("AMD");
|
||||
});
|
||||
|
||||
it("returns empty string when nothing is selected", () => {
|
||||
expect(formatRigValue("gpu", "")).toBe("");
|
||||
expect(formatRigValue("gpu", "||")).toBe("");
|
||||
});
|
||||
|
||||
it("passes legacy free-text values through unchanged", () => {
|
||||
// Pre-v0.13 rigs persisted GPU as plain text. Round-trip those.
|
||||
it("passes the user's own text through unchanged", () => {
|
||||
expect(formatRigValue("gpu", "NVIDIA GeForce RTX 4090")).toBe("NVIDIA GeForce RTX 4090");
|
||||
});
|
||||
|
||||
it("prints nothing for a catalog id that no longer exists", () => {
|
||||
expect(formatRigValue("gpu", "gpu:does-not-exist")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("composite_dropdown (RAM, v0.13)", () => {
|
||||
it("formats preset size + DDR generation", () => {
|
||||
describe("RAM", () => {
|
||||
it("formats size + type", () => {
|
||||
expect(formatRigValue("ram", "16|DDR5")).toBe("16 GB DDR5");
|
||||
});
|
||||
|
||||
it("supports a custom numeric size", () => {
|
||||
it("formats size + type + speed the way kits are named", () => {
|
||||
expect(formatRigValue("ram", "32|DDR5|6000")).toBe("32 GB DDR5-6000");
|
||||
expect(formatRigValue("ram", "16|LPDDR5X|8533")).toBe("16 GB LPDDR5X-8533");
|
||||
});
|
||||
|
||||
it("gives a lone speed its unit", () => {
|
||||
expect(formatRigValue("ram", "32||6000")).toBe("32 GB 6000 MT/s");
|
||||
});
|
||||
|
||||
it("supports a custom size", () => {
|
||||
expect(formatRigValue("ram", "custom:48|DDR5")).toBe("48 GB DDR5");
|
||||
});
|
||||
|
||||
it("renders only the size when DDR is empty", () => {
|
||||
it("doesn't double the unit when the user typed it (was '48GB GB')", () => {
|
||||
expect(formatRigValue("ram", "custom:48GB|DDR5")).toBe("48 GB DDR5");
|
||||
expect(formatRigValue("ram", "custom:48 gb|DDR5")).toBe("48 GB DDR5");
|
||||
});
|
||||
|
||||
it("prints the first DDR generation as plain DDR", () => {
|
||||
expect(formatRigValue("ram", "4|DDR1")).toBe("4 GB DDR");
|
||||
});
|
||||
|
||||
it("renders only the size when the type is empty", () => {
|
||||
expect(formatRigValue("ram", "32|")).toBe("32 GB");
|
||||
});
|
||||
|
||||
it("renders only DDR when size is empty", () => {
|
||||
it("renders only the type when the size is empty", () => {
|
||||
expect(formatRigValue("ram", "|DDR4")).toBe("DDR4");
|
||||
});
|
||||
|
||||
@@ -89,7 +121,7 @@ describe("formatRigValue", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("composite_dropdown (OS, v0.22.0)", () => {
|
||||
describe("OS", () => {
|
||||
it("formats name + version + edition", () => {
|
||||
expect(formatRigValue("os", "windows|11|pro")).toBe("Windows 11 Pro");
|
||||
});
|
||||
@@ -102,13 +134,9 @@ describe("formatRigValue", () => {
|
||||
expect(formatRigValue("os", "windows||home")).toBe("Windows Home");
|
||||
});
|
||||
|
||||
it("falls back to raw values when name is empty (v0.23.0 cascading change)", () => {
|
||||
// Defensive — pre-v0.23 static OS_EDITION_OPTIONS resolved
|
||||
// "enterprise" → "Enterprise" regardless of name. Post-v0.23 the
|
||||
// option list cascades from name; an empty name means no option
|
||||
// list applies, so the raw stored values pass through verbatim.
|
||||
// A real editor session always sets name first, so this is purely
|
||||
// a hand-edited / malformed-blob guard.
|
||||
it("falls back to raw values when name is empty", () => {
|
||||
// An empty name means no option list applies, so the raw stored
|
||||
// values pass through verbatim. Only a hand-edited blob does this.
|
||||
expect(formatRigValue("os", "|10|enterprise")).toBe("10 enterprise");
|
||||
});
|
||||
|
||||
@@ -117,61 +145,73 @@ describe("formatRigValue", () => {
|
||||
expect(formatRigValue("os", "||")).toBe("");
|
||||
});
|
||||
|
||||
it("includes an OS entry in RIG_FIELDS as the first field", () => {
|
||||
expect(RIG_FIELDS[0]?.id).toBe("os");
|
||||
expect(RIG_FIELDS[0]?.type).toBe("composite_dropdown");
|
||||
});
|
||||
});
|
||||
|
||||
describe("composite_dropdown (OS cascading, v0.23.0)", () => {
|
||||
it("renders macOS version-only — third slot hidden", () => {
|
||||
expect(formatRigValue("os", "macos|15 Sequoia|")).toBe("macOS 15 Sequoia");
|
||||
});
|
||||
|
||||
it("renders macOS Tahoe (the 2025 year-aligned jump)", () => {
|
||||
expect(formatRigValue("os", "macos|26 Tahoe|")).toBe("macOS 26 Tahoe");
|
||||
});
|
||||
|
||||
it("renders Linux distro + version with three visible parts", () => {
|
||||
expect(formatRigValue("os", "linux|ubuntu|22.04 LTS")).toBe("Linux Ubuntu 22.04 LTS");
|
||||
});
|
||||
|
||||
it("renders Linux rolling distros (Arch) with the placeholder version", () => {
|
||||
expect(formatRigValue("os", "linux|arch|rolling")).toBe("Linux Arch rolling");
|
||||
});
|
||||
|
||||
it("renders Linux Fedora with a numeric version", () => {
|
||||
expect(formatRigValue("os", "linux|fedora|40")).toBe("Linux Fedora 40");
|
||||
});
|
||||
|
||||
it("renders just distro name when version slot is empty", () => {
|
||||
expect(formatRigValue("os", "linux|debian|")).toBe("Linux Debian");
|
||||
});
|
||||
|
||||
it("falls back gracefully when macOS edition slot carries stale data", () => {
|
||||
// Hand-edited / future-downgrade case: macOS with a third
|
||||
// segment. Engine should skip it (hiddenWhen) rather than
|
||||
// surfacing "macOS 15 Sequoia pro".
|
||||
it("skips a stale edition on macOS", () => {
|
||||
expect(formatRigValue("os", "macos|15 Sequoia|pro")).toBe("macOS 15 Sequoia");
|
||||
});
|
||||
|
||||
it("preserves v0.22.0 Windows storage shape (backward-compat guard)", () => {
|
||||
// Pre-v0.23 stored values must round-trip identically — this
|
||||
// case validates the editor-store v13/v14 doesn't need a
|
||||
// dedicated OS migration step.
|
||||
expect(formatRigValue("os", "windows|11|pro")).toBe("Windows 11 Pro");
|
||||
it("names a Linux system by its distro", () => {
|
||||
expect(formatRigValue("os", "linux|ubuntu|22.04 LTS")).toBe("Ubuntu 22.04 LTS");
|
||||
expect(formatRigValue("os", "linux|fedora|43")).toBe("Fedora 43");
|
||||
expect(formatRigValue("os", "linux|debian|")).toBe("Debian");
|
||||
expect(formatRigValue("os", "linux|steamos|3")).toBe("SteamOS 3");
|
||||
});
|
||||
|
||||
it("puts rolling / latest in parentheses", () => {
|
||||
expect(formatRigValue("os", "linux|arch|rolling")).toBe("Arch Linux (rolling)");
|
||||
expect(formatRigValue("os", "linux|bazzite|latest")).toBe("Bazzite (latest stable)");
|
||||
});
|
||||
|
||||
it("prints plain Linux when no distro is chosen", () => {
|
||||
expect(formatRigValue("os", "linux||")).toBe("Linux");
|
||||
});
|
||||
|
||||
it("preserves the v0.22.0 Windows storage shape", () => {
|
||||
expect(formatRigValue("os", "windows|10|enterprise")).toBe("Windows 10 Enterprise");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("RAM composite — regression guard for v0.23.0 type widening", () => {
|
||||
it("still resolves static option arrays after CompositePart.options widened to a union", () => {
|
||||
// The v0.23.0 change made CompositePart.options accept either a
|
||||
// static array (RAM-style) or a function (OS cascading). RAM uses
|
||||
// the static form — re-running its formatter ensures the union
|
||||
// didn't break the simpler path.
|
||||
expect(formatRigValue("ram", "16|DDR5")).toBe("16 GB DDR5");
|
||||
expect(formatRigValue("ram", "custom:48|DDR5")).toBe("48 GB DDR5");
|
||||
describe("cleanCpuName", () => {
|
||||
it("strips Windows' trademark marks and clock suffix", () => {
|
||||
expect(cleanCpuName("Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz")).toBe("Intel Core i9-9900K");
|
||||
expect(cleanCpuName("12th Gen Intel(R) Core(TM) i7-12700K")).toBe("Intel Core i7-12700K");
|
||||
});
|
||||
|
||||
it("drops AMD's core-count suffix", () => {
|
||||
expect(cleanCpuName("AMD Ryzen 7 7800X3D 8-Core Processor")).toBe("AMD Ryzen 7 7800X3D");
|
||||
expect(cleanCpuName("AMD Ryzen 7 7840HS w/ Radeon 780M Graphics")).toBe(
|
||||
"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics",
|
||||
);
|
||||
expect(cleanCpuName("AMD Ryzen 5 5600G with Radeon Graphics")).toBe("AMD Ryzen 5 5600G");
|
||||
});
|
||||
|
||||
it("leaves clean or unknown text alone apart from whitespace", () => {
|
||||
expect(cleanCpuName(" Apple M4 Pro ")).toBe("Apple M4 Pro");
|
||||
expect(cleanCpuName("Ryzen 9 7950X")).toBe("Ryzen 9 7950X");
|
||||
});
|
||||
});
|
||||
|
||||
describe("migrateRig", () => {
|
||||
it("converts the GPU and keeps the rest", () => {
|
||||
expect(migrateRig({ gpu: "nvidia|rtx_50|RTX 5080", cpu: "Ryzen 7 9800X3D" })).toEqual({
|
||||
gpu: "gpu:nvidia-rtx-5080",
|
||||
cpu: "Ryzen 7 9800X3D",
|
||||
});
|
||||
});
|
||||
|
||||
it("drops non-string values and survives null", () => {
|
||||
expect(migrateRig({ gpu: null, ram: 32, cpu: "x" })).toEqual({ cpu: "x" });
|
||||
expect(migrateRig(null)).toEqual({});
|
||||
expect(migrateRig("nope")).toEqual({});
|
||||
});
|
||||
|
||||
it("is idempotent", () => {
|
||||
const once = migrateRig({ gpu: "amd|rx_9000|RX 9080" });
|
||||
expect(migrateRig(once)).toEqual(once);
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,12 @@ import {
|
||||
formatTagString,
|
||||
tagFriendlyGameName,
|
||||
sanitizeForTag,
|
||||
youtubeTagsLength,
|
||||
trimToCharLimit,
|
||||
GENRE_TAG_REGISTRY,
|
||||
GENRE_SEARCH_TERMS,
|
||||
} from "@engine/tag-generator";
|
||||
import { GENRES } from "@config/genres";
|
||||
import type { GeneratorInput } from "@engine/types";
|
||||
|
||||
function makeInput(overrides: Partial<GeneratorInput> = {}): GeneratorInput {
|
||||
@@ -301,3 +306,69 @@ describe("tagFriendlyGameName — punctuation sanitization (v0.20.0)", () => {
|
||||
expect(tagFriendlyGameName("Hello, World", 30)).toBe("Hello World");
|
||||
});
|
||||
});
|
||||
|
||||
describe("tag length as YouTube counts it (v1.0.0)", () => {
|
||||
it("counts quotes around multi-word tags and one comma between tags", () => {
|
||||
expect(youtubeTagsLength([])).toBe(0);
|
||||
expect(youtubeTagsLength(["rpg"])).toBe(3);
|
||||
// "rpg" (3) + "\"open world\"" (12) + one comma
|
||||
expect(youtubeTagsLength(["rpg", "open world"])).toBe(16);
|
||||
});
|
||||
|
||||
it("never produces more than 500 by YouTube's count", () => {
|
||||
const tags = generateTags(
|
||||
makeInput({
|
||||
gameName: "The Legend of Heroes Trails through Daybreak",
|
||||
genres: ["jrpg", "action_rpg", "openworld"],
|
||||
videoType: "collectibles",
|
||||
resolution: "4K",
|
||||
fps: "120",
|
||||
pubDevName: "Nihon Falcom",
|
||||
}),
|
||||
{ year: 2026 },
|
||||
);
|
||||
expect(youtubeTagsLength(tags)).toBeLessThanOrEqual(500);
|
||||
});
|
||||
|
||||
it("keeps trying shorter tags after one that doesn't fit", () => {
|
||||
const long = "x".repeat(20) + " long tag";
|
||||
const kept = trimToCharLimit(["a".repeat(10), long, "short"], 20);
|
||||
expect(kept).toEqual(["a".repeat(10), "short"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("platform and trending tags (v1.0.0)", () => {
|
||||
it("names the platform the way people search for it", () => {
|
||||
const steam = generateTags(makeInput({ platform: "steam" }));
|
||||
expect(steam).toContain("Elden Ring Steam");
|
||||
expect(steam.some((t) => t.includes("STEAM"))).toBe(false);
|
||||
|
||||
const itch = generateTags(makeInput({ gameName: "Celeste", platform: "itchio" }));
|
||||
expect(itch).toContain("itch.io gameplay");
|
||||
expect(itch.some((t) => t.includes("ITCHIO"))).toBe(false);
|
||||
});
|
||||
|
||||
it("adds no platform tags for a publisher's own site", () => {
|
||||
const tags = generateTags(makeInput({ platform: "publisher" }));
|
||||
expect(tags.some((t) => /publisher/i.test(t))).toBe(false);
|
||||
});
|
||||
|
||||
it("uses search terms and the given year in trending tags", () => {
|
||||
const tags = generateTags(makeInput({ genres: ["openworld"] }), { year: 2031 });
|
||||
expect(tags).toContain("best open world games 2031");
|
||||
expect(tags.some((t) => t.includes("openworld"))).toBe(false);
|
||||
});
|
||||
|
||||
it("has a tag pool and a search term for every genre", () => {
|
||||
const ids = GENRES.map((g) => g.id);
|
||||
expect(Object.keys(GENRE_TAG_REGISTRY).sort()).toEqual([...ids].sort());
|
||||
expect(Object.keys(GENRE_SEARCH_TERMS).sort()).toEqual([...ids].sort());
|
||||
});
|
||||
|
||||
it("keeps each genre's pool on its own genre", () => {
|
||||
const rpg = GENRE_TAG_REGISTRY.rpg?.("X") ?? [];
|
||||
expect(rpg.some((t) => t.includes("JRPG"))).toBe(false);
|
||||
const cards = GENRE_TAG_REGISTRY.card_game?.("X") ?? [];
|
||||
expect(cards.some((t) => t.includes("deck builder"))).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,93 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
checkChapters,
|
||||
formatTimecode,
|
||||
normalizeTimeline,
|
||||
parseTimeline,
|
||||
timecodeSeconds,
|
||||
} from "@engine/timeline-parser";
|
||||
|
||||
const first = (line: string) => parseTimeline(line)[0];
|
||||
|
||||
describe("keyword matching respects word boundaries (v1.0.0)", () => {
|
||||
it("does not read a game title as a keyword", () => {
|
||||
expect(first("1:00 Final Fantasy VII")?.keyword).toBeUndefined();
|
||||
expect(first("1:00 Party time")?.keyword).toBeUndefined();
|
||||
expect(first("1:00 Bossa nova")?.keyword).toBeUndefined();
|
||||
expect(first("1:00 Introspection")?.keyword).toBeUndefined();
|
||||
expect(first("1:00 Creditors")?.keyword).toBeUndefined();
|
||||
});
|
||||
|
||||
it("still recognises the keywords themselves", () => {
|
||||
expect(first("1:00 Introduction")).toMatchObject({ keyword: "intro" });
|
||||
expect(first("1:00 Introduction")?.rest).toBeUndefined();
|
||||
expect(first("1:00 Part 2")).toMatchObject({ keyword: "part", number: 2 });
|
||||
expect(first("1:00 Boss: Malenia")).toMatchObject({ keyword: "boss", rest: ": Malenia" });
|
||||
});
|
||||
|
||||
it("keeps Spanish 'Final' as an ending when it stands alone", () => {
|
||||
expect(first("1:00 Final")).toMatchObject({ keyword: "ending" });
|
||||
expect(first("1:00 Final 2")).toMatchObject({ keyword: "ending", number: 2 });
|
||||
expect(first("1:00 Final: el mejor")).toMatchObject({ keyword: "ending" });
|
||||
});
|
||||
|
||||
it("recognises Portuguese and Indonesian keywords", () => {
|
||||
expect(first("0:00 Introdução")).toMatchObject({ keyword: "intro" });
|
||||
expect(first("5:00 Chefe final")).toMatchObject({ keyword: "final_boss" });
|
||||
expect(first("5:00 Bab 3")).toMatchObject({ keyword: "chapter", number: 3 });
|
||||
expect(first("5:00 Bagian 2")).toMatchObject({ keyword: "part", number: 2 });
|
||||
expect(first("9:00 Bos terakhir")).toMatchObject({ keyword: "final_boss" });
|
||||
});
|
||||
|
||||
it("keeps matching CJK keywords written without spaces", () => {
|
||||
expect(first("1:00 第3章森")).toMatchObject({ keyword: "chapter", number: 3 });
|
||||
expect(first("1:00 オープンワールド探索")?.keyword).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("timestamp formats (v1.0.0)", () => {
|
||||
it("accepts brackets, separators and frame counts", () => {
|
||||
expect(first("[0:00] Intro")).toMatchObject({ time: "0:00", rawLabel: "Intro" });
|
||||
expect(first("(1:23) Boss")).toMatchObject({ time: "1:23", rawLabel: "Boss" });
|
||||
expect(first("0:00 - Start")).toMatchObject({ time: "0:00", rawLabel: "Start" });
|
||||
expect(first("0:00 – Start")).toMatchObject({ time: "0:00", rawLabel: "Start" });
|
||||
expect(first("00:01:02:15 Cutscene")).toMatchObject({ time: "00:01:02", rawLabel: "Cutscene" });
|
||||
});
|
||||
|
||||
it("converts timecodes to and from seconds", () => {
|
||||
expect(timecodeSeconds("0:00")).toBe(0);
|
||||
expect(timecodeSeconds("12:34")).toBe(754);
|
||||
expect(timecodeSeconds("1:02:03")).toBe(3723);
|
||||
expect(timecodeSeconds("abc")).toBeNaN();
|
||||
expect(formatTimecode(5)).toBe("0:05");
|
||||
expect(formatTimecode(3723)).toBe("1:02:03");
|
||||
});
|
||||
|
||||
it("normalises a list to YouTube's form", () => {
|
||||
expect(normalizeTimeline("[00:00] Intro\n00:01:30:10 - Part 1\nnotes")).toBe(
|
||||
"0:00 Intro\n1:30 Part 1\nnotes",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("checkChapters", () => {
|
||||
it("accepts a valid chapter list", () => {
|
||||
expect(checkChapters(parseTimeline("0:00 Intro\n0:30 Part 1\n5:00 Ending"))).toEqual([]);
|
||||
});
|
||||
|
||||
it("has nothing to say about an empty list", () => {
|
||||
expect(checkChapters([])).toEqual([]);
|
||||
});
|
||||
|
||||
it("reports every rule YouTube enforces", () => {
|
||||
const issues = checkChapters(parseTimeline("0:05 Intro\n0:10 Part 1"));
|
||||
expect(issues).toContainEqual({ kind: "firstNotZero" });
|
||||
expect(issues).toContainEqual({ kind: "tooFew", count: 2 });
|
||||
expect(issues).toContainEqual({ kind: "tooShort", time: "0:10" });
|
||||
});
|
||||
|
||||
it("flags timestamps out of order", () => {
|
||||
const issues = checkChapters(parseTimeline("0:00 A\n2:00 B\n1:00 C"));
|
||||
expect(issues).toContainEqual({ kind: "outOfOrder", time: "1:00" });
|
||||
});
|
||||
});
|
||||
@@ -404,3 +404,25 @@ describe("migrateEditorState — v17 → v18 (v0.34.0 Email split)", () => {
|
||||
expect(result.contactEmail).toBe("hello@channel.com");
|
||||
});
|
||||
});
|
||||
|
||||
describe("migrateEditorState — v18 → v19 (v1.0.0 GPU catalog)", () => {
|
||||
it("converts a v0.13 GPU tuple to the catalog id", () => {
|
||||
const result = migrateEditorState({ rig: { gpu: "nvidia|rtx_50|RTX 5080", cpu: "x" } }, 18);
|
||||
expect(result.rig).toEqual({ gpu: "gpu:nvidia-rtx-5080", cpu: "x" });
|
||||
});
|
||||
|
||||
it("keeps a card the catalog doesn't know as its full name", () => {
|
||||
const result = migrateEditorState({ rig: { gpu: "amd|rx_9000|RX 9090 XT" } }, 18);
|
||||
expect(result.rig.gpu).toBe("AMD Radeon RX 9090 XT");
|
||||
});
|
||||
|
||||
it("survives a missing or malformed rig", () => {
|
||||
expect(migrateEditorState({ rig: null }, 18).rig).toEqual({});
|
||||
expect(migrateEditorState({}, 18).rig).toEqual({});
|
||||
});
|
||||
|
||||
it("does not touch the rig of a v19 draft", () => {
|
||||
const rig = { gpu: "gpu:amd-rx-7800-xt" };
|
||||
expect(migrateEditorState({ rig }, 19).rig).toEqual(rig);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
dedupeHistory,
|
||||
historyKey,
|
||||
useHistoryStore,
|
||||
type HistoryEntry,
|
||||
} from "@store/history-store";
|
||||
|
||||
const base = {
|
||||
gameName: "Elden Ring",
|
||||
videoType: "part" as const,
|
||||
language: "en" as const,
|
||||
genres: ["action" as const],
|
||||
title: "Elden Ring Part 1 — Gameplay No Commentary",
|
||||
description: "first",
|
||||
tags: "a, b",
|
||||
};
|
||||
|
||||
describe("history store (v1.0.0 dedupe)", () => {
|
||||
beforeEach(() => useHistoryStore.setState({ entries: [] }));
|
||||
|
||||
it("records one entry per video however often it is generated", () => {
|
||||
const { addEntry } = useHistoryStore.getState();
|
||||
addEntry(base);
|
||||
addEntry(base);
|
||||
addEntry({ ...base, description: "second" });
|
||||
const { entries } = useHistoryStore.getState();
|
||||
expect(entries).toHaveLength(1);
|
||||
expect(entries[0]?.description).toBe("second");
|
||||
});
|
||||
|
||||
it("keeps the entry id and moves the video to the top", () => {
|
||||
const { addEntry } = useHistoryStore.getState();
|
||||
addEntry(base);
|
||||
const id = useHistoryStore.getState().entries[0]?.id;
|
||||
addEntry({ ...base, title: "Elden Ring Part 2 — Gameplay No Commentary" });
|
||||
addEntry(base);
|
||||
const { entries } = useHistoryStore.getState();
|
||||
expect(entries.map((e) => e.title)).toEqual([
|
||||
base.title,
|
||||
"Elden Ring Part 2 — Gameplay No Commentary",
|
||||
]);
|
||||
expect(entries[0]?.id).toBe(id);
|
||||
});
|
||||
|
||||
it("clamps a bad limit instead of trusting it", () => {
|
||||
const { addEntry } = useHistoryStore.getState();
|
||||
for (let i = 0; i < 15; i++) addEntry({ ...base, title: `T${i}` }, 3);
|
||||
expect(useHistoryStore.getState().entries).toHaveLength(10);
|
||||
});
|
||||
|
||||
it("treats a different language or type as a different video", () => {
|
||||
expect(historyKey(base)).not.toBe(historyKey({ ...base, language: "vi" }));
|
||||
expect(historyKey(base)).not.toBe(historyKey({ ...base, videoType: "boss" }));
|
||||
expect(historyKey(base)).toBe(historyKey({ ...base, gameName: " elden ring " }));
|
||||
});
|
||||
|
||||
it("folds old duplicates keeping the newest", () => {
|
||||
const entry = (id: string, createdAt: string): HistoryEntry => ({ ...base, id, createdAt });
|
||||
const folded = dedupeHistory([
|
||||
entry("new", "2026-09-30T00:00:00Z"),
|
||||
entry("old", "2026-09-01T00:00:00Z"),
|
||||
]);
|
||||
expect(folded.map((e) => e.id)).toEqual(["new"]);
|
||||
});
|
||||
});
|
||||
@@ -287,3 +287,16 @@ describe("healSettings", () => {
|
||||
expect(healSettings({ legalConsentVersion: 2.9 }).legalConsentVersion).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("healSettings — historyLimit (v1.0.0)", () => {
|
||||
it("clamps the history limit into 10–500", () => {
|
||||
expect(healSettings({ historyLimit: 1 }).historyLimit).toBe(10);
|
||||
expect(healSettings({ historyLimit: 1e9 }).historyLimit).toBe(500);
|
||||
expect(healSettings({ historyLimit: 250.7 }).historyLimit).toBe(250);
|
||||
});
|
||||
|
||||
it("falls back to the default for a non-number", () => {
|
||||
expect(healSettings({ historyLimit: "many" }).historyLimit).toBe(100);
|
||||
expect(healSettings({ historyLimit: Number.NaN }).historyLimit).toBe(100);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { validateRamValue, validateGpuValue, validateCompositeField } from "@utils/rig-validation";
|
||||
import { validateRamValue, validateCompositeField } from "@utils/rig-validation";
|
||||
|
||||
describe("validateRamValue", () => {
|
||||
it("flags a size with no DDR generation", () => {
|
||||
@@ -27,20 +27,6 @@ describe("validateRamValue", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("validateGpuValue", () => {
|
||||
it("flags a brand with no series", () => {
|
||||
expect(validateGpuValue("nvidia||")?.messageKey).toBe("editor.validation.gpuMissingSeries");
|
||||
});
|
||||
|
||||
it("flags an empty custom GPU", () => {
|
||||
expect(validateGpuValue("custom||")?.messageKey).toBe("editor.validation.gpuCustomEmpty");
|
||||
});
|
||||
|
||||
it("passes a complete brand + series + model", () => {
|
||||
expect(validateGpuValue("nvidia|rtx_40|RTX 4090")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("validateCompositeField (v0.24.0 — per-field validator selection)", () => {
|
||||
it("validates the RAM composite", () => {
|
||||
expect(validateCompositeField("ram", "32|")?.messageKey).toBe(
|
||||
|
||||
@@ -2,6 +2,8 @@ import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
validateUrlWithPattern,
|
||||
validatePlaylistUrl,
|
||||
normalizePlaylistUrl,
|
||||
validateUrlWithPrefix,
|
||||
validateMessengerUrl,
|
||||
validateZaloGroupUrl,
|
||||
validateSignalGroupUrl,
|
||||
@@ -176,10 +178,29 @@ describe("validatePlaylistUrl", () => {
|
||||
expect(result.errorParams?.expected).toBe("https://www.youtube.com/playlist?list=[id]");
|
||||
});
|
||||
|
||||
it("rejects a watch URL with both v= and list= params", () => {
|
||||
expect(
|
||||
validatePlaylistUrl("https://www.youtube.com/watch?v=abc&list=PLrAXtmRdnEQy6nuLMHj").valid,
|
||||
).toBe(false);
|
||||
it("accepts a video-in-playlist URL and normalises it to the playlist page (v1.0.0)", () => {
|
||||
const url = "https://www.youtube.com/watch?v=abc&list=PLrAXtmRdnEQy6nuLMHj";
|
||||
expect(validatePlaylistUrl(url).valid).toBe(true);
|
||||
expect(normalizePlaylistUrl(url)).toBe(
|
||||
"https://www.youtube.com/playlist?list=PLrAXtmRdnEQy6nuLMHj",
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts phone and YouTube Music playlist links (v1.0.0)", () => {
|
||||
for (const url of [
|
||||
"https://m.youtube.com/playlist?list=PLabc",
|
||||
"https://music.youtube.com/playlist?list=PLabc",
|
||||
]) {
|
||||
expect(validatePlaylistUrl(url).valid, url).toBe(true);
|
||||
expect(normalizePlaylistUrl(url)).toBe("https://www.youtube.com/playlist?list=PLabc");
|
||||
}
|
||||
});
|
||||
|
||||
it("still rejects a watch URL without a list", () => {
|
||||
expect(validatePlaylistUrl("https://www.youtube.com/watch?v=abc").valid).toBe(false);
|
||||
expect(normalizePlaylistUrl("https://www.youtube.com/watch?v=abc")).toBe(
|
||||
"https://www.youtube.com/watch?v=abc",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects a youtu.be short URL", () => {
|
||||
@@ -559,3 +580,25 @@ describe("validateEmails — the cap still applies to imported values", () => {
|
||||
expect(result.error).toBe("validation.emailInvalid");
|
||||
});
|
||||
});
|
||||
|
||||
describe("v1.0.0 validation changes", () => {
|
||||
it("requires a dot and a real TLD in email domains", () => {
|
||||
expect(validateEmails("me@gmail").valid).toBe(false);
|
||||
expect(validateEmails("me@localhost").valid).toBe(false);
|
||||
expect(validateEmails("me@gmail.com").valid).toBe(true);
|
||||
expect(validateEmails("me@mail.co.uk").valid).toBe(true);
|
||||
});
|
||||
|
||||
it("does not warn about www., m. or twitter.com against a social prefix", () => {
|
||||
expect(
|
||||
validateUrlWithPrefix("https://www.instagram.com/me", "https://instagram.com/").error,
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
validateUrlWithPrefix("https://m.facebook.com/me", "https://facebook.com/").error,
|
||||
).toBeUndefined();
|
||||
expect(validateUrlWithPrefix("https://twitter.com/me", "https://x.com/").error).toBeUndefined();
|
||||
expect(validateUrlWithPrefix("https://example.com/me", "https://x.com/").error).toBe(
|
||||
"validation.urlPrefixMismatch",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user