feat(editor): quick start, next part, store links pasted anywhere, more stores and platforms
Editor: - Quick start at the top: pick the channel profile and the game preset (remembered per device); replacing fields that hold something else asks first, everything offers Undo; "Update profile / preset" appears when the editor drifts from the one in use. - Next part (number + 1) and New video (same game) clear what belonged to the last video: boss, timestamps, endings, pinned comment, sponsor… Applying a preset for another game or a template does the same first. - Start over replaces Clear Draft and keeps the channel (profile fields); a new draft starts in the Default Output Language (it was always "en"). - A store link pasted anywhere — the page, the Game name field, another store's field — lands in the right store field, sets the platform for a game's first link and names the game from it (Roman numerals and well-known possessives restored: "Final Fantasy VII", "Baldur's Gate 3"). Steam links keep their name slug and drop tracking parameters. - Game-name suggestions from presets and history. Catalogs: - Stores: EA app, Ubisoft, Battle.net, Google Play, App Store, Meta Quest. - Social: YouTube, Threads, Kick, Reddit, Bilibili; "X (Twitter)" with the X mark; threads.net and youtu.be links accepted. - Cross-posting: YouTube Shorts, X (counted the way X counts — CJK, Vietnamese letters with diacritics and emoji count twice), Threads (one topic tag), Bluesky; hashtag caps per platform. - Banks: MBV, VCBNeo, Vikki Bank (renamed OceanBank, CBBank, DongA Bank — saved old names get a one-click switch), Cake by VPBank, Timo. Output: - An empty channel name no longer leaves "…of Hades on ." — the channel phrase is dropped per language (8 locales, every template tested). - Title alternatives are real title shapes with the user's separator and badge case; "Use this shape" sets them (new Title order setting: game first / video first); over-long ones can't be copied. - Copy All can include the tags (setting); Batch picks Part or Demo part and continues from the editor's part number; Ctrl/Cmd+S saves the output to History. - Social editor headings and hints translated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3912ca5152
commit
3c985a07d6
58 files changed
+2297
-408
No files matched your search
+15
@@ -14,6 +14,7 @@ import { needsConsent } from "@config/legal";
|
||||
import { EditorPage } from "@pages/EditorPage";
|
||||
import { hydrateLogStore } from "@store/log-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import i18n from "@i18n/index";
|
||||
import { IS_TAURI } from "@utils/platform";
|
||||
|
||||
@@ -89,6 +90,20 @@ function ConsentGuard() {
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
useEffect(() => {
|
||||
// A first run has no saved draft yet: start it in the Default Output
|
||||
// Language from Settings rather than the editor's built-in English.
|
||||
try {
|
||||
if (localStorage.getItem("ytdescgen-editor-draft") === null) {
|
||||
useEditorStore.setState({
|
||||
language: useSettingsStore.getState().defaultOutputLanguage,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// Storage unavailable (private mode): nothing to decide.
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// Tauri: move data files older versions misplaced, start automatic
|
||||
// backups (desktop) — then load the logs, which that may have moved.
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
import { useId, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Input } from "@components/ui/Input";
|
||||
import { Select } from "@components/ui/Select";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { FIELD_LIMITS } from "@config/field-limits";
|
||||
import { usePresetStore } from "@store/preset-store";
|
||||
import { useHistoryStore } from "@store/history-store";
|
||||
import { applyStoreLink, matchStoreLink } from "@utils/store-paste";
|
||||
|
||||
/** Games the user has written about before: presets, then recent history. */
|
||||
function useGameNameSuggestions(): string[] {
|
||||
const presets = usePresetStore((s) => s.presets);
|
||||
const entries = useHistoryStore((s) => s.entries);
|
||||
return useMemo(() => {
|
||||
const seen = new Set<string>();
|
||||
const names: string[] = [];
|
||||
for (const name of [...presets.map((p) => p.gameName), ...entries.map((e) => e.gameName)]) {
|
||||
const key = name.trim().toLowerCase();
|
||||
if (!key || seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
names.push(name.trim());
|
||||
if (names.length >= 50) break;
|
||||
}
|
||||
return names;
|
||||
}, [presets, entries]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Core identity fields for the video (game name, channel, platform).
|
||||
@@ -15,6 +37,8 @@ export function GameInfoForm() {
|
||||
const store = useEditorStore();
|
||||
|
||||
const platformOptions = PLATFORMS.map((p) => ({ value: p.id, label: p.label }));
|
||||
const suggestionsId = useId();
|
||||
const suggestions = useGameNameSuggestions();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
@@ -24,9 +48,23 @@ export function GameInfoForm() {
|
||||
placeholder={t("editor.gameNamePlaceholder")}
|
||||
value={store.gameName}
|
||||
onChange={(e) => store.set("gameName", e.target.value)}
|
||||
onPaste={(e) => {
|
||||
// A store link pasted here goes to its store field instead, and
|
||||
// the game name is read from it.
|
||||
const match = matchStoreLink(e.clipboardData.getData("text"));
|
||||
if (!match) return;
|
||||
e.preventDefault();
|
||||
applyStoreLink(match);
|
||||
}}
|
||||
list={suggestionsId}
|
||||
autoComplete="off"
|
||||
enterKeyHint="next"
|
||||
/>
|
||||
<datalist id={suggestionsId}>
|
||||
{suggestions.map((name) => (
|
||||
<option key={name} value={name} />
|
||||
))}
|
||||
</datalist>
|
||||
<Input
|
||||
label={t("editor.channelName")}
|
||||
maxLength={FIELD_LIMITS.SHORT_NAME}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FilePlus2, RefreshCw, SkipForward } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { Card } from "@components/ui/Card";
|
||||
import { Button } from "@components/ui/Button";
|
||||
import { Select } from "@components/ui/Select";
|
||||
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
|
||||
import { VIDEO_TYPES } from "@config/video-types";
|
||||
import { editorDataOf, normalizeEditorPatch, useEditorStore } from "@store/editor-store";
|
||||
import { useProfileStore, type Profile } from "@store/profile-store";
|
||||
import { usePresetStore, type GamePreset } from "@store/preset-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import {
|
||||
applyPreset,
|
||||
applyProfile,
|
||||
changedSince,
|
||||
nextPartNumber,
|
||||
overwrittenFields,
|
||||
presetFieldsFromEditor,
|
||||
presetPatch,
|
||||
profileFieldsFromEditor,
|
||||
profilePatch,
|
||||
startNewVideo,
|
||||
startNextPart,
|
||||
} from "@utils/library-apply";
|
||||
|
||||
type Pending =
|
||||
| { kind: "profile"; item: Profile; count: number }
|
||||
| { kind: "preset"; item: GamePreset; count: number };
|
||||
|
||||
/**
|
||||
* The top of the editor: fill the channel from a profile and the game from
|
||||
* a preset, or move on to the next video of the same game. Replacing fields
|
||||
* that already hold something else asks first; everything offers Undo.
|
||||
*/
|
||||
export function QuickStart() {
|
||||
const { t } = useTranslation("ui");
|
||||
const profiles = useProfileStore((s) => s.profiles);
|
||||
const presets = usePresetStore((s) => s.presets);
|
||||
const updateProfile = useProfileStore((s) => s.updateProfile);
|
||||
const updatePreset = usePresetStore((s) => s.updatePreset);
|
||||
const lastProfileId = useSettingsStore((s) => s.lastProfileId);
|
||||
const lastPresetId = useSettingsStore((s) => s.lastPresetId);
|
||||
// The drift hints compare against the whole form, so this re-renders with
|
||||
// it — a card of two selects and two buttons.
|
||||
const editor = useEditorStore();
|
||||
const [pending, setPending] = useState<Pending | null>(null);
|
||||
|
||||
const activeProfile = profiles.find((p) => p.id === lastProfileId);
|
||||
const activePreset = presets.find((p) => p.id === lastPresetId);
|
||||
const data = editorDataOf(editor);
|
||||
// Compared the way applying would write them (legacy values mapped), so a
|
||||
// freshly applied item never shows as changed.
|
||||
const profileDrift = activeProfile
|
||||
? changedSince(data, normalizeEditorPatch(profilePatch(activeProfile)))
|
||||
: [];
|
||||
const presetDrift = activePreset
|
||||
? changedSince(data, normalizeEditorPatch(presetPatch(activePreset)))
|
||||
: [];
|
||||
|
||||
const usesPart = VIDEO_TYPES.find((v) => v.id === editor.videoType)?.extraFields.some(
|
||||
(f) => f === "partNumber",
|
||||
);
|
||||
const nextPart = nextPartNumber(editor.partNumber);
|
||||
|
||||
const apply = (target: Pending) => {
|
||||
if (target.kind === "profile") applyProfile(target.item);
|
||||
else applyPreset(target.item);
|
||||
};
|
||||
|
||||
const choose = (target: Omit<Pending, "count">) => {
|
||||
const patch =
|
||||
target.kind === "profile"
|
||||
? profilePatch(target.item as Profile)
|
||||
: presetPatch(target.item as GamePreset);
|
||||
const count = overwrittenFields(data, normalizeEditorPatch(patch)).length;
|
||||
const full = { ...target, count } as Pending;
|
||||
if (count > 0) setPending(full);
|
||||
else apply(full);
|
||||
};
|
||||
|
||||
const hasLibrary = profiles.length > 0 || presets.length > 0;
|
||||
|
||||
return (
|
||||
<Card className="flex flex-col gap-3 p-3 sm:p-4">
|
||||
{hasLibrary ? (
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
<Select
|
||||
label={t("editor.quick.profile")}
|
||||
value={activeProfile?.id ?? ""}
|
||||
disabled={profiles.length === 0}
|
||||
options={[
|
||||
{ value: "", label: t("editor.quick.chooseProfile") },
|
||||
...profiles.map((p) => ({ value: p.id, label: p.name })),
|
||||
]}
|
||||
onChange={(id) => {
|
||||
const item = profiles.find((p) => p.id === id);
|
||||
if (item) choose({ kind: "profile", item });
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
label={t("editor.quick.preset")}
|
||||
value={activePreset?.id ?? ""}
|
||||
disabled={presets.length === 0}
|
||||
options={[
|
||||
{ value: "", label: t("editor.quick.choosePreset") },
|
||||
...presets.map((p) => ({ value: p.id, label: p.gameName })),
|
||||
]}
|
||||
onChange={(id) => {
|
||||
const item = presets.find((p) => p.id === id);
|
||||
if (item) choose({ kind: "preset", item });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-text-muted text-xs">
|
||||
{t("editor.quick.emptyLibrary")}{" "}
|
||||
<Link to="/profiles" className="text-accent font-medium hover:underline">
|
||||
{t("tabs.profiles")}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
|
||||
{activeProfile && profileDrift.length > 0 && (
|
||||
<DriftHint
|
||||
text={t("editor.quick.profileChanged", { name: activeProfile.name })}
|
||||
action={t("editor.quick.updateProfile")}
|
||||
onUpdate={() => {
|
||||
updateProfile(activeProfile.id, profileFieldsFromEditor(data));
|
||||
toast.success(t("profiles.updated", { name: activeProfile.name }));
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{activePreset && presetDrift.length > 0 && (
|
||||
<DriftHint
|
||||
text={t("editor.quick.presetChanged", { name: activePreset.gameName })}
|
||||
action={t("editor.quick.updatePreset")}
|
||||
onUpdate={() => {
|
||||
updatePreset(activePreset.id, presetFieldsFromEditor(data));
|
||||
toast.success(t("presets.updated", { name: activePreset.gameName }));
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{usesPart && (
|
||||
<Button variant="secondary" size="sm" onClick={startNextPart}>
|
||||
<SkipForward />
|
||||
{nextPart
|
||||
? t("editor.quick.nextPart", { n: nextPart })
|
||||
: t("editor.quick.nextPartPlain")}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="secondary" size="sm" onClick={startNewVideo}>
|
||||
<FilePlus2 />
|
||||
{t("editor.quick.newVideo")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog
|
||||
open={pending !== null}
|
||||
title={
|
||||
pending?.kind === "profile"
|
||||
? t("editor.quick.applyProfileTitle", { name: pending.item.name })
|
||||
: t("editor.quick.applyPresetTitle", {
|
||||
name: pending?.kind === "preset" ? pending.item.gameName : "",
|
||||
})
|
||||
}
|
||||
message={t("editor.quick.overwrite", { n: pending?.count ?? 0 })}
|
||||
confirmLabel={t("editor.quick.replace")}
|
||||
onConfirm={() => {
|
||||
if (pending) apply(pending);
|
||||
setPending(null);
|
||||
}}
|
||||
onCancel={() => setPending(null)}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
function DriftHint({
|
||||
text,
|
||||
action,
|
||||
onUpdate,
|
||||
}: {
|
||||
text: string;
|
||||
action: string;
|
||||
onUpdate: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="bg-surface-2/60 flex flex-wrap items-center justify-between gap-2 rounded-lg px-3 py-2">
|
||||
<p className="text-text-secondary text-xs">{text}</p>
|
||||
<Button variant="ghost" size="sm" onClick={onUpdate}>
|
||||
<RefreshCw />
|
||||
{action}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +18,9 @@ export function SocialEditor() {
|
||||
<span className="text-text-primary text-sm font-semibold">{t("editor.social")}</span>
|
||||
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-text-muted text-xs font-medium uppercase">Donate</span>
|
||||
<span className="text-text-muted text-xs font-medium uppercase">
|
||||
{t("editor.socialGroups.donate")}
|
||||
</span>
|
||||
{donateFields.map((field) => (
|
||||
<ValidatedInput
|
||||
key={field.id}
|
||||
@@ -37,7 +39,9 @@ export function SocialEditor() {
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-text-muted text-xs font-medium uppercase">Social</span>
|
||||
<span className="text-text-muted text-xs font-medium uppercase">
|
||||
{t("editor.socialGroups.social")}
|
||||
</span>
|
||||
{socialFields.map((field) => (
|
||||
<ValidatedInput
|
||||
key={field.id}
|
||||
@@ -51,11 +55,7 @@ export function SocialEditor() {
|
||||
validate={(v) =>
|
||||
field.urlPrefix ? validateUrlWithPrefix(v, field.urlPrefix) : validateUrl(v)
|
||||
}
|
||||
helpText={
|
||||
field.id === "mastodon"
|
||||
? "Full URL including instance, e.g. https://mastodon.social/@user"
|
||||
: undefined
|
||||
}
|
||||
helpText={field.id === "mastodon" ? t("editor.mastodonHelp") : undefined}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { PLATFORMS } from "@config/platforms";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { validateUrlWithPattern } from "@utils/validation";
|
||||
import { extractGameNameFromUrl, isLinkNameMismatch } from "@utils/url-extractors";
|
||||
import { applyStoreLink, matchStoreLink } from "@utils/store-paste";
|
||||
import type { StoreLinkType } from "@engine/types";
|
||||
import { FIELD_LIMITS } from "@config/field-limits";
|
||||
|
||||
@@ -67,10 +68,17 @@ export function StoreLinkEditor() {
|
||||
// Game Name field is still empty, auto-fill it from the URL slug. The
|
||||
// toast carries an Undo action so a wrong guess is one click away from
|
||||
// being reverted. Never overwrites a non-empty Game Name.
|
||||
const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {
|
||||
if (gameName.trim()) return;
|
||||
const handlePaste = (e: ClipboardEvent<HTMLInputElement>, platformId: string) => {
|
||||
const pasted = e.clipboardData.getData("text").trim();
|
||||
if (!pasted) return;
|
||||
// A link for another store goes to that store's field.
|
||||
const match = matchStoreLink(pasted);
|
||||
if (match && match.platformId !== platformId) {
|
||||
e.preventDefault();
|
||||
applyStoreLink(match);
|
||||
return;
|
||||
}
|
||||
if (gameName.trim()) return;
|
||||
const extracted = extractGameNameFromUrl(pasted);
|
||||
if (!extracted) return;
|
||||
|
||||
@@ -131,7 +139,7 @@ export function StoreLinkEditor() {
|
||||
setNested("storeLinks", platform.id, final);
|
||||
}}
|
||||
validate={(v) => validateUrlWithPattern(v, platform.urlPattern)}
|
||||
onPaste={handlePaste}
|
||||
onPaste={(e) => handlePaste(e, platform.id)}
|
||||
/>
|
||||
<Select
|
||||
label={t("editor.storeLinkType")}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useEditorStore } from "@store/editor-store";
|
||||
import { FIELD_LIMITS } from "@config/field-limits";
|
||||
import {
|
||||
VIETNAMESE_BANKS,
|
||||
renamedVietnameseBank,
|
||||
VIETNAMESE_BANK_OTHER,
|
||||
isCustomVietnameseBank,
|
||||
} from "@config/vietnamese-banks";
|
||||
@@ -50,6 +51,8 @@ export function VietnameseDonateEditor() {
|
||||
);
|
||||
|
||||
const customMode = isVi && (otherSticky || isCustomVietnameseBank(vnBankName ?? ""));
|
||||
// OceanBank, CBBank and DongA Bank were renamed in 2025.
|
||||
const renamedTo = isVi ? renamedVietnameseBank(vnBankName ?? "") : null;
|
||||
const selectValue = customMode ? VIETNAMESE_BANK_OTHER : (vnBankName ?? "");
|
||||
|
||||
const bankOptions = [
|
||||
@@ -90,6 +93,21 @@ export function VietnameseDonateEditor() {
|
||||
onChange={(e) => store.set("vnBankName", e.target.value)}
|
||||
/>
|
||||
)}
|
||||
{renamedTo && (
|
||||
<p className="text-text-muted text-xs">
|
||||
{t("editor.vnBankRenamed", { name: renamedTo })}{" "}
|
||||
<button
|
||||
type="button"
|
||||
className="text-accent font-medium hover:underline"
|
||||
onClick={() => {
|
||||
setOtherSticky(false);
|
||||
store.set("vnBankName", renamedTo);
|
||||
}}
|
||||
>
|
||||
{t("editor.vnBankUseNewName", { name: renamedTo })}
|
||||
</button>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<Input
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
siPaypal,
|
||||
siSteam,
|
||||
siTelegram,
|
||||
siThreads,
|
||||
siTiktok,
|
||||
siX,
|
||||
siYoutube,
|
||||
@@ -60,3 +61,4 @@ export const PaypalIcon = brandIcon(siPaypal);
|
||||
export const FacebookIcon = brandIcon(siFacebook);
|
||||
export const InstagramIcon = brandIcon(siInstagram);
|
||||
export const TiktokIcon = brandIcon(siTiktok);
|
||||
export const ThreadsIcon = brandIcon(siThreads);
|
||||
@@ -1,14 +1,18 @@
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import i18n from "i18next";
|
||||
import { Check } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
import { Modal } from "@components/ui/Modal";
|
||||
import { Button } from "@components/ui/Button";
|
||||
import { Badge } from "@components/ui/Badge";
|
||||
import { CopyButton } from "./CopyButton";
|
||||
import { CharCounter } from "./CharCounter";
|
||||
import { buildTitleVariants } from "@engine/title-variants";
|
||||
import { buildTitleVariants, type TitleVariant } from "@engine/title-variants";
|
||||
import { useLanguagesReady } from "@hooks/use-languages-ready";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { useCurrentGeneratorInput } from "@hooks/use-current-generator-input";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import { YT_LIMITS, type GeneratorInput } from "@engine/types";
|
||||
import { YT_LIMITS } from "@engine/types";
|
||||
|
||||
interface VariantPickerProps {
|
||||
open: boolean;
|
||||
@@ -16,90 +20,97 @@ interface VariantPickerProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* Modal that shows 3 A/B-testable title variants for the current editor
|
||||
* state. Generated fresh each time the modal opens — no state persists
|
||||
* here because the titles are derived from the store.
|
||||
* Three title shapes for the current editor state, with the user's
|
||||
* separator and badge case. "Use this shape" saves the shape to the title
|
||||
* format, so every title — this one and the next — is built that way.
|
||||
*/
|
||||
export function VariantPicker({ open, onClose }: VariantPickerProps) {
|
||||
const { t } = useTranslation("ui");
|
||||
const state = useEditorStore();
|
||||
const input = useCurrentGeneratorInput();
|
||||
const showQualityBadge = useSettingsStore((s) => s.showQualityBadge);
|
||||
const titleFormat = useSettingsStore((s) => s.titleFormat);
|
||||
const setTitleFormat = useSettingsStore((s) => s.setTitleFormat);
|
||||
|
||||
// Lazy-loaded locales (v0.26): only request the bundle while the modal
|
||||
// is actually open; the list fills in on the ready flip.
|
||||
const ready = useLanguagesReady(open ? [state.language] : []);
|
||||
const ready = useLanguagesReady(open ? [input.language] : []);
|
||||
|
||||
const variants = useMemo(() => {
|
||||
if (!open || !ready) return [];
|
||||
const input: GeneratorInput = {
|
||||
videoType: state.videoType,
|
||||
language: state.language,
|
||||
genres: state.genres,
|
||||
gameName: state.gameName,
|
||||
gameNameLocalized: state.gameNameLocalized,
|
||||
channelName: state.channelName,
|
||||
platform: state.platform,
|
||||
partNumber: state.partNumber,
|
||||
bossName: state.bossName,
|
||||
dlcName: state.dlcName,
|
||||
challengeName: state.challengeName,
|
||||
modName: state.modName,
|
||||
resolution: state.resolution,
|
||||
fps: state.fps,
|
||||
graphicsPreset: state.graphicsPreset,
|
||||
spoilerWarning: state.spoilerWarning,
|
||||
matureWarning: state.matureWarning,
|
||||
storeLinks: state.storeLinks,
|
||||
social: state.social,
|
||||
rig: state.rig,
|
||||
const tFn = i18n.getFixedT(input.language, "templates");
|
||||
return buildTitleVariants(input, tFn, { ...titleFormat, showQualityBadge });
|
||||
}, [open, ready, input, titleFormat, showQualityBadge]);
|
||||
|
||||
const isCurrent = (variant: TitleVariant) =>
|
||||
(titleFormat.order ?? "gameFirst") === variant.format.order &&
|
||||
titleFormat.badgePosition === variant.format.badgePosition;
|
||||
|
||||
// Without a quality badge two shapes read the same; list each title once,
|
||||
// preferring the one in use.
|
||||
const shown = variants.filter((variant, index) => {
|
||||
if (isCurrent(variant)) return true;
|
||||
const current = variants.find(isCurrent);
|
||||
if (current && current.title === variant.title) return false;
|
||||
return variants.findIndex((other) => other.title === variant.title) === index;
|
||||
});
|
||||
|
||||
const apply = (variant: TitleVariant) => {
|
||||
const before = {
|
||||
order: titleFormat.order ?? "gameFirst",
|
||||
badgePosition: titleFormat.badgePosition,
|
||||
};
|
||||
const tFn = i18n.getFixedT(state.language, "templates");
|
||||
return buildTitleVariants(input, tFn, showQualityBadge);
|
||||
}, [
|
||||
open,
|
||||
ready,
|
||||
showQualityBadge,
|
||||
state.videoType,
|
||||
state.language,
|
||||
state.genres,
|
||||
state.gameName,
|
||||
state.gameNameLocalized,
|
||||
state.channelName,
|
||||
state.platform,
|
||||
state.partNumber,
|
||||
state.bossName,
|
||||
state.dlcName,
|
||||
state.challengeName,
|
||||
state.modName,
|
||||
state.resolution,
|
||||
state.fps,
|
||||
state.graphicsPreset,
|
||||
state.spoilerWarning,
|
||||
state.matureWarning,
|
||||
state.storeLinks,
|
||||
state.social,
|
||||
state.rig,
|
||||
]);
|
||||
setTitleFormat(variant.format);
|
||||
toast.success(t("output.variantApplied", { name: t(variant.labelKey) }), {
|
||||
action: { label: t("common.undo"), onClick: () => setTitleFormat(before) },
|
||||
});
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal open={open} onClose={onClose} title={t("output.generateAlternatives")} size="lg">
|
||||
<Modal
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
title={t("output.generateAlternatives")}
|
||||
description={t("output.variantsHint")}
|
||||
size="lg"
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
{variants.map((variant) => (
|
||||
<section key={variant.id} className="flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="text-text-muted text-xs font-semibold tracking-wide uppercase">
|
||||
{t(variant.labelKey)}
|
||||
</h3>
|
||||
<div className="flex items-center gap-3">
|
||||
<CharCounter text={variant.title} limit={YT_LIMITS.TITLE_MAX} />
|
||||
<CopyButton text={variant.title} label={t("output.copyTitle")} />
|
||||
{shown.map((variant) => {
|
||||
const over = variant.title.length > YT_LIMITS.TITLE_MAX;
|
||||
const current = isCurrent(variant);
|
||||
return (
|
||||
<section key={variant.id} className="flex flex-col gap-2">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h3 className="text-text-muted flex items-center gap-2 text-xs font-semibold tracking-wide uppercase">
|
||||
{t(variant.labelKey)}
|
||||
{current && <Badge tone="accent">{t("output.variantCurrent")}</Badge>}
|
||||
</h3>
|
||||
<div className="flex items-center gap-2">
|
||||
<CharCounter text={variant.title} limit={YT_LIMITS.TITLE_MAX} />
|
||||
<CopyButton
|
||||
text={variant.title}
|
||||
label={t("output.copyTitle")}
|
||||
blocked={over}
|
||||
blockedHint={t("output.limits.fieldLine", {
|
||||
field: t("output.title"),
|
||||
count: variant.title.length,
|
||||
limit: YT_LIMITS.TITLE_MAX,
|
||||
})}
|
||||
/>
|
||||
{!current && (
|
||||
<Button variant="secondary" size="sm" onClick={() => apply(variant)}>
|
||||
<Check />
|
||||
{t("output.variantApply")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="border-border bg-surface-0 text-text-primary rounded-lg border px-3 py-2.5 text-sm font-medium">
|
||||
{variant.title}
|
||||
</p>
|
||||
</section>
|
||||
))}
|
||||
<p className="border-border bg-surface-0 text-text-primary rounded-lg border px-3 py-2.5 text-sm font-medium break-words">
|
||||
{variant.title}
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Select } from "@components/ui/Select";
|
||||
import { usePresetStore } from "@store/preset-store";
|
||||
import { applyPreset } from "@utils/library-apply";
|
||||
|
||||
/** Fill the game fields from a saved preset (with Undo). */
|
||||
export function PresetSelector() {
|
||||
const { t } = useTranslation("ui");
|
||||
const presets = usePresetStore((s) => s.presets);
|
||||
|
||||
if (presets.length === 0) return null;
|
||||
|
||||
const options = [
|
||||
{ value: "", label: t("presets.selectPreset") },
|
||||
...presets.map((p) => ({ value: p.id, label: p.gameName })),
|
||||
];
|
||||
|
||||
return (
|
||||
<Select
|
||||
label={t("presets.selectPreset")}
|
||||
options={options}
|
||||
value=""
|
||||
onChange={(id) => {
|
||||
const preset = presets.find((p) => p.id === id);
|
||||
if (preset) applyPreset(preset);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -14,7 +14,7 @@ const SHORTCUTS = [
|
||||
{ keys: ["mod", "G"], labelKey: "shortcuts.generate" },
|
||||
{ keys: ["mod", "enter"], labelKey: "shortcuts.generate" },
|
||||
{ keys: ["mod", "shift", "C"], labelKey: "shortcuts.copyAll" },
|
||||
{ keys: ["mod", "S"], labelKey: "shortcuts.saveDraft" },
|
||||
{ keys: ["mod", "S"], labelKey: "shortcuts.saveToHistory" },
|
||||
{ keys: ["mod", "B"], labelKey: "shortcuts.toggleSidebar" },
|
||||
{ keys: ["mod", "/"], labelKey: "shortcuts.help" },
|
||||
{ keys: ["?"], labelKey: "shortcuts.help" },
|
||||
|
||||
@@ -57,3 +57,33 @@ export const PRESET_FIELDS = [
|
||||
|
||||
export type ProfileField = (typeof PROFILE_FIELDS)[number];
|
||||
export type PresetField = (typeof PRESET_FIELDS)[number];
|
||||
|
||||
/**
|
||||
* What belongs to one video and not the next: cleared by "Next part",
|
||||
* "New video" and when a preset for another game is applied. The part
|
||||
* number is handled on its own (Next part increments it).
|
||||
*/
|
||||
export const PER_VIDEO_FIELDS = [
|
||||
"bossName",
|
||||
"dlcName",
|
||||
"challengeName",
|
||||
"modName",
|
||||
"modList",
|
||||
"liveUrl",
|
||||
"scheduledTime",
|
||||
"chapterName",
|
||||
"questName",
|
||||
"characterName",
|
||||
"anniversaryYear",
|
||||
"gachaVersion",
|
||||
"timestamps",
|
||||
"thumbnailText",
|
||||
"pinnedComment",
|
||||
"sponsorName",
|
||||
"sponsorPlatform",
|
||||
"endingsShown",
|
||||
"endings",
|
||||
"endingVideoCount",
|
||||
"endingVideoRanges",
|
||||
"endingVideoIndex",
|
||||
] as const satisfies readonly (keyof EditorData)[];
|
||||
+52
-5
@@ -22,17 +22,19 @@ export interface PlatformConfig {
|
||||
/**
|
||||
* Normaliser for Steam store URLs.
|
||||
*
|
||||
* Valid shape: `https://store.steampowered.com/app/<id>` with an optional
|
||||
* trailing slug such as `/ELDEN_RING/`. This strips everything after the
|
||||
* numeric id, yielding the canonical `.../app/<id>` form.
|
||||
* Keeps `https://store.steampowered.com/app/<id>/<Slug>/` — the slug makes
|
||||
* the link readable in a description and is where the game's name is read
|
||||
* from — and drops what follows it (tracking `?snr=` parameters, extra
|
||||
* path segments). An `s.team/a/<id>` short link becomes the `/app/<id>` form.
|
||||
*/
|
||||
function normalizeSteamUrl(url: string): string {
|
||||
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,
|
||||
/^(https:\/\/store\.steampowered\.com\/(?:app|sub|bundle)\/\d+)(\/[^/?#\s]+)?/i,
|
||||
);
|
||||
return match?.[1] ?? url;
|
||||
if (!match) return url;
|
||||
return match[2] ? `${match[1]}${match[2]}/` : (match[1] ?? url);
|
||||
}
|
||||
|
||||
export const PLATFORMS: readonly PlatformConfig[] = [
|
||||
@@ -111,6 +113,51 @@ export const PLATFORMS: readonly PlatformConfig[] = [
|
||||
// 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,
|
||||
},
|
||||
{
|
||||
id: "ea",
|
||||
tagName: "EA app",
|
||||
label: "EA app",
|
||||
urlPrefix: "https://www.ea.com/games/",
|
||||
urlPattern: /^https:\/\/(?:www\.)?ea\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "ubisoft",
|
||||
tagName: "Ubisoft Connect",
|
||||
label: "Ubisoft Store",
|
||||
urlPrefix: "https://store.ubisoft.com/",
|
||||
urlPattern: /^https:\/\/(?:store\.ubisoft\.com|(?:www\.)?ubisoft\.com)\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "battlenet",
|
||||
tagName: "Battle.net",
|
||||
label: "Battle.net",
|
||||
urlPrefix: "https://shop.battle.net/",
|
||||
// shop.battle.net and its regional hosts (us.shop.battle.net …).
|
||||
urlPattern: /^https:\/\/(?:[a-z0-9-]+\.)*battle\.net\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "googleplay",
|
||||
tagName: "Android",
|
||||
label: "Google Play",
|
||||
urlPrefix: "https://play.google.com/store/apps/details?id=",
|
||||
// `id=` first or after other parameters (`?hl=en&id=…`).
|
||||
urlPattern: /^https:\/\/play\.google\.com\/store\/apps\/details\?(?:[^\s]*&)?id=[\w.]+[^\s]*$/i,
|
||||
},
|
||||
{
|
||||
id: "appstore",
|
||||
tagName: "iOS",
|
||||
label: "App Store",
|
||||
urlPrefix: "https://apps.apple.com/app/",
|
||||
urlPattern: /^https:\/\/apps\.apple\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
id: "meta",
|
||||
tagName: "Meta Quest",
|
||||
label: "Meta Quest Store",
|
||||
urlPrefix: "https://www.meta.com/experiences/",
|
||||
// meta.com, and oculus.com links that still circulate.
|
||||
urlPattern: /^https:\/\/(?:www\.)?(?:meta|oculus)\.com\/[^\s]+$/i,
|
||||
},
|
||||
{
|
||||
// Catch-all for indie / niche releases distributed only from a
|
||||
// publisher's or developer's own site. Pattern is intentionally
|
||||
|
||||
@@ -44,8 +44,16 @@ export const SOCIAL_FIELDS = [
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "youtube",
|
||||
label: "YouTube",
|
||||
labelKey: "social.youtube",
|
||||
urlPrefix: "https://www.youtube.com/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
// Id kept from before the rename, so saved links still load.
|
||||
id: "twitter",
|
||||
label: "Twitter / X",
|
||||
label: "X (Twitter)",
|
||||
labelKey: "social.twitter",
|
||||
urlPrefix: "https://x.com/",
|
||||
category: "social",
|
||||
@@ -64,6 +72,13 @@ export const SOCIAL_FIELDS = [
|
||||
urlPrefix: "https://twitch.tv/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "kick",
|
||||
label: "Kick",
|
||||
labelKey: "social.kick",
|
||||
urlPrefix: "https://kick.com/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "tiktok",
|
||||
label: "TikTok",
|
||||
@@ -78,6 +93,13 @@ export const SOCIAL_FIELDS = [
|
||||
urlPrefix: "https://instagram.com/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "threads",
|
||||
label: "Threads",
|
||||
labelKey: "social.threads",
|
||||
urlPrefix: "https://www.threads.com/@",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "bluesky",
|
||||
label: "Bluesky",
|
||||
@@ -108,6 +130,20 @@ export const SOCIAL_FIELDS = [
|
||||
},
|
||||
// Facebook Group moved to the Community section in v0.33.0 — it's now a
|
||||
// dedicated `facebookGroupLink` editor field (see CommunityEditor).
|
||||
{
|
||||
id: "reddit",
|
||||
label: "Reddit",
|
||||
labelKey: "social.reddit",
|
||||
urlPrefix: "https://www.reddit.com/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "bilibili",
|
||||
label: "Bilibili",
|
||||
labelKey: "social.bilibili",
|
||||
urlPrefix: "https://space.bilibili.com/",
|
||||
category: "social",
|
||||
},
|
||||
{
|
||||
id: "telegram",
|
||||
label: "Telegram",
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import {
|
||||
BlueskyIcon,
|
||||
FacebookIcon,
|
||||
InstagramIcon,
|
||||
ThreadsIcon,
|
||||
TiktokIcon,
|
||||
XIcon,
|
||||
YoutubeIcon,
|
||||
type IconComponent,
|
||||
} from "@components/icons/brand";
|
||||
|
||||
/**
|
||||
* A short-form platform the cross-post generator targets (v0.24.0). Each
|
||||
* one re-packages the same YouTube source (title, rig, content warnings,
|
||||
* A platform the cross-post generator targets (v0.24.0). Each one
|
||||
* re-packages the same YouTube source (title, rig, content warnings,
|
||||
* copyright, thanks, hashtags) under its own character ceiling and a
|
||||
* curated set of platform-popular hashtags.
|
||||
*
|
||||
@@ -16,7 +20,14 @@ import {
|
||||
* `@config/social-fields`.
|
||||
*/
|
||||
export interface SocialPlatform {
|
||||
readonly id: "tiktok" | "instagram_reels" | "facebook_reels";
|
||||
readonly id:
|
||||
| "tiktok"
|
||||
| "instagram_reels"
|
||||
| "facebook_reels"
|
||||
| "youtube_shorts"
|
||||
| "x"
|
||||
| "threads"
|
||||
| "bluesky";
|
||||
/** i18n key under `socialPost.platforms.<id>`. */
|
||||
readonly labelKey: string;
|
||||
/** Caption character ceiling enforced by the platform. */
|
||||
@@ -28,6 +39,13 @@ export interface SocialPlatform {
|
||||
* derived hashtags at build time.
|
||||
*/
|
||||
readonly popularHashtags: readonly string[];
|
||||
/** Most hashtags worth posting (Threads takes one topic per post). */
|
||||
readonly maxHashtags?: number;
|
||||
/**
|
||||
* How the platform counts toward `charLimit`. `"x"`: X's weighted count,
|
||||
* where CJK, Vietnamese letters with diacritics and emoji count twice.
|
||||
*/
|
||||
readonly countMode?: "x";
|
||||
}
|
||||
|
||||
export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
|
||||
@@ -46,6 +64,16 @@ export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
|
||||
"#gamer",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "youtube_shorts",
|
||||
labelKey: "socialPost.platforms.youtube_shorts",
|
||||
charLimit: 5000,
|
||||
icon: YoutubeIcon,
|
||||
// YouTube shows the first three above the title; past that they only
|
||||
// add noise.
|
||||
popularHashtags: ["#shorts", "#gaming", "#gameplay"],
|
||||
maxHashtags: 5,
|
||||
},
|
||||
{
|
||||
id: "instagram_reels",
|
||||
labelKey: "socialPost.platforms.instagram_reels",
|
||||
@@ -76,4 +104,29 @@ export const SOCIAL_PLATFORMS: readonly SocialPlatform[] = [
|
||||
"#videogames",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "x",
|
||||
labelKey: "socialPost.platforms.x",
|
||||
charLimit: 280,
|
||||
icon: XIcon,
|
||||
popularHashtags: ["#gaming"],
|
||||
maxHashtags: 3,
|
||||
countMode: "x",
|
||||
},
|
||||
{
|
||||
id: "threads",
|
||||
labelKey: "socialPost.platforms.threads",
|
||||
charLimit: 500,
|
||||
icon: ThreadsIcon,
|
||||
popularHashtags: [],
|
||||
maxHashtags: 1,
|
||||
},
|
||||
{
|
||||
id: "bluesky",
|
||||
labelKey: "socialPost.platforms.bluesky",
|
||||
charLimit: 300,
|
||||
icon: BlueskyIcon,
|
||||
popularHashtags: ["#gaming"],
|
||||
maxHashtags: 3,
|
||||
},
|
||||
] as const;
|
||||
@@ -53,6 +53,13 @@ export const VIETNAMESE_BANKS = [
|
||||
"VietABank",
|
||||
"Vietbank",
|
||||
"BVBank",
|
||||
// Banks restructured in 2025 under new names (formerly OceanBank, CBBank,
|
||||
// DongA Bank) and digital-first banks
|
||||
"MBV",
|
||||
"VCBNeo",
|
||||
"Vikki Bank",
|
||||
"Cake by VPBank",
|
||||
"Timo",
|
||||
// 100% foreign-owned banks with the strongest retail presence in VN
|
||||
"HSBC Vietnam",
|
||||
"Standard Chartered",
|
||||
@@ -60,6 +67,27 @@ export const VIETNAMESE_BANKS = [
|
||||
"UOB Vietnam",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Former names of banks that were renamed, mapped to the current one. A
|
||||
* profile saved with an old name keeps it (it shows as a custom entry);
|
||||
* the editor offers the new name.
|
||||
*/
|
||||
export const VIETNAMESE_BANK_RENAMES: Readonly<Record<string, (typeof VIETNAMESE_BANKS)[number]>> =
|
||||
{
|
||||
oceanbank: "MBV",
|
||||
"ocean bank": "MBV",
|
||||
cbbank: "VCBNeo",
|
||||
"cb bank": "VCBNeo",
|
||||
"donga bank": "Vikki Bank",
|
||||
dongabank: "Vikki Bank",
|
||||
"dong a bank": "Vikki Bank",
|
||||
};
|
||||
|
||||
/** The current name for a renamed bank, or null. */
|
||||
export function renamedVietnameseBank(value: string): string | null {
|
||||
return VIETNAMESE_BANK_RENAMES[value.trim().toLowerCase()] ?? null;
|
||||
}
|
||||
|
||||
/** Sentinel select-option value the editor uses to surface a fall-through
|
||||
* text input. Kept as a non-bank-name string so a real bank could
|
||||
* never collide with it. */
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import type { SupportedLanguage } from "./types";
|
||||
|
||||
/**
|
||||
* Sentences that name the channel ("…of Hades on {{channelName}}.") without
|
||||
* a channel name.
|
||||
*
|
||||
* Every intro, greeting and playlist line interpolates `{{channelName}}`, so
|
||||
* an empty channel produced "This video features the full gameplay of Hades
|
||||
* on ." Templates render with {@link CHANNEL_SLOT} in the channel's place,
|
||||
* then {@link withoutEmptyChannel} drops the words that only made sense with
|
||||
* a name — "on", "trên kênh", "による"… — per language.
|
||||
*/
|
||||
|
||||
/** Stands in for an empty channel name while a template renders. */
|
||||
export const CHANNEL_SLOT = "@@CHANNEL@@";
|
||||
|
||||
/** The channel name, or the slot when there is none. */
|
||||
export function channelOrSlot(channelName: string): string {
|
||||
return channelName.trim() || CHANNEL_SLOT;
|
||||
}
|
||||
|
||||
const S = CHANNEL_SLOT;
|
||||
|
||||
/** The words around the channel name that go with it, per language. */
|
||||
const DROP: Record<SupportedLanguage, readonly RegExp[]> = {
|
||||
en: [],
|
||||
vi: [new RegExp(`\\s+(?:trên kênh|trên|cùng) ${S}`, "g")],
|
||||
ja: [new RegExp(`${S}\\s*(?:による|にて|での|で|の)\\s*`, "g")],
|
||||
es: [new RegExp(`\\s+en ${S}`, "g")],
|
||||
ko: [new RegExp(`${S}\\s*(?:채널의|에서|의)\\s*`, "g")],
|
||||
zh: [
|
||||
new RegExp(`${S}\\s*频道\\s*`, "g"),
|
||||
new RegExp(`在\\s*${S}\\s*`, "g"),
|
||||
new RegExp(`${S}\\s*的\\s*`, "g"),
|
||||
],
|
||||
"pt-BR": [new RegExp(`\\s+no ${S}`, "g")],
|
||||
id: [new RegExp(`\\s+(?:di|pada) ${S}`, "g")],
|
||||
};
|
||||
|
||||
/** Some locales still carry English sentences for newer video types. */
|
||||
const ENGLISH = new RegExp(`\\s+on ${S}`, "g");
|
||||
|
||||
/** For a sentence shape none of the patterns covers: a neutral stand-in. */
|
||||
const FALLBACK: Record<SupportedLanguage, string> = {
|
||||
en: "this channel",
|
||||
vi: "kênh",
|
||||
ja: "チャンネル",
|
||||
es: "este canal",
|
||||
ko: "채널",
|
||||
zh: "我们",
|
||||
"pt-BR": "este canal",
|
||||
id: "kanal ini",
|
||||
};
|
||||
|
||||
/** `text` without the channel phrase, when it was rendered with {@link CHANNEL_SLOT}. */
|
||||
export function withoutEmptyChannel(text: string, language: SupportedLanguage): string {
|
||||
if (!text.includes(CHANNEL_SLOT)) return text;
|
||||
let out = text;
|
||||
for (const pattern of [...DROP[language], ENGLISH]) out = out.replace(pattern, "");
|
||||
out = out.split(CHANNEL_SLOT).join(FALLBACK[language]);
|
||||
return out.replace(/[ \t]{2,}/g, " ").replace(/[ \t]+([.,!?。!?])/g, "$1");
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { GeneratorInput, TranslationFn, CharLimitWarning } from "./types";
|
||||
import { channelOrSlot, withoutEmptyChannel } from "./channel-phrase";
|
||||
import { YT_LIMITS } from "./types";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
import { PLAYTEST_PLATFORMS } from "@config/playtest-platforms";
|
||||
@@ -18,15 +19,20 @@ const SOCIAL_ICONS: Record<string, string> = {
|
||||
paypal: "💸",
|
||||
streamlabs: "🎬",
|
||||
github: "🐙",
|
||||
twitter: "🐦",
|
||||
youtube: "▶️",
|
||||
twitter: "𝕏",
|
||||
discord: "💬",
|
||||
twitch: "📺",
|
||||
kick: "🟢",
|
||||
tiktok: "🎵",
|
||||
instagram: "📸",
|
||||
threads: "🧵",
|
||||
bluesky: "🦋",
|
||||
mastodon: "🐘",
|
||||
facebook: "👤",
|
||||
fb_page: "📄",
|
||||
reddit: "👽",
|
||||
bilibili: "📼",
|
||||
telegram: "✈️",
|
||||
website: "🌐",
|
||||
};
|
||||
@@ -302,7 +308,7 @@ export function buildDescription(
|
||||
: "";
|
||||
const intro = t(introKey, {
|
||||
gameName,
|
||||
channelName: input.channelName,
|
||||
channelName: channelOrSlot(input.channelName),
|
||||
partNumber: input.partNumber ?? "",
|
||||
bossName: input.bossName ?? "",
|
||||
dlcName: input.dlcName ?? "",
|
||||
@@ -316,7 +322,7 @@ export function buildDescription(
|
||||
gachaVersion: input.gachaVersion ?? "",
|
||||
versionLabel,
|
||||
});
|
||||
sections.push(intro);
|
||||
sections.push(withoutEmptyChannel(intro, input.language));
|
||||
|
||||
// 1.25 Livestream metadata — only emitted for livestream-type videos
|
||||
// when at least one of `liveUrl` / `scheduledTime` is set. Sits right
|
||||
|
||||
+19
-2
@@ -105,6 +105,23 @@ export function isFieldOver(status: OutputLimitStatus, field: LimitedField): boo
|
||||
* 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");
|
||||
export function isCopyAllBlocked(status: OutputLimitStatus, withTags = false): boolean {
|
||||
return (
|
||||
isFieldOver(status, "title") ||
|
||||
isFieldOver(status, "description") ||
|
||||
(withTags && isFieldOver(status, "tags"))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* What Copy All copies: the title and description, and the tags when the
|
||||
* "Copy All includes tags" setting is on — each separated by a blank line.
|
||||
*/
|
||||
export function copyAllText(
|
||||
output: { title: string; description: string; tagString: string },
|
||||
withTags: boolean,
|
||||
): string {
|
||||
const parts = [output.title, output.description];
|
||||
if (withTags && output.tagString) parts.push(output.tagString);
|
||||
return parts.join("\n\n");
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { GeneratorInput, TranslationFn, Genre } from "./types";
|
||||
import { channelOrSlot, withoutEmptyChannel } from "./channel-phrase";
|
||||
|
||||
export interface BuildPinnedCommentOptions {
|
||||
/**
|
||||
@@ -65,7 +66,7 @@ export function buildPinnedComment(
|
||||
|
||||
const vars: Record<string, string> = {
|
||||
gameName,
|
||||
channelName: input.channelName,
|
||||
channelName: channelOrSlot(input.channelName),
|
||||
};
|
||||
|
||||
// Greeting — per-video-type first, then `part` fallback, then drop.
|
||||
@@ -79,7 +80,7 @@ export function buildPinnedComment(
|
||||
}
|
||||
|
||||
const lines: string[] = [];
|
||||
if (greeting.trim()) lines.push(greeting);
|
||||
if (greeting.trim()) lines.push(withoutEmptyChannel(greeting, input.language));
|
||||
|
||||
const thanks = t("pinnedComment.thanksForWatching");
|
||||
if (thanks && thanks !== "pinnedComment.thanksForWatching") lines.push(thanks);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { TranslationFn } from "./types";
|
||||
import type { SupportedLanguage, TranslationFn } from "./types";
|
||||
import { channelOrSlot, withoutEmptyChannel } from "./channel-phrase";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
|
||||
export type PlaylistStatus = "completed" | "dropped" | "incomplete" | "in_progress";
|
||||
@@ -63,14 +64,21 @@ export function buildPlaylistTitle(input: PlaylistInput, t: TranslationFn): stri
|
||||
});
|
||||
}
|
||||
|
||||
export function buildPlaylistDescription(input: PlaylistInput, t: TranslationFn): string {
|
||||
export function buildPlaylistDescription(
|
||||
input: PlaylistInput,
|
||||
t: TranslationFn,
|
||||
language: SupportedLanguage = "en",
|
||||
): string {
|
||||
const lines: string[] = [];
|
||||
|
||||
lines.push(
|
||||
t(`playlist.description.${input.contentType}`, {
|
||||
gameName: input.gameName,
|
||||
channelName: input.channelName,
|
||||
}),
|
||||
withoutEmptyChannel(
|
||||
t(`playlist.description.${input.contentType}`, {
|
||||
gameName: input.gameName,
|
||||
channelName: channelOrSlot(input.channelName),
|
||||
}),
|
||||
language,
|
||||
),
|
||||
);
|
||||
|
||||
lines.push("");
|
||||
|
||||
@@ -34,6 +34,10 @@ export interface SocialPostOptions {
|
||||
tEn?: TranslationFn;
|
||||
/** Year for the copyright line; the current year when omitted. */
|
||||
year?: number;
|
||||
/** Most hashtags to keep (derived ones first). */
|
||||
maxHashtags?: number;
|
||||
/** How the platform counts characters; plain length when omitted. */
|
||||
countMode?: "x";
|
||||
}
|
||||
|
||||
export interface SocialPostOutput {
|
||||
@@ -45,6 +49,51 @@ export interface SocialPostOutput {
|
||||
droppedBlocks: string[];
|
||||
}
|
||||
|
||||
/** Code points X counts once; everything else counts twice (twitter-text v3). */
|
||||
function xCountsOnce(codePoint: number): boolean {
|
||||
return (
|
||||
codePoint <= 0x10ff ||
|
||||
(codePoint >= 0x2000 && codePoint <= 0x200d) ||
|
||||
(codePoint >= 0x2010 && codePoint <= 0x201f) ||
|
||||
(codePoint >= 0x2032 && codePoint <= 0x2037)
|
||||
);
|
||||
}
|
||||
|
||||
const PICTOGRAPHIC = /\p{Extended_Pictographic}/u;
|
||||
|
||||
/** `Intl.Segmenter` (ES2022; the project's TS lib predates it). */
|
||||
type GraphemeSegmenter = new (
|
||||
locale: undefined,
|
||||
options: { granularity: "grapheme" },
|
||||
) => { segment(input: string): Iterable<{ segment: string }> };
|
||||
const Segmenter = (globalThis.Intl as unknown as { Segmenter?: GraphemeSegmenter } | undefined)
|
||||
?.Segmenter;
|
||||
|
||||
/**
|
||||
* Length the way X counts it against 280: Latin, Cyrillic, Greek… count
|
||||
* once; CJK, Hangul, Vietnamese letters with diacritics (Latin Extended
|
||||
* Additional) count twice; an emoji — however many code points — counts
|
||||
* twice.
|
||||
*/
|
||||
export function xWeightedLength(text: string): number {
|
||||
const normalized = text.normalize("NFC");
|
||||
const graphemes = Segmenter
|
||||
? Array.from(
|
||||
new Segmenter(undefined, { granularity: "grapheme" }).segment(normalized),
|
||||
(part) => part.segment,
|
||||
)
|
||||
: Array.from(normalized);
|
||||
let total = 0;
|
||||
for (const grapheme of graphemes) {
|
||||
if (PICTOGRAPHIC.test(grapheme)) {
|
||||
total += 2;
|
||||
continue;
|
||||
}
|
||||
for (const char of grapheme) total += xCountsOnce(char.codePointAt(0) ?? 0) ? 1 : 2;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/** Optional blocks listed in display order (Title is always first,
|
||||
* hashtags always last — neither is in this list). */
|
||||
const DISPLAY_ORDER = ["rig", "warnings", "thanks", "copyright"] as const;
|
||||
@@ -72,7 +121,11 @@ function dedupeHashtags(tags: readonly string[]): string[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
function buildHashtagLine(input: GeneratorInput, popular: readonly string[]): string {
|
||||
function buildHashtagLine(
|
||||
input: GeneratorInput,
|
||||
popular: readonly string[],
|
||||
max = Number.POSITIVE_INFINITY,
|
||||
): string {
|
||||
const gameName = input.gameNameLocalized?.[input.language] ?? input.gameName;
|
||||
const primaryGenre = input.genres[0];
|
||||
const derived = [
|
||||
@@ -80,7 +133,9 @@ function buildHashtagLine(input: GeneratorInput, popular: readonly string[]): st
|
||||
"#GameplayNoCommentary",
|
||||
...(primaryGenre ? [`#${sanitizeHashtag(primaryGenre)}`] : []),
|
||||
].filter((tag) => tag.length > 1);
|
||||
return dedupeHashtags([...derived, ...popular]).join(" ");
|
||||
return dedupeHashtags([...derived, ...popular])
|
||||
.slice(0, max)
|
||||
.join(" ");
|
||||
}
|
||||
|
||||
export function buildSocialPost(
|
||||
@@ -95,7 +150,10 @@ export function buildSocialPost(
|
||||
showSponsorCredit,
|
||||
tEn,
|
||||
year = new Date().getFullYear(),
|
||||
maxHashtags,
|
||||
countMode,
|
||||
} = options;
|
||||
const count = countMode === "x" ? xWeightedLength : (text: string) => text.length;
|
||||
|
||||
// Title — short-form, so the `[2K 60FPS]` badge is suppressed.
|
||||
const title = buildTitle(input, t, { showQualityBadge: false });
|
||||
@@ -126,7 +184,7 @@ export function buildSocialPost(
|
||||
: "",
|
||||
};
|
||||
|
||||
const hashtags = buildHashtagLine(input, popularHashtags);
|
||||
const hashtags = buildHashtagLine(input, popularHashtags, maxHashtags);
|
||||
|
||||
// Track which optional blocks are still present; drop in priority order
|
||||
// until the caption fits. Title + hashtags are always kept.
|
||||
@@ -144,7 +202,7 @@ export function buildSocialPost(
|
||||
const droppedBlocks: string[] = [];
|
||||
let text = assemble();
|
||||
for (const id of DROP_ORDER) {
|
||||
if (text.length <= charLimit) break;
|
||||
if (count(text) <= charLimit) break;
|
||||
if (present.has(id)) {
|
||||
present.delete(id);
|
||||
droppedBlocks.push(id);
|
||||
@@ -152,10 +210,11 @@ export function buildSocialPost(
|
||||
}
|
||||
}
|
||||
|
||||
const charCount = count(text);
|
||||
return {
|
||||
text,
|
||||
charCount: text.length,
|
||||
isOver: text.length > charLimit,
|
||||
charCount,
|
||||
isOver: charCount > charLimit,
|
||||
droppedBlocks,
|
||||
};
|
||||
}
|
||||
@@ -185,6 +244,8 @@ export function buildAllSocialPosts(
|
||||
showSponsorCredit: shared.showSponsorCredit,
|
||||
tEn: shared.tEn,
|
||||
year: shared.year,
|
||||
maxHashtags: p.maxHashtags,
|
||||
countMode: p.countMode,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -123,6 +123,7 @@ export function renderAll(
|
||||
badgePosition: options?.titleFormat?.badgePosition,
|
||||
separator: options?.titleFormat?.separator,
|
||||
badgeCase: options?.titleFormat?.badgeCase,
|
||||
order: options?.titleFormat?.order,
|
||||
});
|
||||
const description = buildDescription(input, t, {
|
||||
hashtagCount: options?.hashtagCount,
|
||||
|
||||
+30
-10
@@ -5,6 +5,7 @@ import type {
|
||||
TitleBadgePosition,
|
||||
TitleSeparatorId,
|
||||
TitleBadgeCase,
|
||||
TitleOrder,
|
||||
} from "./types";
|
||||
import { YT_LIMITS } from "./types";
|
||||
import {
|
||||
@@ -52,6 +53,8 @@ export interface BuildTitleOptions {
|
||||
separator?: TitleSeparatorId;
|
||||
/** Case of the badge label. Default: "upper" (v0.6 behavior). */
|
||||
badgeCase?: TitleBadgeCase;
|
||||
/** Game or video type first. Default: "gameFirst". */
|
||||
order?: TitleOrder;
|
||||
}
|
||||
|
||||
const DEFAULT_TITLE_OPTIONS: Required<BuildTitleOptions> = {
|
||||
@@ -59,6 +62,7 @@ const DEFAULT_TITLE_OPTIONS: Required<BuildTitleOptions> = {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
};
|
||||
|
||||
function normalizeOptions(
|
||||
@@ -67,7 +71,13 @@ function normalizeOptions(
|
||||
if (typeof optsOrShow === "boolean") {
|
||||
return { ...DEFAULT_TITLE_OPTIONS, showQualityBadge: optsOrShow };
|
||||
}
|
||||
return { ...DEFAULT_TITLE_OPTIONS, ...(optsOrShow ?? {}) };
|
||||
const merged = { ...DEFAULT_TITLE_OPTIONS, ...(optsOrShow ?? {}) };
|
||||
// An explicit `undefined` in the caller's object must not erase a default.
|
||||
for (const key of Object.keys(DEFAULT_TITLE_OPTIONS) as (keyof BuildTitleOptions)[]) {
|
||||
if (merged[key] === undefined)
|
||||
(merged as Record<string, unknown>)[key] = DEFAULT_TITLE_OPTIONS[key];
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
interface ComposeArgs {
|
||||
@@ -77,6 +87,7 @@ interface ComposeArgs {
|
||||
badge: string;
|
||||
separator: string;
|
||||
position: TitleBadgePosition;
|
||||
order: TitleOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,29 +108,36 @@ interface ComposeArgs {
|
||||
* string — tested explicitly in title-builder.test.ts.
|
||||
*/
|
||||
function composeTitle(args: ComposeArgs): string {
|
||||
const { gameName, videoTypeLabel, suffix, badge, separator, position } = args;
|
||||
const { gameName, videoTypeLabel, suffix, badge, separator, position, order } = args;
|
||||
const badgeTag = badge ? `[${badge}]` : "";
|
||||
// "Part 3 — Hades" instead of "Hades — Part 3"; the badge positions
|
||||
// below apply to whichever segment ends up first / second.
|
||||
const [first, second] =
|
||||
order === "typeFirst" && videoTypeLabel
|
||||
? [videoTypeLabel, gameName]
|
||||
: [gameName, videoTypeLabel];
|
||||
|
||||
if (position === "prefix") {
|
||||
const head = badgeTag ? `${badgeTag} ${gameName}` : gameName;
|
||||
const head = badgeTag ? `${badgeTag} ${first}` : first;
|
||||
const parts = [head];
|
||||
if (videoTypeLabel) parts.push(videoTypeLabel);
|
||||
if (second) parts.push(second);
|
||||
parts.push(suffix);
|
||||
return parts.join(separator);
|
||||
}
|
||||
|
||||
if (position === "suffix") {
|
||||
const tail = badgeTag ? `${badgeTag} ${suffix}` : suffix;
|
||||
const parts = [gameName];
|
||||
if (videoTypeLabel) parts.push(videoTypeLabel);
|
||||
const parts = [first];
|
||||
if (second) parts.push(second);
|
||||
parts.push(tail);
|
||||
return parts.join(separator);
|
||||
}
|
||||
|
||||
// position === "middle" (default / v0.6 behavior)
|
||||
const parts = [gameName];
|
||||
if (videoTypeLabel) {
|
||||
parts.push(badgeTag ? `${videoTypeLabel} ${badgeTag}` : videoTypeLabel);
|
||||
// position === "middle" (default / v0.6 behavior): the badge follows the
|
||||
// second segment.
|
||||
const parts = [first];
|
||||
if (second) {
|
||||
parts.push(badgeTag ? `${second} ${badgeTag}` : second);
|
||||
} else if (badgeTag) {
|
||||
parts.push(badgeTag);
|
||||
}
|
||||
@@ -297,6 +315,7 @@ export function buildTitle(
|
||||
badge,
|
||||
separator,
|
||||
position: opts.badgePosition,
|
||||
order: opts.order,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -327,6 +346,7 @@ export function buildTitle(
|
||||
badge,
|
||||
separator,
|
||||
position: opts.badgePosition,
|
||||
order: opts.order,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { GeneratorInput, TranslationFn } from "./types";
|
||||
import { buildQualityBadge } from "./title-builder";
|
||||
import type { GeneratorInput, TitleBadgePosition, TitleOrder, TranslationFn } from "./types";
|
||||
import { buildTitle, type BuildTitleOptions } from "./title-builder";
|
||||
|
||||
type TitleVariantId = "default" | "typeFirst" | "qualityFirst";
|
||||
|
||||
@@ -8,65 +8,40 @@ export interface TitleVariant {
|
||||
/** i18n key under `output.variants.*`. */
|
||||
labelKey: string;
|
||||
title: string;
|
||||
/** The title format that produces this variant — what "Apply" saves. */
|
||||
format: { order: TitleOrder; badgePosition: TitleBadgePosition };
|
||||
}
|
||||
|
||||
const SHAPES: ReadonlyArray<{ id: TitleVariantId; format: TitleVariant["format"] }> = [
|
||||
{ id: "default", format: { order: "gameFirst", badgePosition: "middle" } },
|
||||
{ id: "typeFirst", format: { order: "typeFirst", badgePosition: "middle" } },
|
||||
{ id: "qualityFirst", format: { order: "gameFirst", badgePosition: "prefix" } },
|
||||
];
|
||||
|
||||
/**
|
||||
* Builds three alternative title phrasings so a creator can A/B test
|
||||
* the same video. Reuses `buildQualityBadge` for consistency with the
|
||||
* primary title builder — a title with the badge off in
|
||||
* `useGeneratedOutput` will produce variants without the badge too.
|
||||
* Three alternative title shapes so a creator can A/B test the same video.
|
||||
* Each is the real title builder with a different order / badge position —
|
||||
* the user's separator and badge case still apply — so applying one makes
|
||||
* the Output title identical to what was shown here.
|
||||
*
|
||||
* - default: Game — Type [2K 60FPS] — Gameplay No Commentary
|
||||
* - typeFirst: Type — Game [2K 60FPS] — Gameplay No Commentary
|
||||
* - qualityFirst: [2K 60FPS] Game — Type — Gameplay No Commentary
|
||||
*
|
||||
* When the badge is empty (1080p 60fps or toggle off), `qualityFirst`
|
||||
* collapses to the default shape so callers don't see a duplicate.
|
||||
* Without a badge (1080p 60fps, or the badge turned off) `qualityFirst`
|
||||
* reads exactly like the default.
|
||||
*/
|
||||
export function buildTitleVariants(
|
||||
input: GeneratorInput,
|
||||
t: TranslationFn,
|
||||
showQualityBadge = true,
|
||||
options: BuildTitleOptions | boolean = true,
|
||||
): TitleVariant[] {
|
||||
const separator = t("title.separator");
|
||||
const suffix = t("title.suffix");
|
||||
|
||||
const videoTypeLabel = t(`title.videoType.${input.videoType}`, {
|
||||
partNumber: input.partNumber ?? "",
|
||||
bossName: input.bossName ?? "",
|
||||
dlcName: input.dlcName ?? "",
|
||||
challengeName: input.challengeName ?? "",
|
||||
modName: input.modName ?? "",
|
||||
});
|
||||
|
||||
const gameName = input.gameNameLocalized?.[input.language] ?? input.gameName;
|
||||
const badge = showQualityBadge ? buildQualityBadge(input.resolution, input.fps) : "";
|
||||
const typeWithBadge = videoTypeLabel && badge ? `${videoTypeLabel} [${badge}]` : videoTypeLabel;
|
||||
const gameWithBadge = badge ? `${gameName} [${badge}]` : gameName;
|
||||
|
||||
const joinNonEmpty = (parts: string[]): string =>
|
||||
parts.filter((p) => p.length > 0).join(separator);
|
||||
|
||||
// Variant 1 — default (game [badge after type])
|
||||
const defaultParts: string[] = [gameName];
|
||||
if (typeWithBadge) defaultParts.push(typeWithBadge);
|
||||
defaultParts.push(suffix);
|
||||
|
||||
// Variant 2 — type first, keeps the badge attached to the game name
|
||||
const typeFirstParts: string[] = [];
|
||||
if (videoTypeLabel) typeFirstParts.push(videoTypeLabel);
|
||||
typeFirstParts.push(gameWithBadge);
|
||||
typeFirstParts.push(suffix);
|
||||
|
||||
// Variant 3 — quality badge up front; falls back to default when
|
||||
// there is no badge so we never render two identical variants.
|
||||
const qualityFirstTitle = badge
|
||||
? joinNonEmpty([`[${badge}] ${gameName}`, videoTypeLabel, suffix])
|
||||
: joinNonEmpty(defaultParts);
|
||||
|
||||
return [
|
||||
{ id: "default", labelKey: "output.variants.default", title: joinNonEmpty(defaultParts) },
|
||||
{ id: "typeFirst", labelKey: "output.variants.typeFirst", title: joinNonEmpty(typeFirstParts) },
|
||||
{ id: "qualityFirst", labelKey: "output.variants.qualityFirst", title: qualityFirstTitle },
|
||||
];
|
||||
const base: BuildTitleOptions =
|
||||
typeof options === "boolean" ? { showQualityBadge: options } : options;
|
||||
return SHAPES.map(({ id, format }) => ({
|
||||
id,
|
||||
labelKey: `output.variants.${id}`,
|
||||
title: buildTitle(input, t, { ...base, ...format }),
|
||||
format,
|
||||
}));
|
||||
}
|
||||
@@ -940,8 +940,13 @@ export type TitleBadgeCase = "upper" | "lower";
|
||||
* User-configurable title formatting. Defaults (middle / emDash / upper)
|
||||
* reproduce v0.6 output byte-for-byte.
|
||||
*/
|
||||
/** Which comes first in a title: the game ("Hades — Part 3") or the video ("Part 3 — Hades"). */
|
||||
export type TitleOrder = "gameFirst" | "typeFirst";
|
||||
|
||||
export interface TitleFormatConfig {
|
||||
badgePosition: TitleBadgePosition;
|
||||
separator: TitleSeparatorId;
|
||||
badgeCase: TitleBadgeCase;
|
||||
/** v1.0.0. Missing on settings saved before — read as "gameFirst". */
|
||||
order?: TitleOrder;
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import { useOutputCopy } from "./use-output-copy";
|
||||
import { useSaveToHistory } from "./use-save-to-history";
|
||||
|
||||
export interface ShortcutHandlers {
|
||||
onToggleHelp: () => void;
|
||||
@@ -20,17 +19,17 @@ export interface ShortcutHandlers {
|
||||
*/
|
||||
export function useKeyboardShortcuts(handlers: ShortcutHandlers) {
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation("ui");
|
||||
const copyOutput = useOutputCopy();
|
||||
const saveToHistory = useSaveToHistory();
|
||||
|
||||
const latest = useRef({ handlers, navigate, t, copyOutput });
|
||||
const latest = useRef({ handlers, navigate, copyOutput, saveToHistory });
|
||||
useEffect(() => {
|
||||
latest.current = { handlers, navigate, t, copyOutput };
|
||||
latest.current = { handlers, navigate, copyOutput, saveToHistory };
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
const { handlers, navigate, t, copyOutput } = latest.current;
|
||||
const { handlers, navigate, copyOutput, saveToHistory } = latest.current;
|
||||
const mod = e.ctrlKey || e.metaKey;
|
||||
const key = e.key.toLowerCase();
|
||||
|
||||
@@ -46,10 +45,11 @@ export function useKeyboardShortcuts(handlers: ShortcutHandlers) {
|
||||
// Mode error means nothing is copied.
|
||||
void copyOutput("all");
|
||||
} else if (mod && !e.shiftKey && key === "s") {
|
||||
// The draft is saved on every change already; this only confirms it
|
||||
// (and keeps the browser's "Save page" dialog out of the way).
|
||||
// The draft saves itself on every change; Ctrl/⌘+S keeps a copy of
|
||||
// the generated output in History (and the browser's "Save page"
|
||||
// dialog out of the way).
|
||||
e.preventDefault();
|
||||
toast.success(t("editor.draftSaved"));
|
||||
saveToHistory();
|
||||
} else if (mod && !e.shiftKey && key === "b") {
|
||||
// VS Code convention: Ctrl/Cmd+B toggles the sidebar.
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import { getOutputLimitStatus, isCopyAllBlocked, isFieldOver } from "@engine/limits";
|
||||
import { copyAllText, getOutputLimitStatus, isCopyAllBlocked, isFieldOver } from "@engine/limits";
|
||||
import { YT_LIMITS } from "@engine/types";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import { useGeneratedOutput } from "./use-generated-output";
|
||||
import { useClipboard } from "./use-clipboard";
|
||||
import { useStrictBlock } from "./use-strict-block";
|
||||
@@ -22,6 +23,7 @@ export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean>
|
||||
const output = useGeneratedOutput();
|
||||
const hasGame = useEditorStore((s) => s.gameName.trim() !== "");
|
||||
const strictBlocked = useStrictBlock();
|
||||
const withTags = useSettingsStore((s) => s.copyAllIncludesTags);
|
||||
const { copy } = useClipboard();
|
||||
|
||||
return useCallback(
|
||||
@@ -35,7 +37,8 @@ export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean>
|
||||
return false;
|
||||
}
|
||||
const status = getOutputLimitStatus(output);
|
||||
const blocked = target === "all" ? isCopyAllBlocked(status) : isFieldOver(status, target);
|
||||
const blocked =
|
||||
target === "all" ? isCopyAllBlocked(status, withTags) : isFieldOver(status, target);
|
||||
if (blocked) {
|
||||
toast.error(t("output.limits.bannerTitle"));
|
||||
return false;
|
||||
@@ -53,9 +56,9 @@ export function useOutputCopy(): (target: OutputCopyTarget) => Promise<boolean>
|
||||
// joined string, and the check above already used its count.
|
||||
return copy(output.tagString);
|
||||
case "all":
|
||||
return copy(`${output.title}\n\n${output.description}`);
|
||||
return copy(copyAllText(output, withTags));
|
||||
}
|
||||
},
|
||||
[output, hasGame, strictBlocked, copy, t],
|
||||
[output, hasGame, strictBlocked, withTags, copy, t],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { useHistoryStore } from "@store/history-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import { useGeneratedOutput } from "./use-generated-output";
|
||||
|
||||
/**
|
||||
* Save the current output to History now (Ctrl/⌘+S). The Output page also
|
||||
* records what it shows; this works from anywhere, e.g. straight from the
|
||||
* editor. History keeps one entry per video, so saving again updates it.
|
||||
*/
|
||||
export function useSaveToHistory(): () => boolean {
|
||||
const { t } = useTranslation("ui");
|
||||
const output = useGeneratedOutput();
|
||||
const gameName = useEditorStore((s) => s.gameName);
|
||||
const videoType = useEditorStore((s) => s.videoType);
|
||||
const language = useEditorStore((s) => s.language);
|
||||
const genres = useEditorStore((s) => s.genres);
|
||||
const historyLimit = useSettingsStore((s) => s.historyLimit);
|
||||
const addEntry = useHistoryStore((s) => s.addEntry);
|
||||
|
||||
return useCallback(() => {
|
||||
if (!gameName.trim() || !output.title) {
|
||||
toast.error(t("output.copy.empty"));
|
||||
return false;
|
||||
}
|
||||
addEntry(
|
||||
{
|
||||
gameName,
|
||||
videoType,
|
||||
language,
|
||||
genres,
|
||||
title: output.title,
|
||||
description: output.description,
|
||||
tags: output.tagString,
|
||||
},
|
||||
historyLimit,
|
||||
);
|
||||
toast.success(t("history.savedSnapshot"));
|
||||
return true;
|
||||
}, [output, gameName, videoType, language, genres, historyLimit, addEntry, t]);
|
||||
}
|
||||
@@ -186,9 +186,9 @@
|
||||
|
||||
"quickPreview",
|
||||
"version",
|
||||
"clearDraft",
|
||||
|
||||
"draftSaved",
|
||||
"clearDraftConfirm",
|
||||
|
||||
"genreSearchPlaceholder",
|
||||
"genreSearchNoResults",
|
||||
"collapseAll",
|
||||
@@ -208,7 +208,7 @@
|
||||
"gpuNone",
|
||||
"gpuCustomLabel",
|
||||
"gpuCustomChosen",
|
||||
"timestampsNormalize"
|
||||
"timestampsNormalize", "mastodonHelp", "vnBankRenamed", "vnBankUseNewName"
|
||||
],
|
||||
"editor.genreGroups": ["rpg", "shooter", "horror"],
|
||||
"editor.graphicsPresetOptions": [
|
||||
@@ -695,7 +695,7 @@
|
||||
"previewingVideo",
|
||||
"emptyTitle",
|
||||
"emptyHint",
|
||||
"forbiddenChars"
|
||||
"forbiddenChars", "variantsHint", "variantApply", "variantCurrent", "variantApplied"
|
||||
],
|
||||
"output.variants": ["default", "typeFirst", "qualityFirst"],
|
||||
"output.copy": ["overLimit", "fieldGeneric", "failed", "empty"],
|
||||
@@ -831,7 +831,7 @@
|
||||
"mastodon",
|
||||
"facebook",
|
||||
"fb_page",
|
||||
"telegram"
|
||||
"telegram", "youtube", "threads", "kick", "reddit", "bilibili"
|
||||
],
|
||||
"resolutions": ["720p", "1080p", "1440p", "4K"],
|
||||
"fpsOptions": ["30", "60", "120", "144"],
|
||||
@@ -862,8 +862,8 @@
|
||||
"loadPreset",
|
||||
"deleteConfirm",
|
||||
"emptyState",
|
||||
"selectPreset",
|
||||
"noPresets",
|
||||
|
||||
|
||||
"exportPresets",
|
||||
"importPresets",
|
||||
"hint", "saveHint", "updateFromEditor", "saved", "updated", "unnamed"
|
||||
@@ -890,7 +890,7 @@
|
||||
"clearAll",
|
||||
"clearConfirm",
|
||||
"searchPlaceholder",
|
||||
"noResults", "exportCsv", "exportJson"
|
||||
"noResults", "exportCsv", "exportJson", "savedSnapshot"
|
||||
],
|
||||
"settings": [
|
||||
"title",
|
||||
@@ -949,7 +949,7 @@
|
||||
"genrePlaylistsBadge",
|
||||
"numberRange",
|
||||
"themeDark",
|
||||
"themeLight"
|
||||
"themeLight", "titleOrder", "titleOrderGameFirst", "titleOrderTypeFirst", "copyAllIncludesTags", "copyAllIncludesTagsHint"
|
||||
],
|
||||
"batch": [
|
||||
"title",
|
||||
@@ -960,7 +960,7 @@
|
||||
"emptyState",
|
||||
"intro",
|
||||
"partLabel",
|
||||
"summary"
|
||||
"summary", "videoType"
|
||||
],
|
||||
"socialPost": [
|
||||
"title",
|
||||
@@ -977,17 +977,17 @@
|
||||
"importedHeading",
|
||||
"bulkSummary"
|
||||
],
|
||||
"socialPost.platforms": ["tiktok", "instagram_reels", "facebook_reels"],
|
||||
"socialPost.platforms": ["tiktok", "instagram_reels", "facebook_reels", "youtube_shorts", "x", "threads", "bluesky"],
|
||||
"shortcuts": [
|
||||
"title",
|
||||
"generate",
|
||||
"copyAll",
|
||||
"saveDraft",
|
||||
|
||||
"toggleSidebar",
|
||||
"help",
|
||||
"close",
|
||||
"searchPlaceholder",
|
||||
"noResults"
|
||||
"noResults", "saveToHistory"
|
||||
],
|
||||
"validation": [
|
||||
"emailInvalid",
|
||||
@@ -1116,7 +1116,10 @@
|
||||
"restore": ["title", "meta", "metaUnknown", "mode", "merge", "mergeHint", "replace", "replaceHint", "conflicts", "newer", "newerHint", "both", "bothHint", "counts", "sameAsHere", "settingsNote", "draftNote", "dropped", "showItems", "hideItems", "tooNewTitle", "tooNew", "empty", "replaceRemoves", "apply", "nothing", "done", "doneDetail", "undone"],
|
||||
"restore.status": ["new", "same", "changed"],
|
||||
"import.errors": ["empty", "notJson", "unknown", "newer", "tooLarge", "wrongType", "unreadable"],
|
||||
"import": ["logsFile", "socialFile"]
|
||||
"import": ["logsFile", "socialFile"],
|
||||
"editor.quick": ["profile", "preset", "chooseProfile", "choosePreset", "emptyLibrary", "profileChanged", "presetChanged", "updateProfile", "updatePreset", "nextPart", "nextPartPlain", "newVideo", "nextPartDone", "newVideoDone", "startOver", "startOverConfirm", "startOverDone", "applyProfileTitle", "applyPresetTitle", "overwrite", "replace"],
|
||||
"editor.paste": ["link", "linkAndName"],
|
||||
"editor.socialGroups": ["donate", "social"]
|
||||
},
|
||||
"templates": {
|
||||
"title": ["separator", "suffix"],
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "Quick Preview",
|
||||
"version": "Version",
|
||||
"clearDraft": "Clear Draft",
|
||||
"draftSaved": "Draft saved",
|
||||
"clearDraftConfirm": "Are you sure you want to clear all form data?",
|
||||
"genreSearchPlaceholder": "Search genres",
|
||||
"genreSearchNoResults": "No matching genres",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "Channel profile",
|
||||
"preset": "Game preset",
|
||||
"chooseProfile": "Choose a profile…",
|
||||
"choosePreset": "Choose a game…",
|
||||
"emptyLibrary": "Save your channel as a profile and each game as a preset to fill them here in one click:",
|
||||
"profileChanged": "Channel fields differ from profile “{{name}}”.",
|
||||
"presetChanged": "Game fields differ from preset “{{name}}”.",
|
||||
"updateProfile": "Update profile",
|
||||
"updatePreset": "Update preset",
|
||||
"nextPart": "Next part ({{n}})",
|
||||
"nextPartPlain": "Next part",
|
||||
"newVideo": "New video, same game",
|
||||
"nextPartDone": "Ready for part {{n}} — the last video's details are cleared",
|
||||
"newVideoDone": "Ready for a new video — the last video's details are cleared",
|
||||
"startOver": "Start over",
|
||||
"startOverConfirm": "Clears the game and video fields. Your channel — name, contact, social links, rig, donate and community links — stays.",
|
||||
"startOverDone": "Started over — your channel details are kept",
|
||||
"applyProfileTitle": "Apply profile “{{name}}”?",
|
||||
"applyPresetTitle": "Apply preset “{{name}}”?",
|
||||
"overwrite": "{{n}} field(s) you've filled in will be replaced. You can undo it right after.",
|
||||
"replace": "Replace"
|
||||
},
|
||||
"paste": {
|
||||
"link": "{{store}} link added",
|
||||
"linkAndName": "{{store}} link added — game name set to “{{name}}”"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "Donate",
|
||||
"social": "Social"
|
||||
},
|
||||
"mastodonHelp": "Full URL including the server, e.g. https://mastodon.social/@user",
|
||||
"vnBankRenamed": "This bank is now called {{name}}.",
|
||||
"vnBankUseNewName": "Use {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "Title",
|
||||
@@ -809,7 +841,11 @@
|
||||
"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."
|
||||
"forbiddenChars": "{{field}}: YouTube doesn't accept the characters < and > — remove them before uploading.",
|
||||
"variantsHint": "Title shapes with your separator and badge settings. Use one and every title is built that way.",
|
||||
"variantApply": "Use this shape",
|
||||
"variantCurrent": "In use",
|
||||
"variantApplied": "Titles now use “{{name}}”"
|
||||
},
|
||||
"common": {
|
||||
"save": "Save",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "Website",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook Page",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1016,8 +1057,6 @@
|
||||
"loadPreset": "Load",
|
||||
"deleteConfirm": "Are you sure you want to delete this preset?",
|
||||
"emptyState": "No game presets yet. Create one to save game info for reuse.",
|
||||
"selectPreset": "Load Game Preset",
|
||||
"noPresets": "No presets",
|
||||
"exportPresets": "Export Presets",
|
||||
"importPresets": "Import Presets",
|
||||
"hint": "A game's name, genres, platform and store links — reused across all its parts.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "Search by game name...",
|
||||
"noResults": "No entries match your search.",
|
||||
"exportCsv": "CSV (spreadsheet)",
|
||||
"exportJson": "JSON (for restoring)"
|
||||
"exportJson": "JSON (for restoring)",
|
||||
"savedSnapshot": "Saved to History"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "Between {{min}} and {{max}}.",
|
||||
"themeDark": "Dark",
|
||||
"themeLight": "Light"
|
||||
"themeLight": "Light",
|
||||
"titleOrder": "Title order",
|
||||
"titleOrderGameFirst": "Game first (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "Video first (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "Copy All includes the tags",
|
||||
"copyAllIncludesTagsHint": "Title, description, then the tags — for pasting everything into a notes app in one go."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "Cross-Post Captions",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} captions"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "Configure batch range and generate.",
|
||||
"intro": "Generate a run of parts for the game in the Editor, in one or more languages.",
|
||||
"partLabel": "Part {{n}}",
|
||||
"summary": "{{parts}} parts × {{languages}} languages"
|
||||
"summary": "{{parts}} parts × {{languages}} languages",
|
||||
"videoType": "Video type"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "Keyboard Shortcuts",
|
||||
"generate": "Generate (switch to Output)",
|
||||
"copyAll": "Copy All",
|
||||
"saveDraft": "Save Draft",
|
||||
"toggleSidebar": "Toggle Sidebar",
|
||||
"help": "Show Shortcuts",
|
||||
"close": "Close Modal",
|
||||
"searchPlaceholder": "Search shortcuts",
|
||||
"noResults": "No matching shortcuts"
|
||||
"noResults": "No matching shortcuts",
|
||||
"saveToHistory": "Save to History"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "Enter a number.",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "Vista Previa Rápida",
|
||||
"version": "Versión",
|
||||
"clearDraft": "Limpiar Borrador",
|
||||
"draftSaved": "Borrador guardado",
|
||||
"clearDraftConfirm": "¿Estás seguro de que quieres borrar todos los datos del formulario?",
|
||||
"genreSearchPlaceholder": "Buscar géneros",
|
||||
"genreSearchNoResults": "No se encontraron géneros",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "Perfil del canal",
|
||||
"preset": "Preajuste de juego",
|
||||
"chooseProfile": "Elige un perfil…",
|
||||
"choosePreset": "Elige un juego…",
|
||||
"emptyLibrary": "Guarda tu canal como perfil y cada juego como preajuste para rellenarlos aquí con un clic:",
|
||||
"profileChanged": "Los campos del canal difieren del perfil «{{name}}».",
|
||||
"presetChanged": "Los campos del juego difieren del preajuste «{{name}}».",
|
||||
"updateProfile": "Actualizar perfil",
|
||||
"updatePreset": "Actualizar preajuste",
|
||||
"nextPart": "Siguiente parte ({{n}})",
|
||||
"nextPartPlain": "Siguiente parte",
|
||||
"newVideo": "Nuevo vídeo, mismo juego",
|
||||
"nextPartDone": "Listo para la parte {{n}}: se borraron los detalles del vídeo anterior",
|
||||
"newVideoDone": "Listo para un nuevo vídeo: se borraron los detalles del anterior",
|
||||
"startOver": "Empezar de nuevo",
|
||||
"startOverConfirm": "Borra los campos del juego y del vídeo. Tu canal —nombre, contacto, redes, equipo, donaciones y comunidad— se mantiene.",
|
||||
"startOverDone": "Empezaste de nuevo: los datos del canal se mantienen",
|
||||
"applyProfileTitle": "¿Aplicar el perfil «{{name}}»?",
|
||||
"applyPresetTitle": "¿Aplicar el preajuste «{{name}}»?",
|
||||
"overwrite": "Se reemplazarán {{n}} campo(s) que ya rellenaste. Podrás deshacerlo justo después.",
|
||||
"replace": "Reemplazar"
|
||||
},
|
||||
"paste": {
|
||||
"link": "Enlace de {{store}} añadido",
|
||||
"linkAndName": "Enlace de {{store}} añadido: nombre del juego «{{name}}»"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "Donaciones",
|
||||
"social": "Redes sociales"
|
||||
},
|
||||
"mastodonHelp": "URL completa con el servidor, p. ej. https://mastodon.social/@user",
|
||||
"vnBankRenamed": "Este banco ahora se llama {{name}}.",
|
||||
"vnBankUseNewName": "Usar {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "Título",
|
||||
@@ -809,7 +841,11 @@
|
||||
"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."
|
||||
"forbiddenChars": "{{field}}: YouTube no acepta los caracteres < y >; quítalos antes de subir el vídeo.",
|
||||
"variantsHint": "Formas de título con tu separador y tu insignia. Usa una y todos los títulos se crearán así.",
|
||||
"variantApply": "Usar esta forma",
|
||||
"variantCurrent": "En uso",
|
||||
"variantApplied": "Los títulos ahora usan «{{name}}»"
|
||||
},
|
||||
"common": {
|
||||
"save": "Guardar",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "Sitio Web",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Página de Facebook",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1036,8 +1077,6 @@
|
||||
"loadPreset": "Cargar",
|
||||
"deleteConfirm": "¿Estás seguro de que quieres eliminar este preajuste?",
|
||||
"emptyState": "Aún no hay preajustes de juego. Crea uno para reutilizar información del juego.",
|
||||
"selectPreset": "Cargar Preajuste de Juego",
|
||||
"noPresets": "Sin preajustes",
|
||||
"exportPresets": "Exportar Preajustes",
|
||||
"importPresets": "Importar Preajustes",
|
||||
"hint": "Nombre, géneros, plataforma y enlaces de tienda de un juego, reutilizados en todas sus partes.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "Buscar en el historial...",
|
||||
"noResults": "Ninguna entrada coincide con la búsqueda.",
|
||||
"exportCsv": "CSV (hoja de cálculo)",
|
||||
"exportJson": "JSON (para restaurar)"
|
||||
"exportJson": "JSON (para restaurar)",
|
||||
"savedSnapshot": "Guardado en el historial"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Ajustes",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "Entre {{min}} y {{max}}.",
|
||||
"themeDark": "Oscuro",
|
||||
"themeLight": "Claro"
|
||||
"themeLight": "Claro",
|
||||
"titleOrder": "Orden del título",
|
||||
"titleOrderGameFirst": "Juego primero (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "Vídeo primero (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "Copiar todo incluye las etiquetas",
|
||||
"copyAllIncludesTagsHint": "Título, descripción y luego las etiquetas, para pegarlo todo de una vez en una app de notas."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "Publicaciones multiplataforma",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} textos"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "Configura el rango de partes y genera descripciones en lote.",
|
||||
"intro": "Genera una serie de partes del juego del Editor, en uno o varios idiomas.",
|
||||
"partLabel": "Parte {{n}}",
|
||||
"summary": "{{parts}} partes × {{languages}} idiomas"
|
||||
"summary": "{{parts}} partes × {{languages}} idiomas",
|
||||
"videoType": "Tipo de vídeo"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "Atajos de Teclado",
|
||||
"generate": "Generar",
|
||||
"copyAll": "Copiar Todo",
|
||||
"saveDraft": "Guardar Borrador",
|
||||
"toggleSidebar": "Mostrar/Ocultar Barra Lateral",
|
||||
"help": "Ayuda",
|
||||
"close": "Cerrar",
|
||||
"searchPlaceholder": "Buscar atajos",
|
||||
"noResults": "No se encontraron atajos"
|
||||
"noResults": "No se encontraron atajos",
|
||||
"saveToHistory": "Guardar en el historial"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "Introduce un número.",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "Pratinjau Cepat",
|
||||
"version": "Versi",
|
||||
"clearDraft": "Hapus Draf",
|
||||
"draftSaved": "Draf tersimpan",
|
||||
"clearDraftConfirm": "Yakin ingin menghapus seluruh isi formulir?",
|
||||
"genreSearchPlaceholder": "Cari genre",
|
||||
"genreSearchNoResults": "Tidak ada genre yang cocok",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "Profil kanal",
|
||||
"preset": "Preset game",
|
||||
"chooseProfile": "Pilih profil…",
|
||||
"choosePreset": "Pilih game…",
|
||||
"emptyLibrary": "Simpan kanal Anda sebagai profil dan setiap game sebagai preset untuk mengisinya di sini dengan sekali klik:",
|
||||
"profileChanged": "Kolom kanal berbeda dari profil “{{name}}”.",
|
||||
"presetChanged": "Kolom game berbeda dari preset “{{name}}”.",
|
||||
"updateProfile": "Perbarui profil",
|
||||
"updatePreset": "Perbarui preset",
|
||||
"nextPart": "Bagian berikutnya ({{n}})",
|
||||
"nextPartPlain": "Bagian berikutnya",
|
||||
"newVideo": "Video baru, game yang sama",
|
||||
"nextPartDone": "Siap untuk bagian {{n}} — detail video sebelumnya dihapus",
|
||||
"newVideoDone": "Siap untuk video baru — detail video sebelumnya dihapus",
|
||||
"startOver": "Mulai ulang",
|
||||
"startOverConfirm": "Mengosongkan kolom game dan video. Kanal Anda — nama, kontak, tautan sosial, spesifikasi PC, donasi dan komunitas — tetap ada.",
|
||||
"startOverDone": "Dimulai ulang — detail kanal tetap disimpan",
|
||||
"applyProfileTitle": "Terapkan profil “{{name}}”?",
|
||||
"applyPresetTitle": "Terapkan preset “{{name}}”?",
|
||||
"overwrite": "{{n}} kolom yang sudah Anda isi akan diganti. Anda bisa membatalkannya segera setelahnya.",
|
||||
"replace": "Ganti"
|
||||
},
|
||||
"paste": {
|
||||
"link": "Tautan {{store}} ditambahkan",
|
||||
"linkAndName": "Tautan {{store}} ditambahkan — nama game diisi “{{name}}”"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "Donasi",
|
||||
"social": "Sosial"
|
||||
},
|
||||
"mastodonHelp": "URL lengkap termasuk server, mis. https://mastodon.social/@user",
|
||||
"vnBankRenamed": "Bank ini sekarang bernama {{name}}.",
|
||||
"vnBankUseNewName": "Gunakan {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "Judul",
|
||||
@@ -809,7 +841,11 @@
|
||||
"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."
|
||||
"forbiddenChars": "{{field}}: YouTube tidak menerima karakter < dan > — hapus sebelum mengunggah.",
|
||||
"variantsHint": "Bentuk judul dengan pemisah dan lencana Anda. Pakai satu dan semua judul dibuat seperti itu.",
|
||||
"variantApply": "Pakai bentuk ini",
|
||||
"variantCurrent": "Dipakai",
|
||||
"variantApplied": "Judul sekarang memakai “{{name}}”"
|
||||
},
|
||||
"common": {
|
||||
"save": "Simpan",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "Website",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook Page",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1016,8 +1057,6 @@
|
||||
"loadPreset": "Muat",
|
||||
"deleteConfirm": "Yakin ingin menghapus preset ini?",
|
||||
"emptyState": "Belum ada preset game. Buat satu untuk menyimpan info game agar bisa dipakai lagi.",
|
||||
"selectPreset": "Muat Preset Game",
|
||||
"noPresets": "Tidak ada preset",
|
||||
"exportPresets": "Ekspor Preset",
|
||||
"importPresets": "Impor Preset",
|
||||
"hint": "Nama, genre, platform, dan tautan toko sebuah game — dipakai ulang di semua part-nya.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "Cari berdasarkan nama game...",
|
||||
"noResults": "Tidak ada entri yang cocok dengan pencarian.",
|
||||
"exportCsv": "CSV (lembar kerja)",
|
||||
"exportJson": "JSON (untuk pemulihan)"
|
||||
"exportJson": "JSON (untuk pemulihan)",
|
||||
"savedSnapshot": "Disimpan ke Riwayat"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Pengaturan",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "Antara {{min}} dan {{max}}.",
|
||||
"themeDark": "Gelap",
|
||||
"themeLight": "Terang"
|
||||
"themeLight": "Terang",
|
||||
"titleOrder": "Urutan judul",
|
||||
"titleOrderGameFirst": "Game dulu (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "Video dulu (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "Salin semua termasuk tag",
|
||||
"copyAllIncludesTagsHint": "Judul, deskripsi, lalu tag — untuk menempel semuanya sekaligus ke aplikasi catatan."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "Caption Lintas Platform",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} caption"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "Atur rentang batch lalu buat.",
|
||||
"intro": "Buat serangkaian part untuk game di Editor, dalam satu atau beberapa bahasa.",
|
||||
"partLabel": "Part {{n}}",
|
||||
"summary": "{{parts}} part × {{languages}} bahasa"
|
||||
"summary": "{{parts}} part × {{languages}} bahasa",
|
||||
"videoType": "Jenis video"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "Pintasan Keyboard",
|
||||
"generate": "Buat (pindah ke Hasil)",
|
||||
"copyAll": "Salin Semua",
|
||||
"saveDraft": "Simpan Draf",
|
||||
"toggleSidebar": "Buka/tutup bilah sisi",
|
||||
"help": "Tampilkan Pintasan",
|
||||
"close": "Tutup Modal",
|
||||
"searchPlaceholder": "Cari pintasan",
|
||||
"noResults": "Tidak ada pintasan yang cocok"
|
||||
"noResults": "Tidak ada pintasan yang cocok",
|
||||
"saveToHistory": "Simpan ke Riwayat"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "Masukkan angka.",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "クイックプレビュー",
|
||||
"version": "バージョン",
|
||||
"clearDraft": "下書きをクリア",
|
||||
"draftSaved": "下書き保存済み",
|
||||
"clearDraftConfirm": "フォームデータをすべてクリアしますか?",
|
||||
"genreSearchPlaceholder": "ジャンルを検索",
|
||||
"genreSearchNoResults": "該当するジャンルはありません",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"tooFew": "チャプターには 3 つ以上のタイムスタンプが必要です(現在 {{n}} 個)。",
|
||||
"tooShort": "{{time}}:各チャプターは 10 秒以上必要です。",
|
||||
"outOfOrder": "{{time}} が上の行より前の時間になっています。"
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "チャンネルのプロフィール",
|
||||
"preset": "ゲームプリセット",
|
||||
"chooseProfile": "プロフィールを選択…",
|
||||
"choosePreset": "ゲームを選択…",
|
||||
"emptyLibrary": "チャンネルをプロフィール、各ゲームをプリセットとして保存すると、ここでワンクリックで入力できます:",
|
||||
"profileChanged": "チャンネル項目がプロフィール「{{name}}」と異なります。",
|
||||
"presetChanged": "ゲーム項目がプリセット「{{name}}」と異なります。",
|
||||
"updateProfile": "プロフィールを更新",
|
||||
"updatePreset": "プリセットを更新",
|
||||
"nextPart": "次のパート({{n}})",
|
||||
"nextPartPlain": "次のパート",
|
||||
"newVideo": "同じゲームの新しい動画",
|
||||
"nextPartDone": "パート {{n}} の準備ができました — 前の動画の詳細は消去しました",
|
||||
"newVideoDone": "新しい動画の準備ができました — 前の動画の詳細は消去しました",
|
||||
"startOver": "最初からやり直す",
|
||||
"startOverConfirm": "ゲームと動画の項目を消去します。チャンネル情報(名前、連絡先、SNS、PC 構成、寄付・コミュニティ)は残ります。",
|
||||
"startOverDone": "やり直しました — チャンネル情報はそのままです",
|
||||
"applyProfileTitle": "プロフィール「{{name}}」を適用しますか?",
|
||||
"applyPresetTitle": "プリセット「{{name}}」を適用しますか?",
|
||||
"overwrite": "入力済みの {{n}} 項目が置き換わります。直後なら元に戻せます。",
|
||||
"replace": "置き換える"
|
||||
},
|
||||
"paste": {
|
||||
"link": "{{store}} のリンクを追加しました",
|
||||
"linkAndName": "{{store}} のリンクを追加し、ゲーム名を「{{name}}」にしました"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "寄付",
|
||||
"social": "SNS"
|
||||
},
|
||||
"mastodonHelp": "サーバーを含む完全な URL(例: https://mastodon.social/@user)",
|
||||
"vnBankRenamed": "この銀行は現在 {{name}} という名前です。",
|
||||
"vnBankUseNewName": "{{name}} にする"
|
||||
},
|
||||
"output": {
|
||||
"title": "タイトル",
|
||||
@@ -809,7 +841,11 @@
|
||||
"titleCut": "検索結果やおすすめではタイトルが約 {{chars}} 文字で切れます — 重要な語を先頭に置きましょう。",
|
||||
"foldHint": "「…もっと見る」の前に表示されるのは説明文の最初の約 {{chars}} 文字だけです。"
|
||||
},
|
||||
"forbiddenChars": "{{field}}:YouTube は < と > を受け付けません。アップロード前に削除してください。"
|
||||
"forbiddenChars": "{{field}}:YouTube は < と > を受け付けません。アップロード前に削除してください。",
|
||||
"variantsHint": "区切り文字とバッジの設定を反映したタイトルの形です。選ぶと、以降のタイトルはすべてその形になります。",
|
||||
"variantApply": "この形にする",
|
||||
"variantCurrent": "使用中",
|
||||
"variantApplied": "タイトルを「{{name}}」の形にしました"
|
||||
},
|
||||
"common": {
|
||||
"save": "保存",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "ウェブサイト",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebookページ",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1036,8 +1077,6 @@
|
||||
"loadPreset": "読み込む",
|
||||
"deleteConfirm": "このプリセットを削除しますか?",
|
||||
"emptyState": "プリセットがありません。ゲーム情報を保存するために作成してください。",
|
||||
"selectPreset": "ゲームプリセットを選択",
|
||||
"noPresets": "プリセットなし",
|
||||
"exportPresets": "プリセットをエクスポート",
|
||||
"importPresets": "プリセットをインポート",
|
||||
"hint": "ゲーム名・ジャンル・プラットフォーム・ストアリンク — すべてのパートで使い回せます。",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "ゲーム名で検索...",
|
||||
"noResults": "検索に一致する履歴はありません。",
|
||||
"exportCsv": "CSV(表計算)",
|
||||
"exportJson": "JSON(復元用)"
|
||||
"exportJson": "JSON(復元用)",
|
||||
"savedSnapshot": "履歴に保存しました"
|
||||
},
|
||||
"settings": {
|
||||
"title": "設定",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "{{min}}〜{{max}} の範囲で入力してください。",
|
||||
"themeDark": "ダーク",
|
||||
"themeLight": "ライト"
|
||||
"themeLight": "ライト",
|
||||
"titleOrder": "タイトルの順序",
|
||||
"titleOrderGameFirst": "ゲームが先(Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "動画が先(Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "「すべてコピー」にタグも含める",
|
||||
"copyAllIncludesTagsHint": "タイトル、説明、タグの順。メモアプリにまとめて貼り付けるときに。"
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "クロス投稿キャプション",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube ショート",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "キャプション {{captions}} 件"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "範囲を設定して生成してください。",
|
||||
"intro": "エディターのゲームについて、連続するパートを 1 つ以上の言語でまとめて生成します。",
|
||||
"partLabel": "パート {{n}}",
|
||||
"summary": "{{parts}} パート × {{languages}} 言語"
|
||||
"summary": "{{parts}} パート × {{languages}} 言語",
|
||||
"videoType": "動画の種類"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "キーボードショートカット",
|
||||
"generate": "生成(出力へ切替)",
|
||||
"copyAll": "すべてコピー",
|
||||
"saveDraft": "下書き保存",
|
||||
"toggleSidebar": "サイドバーの表示切替",
|
||||
"help": "ショートカット表示",
|
||||
"close": "モーダルを閉じる",
|
||||
"searchPlaceholder": "ショートカットを検索",
|
||||
"noResults": "該当するショートカットはありません"
|
||||
"noResults": "該当するショートカットはありません",
|
||||
"saveToHistory": "履歴に保存"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "数値を入力してください。",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "빠른 미리보기",
|
||||
"version": "버전",
|
||||
"clearDraft": "초안 지우기",
|
||||
"draftSaved": "초안 저장됨",
|
||||
"clearDraftConfirm": "모든 양식 데이터를 지우시겠습니까?",
|
||||
"genreSearchPlaceholder": "장르 검색",
|
||||
"genreSearchNoResults": "일치하는 장르 없음",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"tooFew": "챕터를 만들려면 타임스탬프가 3개 이상 필요합니다(현재 {{n}}개).",
|
||||
"tooShort": "{{time}}: 각 챕터는 10초 이상이어야 합니다.",
|
||||
"outOfOrder": "{{time}}이(가) 위 타임스탬프보다 앞입니다."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "채널 프로필",
|
||||
"preset": "게임 프리셋",
|
||||
"chooseProfile": "프로필 선택…",
|
||||
"choosePreset": "게임 선택…",
|
||||
"emptyLibrary": "채널을 프로필로, 게임을 프리셋으로 저장하면 여기서 한 번에 채울 수 있습니다:",
|
||||
"profileChanged": "채널 항목이 프로필 “{{name}}”과(와) 다릅니다.",
|
||||
"presetChanged": "게임 항목이 프리셋 “{{name}}”과(와) 다릅니다.",
|
||||
"updateProfile": "프로필 업데이트",
|
||||
"updatePreset": "프리셋 업데이트",
|
||||
"nextPart": "다음 파트 ({{n}})",
|
||||
"nextPartPlain": "다음 파트",
|
||||
"newVideo": "같은 게임의 새 영상",
|
||||
"nextPartDone": "{{n}}편 준비 완료 — 이전 영상의 세부 정보를 지웠습니다",
|
||||
"newVideoDone": "새 영상 준비 완료 — 이전 영상의 세부 정보를 지웠습니다",
|
||||
"startOver": "처음부터 다시",
|
||||
"startOverConfirm": "게임과 영상 항목을 지웁니다. 채널 정보(이름, 연락처, 소셜, PC 사양, 후원·커뮤니티)는 유지됩니다.",
|
||||
"startOverDone": "처음부터 다시 시작했습니다 — 채널 정보는 유지됩니다",
|
||||
"applyProfileTitle": "프로필 “{{name}}”을(를) 적용할까요?",
|
||||
"applyPresetTitle": "프리셋 “{{name}}”을(를) 적용할까요?",
|
||||
"overwrite": "입력한 항목 {{n}}개가 바뀝니다. 바로 직후에는 되돌릴 수 있습니다.",
|
||||
"replace": "바꾸기"
|
||||
},
|
||||
"paste": {
|
||||
"link": "{{store}} 링크를 추가했습니다",
|
||||
"linkAndName": "{{store}} 링크를 추가하고 게임 이름을 “{{name}}”(으)로 정했습니다"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "후원",
|
||||
"social": "소셜"
|
||||
},
|
||||
"mastodonHelp": "서버를 포함한 전체 URL, 예: https://mastodon.social/@user",
|
||||
"vnBankRenamed": "이 은행의 현재 이름은 {{name}}입니다.",
|
||||
"vnBankUseNewName": "{{name}}(으)로 변경"
|
||||
},
|
||||
"output": {
|
||||
"title": "제목",
|
||||
@@ -809,7 +841,11 @@
|
||||
"titleCut": "검색 결과와 추천 영상에서는 제목이 약 {{chars}}자에서 잘립니다 — 핵심 단어를 앞에 두세요.",
|
||||
"foldHint": "시청자는 “…더보기” 전에 설명의 처음 약 {{chars}}자만 봅니다."
|
||||
},
|
||||
"forbiddenChars": "{{field}}: YouTube는 < 와 > 문자를 허용하지 않습니다. 업로드 전에 지우세요."
|
||||
"forbiddenChars": "{{field}}: YouTube는 < 와 > 문자를 허용하지 않습니다. 업로드 전에 지우세요.",
|
||||
"variantsHint": "구분자와 배지 설정을 반영한 제목 형식입니다. 하나를 고르면 모든 제목이 그 형식으로 만들어집니다.",
|
||||
"variantApply": "이 형식 사용",
|
||||
"variantCurrent": "사용 중",
|
||||
"variantApplied": "이제 제목은 “{{name}}” 형식을 씁니다"
|
||||
},
|
||||
"common": {
|
||||
"save": "저장",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "웹사이트",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook 페이지",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1036,8 +1077,6 @@
|
||||
"loadPreset": "불러오기",
|
||||
"deleteConfirm": "이 프리셋을 삭제하시겠습니까?",
|
||||
"emptyState": "게임 프리셋이 없습니다. 게임 정보를 재사용하려면 프리셋을 만드세요.",
|
||||
"selectPreset": "게임 프리셋 불러오기",
|
||||
"noPresets": "프리셋 없음",
|
||||
"exportPresets": "프리셋 내보내기",
|
||||
"importPresets": "프리셋 가져오기",
|
||||
"hint": "게임 이름, 장르, 플랫폼, 스토어 링크 — 모든 파트에서 재사용됩니다.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "기록 검색...",
|
||||
"noResults": "검색과 일치하는 기록이 없습니다.",
|
||||
"exportCsv": "CSV (스프레드시트)",
|
||||
"exportJson": "JSON (복원용)"
|
||||
"exportJson": "JSON (복원용)",
|
||||
"savedSnapshot": "기록에 저장했습니다"
|
||||
},
|
||||
"settings": {
|
||||
"title": "설정",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "{{min}}~{{max}} 사이의 값.",
|
||||
"themeDark": "다크",
|
||||
"themeLight": "라이트"
|
||||
"themeLight": "라이트",
|
||||
"titleOrder": "제목 순서",
|
||||
"titleOrderGameFirst": "게임 먼저 (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "영상 먼저 (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "모두 복사에 태그 포함",
|
||||
"copyAllIncludesTagsHint": "제목, 설명, 태그 순서로 — 메모 앱에 한 번에 붙여넣을 때 좋습니다."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "크로스포스트 캡션",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "캡션 {{captions}}개"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "파트 범위를 설정하고 일괄 설명을 생성하세요.",
|
||||
"intro": "에디터의 게임에 대해 연속된 파트를 하나 이상의 언어로 한 번에 생성합니다.",
|
||||
"partLabel": "파트 {{n}}",
|
||||
"summary": "파트 {{parts}}개 × 언어 {{languages}}개"
|
||||
"summary": "파트 {{parts}}개 × 언어 {{languages}}개",
|
||||
"videoType": "영상 유형"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "키보드 단축키",
|
||||
"generate": "생성",
|
||||
"copyAll": "전체 복사",
|
||||
"saveDraft": "초안 저장",
|
||||
"toggleSidebar": "사이드바 토글",
|
||||
"help": "도움말",
|
||||
"close": "닫기",
|
||||
"searchPlaceholder": "단축키 검색",
|
||||
"noResults": "일치하는 단축키 없음"
|
||||
"noResults": "일치하는 단축키 없음",
|
||||
"saveToHistory": "기록에 저장"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "숫자를 입력하세요.",
|
||||
|
||||
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "Prévia rápida",
|
||||
"version": "Versão",
|
||||
"clearDraft": "Limpar rascunho",
|
||||
"draftSaved": "Rascunho salvo",
|
||||
"clearDraftConfirm": "Tem certeza de que quer limpar todos os dados do formulário?",
|
||||
"genreSearchPlaceholder": "Buscar gêneros",
|
||||
"genreSearchNoResults": "Nenhum gênero correspondente",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "Perfil do canal",
|
||||
"preset": "Preset de jogo",
|
||||
"chooseProfile": "Escolha um perfil…",
|
||||
"choosePreset": "Escolha um jogo…",
|
||||
"emptyLibrary": "Salve seu canal como perfil e cada jogo como preset para preenchê-los aqui com um clique:",
|
||||
"profileChanged": "Os campos do canal diferem do perfil “{{name}}”.",
|
||||
"presetChanged": "Os campos do jogo diferem do preset “{{name}}”.",
|
||||
"updateProfile": "Atualizar perfil",
|
||||
"updatePreset": "Atualizar preset",
|
||||
"nextPart": "Próxima parte ({{n}})",
|
||||
"nextPartPlain": "Próxima parte",
|
||||
"newVideo": "Novo vídeo, mesmo jogo",
|
||||
"nextPartDone": "Pronto para a parte {{n}} — os detalhes do vídeo anterior foram apagados",
|
||||
"newVideoDone": "Pronto para um novo vídeo — os detalhes do anterior foram apagados",
|
||||
"startOver": "Recomeçar",
|
||||
"startOverConfirm": "Limpa os campos do jogo e do vídeo. Seu canal — nome, contato, redes, setup, doações e comunidade — continua.",
|
||||
"startOverDone": "Recomeçado — os dados do canal foram mantidos",
|
||||
"applyProfileTitle": "Aplicar o perfil “{{name}}”?",
|
||||
"applyPresetTitle": "Aplicar o preset “{{name}}”?",
|
||||
"overwrite": "{{n}} campo(s) já preenchido(s) será(ão) substituído(s). Dá para desfazer logo em seguida.",
|
||||
"replace": "Substituir"
|
||||
},
|
||||
"paste": {
|
||||
"link": "Link da {{store}} adicionado",
|
||||
"linkAndName": "Link da {{store}} adicionado — nome do jogo: “{{name}}”"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "Doações",
|
||||
"social": "Redes sociais"
|
||||
},
|
||||
"mastodonHelp": "URL completa com o servidor, ex.: https://mastodon.social/@user",
|
||||
"vnBankRenamed": "Este banco agora se chama {{name}}.",
|
||||
"vnBankUseNewName": "Usar {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "Título",
|
||||
@@ -809,7 +841,11 @@
|
||||
"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."
|
||||
"forbiddenChars": "{{field}}: o YouTube não aceita os caracteres < e > — remova-os antes de enviar.",
|
||||
"variantsHint": "Formatos de título com seu separador e selo. Use um e todos os títulos serão montados assim.",
|
||||
"variantApply": "Usar este formato",
|
||||
"variantCurrent": "Em uso",
|
||||
"variantApplied": "Os títulos agora usam “{{name}}”"
|
||||
},
|
||||
"common": {
|
||||
"save": "Salvar",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "Website",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook Page",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1016,8 +1057,6 @@
|
||||
"loadPreset": "Carregar",
|
||||
"deleteConfirm": "Tem certeza de que quer excluir este preset?",
|
||||
"emptyState": "Nenhum preset ainda. Crie um para reutilizar os dados do jogo.",
|
||||
"selectPreset": "Carregar preset de jogo",
|
||||
"noPresets": "Nenhum preset",
|
||||
"exportPresets": "Exportar presets",
|
||||
"importPresets": "Importar presets",
|
||||
"hint": "Nome, gêneros, plataforma e links de loja de um jogo — reutilizados em todas as partes.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "Buscar pelo nome do jogo...",
|
||||
"noResults": "Nenhuma entrada corresponde à busca.",
|
||||
"exportCsv": "CSV (planilha)",
|
||||
"exportJson": "JSON (para restaurar)"
|
||||
"exportJson": "JSON (para restaurar)",
|
||||
"savedSnapshot": "Salvo no histórico"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Configurações",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "Entre {{min}} e {{max}}.",
|
||||
"themeDark": "Escuro",
|
||||
"themeLight": "Claro"
|
||||
"themeLight": "Claro",
|
||||
"titleOrder": "Ordem do título",
|
||||
"titleOrderGameFirst": "Jogo primeiro (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "Vídeo primeiro (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "Copiar tudo inclui as tags",
|
||||
"copyAllIncludesTagsHint": "Título, descrição e depois as tags — para colar tudo de uma vez num app de notas."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "Legendas para outras redes",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} legendas"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "Configure o intervalo do lote e gere.",
|
||||
"intro": "Gere uma sequência de partes do jogo do Editor, em um ou mais idiomas.",
|
||||
"partLabel": "Parte {{n}}",
|
||||
"summary": "{{parts}} partes × {{languages}} idiomas"
|
||||
"summary": "{{parts}} partes × {{languages}} idiomas",
|
||||
"videoType": "Tipo de vídeo"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "Atalhos de teclado",
|
||||
"generate": "Gerar (ir para a Saída)",
|
||||
"copyAll": "Copiar tudo",
|
||||
"saveDraft": "Salvar rascunho",
|
||||
"toggleSidebar": "Alternar barra lateral",
|
||||
"help": "Mostrar atalhos",
|
||||
"close": "Fechar modal",
|
||||
"searchPlaceholder": "Buscar atalhos",
|
||||
"noResults": "Nenhum atalho encontrado"
|
||||
"noResults": "Nenhum atalho encontrado",
|
||||
"saveToHistory": "Salvar no histórico"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "Digite um número.",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "Xem trước nhanh",
|
||||
"version": "Phiên bản",
|
||||
"clearDraft": "Xóa bản nháp",
|
||||
"draftSaved": "Đã lưu nháp",
|
||||
"clearDraftConfirm": "Bạn có chắc muốn xóa toàn bộ dữ liệu form?",
|
||||
"genreSearchPlaceholder": "Tìm thể loại",
|
||||
"genreSearchNoResults": "Không có thể loại phù hợp",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"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."
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "Hồ sơ kênh",
|
||||
"preset": "Preset game",
|
||||
"chooseProfile": "Chọn hồ sơ…",
|
||||
"choosePreset": "Chọn game…",
|
||||
"emptyLibrary": "Lưu kênh thành hồ sơ và mỗi game thành preset để điền ở đây chỉ với một lần bấm:",
|
||||
"profileChanged": "Các trường kênh khác với hồ sơ “{{name}}”.",
|
||||
"presetChanged": "Các trường game khác với preset “{{name}}”.",
|
||||
"updateProfile": "Cập nhật hồ sơ",
|
||||
"updatePreset": "Cập nhật preset",
|
||||
"nextPart": "Tập tiếp theo ({{n}})",
|
||||
"nextPartPlain": "Tập tiếp theo",
|
||||
"newVideo": "Video mới, cùng game",
|
||||
"nextPartDone": "Sẵn sàng cho tập {{n}} — đã xoá chi tiết của video trước",
|
||||
"newVideoDone": "Sẵn sàng cho video mới — đã xoá chi tiết của video trước",
|
||||
"startOver": "Làm lại từ đầu",
|
||||
"startOverConfirm": "Xoá các trường game và video. Thông tin kênh — tên, liên hệ, mạng xã hội, cấu hình máy, ủng hộ và cộng đồng — vẫn giữ nguyên.",
|
||||
"startOverDone": "Đã làm lại từ đầu — thông tin kênh vẫn giữ nguyên",
|
||||
"applyProfileTitle": "Áp dụng hồ sơ “{{name}}”?",
|
||||
"applyPresetTitle": "Áp dụng preset “{{name}}”?",
|
||||
"overwrite": "{{n}} trường bạn đã điền sẽ bị thay thế. Bạn có thể hoàn tác ngay sau đó.",
|
||||
"replace": "Thay thế"
|
||||
},
|
||||
"paste": {
|
||||
"link": "Đã thêm link {{store}}",
|
||||
"linkAndName": "Đã thêm link {{store}} — tên game là “{{name}}”"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "Ủng hộ",
|
||||
"social": "Mạng xã hội"
|
||||
},
|
||||
"mastodonHelp": "URL đầy đủ kèm máy chủ, ví dụ https://mastodon.social/@user",
|
||||
"vnBankRenamed": "Ngân hàng này nay đã đổi tên thành {{name}}.",
|
||||
"vnBankUseNewName": "Dùng {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "Tiêu đề",
|
||||
@@ -809,7 +841,11 @@
|
||||
"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."
|
||||
"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.",
|
||||
"variantsHint": "Các kiểu tiêu đề theo dấu phân cách và badge bạn đã chọn. Chọn một kiểu thì mọi tiêu đề sẽ dựng theo kiểu đó.",
|
||||
"variantApply": "Dùng kiểu này",
|
||||
"variantCurrent": "Đang dùng",
|
||||
"variantApplied": "Tiêu đề giờ dùng kiểu “{{name}}”"
|
||||
},
|
||||
"common": {
|
||||
"save": "Lưu",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "Website",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook Page",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "Bilibili"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1036,8 +1077,6 @@
|
||||
"loadPreset": "Tải",
|
||||
"deleteConfirm": "Bạn có chắc muốn xóa preset này?",
|
||||
"emptyState": "Chưa có preset. Tạo một preset để lưu thông tin game.",
|
||||
"selectPreset": "Chọn Game Preset",
|
||||
"noPresets": "Chưa có preset",
|
||||
"exportPresets": "Xuất presets",
|
||||
"importPresets": "Nhập presets",
|
||||
"hint": "Tên game, thể loại, nền tảng và link cửa hàng — dùng lại cho mọi tập.",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "Tìm theo tên game...",
|
||||
"noResults": "Không có mục nào khớp với tìm kiếm.",
|
||||
"exportCsv": "CSV (bảng tính)",
|
||||
"exportJson": "JSON (để khôi phục)"
|
||||
"exportJson": "JSON (để khôi phục)",
|
||||
"savedSnapshot": "Đã lưu vào lịch sử"
|
||||
},
|
||||
"settings": {
|
||||
"title": "Cài đặt",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "Từ {{min}} đến {{max}}.",
|
||||
"themeDark": "Tối",
|
||||
"themeLight": "Sáng"
|
||||
"themeLight": "Sáng",
|
||||
"titleOrder": "Thứ tự tiêu đề",
|
||||
"titleOrderGameFirst": "Game trước (Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "Video trước (Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "Sao chép tất cả kèm cả tag",
|
||||
"copyAllIncludesTagsHint": "Tiêu đề, mô tả, rồi đến tag — để dán tất cả vào ứng dụng ghi chú một lần."
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "Bài đăng đa nền tảng",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} caption"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "Cấu hình phạm vi và tạo.",
|
||||
"intro": "Tạo nhiều tập liên tiếp cho game trong trang Chỉnh sửa, bằng một hoặc nhiều ngôn ngữ.",
|
||||
"partLabel": "Tập {{n}}",
|
||||
"summary": "{{parts}} tập × {{languages}} ngôn ngữ"
|
||||
"summary": "{{parts}} tập × {{languages}} ngôn ngữ",
|
||||
"videoType": "Loại video"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "Phím tắt",
|
||||
"generate": "Tạo (chuyển sang Output)",
|
||||
"copyAll": "Sao chép tất cả",
|
||||
"saveDraft": "Lưu nháp",
|
||||
"toggleSidebar": "Bật/tắt Sidebar",
|
||||
"help": "Hiện phím tắt",
|
||||
"close": "Đóng",
|
||||
"searchPlaceholder": "Tìm phím tắt",
|
||||
"noResults": "Không có phím tắt phù hợp"
|
||||
"noResults": "Không có phím tắt phù hợp",
|
||||
"saveToHistory": "Lưu vào lịch sử"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "Hãy nhập một số.",
|
||||
|
||||
+64
-14
@@ -713,9 +713,7 @@
|
||||
},
|
||||
"quickPreview": "快速预览",
|
||||
"version": "版本",
|
||||
"clearDraft": "清除草稿",
|
||||
"draftSaved": "草稿已保存",
|
||||
"clearDraftConfirm": "确定要清除所有表单数据吗?",
|
||||
"genreSearchPlaceholder": "搜索类型",
|
||||
"genreSearchNoResults": "未找到类型",
|
||||
"validation": {
|
||||
@@ -759,7 +757,41 @@
|
||||
"tooFew": "YouTube 至少需要 3 个时间戳才能生成章节(当前 {{n}} 个)。",
|
||||
"tooShort": "{{time}}:每个章节至少要 10 秒。",
|
||||
"outOfOrder": "{{time}} 早于上一行的时间戳。"
|
||||
}
|
||||
},
|
||||
"quick": {
|
||||
"profile": "频道配置",
|
||||
"preset": "游戏预设",
|
||||
"chooseProfile": "选择配置…",
|
||||
"choosePreset": "选择游戏…",
|
||||
"emptyLibrary": "把频道保存为配置、每个游戏保存为预设,即可在这里一键填写:",
|
||||
"profileChanged": "频道字段与配置“{{name}}”不同。",
|
||||
"presetChanged": "游戏字段与预设“{{name}}”不同。",
|
||||
"updateProfile": "更新配置",
|
||||
"updatePreset": "更新预设",
|
||||
"nextPart": "下一部分({{n}})",
|
||||
"nextPartPlain": "下一部分",
|
||||
"newVideo": "同一游戏的新视频",
|
||||
"nextPartDone": "已准备好第 {{n}} 部分 — 上一个视频的细节已清除",
|
||||
"newVideoDone": "已准备好新视频 — 上一个视频的细节已清除",
|
||||
"startOver": "重新开始",
|
||||
"startOverConfirm": "清除游戏和视频字段。频道信息(名称、联系方式、社交链接、配置、捐助和社群)会保留。",
|
||||
"startOverDone": "已重新开始 — 频道信息已保留",
|
||||
"applyProfileTitle": "应用配置“{{name}}”?",
|
||||
"applyPresetTitle": "应用预设“{{name}}”?",
|
||||
"overwrite": "你已填写的 {{n}} 个字段将被替换。完成后可以立即撤销。",
|
||||
"replace": "替换"
|
||||
},
|
||||
"paste": {
|
||||
"link": "已添加 {{store}} 链接",
|
||||
"linkAndName": "已添加 {{store}} 链接 — 游戏名称设为“{{name}}”"
|
||||
},
|
||||
"socialGroups": {
|
||||
"donate": "捐助",
|
||||
"social": "社交"
|
||||
},
|
||||
"mastodonHelp": "包含服务器的完整 URL,例如 https://mastodon.social/@user",
|
||||
"vnBankRenamed": "该银行现已更名为 {{name}}。",
|
||||
"vnBankUseNewName": "改用 {{name}}"
|
||||
},
|
||||
"output": {
|
||||
"title": "标题",
|
||||
@@ -809,7 +841,11 @@
|
||||
"titleCut": "搜索结果和推荐中的标题约在 {{chars}} 个字符处被截断 — 请把关键词放在前面。",
|
||||
"foldHint": "观众在“…更多”之前只能看到描述的前约 {{chars}} 个字符。"
|
||||
},
|
||||
"forbiddenChars": "{{field}}:YouTube 不接受 < 和 > 字符,请在上传前删除。"
|
||||
"forbiddenChars": "{{field}}:YouTube 不接受 < 和 > 字符,请在上传前删除。",
|
||||
"variantsHint": "按你的分隔符和徽章设置生成的标题样式。选用一种后,所有标题都会按此生成。",
|
||||
"variantApply": "使用此样式",
|
||||
"variantCurrent": "当前使用",
|
||||
"variantApplied": "标题现在使用“{{name}}”样式"
|
||||
},
|
||||
"common": {
|
||||
"save": "保存",
|
||||
@@ -959,7 +995,7 @@
|
||||
"buymeacoffee": "Buy Me a Coffee",
|
||||
"paypal": "PayPal",
|
||||
"github": "GitHub",
|
||||
"twitter": "Twitter / X",
|
||||
"twitter": "X (Twitter)",
|
||||
"discord": "Discord",
|
||||
"website": "网站",
|
||||
"twitch": "Twitch",
|
||||
@@ -970,7 +1006,12 @@
|
||||
"mastodon": "Mastodon",
|
||||
"facebook": "Facebook",
|
||||
"fb_page": "Facebook主页",
|
||||
"telegram": "Telegram"
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube",
|
||||
"threads": "Threads",
|
||||
"kick": "Kick",
|
||||
"reddit": "Reddit",
|
||||
"bilibili": "哔哩哔哩"
|
||||
},
|
||||
"resolutions": {
|
||||
"720p": "720p",
|
||||
@@ -1036,8 +1077,6 @@
|
||||
"loadPreset": "加载",
|
||||
"deleteConfirm": "确定要删除此预设吗?",
|
||||
"emptyState": "暂无游戏预设。创建一个以复用游戏信息。",
|
||||
"selectPreset": "加载游戏预设",
|
||||
"noPresets": "无预设",
|
||||
"exportPresets": "导出预设",
|
||||
"importPresets": "导入预设",
|
||||
"hint": "游戏名称、类型、平台和商店链接 — 在该游戏的每一集中复用。",
|
||||
@@ -1055,7 +1094,8 @@
|
||||
"searchPlaceholder": "搜索历史记录...",
|
||||
"noResults": "没有符合搜索的记录。",
|
||||
"exportCsv": "CSV(电子表格)",
|
||||
"exportJson": "JSON(用于恢复)"
|
||||
"exportJson": "JSON(用于恢复)",
|
||||
"savedSnapshot": "已保存到历史"
|
||||
},
|
||||
"settings": {
|
||||
"title": "设置",
|
||||
@@ -1114,7 +1154,12 @@
|
||||
"genrePlaylistsBadge": "{{filled}}/{{total}}",
|
||||
"numberRange": "范围 {{min}}–{{max}}。",
|
||||
"themeDark": "深色",
|
||||
"themeLight": "浅色"
|
||||
"themeLight": "浅色",
|
||||
"titleOrder": "标题顺序",
|
||||
"titleOrderGameFirst": "游戏在前(Hades — Part 3)",
|
||||
"titleOrderTypeFirst": "视频在前(Part 3 — Hades)",
|
||||
"copyAllIncludesTags": "“全部复制”包含标签",
|
||||
"copyAllIncludesTagsHint": "依次为标题、描述、标签 —— 方便一次性粘贴到笔记应用。"
|
||||
},
|
||||
"socialPost": {
|
||||
"title": "跨平台文案",
|
||||
@@ -1132,7 +1177,11 @@
|
||||
"platforms": {
|
||||
"tiktok": "TikTok",
|
||||
"instagram_reels": "Instagram Reels",
|
||||
"facebook_reels": "Facebook Reels"
|
||||
"facebook_reels": "Facebook Reels",
|
||||
"youtube_shorts": "YouTube Shorts",
|
||||
"x": "X",
|
||||
"threads": "Threads",
|
||||
"bluesky": "Bluesky"
|
||||
},
|
||||
"bulkSummary": "{{captions}} 条文案"
|
||||
},
|
||||
@@ -1145,18 +1194,19 @@
|
||||
"emptyState": "设置分集范围并批量生成描述。",
|
||||
"intro": "为编辑器中的游戏一次生成连续多集,可选一种或多种语言。",
|
||||
"partLabel": "第 {{n}} 集",
|
||||
"summary": "{{parts}} 集 × {{languages}} 种语言"
|
||||
"summary": "{{parts}} 集 × {{languages}} 种语言",
|
||||
"videoType": "视频类型"
|
||||
},
|
||||
"shortcuts": {
|
||||
"title": "键盘快捷键",
|
||||
"generate": "生成",
|
||||
"copyAll": "复制全部",
|
||||
"saveDraft": "保存草稿",
|
||||
"toggleSidebar": "切换侧边栏",
|
||||
"help": "帮助",
|
||||
"close": "关闭",
|
||||
"searchPlaceholder": "搜索快捷键",
|
||||
"noResults": "未找到快捷键"
|
||||
"noResults": "未找到快捷键",
|
||||
"saveToHistory": "保存到历史"
|
||||
},
|
||||
"validation": {
|
||||
"numberRequired": "请输入一个数字。",
|
||||
|
||||
+31
-9
@@ -10,6 +10,7 @@ import { Banner } from "@components/ui/Banner";
|
||||
import { Card } from "@components/ui/Card";
|
||||
import { ChipGroup } from "@components/ui/ChipGroup";
|
||||
import { EmptyState } from "@components/ui/EmptyState";
|
||||
import { SegmentedControl } from "@components/ui/SegmentedControl";
|
||||
import { PageContainer, PageHeader } from "@components/ui/PageHeader";
|
||||
import { CopyButton } from "@components/output/CopyButton";
|
||||
import { CharCounter } from "@components/output/CharCounter";
|
||||
@@ -27,6 +28,7 @@ import { validateBatchRange } from "@utils/validation";
|
||||
import { useStrictBlock } from "@hooks/use-strict-block";
|
||||
import { StrictModeBanner } from "@components/ui/StrictModeBanner";
|
||||
import {
|
||||
copyAllText,
|
||||
getOutputLimitStatus,
|
||||
isCopyAllBlocked,
|
||||
isFieldOver,
|
||||
@@ -51,6 +53,10 @@ interface BatchResult {
|
||||
languages: BatchLanguageRow[];
|
||||
}
|
||||
|
||||
/** The numbered video types a batch can produce. */
|
||||
const BATCH_TYPES = ["part", "demo_part"] as const;
|
||||
type BatchVideoType = (typeof BATCH_TYPES)[number];
|
||||
|
||||
export function BatchPage() {
|
||||
const { t } = useTranslation("ui");
|
||||
useDocumentTitle(t("tabs.batch"));
|
||||
@@ -71,8 +77,15 @@ export function BatchPage() {
|
||||
// Strict Mode: refuse to spin out 100 parts from a form that already has a
|
||||
// known-bad field. No-op unless the user opted in.
|
||||
const strictBlocked = useStrictBlock();
|
||||
const [startPart, setStartPart] = useState("1");
|
||||
const [endPart, setEndPart] = useState("5");
|
||||
// A series continues from where the editor is: its part number and, for a
|
||||
// demo, demo parts.
|
||||
const [batchType, setBatchType] = useState<BatchVideoType>(() =>
|
||||
state.videoType === "demo_part" || state.videoType === "full_demo" ? "demo_part" : "part",
|
||||
);
|
||||
const editorPart = /^\d+$/.test(state.partNumber.trim()) ? Number(state.partNumber) : 1;
|
||||
const [startPart, setStartPart] = useState(String(Math.max(1, editorPart)));
|
||||
const [endPart, setEndPart] = useState(String(Math.max(1, editorPart) + 4));
|
||||
const copyAllWithTags = useSettingsStore((s) => s.copyAllIncludesTags);
|
||||
const [selectedLangs, setSelectedLangs] = useState<SupportedLanguage[]>([state.language]);
|
||||
const [results, setResults] = useState<BatchResult[]>([]);
|
||||
const [generating, setGenerating] = useState(false);
|
||||
@@ -95,12 +108,11 @@ export function BatchPage() {
|
||||
for (let i = start; i <= Math.min(end, start + 99); i++) {
|
||||
const languages: BatchLanguageRow[] = selectedLangs.map((lang) => {
|
||||
const tFn = i18n.getFixedT(lang, "templates");
|
||||
// Batch generates "part" entries regardless of the editor's
|
||||
// currently-selected video type — the page exists to spin out a
|
||||
// series, not to batch-duplicate whatever the user last picked.
|
||||
// Batch spins out a numbered series — parts, or parts of a demo —
|
||||
// whatever single-video type the editor is on.
|
||||
const input = {
|
||||
...baseInput,
|
||||
videoType: "part" as const,
|
||||
videoType: batchType,
|
||||
language: lang,
|
||||
partNumber: String(i),
|
||||
// Batch intentionally leaves the per-part timeline empty; the
|
||||
@@ -142,12 +154,12 @@ export function BatchPage() {
|
||||
const pinnedBlock = l.pinnedComment
|
||||
? `\n\n📌 ${t("output.pinnedCommentTemplate")}\n${l.pinnedComment}`
|
||||
: "";
|
||||
return `[${l.language.toUpperCase()}]\n${l.output.title}\n\n${l.output.description}${pinnedBlock}`;
|
||||
return `[${l.language.toUpperCase()}]\n${copyAllText(l.output, copyAllWithTags)}${pinnedBlock}`;
|
||||
})
|
||||
.join("\n\n---\n\n"),
|
||||
)
|
||||
.join("\n\n===\n\n"),
|
||||
[results, t],
|
||||
[results, t, copyAllWithTags],
|
||||
);
|
||||
|
||||
// Copy All Batch concatenates every row's title and description, so one
|
||||
@@ -175,6 +187,16 @@ export function BatchPage() {
|
||||
if (next.length > 0) setSelectedLangs(next as SupportedLanguage[]);
|
||||
}}
|
||||
/>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<span className="text-text-secondary text-xs font-medium">{t("batch.videoType")}</span>
|
||||
<SegmentedControl
|
||||
ariaLabel={t("batch.videoType")}
|
||||
layoutId="batch-type"
|
||||
value={batchType}
|
||||
onChange={setBatchType}
|
||||
options={BATCH_TYPES.map((type) => ({ value: type, label: t(`videoTypes.${type}`) }))}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-3 sm:grid-cols-[8rem_8rem_auto] sm:items-end">
|
||||
<Input
|
||||
label={t("batch.startPart")}
|
||||
@@ -228,7 +250,7 @@ export function BatchPage() {
|
||||
<CopyButton
|
||||
text={allCombined}
|
||||
label={t("batch.copyAllBatch")}
|
||||
blocked={isCopyAllBlocked(batchStatus)}
|
||||
blocked={isCopyAllBlocked(batchStatus, copyAllWithTags)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -38,7 +38,7 @@ import { MusicAttributionEditor } from "@components/editor/MusicAttributionEdito
|
||||
import { SponsorCreditEditor } from "@components/editor/SponsorCreditEditor";
|
||||
import { LivePreview } from "@components/editor/LivePreview";
|
||||
import { DraftIndicator } from "@components/editor/DraftIndicator";
|
||||
import { PresetSelector } from "@components/presets/PresetSelector";
|
||||
import { QuickStart } from "@components/editor/QuickStart";
|
||||
import { ValidatedInput } from "@components/ui/ValidatedInput";
|
||||
import { Button } from "@components/ui/Button";
|
||||
import { ConfirmDialog } from "@components/ui/ConfirmDialog";
|
||||
@@ -51,6 +51,8 @@ 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 { startOver } from "@utils/library-apply";
|
||||
import { applyStoreLink, isTypingTarget, matchStoreLink } from "@utils/store-paste";
|
||||
import { normalizePlaylistUrl, validatePlaylistUrl } from "@utils/validation";
|
||||
|
||||
interface Section {
|
||||
@@ -95,7 +97,6 @@ const SECTIONS: readonly Section[] = [
|
||||
<>
|
||||
<LanguageSelector />
|
||||
<VideoTypeSelector />
|
||||
<PresetSelector />
|
||||
<GameInfoForm />
|
||||
<ExtraFieldsInput />
|
||||
<GenreSelector />
|
||||
@@ -175,7 +176,6 @@ function useSectionSummaries(): Partial<Record<string, string>> {
|
||||
export function EditorPage() {
|
||||
const { t } = useTranslation("ui");
|
||||
useDocumentTitle(t("tabs.editor"));
|
||||
const reset = useEditorStore((s) => s.reset);
|
||||
const accordion = useSettingsStore((s) => s.editorAccordionState);
|
||||
const toggleAccordion = useSettingsStore((s) => s.toggleEditorAccordion);
|
||||
const setAccordions = useSettingsStore((s) => s.setEditorAccordions);
|
||||
@@ -186,6 +186,20 @@ export function EditorPage() {
|
||||
const isOpen = (id: string): boolean => accordion[id] ?? false;
|
||||
const allOpen = SECTION_IDS.every(isOpen);
|
||||
|
||||
// A store link pasted while no field has focus still lands where it
|
||||
// belongs (fields handle their own pastes).
|
||||
useEffect(() => {
|
||||
const onPaste = (e: ClipboardEvent) => {
|
||||
if (isTypingTarget(document.activeElement)) return;
|
||||
const match = matchStoreLink(e.clipboardData?.getData("text") ?? "");
|
||||
if (!match) return;
|
||||
e.preventDefault();
|
||||
applyStoreLink(match);
|
||||
};
|
||||
document.addEventListener("paste", onPaste);
|
||||
return () => document.removeEventListener("paste", onPaste);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageContainer width="wide" className="pb-24 lg:pb-8">
|
||||
<PageHeader
|
||||
@@ -199,7 +213,7 @@ export function EditorPage() {
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => setShowClearDraft(true)}>
|
||||
<RotateCcw />
|
||||
{t("editor.clearDraft")}
|
||||
{t("editor.quick.startOver")}
|
||||
</Button>
|
||||
<Button asChild size="sm">
|
||||
<Link to="/output">
|
||||
@@ -217,6 +231,7 @@ export function EditorPage() {
|
||||
the user comes to FIX the fields Strict Mode is blocking on, so
|
||||
disabling anything here would be exactly backwards. */}
|
||||
<StrictModeBanner />
|
||||
<QuickStart />
|
||||
{SECTIONS.map((section) => (
|
||||
<Accordion
|
||||
key={section.id}
|
||||
@@ -259,12 +274,13 @@ export function EditorPage() {
|
||||
<ConfirmDialog
|
||||
open={showClearDraft}
|
||||
onConfirm={() => {
|
||||
reset();
|
||||
startOver();
|
||||
setShowClearDraft(false);
|
||||
}}
|
||||
onCancel={() => setShowClearDraft(false)}
|
||||
title={t("editor.clearDraft")}
|
||||
message={t("editor.clearDraftConfirm")}
|
||||
title={t("editor.quick.startOver")}
|
||||
message={t("editor.quick.startOverConfirm")}
|
||||
confirmLabel={t("editor.quick.startOver")}
|
||||
variant="danger"
|
||||
/>
|
||||
</PageContainer>
|
||||
|
||||
+10
-10
@@ -23,7 +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 { copyAllText, fieldsWithForbiddenChars, isCopyAllBlocked } from "@engine/limits";
|
||||
import { useStrictBlock } from "@hooks/use-strict-block";
|
||||
import { useClipboard } from "@hooks/use-clipboard";
|
||||
import { StrictModeBanner } from "@components/ui/StrictModeBanner";
|
||||
@@ -79,9 +79,11 @@ export function OutputPage() {
|
||||
const allStatus = useOutputLimits(everyOutput);
|
||||
|
||||
// Strict Mode blocks every copy; the limits block only the field that is
|
||||
// over (Copy All = title + description, so not the tags).
|
||||
// over (Copy All = title + description, plus the tags when the setting
|
||||
// includes them).
|
||||
const strictBlocked = useStrictBlock();
|
||||
const copyAllBlocked = strictBlocked || isCopyAllBlocked(allStatus);
|
||||
const copyAllWithTags = useSettingsStore((s) => s.copyAllIncludesTags);
|
||||
const copyAllBlocked = strictBlocked || isCopyAllBlocked(allStatus, copyAllWithTags);
|
||||
|
||||
// At least one language stays selected; the active tab follows a removal.
|
||||
const changeLangs = (next: SupportedLanguage[]) => {
|
||||
@@ -135,17 +137,15 @@ export function OutputPage() {
|
||||
.map((lang) => {
|
||||
const o = multilangOutputs[lang];
|
||||
if (!o) return "";
|
||||
return `[${lang.toUpperCase()}]\n${o.title}\n\n${o.description}`;
|
||||
return `[${lang.toUpperCase()}]\n${copyAllText(o, copyAllWithTags)}`;
|
||||
})
|
||||
.join("\n\n===\n\n");
|
||||
}, [isMultiLang, selectedLangs, multilangOutputs]);
|
||||
}, [isMultiLang, selectedLangs, multilangOutputs, copyAllWithTags]);
|
||||
|
||||
const copyAllText = isMultiLang
|
||||
const copyAllContent = isMultiLang
|
||||
? allLangsCombined
|
||||
: `${defaultOutput.title}
|
||||
|
||||
${defaultOutput.description}`;
|
||||
const copyAll = () => void copy(copyAllText);
|
||||
: copyAllText(defaultOutput, copyAllWithTags);
|
||||
const copyAll = () => void copy(copyAllContent);
|
||||
const copyAllDisabled = copyAllBlocked || !gameName;
|
||||
|
||||
const shownOutput = currentOutput ?? defaultOutput;
|
||||
|
||||
@@ -172,7 +172,7 @@ export function PlaylistPage() {
|
||||
const tFn = i18n.getFixedT(language, "templates");
|
||||
return {
|
||||
title: buildPlaylistTitle(playlistInput, tFn),
|
||||
description: buildPlaylistDescription(playlistInput, tFn),
|
||||
description: buildPlaylistDescription(playlistInput, tFn, language),
|
||||
comment: buildPlaylistComment(playlistInput, tFn),
|
||||
};
|
||||
}, [ready, playlistInput, language]);
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
type TitleBadgePosition,
|
||||
type TitleSeparatorId,
|
||||
type TitleBadgeCase,
|
||||
type TitleOrder,
|
||||
} from "@engine/types";
|
||||
|
||||
export function SettingsPage() {
|
||||
@@ -78,6 +79,11 @@ export function SettingsPage() {
|
||||
{ value: "pipe", label: t("settings.titleSeparatorPipe") },
|
||||
];
|
||||
|
||||
const titleOrderOptions = [
|
||||
{ value: "gameFirst", label: t("settings.titleOrderGameFirst") },
|
||||
{ value: "typeFirst", label: t("settings.titleOrderTypeFirst") },
|
||||
];
|
||||
|
||||
const badgeCaseOptions = [
|
||||
{ value: "upper", label: t("settings.badgeCaseUpper") },
|
||||
{ value: "lower", label: t("settings.badgeCaseLower") },
|
||||
@@ -166,6 +172,12 @@ export function SettingsPage() {
|
||||
checked={settings.compactTagDisplay}
|
||||
onChange={(v) => settings.setSetting("compactTagDisplay", v)}
|
||||
/>
|
||||
<Toggle
|
||||
label={t("settings.copyAllIncludesTags")}
|
||||
description={t("settings.copyAllIncludesTagsHint")}
|
||||
checked={settings.copyAllIncludesTags}
|
||||
onChange={(v) => settings.setSetting("copyAllIncludesTags", v)}
|
||||
/>
|
||||
</Accordion>
|
||||
|
||||
{/* Strict Mode is off by default: the app's whole premise is getting a
|
||||
@@ -187,6 +199,12 @@ export function SettingsPage() {
|
||||
onChange={(v) => settings.setSetting("showQualityBadge", v)}
|
||||
/>
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<Select
|
||||
label={t("settings.titleOrder")}
|
||||
options={titleOrderOptions}
|
||||
value={settings.titleFormat.order ?? "gameFirst"}
|
||||
onChange={(v) => settings.setTitleFormat({ order: v as TitleOrder })}
|
||||
/>
|
||||
<Select
|
||||
label={t("settings.badgePosition")}
|
||||
options={badgePositionOptions}
|
||||
|
||||
@@ -292,7 +292,11 @@ export function SocialPage() {
|
||||
icon={ActiveIcon}
|
||||
actions={
|
||||
<>
|
||||
<CharCounter text={activePost.text} limit={activeConfig.charLimit} />
|
||||
<CharCounter
|
||||
text={activePost.text}
|
||||
limit={activeConfig.charLimit}
|
||||
count={activePost.charCount}
|
||||
/>
|
||||
<CopyButton
|
||||
text={activePost.text}
|
||||
label={t("socialPost.copyCaption")}
|
||||
@@ -445,7 +449,11 @@ export function SocialPage() {
|
||||
{t(p.labelKey)}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<CharCounter text={post.text} limit={p.charLimit} />
|
||||
<CharCounter
|
||||
text={post.text}
|
||||
limit={p.charLimit}
|
||||
count={post.charCount}
|
||||
/>
|
||||
<CopyButton
|
||||
text={post.text}
|
||||
label={t("socialPost.copyCaption")}
|
||||
|
||||
@@ -142,6 +142,14 @@ export interface SettingsData {
|
||||
* map predates it.
|
||||
*/
|
||||
settingsAccordionState: Record<string, boolean>;
|
||||
/** v1.0.0: Copy All also copies the tags (title, description, then tags). */
|
||||
copyAllIncludesTags: boolean;
|
||||
/**
|
||||
* v1.0.0: the profile / preset last applied in the editor, so its picker
|
||||
* shows it and can offer to update it. This device only — never exported.
|
||||
*/
|
||||
lastProfileId: string | null;
|
||||
lastPresetId: string | null;
|
||||
}
|
||||
|
||||
function detectBrowserLanguage(): SupportedLanguage {
|
||||
@@ -193,6 +201,7 @@ export const initialSettings: SettingsData = {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
},
|
||||
editorAccordionState: {
|
||||
gameInfo: true,
|
||||
@@ -223,6 +232,9 @@ export const initialSettings: SettingsData = {
|
||||
history: true,
|
||||
logs: true,
|
||||
},
|
||||
copyAllIncludesTags: false,
|
||||
lastProfileId: null,
|
||||
lastPresetId: null,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -257,6 +269,9 @@ export function healSettings(raw: unknown): SettingsData {
|
||||
? (incoming.titleFormat as Partial<TitleFormatConfig>)
|
||||
: {};
|
||||
incoming.titleFormat = { ...initialSettings.titleFormat, ...incomingTf };
|
||||
// v1.0.0: `order` joined the title format; anything else reads as game-first.
|
||||
const tf = incoming.titleFormat as TitleFormatConfig;
|
||||
if (tf.order !== "typeFirst") tf.order = "gameFirst";
|
||||
|
||||
// v6 → v7: `genrePlaylists` map and `pinnedCommentIncludeGenrePlaylist`
|
||||
// toggle added (v0.8 phase 2). Defensive merge for the nested map so
|
||||
@@ -315,5 +330,13 @@ export function healSettings(raw: unknown): SettingsData {
|
||||
...incomingSa,
|
||||
};
|
||||
|
||||
// v1.0.0 additions: coerced like `strictMode`.
|
||||
if (typeof incoming.copyAllIncludesTags !== "boolean") {
|
||||
incoming.copyAllIncludesTags = initialSettings.copyAllIncludesTags;
|
||||
}
|
||||
for (const key of ["lastProfileId", "lastPresetId"] as const) {
|
||||
if (typeof incoming[key] !== "string" || incoming[key] === "") incoming[key] = null;
|
||||
}
|
||||
|
||||
return { ...initialSettings, ...incoming } as SettingsData;
|
||||
}
|
||||
@@ -157,5 +157,8 @@ export function extractData(state: SettingsData): SettingsData {
|
||||
legalConsentAt: state.legalConsentAt,
|
||||
strictMode: state.strictMode,
|
||||
settingsAccordionState: { ...state.settingsAccordionState },
|
||||
copyAllIncludesTags: state.copyAllIncludesTags,
|
||||
lastProfileId: state.lastProfileId,
|
||||
lastPresetId: state.lastPresetId,
|
||||
};
|
||||
}
|
||||
@@ -321,6 +321,8 @@ export const LOCAL_SETTINGS_KEYS = [
|
||||
"editorAccordionState",
|
||||
"settingsAccordionState",
|
||||
"sidebarCollapsed",
|
||||
"lastProfileId",
|
||||
"lastPresetId",
|
||||
] as const satisfies readonly (keyof SettingsData)[];
|
||||
|
||||
/** Settings as they go into a file: without the local fields. */
|
||||
|
||||
+126
-24
@@ -1,11 +1,17 @@
|
||||
import { toast } from "sonner";
|
||||
import i18n from "@i18n/index";
|
||||
import { useEditorStore, type EditorData } from "@store/editor-store";
|
||||
import {
|
||||
editorDataOf,
|
||||
initialEditorData,
|
||||
useEditorStore,
|
||||
type EditorData,
|
||||
} from "@store/editor-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import type { Profile } from "@store/profile-store";
|
||||
import type { GamePreset } from "@store/preset-store";
|
||||
import type { EditorTemplate } from "@store/template-store";
|
||||
import {
|
||||
PER_VIDEO_FIELDS,
|
||||
PRESET_FIELDS,
|
||||
PROFILE_FIELDS,
|
||||
type PresetField,
|
||||
@@ -13,29 +19,21 @@ import {
|
||||
} from "@config/library-fields";
|
||||
|
||||
/**
|
||||
* Applying a saved profile / preset / template to the editor, in one place.
|
||||
*
|
||||
* The profile, preset and template cards and the command palette used to each
|
||||
* build their own patch; they drifted (one defended against a null `rig`, one
|
||||
* did not). Every apply now also offers Undo: the editor's data is
|
||||
* snapshotted first and restored if the user changes their mind.
|
||||
* Everything that fills or clears the editor in one go — applying a saved
|
||||
* profile / preset / template, Next part, New video, Start over — in one
|
||||
* place, each with Undo: the editor's data is snapshotted first and put back
|
||||
* if the user changes their mind.
|
||||
*/
|
||||
|
||||
type EditorSnapshot = Record<string, unknown>;
|
||||
|
||||
function snapshotEditor(): EditorSnapshot {
|
||||
return Object.fromEntries(
|
||||
Object.entries(useEditorStore.getState()).filter(([, value]) => typeof value !== "function"),
|
||||
);
|
||||
}
|
||||
const t = (key: string, options?: Record<string, unknown>) => i18n.t(key, { ns: "ui", ...options });
|
||||
|
||||
function withUndo(message: string, apply: () => void): void {
|
||||
const before = snapshotEditor();
|
||||
const before = editorDataOf(useEditorStore.getState());
|
||||
apply();
|
||||
toast.success(message, {
|
||||
duration: 6000,
|
||||
action: {
|
||||
label: i18n.t("common.undo", { ns: "ui" }),
|
||||
label: t("common.undo"),
|
||||
onClick: () => useEditorStore.setState(before),
|
||||
},
|
||||
});
|
||||
@@ -83,14 +81,78 @@ export function presetFieldsFromEditor(editor: EditorData) {
|
||||
return pickFields(editor, PRESET_FIELDS) as Pick<EditorData, PresetField>;
|
||||
}
|
||||
|
||||
export function applyProfile(profile: Profile): void {
|
||||
withUndo(i18n.t("library.profileApplied", { ns: "ui", name: profile.name }), () =>
|
||||
useEditorStore.getState().loadProfile(profilePatch(profile)),
|
||||
/** Nothing typed: an empty string, list or map (a map of empty strings too). */
|
||||
function isBlank(value: unknown): boolean {
|
||||
if (value === undefined || value === null || value === "") return true;
|
||||
if (Array.isArray(value)) return value.length === 0;
|
||||
if (typeof value === "object") return Object.values(value).every(isBlank);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** JSON with sorted keys, so equal maps compare equal whatever their order. */
|
||||
function stable(value: unknown): string {
|
||||
return JSON.stringify(value, (_key, v: unknown) =>
|
||||
v && typeof v === "object" && !Array.isArray(v)
|
||||
? Object.fromEntries(
|
||||
Object.entries(v as Record<string, unknown>).sort(([a], [b]) => (a < b ? -1 : 1)),
|
||||
)
|
||||
: v,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fields a patch would overwrite that hold something else in the editor
|
||||
* right now — what "Replace N filled fields?" counts. Empty fields and
|
||||
* fields that already match don't count.
|
||||
*/
|
||||
export function overwrittenFields(editor: EditorData, patch: Partial<EditorData>): string[] {
|
||||
const now = editor as unknown as Record<string, unknown>;
|
||||
// A field still at its starting value ("1080p", "Medium"…) wasn't filled in.
|
||||
const blank = initialEditorData() as unknown as Record<string, unknown>;
|
||||
return Object.entries(patch)
|
||||
.filter(
|
||||
([key, value]) =>
|
||||
!isBlank(now[key]) &&
|
||||
stable(now[key]) !== stable(blank[key]) &&
|
||||
stable(now[key]) !== stable(value),
|
||||
)
|
||||
.map(([key]) => key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fields where the editor has drifted from a saved profile or preset —
|
||||
* only the ones the item saved, so an older item doesn't nag about fields
|
||||
* added since.
|
||||
*/
|
||||
export function changedSince(editor: EditorData, patch: Partial<EditorData>): string[] {
|
||||
const now = editor as unknown as Record<string, unknown>;
|
||||
return Object.entries(patch)
|
||||
.filter(([key, value]) => stable(now[key] ?? "") !== stable(value ?? ""))
|
||||
.map(([key]) => key);
|
||||
}
|
||||
|
||||
/** The per-video fields back to empty (the part number is left alone). */
|
||||
function perVideoReset(): Partial<EditorData> {
|
||||
const blank = initialEditorData();
|
||||
return Object.fromEntries(
|
||||
PER_VIDEO_FIELDS.map((key) => [key, blank[key]]),
|
||||
) as Partial<EditorData>;
|
||||
}
|
||||
|
||||
export function applyProfile(profile: Profile): void {
|
||||
withUndo(t("library.profileApplied", { name: profile.name }), () =>
|
||||
useEditorStore.getState().loadProfile(profilePatch(profile)),
|
||||
);
|
||||
useSettingsStore.getState().setSetting("lastProfileId", profile.id);
|
||||
}
|
||||
|
||||
export function applyPreset(preset: GamePreset): void {
|
||||
withUndo(i18n.t("library.presetApplied", { ns: "ui", name: preset.gameName }), () => {
|
||||
withUndo(t("library.presetApplied", { name: preset.gameName }), () => {
|
||||
const editor = useEditorStore.getState();
|
||||
// Another game means another video: what was specific to the last one
|
||||
// (boss, timestamps, endings…) must not ride along.
|
||||
const sameGame = editor.gameName.trim().toLowerCase() === preset.gameName.trim().toLowerCase();
|
||||
if (!sameGame) editor.loadPreset(perVideoReset());
|
||||
useEditorStore.getState().loadPreset(presetPatch(preset));
|
||||
// Only when the preset explicitly carries it, so older presets don't
|
||||
// silently reset the user's preference.
|
||||
@@ -98,16 +160,56 @@ export function applyPreset(preset: GamePreset): void {
|
||||
useSettingsStore.getState().setSetting("showGameCopyright", preset.showGameCopyright);
|
||||
}
|
||||
});
|
||||
useSettingsStore.getState().setSetting("lastPresetId", preset.id);
|
||||
}
|
||||
|
||||
/** Returns false (and says so) when the template is unusable. */
|
||||
export function applyTemplate(template: EditorTemplate): boolean {
|
||||
if (!template.snapshot || typeof template.snapshot !== "object") {
|
||||
toast.error(i18n.t("templates.applyFailed", { ns: "ui" }));
|
||||
toast.error(t("templates.applyFailed"));
|
||||
return false;
|
||||
}
|
||||
withUndo(i18n.t("templates.appliedToast", { ns: "ui", name: template.name }), () =>
|
||||
useEditorStore.getState().loadProfile(template.snapshot),
|
||||
);
|
||||
withUndo(t("templates.appliedToast", { name: template.name }), () => {
|
||||
// A template saved before v1.0.0 holds only part of the form; the
|
||||
// per-video fields it doesn't hold must not keep the last video's values.
|
||||
useEditorStore.getState().loadProfile(perVideoReset());
|
||||
useEditorStore.getState().loadProfile(template.snapshot);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/** The next number after a part number ("7" → "8"), or null when it isn't one. */
|
||||
export function nextPartNumber(partNumber: string): string | null {
|
||||
const trimmed = partNumber.trim();
|
||||
return /^\d+$/.test(trimmed) ? String(Number(trimmed) + 1) : null;
|
||||
}
|
||||
|
||||
/** Same game, next part: the part number goes up, the per-video fields empty. */
|
||||
export function startNextPart(): void {
|
||||
const next = nextPartNumber(useEditorStore.getState().partNumber) ?? "1";
|
||||
withUndo(t("editor.quick.nextPartDone", { n: next }), () =>
|
||||
useEditorStore.getState().loadProfile({ ...perVideoReset(), partNumber: next }),
|
||||
);
|
||||
}
|
||||
|
||||
/** Same game, a different video: the per-video fields empty. */
|
||||
export function startNewVideo(): void {
|
||||
withUndo(t("editor.quick.newVideoDone"), () =>
|
||||
useEditorStore.getState().loadProfile(perVideoReset()),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A blank form for a new game — but the channel (profile fields) stays, and
|
||||
* the output language is the default one from Settings.
|
||||
*/
|
||||
export function startOver(): void {
|
||||
withUndo(t("editor.quick.startOverDone"), () => {
|
||||
const editor = editorDataOf(useEditorStore.getState());
|
||||
useEditorStore.setState({
|
||||
...initialEditorData(),
|
||||
...pickFields(editor, PROFILE_FIELDS),
|
||||
language: useSettingsStore.getState().defaultOutputLanguage,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import { toast } from "sonner";
|
||||
import i18n from "@i18n/index";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
import { useEditorStore } from "@store/editor-store";
|
||||
import { extractGameNameFromUrl } from "./url-extractors";
|
||||
|
||||
/**
|
||||
* Paste a store link anywhere in the editor — the page, the Game name field,
|
||||
* or the wrong store's field — and it lands in the right store field. The
|
||||
* first store link of a game also sets the platform, and an empty Game name
|
||||
* is filled from the link ("final-fantasy-vii-remake" → "Final Fantasy VII
|
||||
* Remake"). One toast, one Undo.
|
||||
*/
|
||||
|
||||
export interface StoreLinkMatch {
|
||||
platformId: string;
|
||||
label: string;
|
||||
/** As saved: normalised by the platform (Steam drops tracking parameters). */
|
||||
url: string;
|
||||
/** As pasted — the game name is read from this. */
|
||||
pasted: string;
|
||||
}
|
||||
|
||||
/** A pasted text that is exactly one store link, or null. */
|
||||
export function matchStoreLink(text: string): StoreLinkMatch | null {
|
||||
const pasted = text.trim();
|
||||
if (!/^https:\/\/\S+$/.test(pasted)) return null;
|
||||
// The publisher entry accepts any https URL; it isn't a store to route to.
|
||||
const platform = PLATFORMS.find((p) => p.id !== "publisher" && p.urlPattern.test(pasted));
|
||||
if (!platform) return null;
|
||||
return {
|
||||
platformId: platform.id,
|
||||
label: platform.label,
|
||||
url: platform.normalize ? platform.normalize(pasted) : pasted,
|
||||
pasted,
|
||||
};
|
||||
}
|
||||
|
||||
export function applyStoreLink(match: StoreLinkMatch): void {
|
||||
const t = (key: string, options?: Record<string, unknown>) =>
|
||||
i18n.t(key, { ns: "ui", ...options });
|
||||
const editor = useEditorStore.getState();
|
||||
const before = {
|
||||
storeLinks: { ...editor.storeLinks },
|
||||
platform: editor.platform,
|
||||
gameName: editor.gameName,
|
||||
};
|
||||
|
||||
editor.setNested("storeLinks", match.platformId, match.url);
|
||||
const firstLink = !Object.entries(before.storeLinks).some(
|
||||
([id, url]) => id !== match.platformId && url.trim() !== "",
|
||||
);
|
||||
if (firstLink) editor.set("platform", match.platformId);
|
||||
const name = before.gameName.trim() ? null : extractGameNameFromUrl(match.pasted);
|
||||
if (name) editor.set("gameName", name);
|
||||
|
||||
toast.success(
|
||||
name
|
||||
? t("editor.paste.linkAndName", { store: match.label, name })
|
||||
: t("editor.paste.link", { store: match.label }),
|
||||
{
|
||||
duration: 6000,
|
||||
action: {
|
||||
label: t("common.undo"),
|
||||
onClick: () => useEditorStore.setState(before),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** True for a focused element the user types into. */
|
||||
export function isTypingTarget(element: Element | null): boolean {
|
||||
if (!(element instanceof HTMLElement)) return false;
|
||||
const tag = element.tagName;
|
||||
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || element.isContentEditable;
|
||||
}
|
||||
@@ -10,10 +10,17 @@
|
||||
* • Nintendo US — `https://www.nintendo.com/us/store/products/<slug>[-switch[-2]]/`
|
||||
* • Nintendo EU — `https://www.nintendo.com/<locale>/Games/<segment>/<slug>[-<id>].html`
|
||||
* • Humble — `https://www.humblebundle.com/store/<slug>`
|
||||
* • App Store — `https://apps.apple.com/<cc>/app/<slug>/id<digits>`
|
||||
* • Meta Quest — `https://www.meta.com/experiences/<slug>/<digits>`
|
||||
* • EA — `https://www.ea.com/games/[<franchise>/]<slug>`
|
||||
* • Battle.net — `https://shop.battle.net/<locale>/product/<slug>`
|
||||
*
|
||||
* Sequel numbers come back upper-case ("Final Fantasy VII") and well-known
|
||||
* possessives get their apostrophe back ("Baldur's Gate 3").
|
||||
*
|
||||
* Returns `null` for every other URL shape — including PlayStation /
|
||||
* Xbox / Amazon Luna URLs, which rely on opaque product IDs rather than
|
||||
* stable name slugs and would emit garbled names.
|
||||
* Xbox / Amazon Luna / Google Play URLs, which rely on opaque product IDs
|
||||
* rather than stable name slugs and would emit garbled names.
|
||||
*/
|
||||
|
||||
interface NameExtractor {
|
||||
@@ -37,14 +44,41 @@ function titleCase(s: string): string {
|
||||
if (/^\s+$/.test(chunk) || chunk === "") return chunk;
|
||||
return chunk
|
||||
.split("-")
|
||||
.map((piece) =>
|
||||
piece.length === 0 ? piece : piece.charAt(0).toUpperCase() + piece.slice(1),
|
||||
)
|
||||
.map((piece) => {
|
||||
if (piece.length === 0) return piece;
|
||||
if (ROMAN.test(piece)) return piece.toUpperCase();
|
||||
const possessive = POSSESSIVES[piece];
|
||||
if (possessive) return possessive;
|
||||
return piece.charAt(0).toUpperCase() + piece.slice(1);
|
||||
})
|
||||
.join("-");
|
||||
})
|
||||
.join("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sequel numbers II–XX, which slugs lower-case ("final-fantasy-vii").
|
||||
* Single letters are left alone: capitalising already gives I, V and X.
|
||||
*/
|
||||
const ROMAN = /^(?:ii|iii|iv|vi|vii|viii|ix|xi|xii|xiii|xiv|xv|xvi|xvii|xviii|xix|xx)$/;
|
||||
|
||||
/**
|
||||
* Slugs drop apostrophes. These are the possessives that game titles
|
||||
* actually use, restored when they appear as a whole word.
|
||||
*/
|
||||
const POSSESSIVES: Record<string, string> = {
|
||||
baldurs: "Baldur's",
|
||||
marvels: "Marvel's",
|
||||
clancys: "Clancy's",
|
||||
meiers: "Meier's",
|
||||
garrys: "Garry's",
|
||||
luigis: "Luigi's",
|
||||
yoshis: "Yoshi's",
|
||||
kirbys: "Kirby's",
|
||||
assassins: "Assassin's",
|
||||
playerunknowns: "PlayerUnknown's",
|
||||
};
|
||||
|
||||
const PLATFORM_NAME_EXTRACTORS: readonly NameExtractor[] = [
|
||||
{
|
||||
// Steam slug sits after `/app/<digits>/`. The slug uses underscores
|
||||
@@ -88,6 +122,30 @@ const PLATFORM_NAME_EXTRACTORS: readonly NameExtractor[] = [
|
||||
pattern: /^https:\/\/www\.humblebundle\.com\/store\/([^/?#\s]+)/i,
|
||||
humanize: (s) => titleCase(s.replace(/-+/g, " ")),
|
||||
},
|
||||
{
|
||||
// App Store: `apps.apple.com/<cc>/app/<slug>/id<digits>`.
|
||||
pattern: /^https:\/\/apps\.apple\.com\/(?:[a-z]{2}\/)?app\/([^/?#\s]+)\/id\d+/i,
|
||||
humanize: (s) => titleCase(s.replace(/-+/g, " ")),
|
||||
},
|
||||
{
|
||||
// Meta Quest: `meta.com/[<locale>/]experiences/<slug>/<digits>` (some
|
||||
// links carry only the number — no name to read).
|
||||
pattern:
|
||||
/^https:\/\/(?:www\.)?meta\.com\/(?:[a-z]{2}-[a-z]{2}\/)?experiences\/([a-z][^/?#\s]*)\/\d+/i,
|
||||
humanize: (s) => titleCase(s.replace(/-+/g, " ")),
|
||||
},
|
||||
{
|
||||
// EA: `ea.com/[<locale>/]games/[<franchise>/]<game>` — the last segment.
|
||||
pattern:
|
||||
/^https:\/\/(?:www\.)?ea\.com\/(?:[a-z]{2}(?:-[a-z]{2})?\/)?games\/(?:[^/?#\s]+\/)?([^/?#\s]+)\/?(?:[?#]|$)/i,
|
||||
humanize: (s) => titleCase(s.replace(/-+/g, " ")),
|
||||
},
|
||||
{
|
||||
// Battle.net shop: `[<region>.]shop.battle.net/[<locale>/]product/<slug>`.
|
||||
pattern:
|
||||
/^https:\/\/(?:[a-z]{2}\.)?shop\.battle\.net\/(?:[a-z]{2}-[a-z]{2}\/)?product\/([^/?#\s]+)/i,
|
||||
humanize: (s) => titleCase(s.replace(/[-_]+/g, " ")),
|
||||
},
|
||||
] as const;
|
||||
|
||||
export function extractGameNameFromUrl(url: string): string | null {
|
||||
|
||||
@@ -102,7 +102,9 @@ function comparableUrl(url: string): string {
|
||||
return url
|
||||
.toLowerCase()
|
||||
.replace(/^(https?:\/\/)(?:www\.|m\.|mobile\.)/, "$1")
|
||||
.replace(/^(https?:\/\/)twitter\.com\//, "$1x.com/");
|
||||
.replace(/^(https?:\/\/)twitter\.com\//, "$1x.com/")
|
||||
.replace(/^(https?:\/\/)threads\.net\//, "$1threads.com/")
|
||||
.replace(/^(https?:\/\/)youtu\.be\//, "$1youtube.com/");
|
||||
}
|
||||
|
||||
export function validateUrlWithPrefix(input: string, expectedPrefix: string): ValidationResult {
|
||||
|
||||
@@ -21,9 +21,15 @@ describe("store URL patterns (v1.0.0)", () => {
|
||||
expect(steam.urlPattern.test("https://store.steampowered.com/search/?term=elden")).toBe(false);
|
||||
});
|
||||
|
||||
it("normalises Steam links to the canonical page", () => {
|
||||
it("normalises Steam links to the canonical page, keeping the name slug", () => {
|
||||
const normalize = platform("steam").normalize;
|
||||
expect(normalize?.("https://store.steampowered.com/app/1245620/ELDEN_RING/")).toBe(
|
||||
"https://store.steampowered.com/app/1245620/ELDEN_RING/",
|
||||
);
|
||||
expect(
|
||||
normalize?.("https://store.steampowered.com/app/1245620/ELDEN_RING/?snr=1_7_7_151_150"),
|
||||
).toBe("https://store.steampowered.com/app/1245620/ELDEN_RING/");
|
||||
expect(normalize?.("https://store.steampowered.com/app/1245620")).toBe(
|
||||
"https://store.steampowered.com/app/1245620",
|
||||
);
|
||||
expect(normalize?.("https://s.team/a/1245620")).toBe(
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { CHANNEL_SLOT, channelOrSlot, withoutEmptyChannel } from "@engine/channel-phrase";
|
||||
import type { SupportedLanguage } from "@engine/types";
|
||||
|
||||
const LANGS: SupportedLanguage[] = ["en", "vi", "ja", "es", "ko", "zh", "pt-BR", "id"];
|
||||
const LOCALES = path.resolve(import.meta.dirname, "../../src/i18n/locales");
|
||||
|
||||
/** Every template that names the channel, except the copyright line (skipped without one). */
|
||||
function channelTemplates(lang: SupportedLanguage): Array<[string, string]> {
|
||||
const data = JSON.parse(fs.readFileSync(path.join(LOCALES, lang, "templates.json"), "utf8"));
|
||||
const out: Array<[string, string]> = [];
|
||||
const walk = (node: unknown, prefix: string) => {
|
||||
if (typeof node === "string") {
|
||||
if (node.includes("{{channelName}}") && !prefix.includes("copyright"))
|
||||
out.push([prefix, node]);
|
||||
return;
|
||||
}
|
||||
if (node && typeof node === "object") {
|
||||
for (const [key, value] of Object.entries(node))
|
||||
walk(value, prefix ? `${prefix}.${key}` : key);
|
||||
}
|
||||
};
|
||||
walk(data, "");
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Stand-in for i18next: every other variable gets a plain value. */
|
||||
function render(template: string, channel: string): string {
|
||||
return template
|
||||
.replace(/\{\{channelName\}\}/g, channel)
|
||||
.replace(/\{\{gameName\}\}/g, "Hades")
|
||||
.replace(/\{\{[a-zA-Z]+\}\}/g, "X");
|
||||
}
|
||||
|
||||
describe("withoutEmptyChannel", () => {
|
||||
it("uses the slot only for an empty channel", () => {
|
||||
expect(channelOrSlot(" Skullmute ")).toBe("Skullmute");
|
||||
expect(channelOrSlot(" ")).toBe(CHANNEL_SLOT);
|
||||
expect(withoutEmptyChannel("of Hades on Skullmute.", "en")).toBe("of Hades on Skullmute.");
|
||||
});
|
||||
|
||||
it.each(LANGS)("leaves no trace of a missing channel in any %s template", (lang) => {
|
||||
const templates = channelTemplates(lang);
|
||||
expect(templates.length).toBeGreaterThan(20);
|
||||
for (const [key, template] of templates) {
|
||||
const text = withoutEmptyChannel(render(template, CHANNEL_SLOT), lang);
|
||||
expect(text, key).not.toContain(CHANNEL_SLOT);
|
||||
expect(text, key).not.toMatch(/ {2}| [.,!?。!?]| on[.!]/);
|
||||
}
|
||||
});
|
||||
|
||||
it("reads naturally in each language", () => {
|
||||
const intro = (lang: SupportedLanguage) => {
|
||||
const found = channelTemplates(lang).find(([key]) => key === "description.intro.full");
|
||||
return withoutEmptyChannel(render(found?.[1] ?? "", CHANNEL_SLOT), lang);
|
||||
};
|
||||
expect(intro("en")).toBe("This video features the full gameplay of Hades.");
|
||||
expect(intro("vi")).toBe("Video này là full gameplay của Hades.");
|
||||
expect(intro("ja")).toBe("この動画はHadesのフルゲームプレイです。");
|
||||
expect(intro("es")).toBe("Este video presenta el gameplay completo de Hades.");
|
||||
expect(intro("ko")).toBe("이 영상은 Hades의 전체 게임플레이를 담고 있습니다.");
|
||||
expect(intro("zh")).toBe("本视频展示了Hades完整游戏实况。");
|
||||
expect(intro("pt-BR")).toBe("Este vídeo traz a gameplay completa de Hades.");
|
||||
expect(intro("id")).toBe("Video ini menampilkan gameplay lengkap Hades.");
|
||||
});
|
||||
});
|
||||
@@ -994,7 +994,7 @@ describe("buildDescription", () => {
|
||||
t,
|
||||
);
|
||||
expect(result).toContain("FOLLOW ME");
|
||||
expect(result).toContain("Twitter / X: https://x.com/test");
|
||||
expect(result).toContain("𝕏 X (Twitter): https://x.com/test");
|
||||
});
|
||||
|
||||
it("includes playlist link when provided", () => {
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildTitle } from "@engine/title-builder";
|
||||
import { buildTitleVariants } from "@engine/title-variants";
|
||||
import { buildSocialPost, xWeightedLength } from "@engine/social-post-builder";
|
||||
import { copyAllText, isCopyAllBlocked } from "@engine/limits";
|
||||
import { SOCIAL_PLATFORMS } from "@config/social-platforms";
|
||||
import type { GeneratorInput } from "@engine/types";
|
||||
import { createMockT } from "../helpers/mock-t";
|
||||
|
||||
function input(overrides: Partial<GeneratorInput> = {}): GeneratorInput {
|
||||
return {
|
||||
videoType: "part",
|
||||
language: "en",
|
||||
genres: ["action"],
|
||||
gameName: "Hades",
|
||||
channelName: "Skullmute",
|
||||
platform: "steam",
|
||||
partNumber: "3",
|
||||
resolution: "1440p",
|
||||
fps: "60",
|
||||
spoilerWarning: false,
|
||||
matureWarning: false,
|
||||
storeLinks: {},
|
||||
social: {},
|
||||
rig: {},
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("title order", () => {
|
||||
const t = createMockT("en");
|
||||
|
||||
it("puts the video first when asked, with every badge position", () => {
|
||||
expect(buildTitle(input(), t, { order: "typeFirst" })).toBe(
|
||||
"Part 3 — Hades [2K] — Gameplay No Commentary",
|
||||
);
|
||||
expect(buildTitle(input(), t, { order: "typeFirst", badgePosition: "prefix" })).toBe(
|
||||
"[2K] Part 3 — Hades — Gameplay No Commentary",
|
||||
);
|
||||
expect(buildTitle(input(), t, { order: "typeFirst", badgePosition: "suffix" })).toBe(
|
||||
"Part 3 — Hades — [2K] Gameplay No Commentary",
|
||||
);
|
||||
});
|
||||
|
||||
it("treats a missing option as the default instead of undefined", () => {
|
||||
expect(buildTitle(input(), t, { order: undefined, badgePosition: undefined })).toBe(
|
||||
buildTitle(input(), t),
|
||||
);
|
||||
});
|
||||
|
||||
it("builds variants with the user's separator, and says which format each is", () => {
|
||||
const variants = buildTitleVariants(input(), t, { separator: "pipe", showQualityBadge: true });
|
||||
expect(variants.map((v) => v.format)).toEqual([
|
||||
{ order: "gameFirst", badgePosition: "middle" },
|
||||
{ order: "typeFirst", badgePosition: "middle" },
|
||||
{ order: "gameFirst", badgePosition: "prefix" },
|
||||
]);
|
||||
for (const v of variants) expect(v.title).toContain(" | ");
|
||||
});
|
||||
});
|
||||
|
||||
describe("X's weighted length", () => {
|
||||
it("counts Latin once and CJK, Vietnamese diacritics and emoji twice", () => {
|
||||
expect(xWeightedLength("Hades")).toBe(5);
|
||||
expect(xWeightedLength("日本")).toBe(4);
|
||||
expect(xWeightedLength("Việt")).toBe(5); // ệ is in Latin Extended Additional
|
||||
expect(xWeightedLength("🎮")).toBe(2);
|
||||
expect(xWeightedLength("👩🚀")).toBe(2);
|
||||
expect(xWeightedLength("“quotes”")).toBe(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe("social posts for the new platforms", () => {
|
||||
const t = createMockT("en");
|
||||
const platform = (id: string) => {
|
||||
const found = SOCIAL_PLATFORMS.find((p) => p.id === id);
|
||||
if (!found) throw new Error(id);
|
||||
return found;
|
||||
};
|
||||
|
||||
it("caps hashtags per platform", () => {
|
||||
const threads = platform("threads");
|
||||
const post = buildSocialPost(input(), t, {
|
||||
charLimit: threads.charLimit,
|
||||
popularHashtags: threads.popularHashtags,
|
||||
maxHashtags: threads.maxHashtags,
|
||||
});
|
||||
const tags = post.text.split(/\s+/).filter((w) => w.startsWith("#"));
|
||||
expect(tags).toEqual(["#Hades"]);
|
||||
});
|
||||
|
||||
it("fits X with its own count", () => {
|
||||
const x = platform("x");
|
||||
const post = buildSocialPost(input({ rig: { cpu: "AMD Ryzen 7 9800X3D" } }), t, {
|
||||
charLimit: x.charLimit,
|
||||
popularHashtags: x.popularHashtags,
|
||||
maxHashtags: x.maxHashtags,
|
||||
countMode: x.countMode,
|
||||
});
|
||||
expect(post.charCount).toBe(xWeightedLength(post.text));
|
||||
expect(post.isOver).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Copy All", () => {
|
||||
const output = { title: "T", description: "D", tagString: "a, b" };
|
||||
const over = (field: "title" | "description" | "tags") => ({
|
||||
overflows: [{ field, current: 999, limit: 1 }],
|
||||
});
|
||||
|
||||
it("adds the tags only when asked", () => {
|
||||
expect(copyAllText(output, false)).toBe("T\n\nD");
|
||||
expect(copyAllText(output, true)).toBe("T\n\nD\n\na, b");
|
||||
expect(copyAllText({ ...output, tagString: "" }, true)).toBe("T\n\nD");
|
||||
});
|
||||
|
||||
it("is blocked by the tags only when it includes them", () => {
|
||||
expect(isCopyAllBlocked(over("tags") as never, false)).toBe(false);
|
||||
expect(isCopyAllBlocked(over("tags") as never, true)).toBe(true);
|
||||
expect(isCopyAllBlocked(over("title") as never, false)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -20,6 +20,7 @@ describe("healSettings", () => {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
});
|
||||
expect(healed.showPinnedCommentTemplate).toBe(false);
|
||||
expect(healed.pinnedCommentIncludeAskNextGame).toBe(true);
|
||||
@@ -83,6 +84,7 @@ describe("healSettings", () => {
|
||||
badgePosition: "prefix" as const,
|
||||
separator: "hyphen" as const,
|
||||
badgeCase: "lower" as const,
|
||||
order: "typeFirst" as const,
|
||||
},
|
||||
showPinnedCommentTemplate: true,
|
||||
pinnedCommentIncludeAskNextGame: false,
|
||||
@@ -109,6 +111,9 @@ describe("healSettings", () => {
|
||||
history: true,
|
||||
logs: true,
|
||||
},
|
||||
copyAllIncludesTags: true,
|
||||
lastProfileId: "profile-1",
|
||||
lastPresetId: null,
|
||||
};
|
||||
const healed = healSettings(complete);
|
||||
expect(healed).toEqual(complete);
|
||||
@@ -185,6 +190,7 @@ describe("healSettings", () => {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -208,6 +214,7 @@ describe("healSettings", () => {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -221,6 +228,7 @@ describe("healSettings", () => {
|
||||
badgePosition: "middle",
|
||||
separator: "emDash",
|
||||
badgeCase: "upper",
|
||||
order: "gameFirst",
|
||||
},
|
||||
});
|
||||
expect(healed.showPinnedCommentTemplate).toBe(false);
|
||||
@@ -300,3 +308,18 @@ describe("healSettings — historyLimit (v1.0.0)", () => {
|
||||
expect(healSettings({ historyLimit: Number.NaN }).historyLimit).toBe(100);
|
||||
});
|
||||
});
|
||||
|
||||
describe("healSettings — v1.0.0 fields", () => {
|
||||
it("coerces the new fields", () => {
|
||||
const healed = healSettings({
|
||||
copyAllIncludesTags: "yes",
|
||||
lastProfileId: 7,
|
||||
lastPresetId: "",
|
||||
titleFormat: { order: "sideways" },
|
||||
});
|
||||
expect(healed.copyAllIncludesTags).toBe(false);
|
||||
expect(healed.lastProfileId).toBeNull();
|
||||
expect(healed.lastPresetId).toBeNull();
|
||||
expect(healed.titleFormat.order).toBe("gameFirst");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,276 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { initialEditorData, useEditorStore } from "@store/editor-store";
|
||||
import { useSettingsStore } from "@store/settings-store";
|
||||
import type { GamePreset } from "@store/preset-store";
|
||||
import type { Profile } from "@store/profile-store";
|
||||
import {
|
||||
applyPreset,
|
||||
applyProfile,
|
||||
applyTemplate,
|
||||
changedSince,
|
||||
nextPartNumber,
|
||||
overwrittenFields,
|
||||
presetPatch,
|
||||
startNewVideo,
|
||||
startNextPart,
|
||||
startOver,
|
||||
} from "@utils/library-apply";
|
||||
import { applyStoreLink, matchStoreLink } from "@utils/store-paste";
|
||||
import { extractGameNameFromUrl } from "@utils/url-extractors";
|
||||
import { PLATFORMS } from "@config/platforms";
|
||||
import { renamedVietnameseBank, VIETNAMESE_BANKS } from "@config/vietnamese-banks";
|
||||
|
||||
const NOW = "2026-09-30T00:00:00.000Z";
|
||||
|
||||
function preset(gameName: string, extra: Partial<GamePreset> = {}): GamePreset {
|
||||
return {
|
||||
id: `p-${gameName}`,
|
||||
gameName,
|
||||
genres: ["action"],
|
||||
platform: "steam",
|
||||
storeLinks: {},
|
||||
createdAt: NOW,
|
||||
...extra,
|
||||
};
|
||||
}
|
||||
|
||||
const profile: Profile = {
|
||||
id: "main",
|
||||
name: "Main",
|
||||
channelName: "Skullmute",
|
||||
contactEmail: "me@example.com",
|
||||
adEmail: "",
|
||||
gameKeyEmail: "",
|
||||
social: { youtube: "https://www.youtube.com/@skullmute" },
|
||||
rig: { cpu: "AMD Ryzen 7 9800X3D" },
|
||||
resolution: "1440p",
|
||||
fps: "60",
|
||||
graphicsPreset: "high",
|
||||
thirdPartyAdText: "",
|
||||
vnMomo: "0900000000",
|
||||
createdAt: NOW,
|
||||
updatedAt: NOW,
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
useEditorStore.setState(initialEditorData());
|
||||
useSettingsStore.setState({
|
||||
lastProfileId: null,
|
||||
lastPresetId: null,
|
||||
defaultOutputLanguage: "vi",
|
||||
});
|
||||
});
|
||||
|
||||
describe("next part / new video / start over", () => {
|
||||
it("counts parts on", () => {
|
||||
expect(nextPartNumber("7")).toBe("8");
|
||||
expect(nextPartNumber(" 09 ")).toBe("10");
|
||||
expect(nextPartNumber("7b")).toBeNull();
|
||||
expect(nextPartNumber("")).toBeNull();
|
||||
});
|
||||
|
||||
it("moves to the next part and clears what belonged to the last one", () => {
|
||||
useEditorStore.setState({
|
||||
gameName: "Hades",
|
||||
partNumber: "7",
|
||||
bossName: "Megaera",
|
||||
timestamps: "0:00 Intro",
|
||||
endings: [{ number: 1, name: "True" }],
|
||||
channelName: "Skullmute",
|
||||
});
|
||||
startNextPart();
|
||||
const s = useEditorStore.getState();
|
||||
expect(s.partNumber).toBe("8");
|
||||
expect(s.bossName).toBe("");
|
||||
expect(s.timestamps).toBe("");
|
||||
expect(s.endings).toEqual([]);
|
||||
expect(s.gameName).toBe("Hades");
|
||||
expect(s.channelName).toBe("Skullmute");
|
||||
});
|
||||
|
||||
it("starts a new video of the same game without touching the part number", () => {
|
||||
useEditorStore.setState({ gameName: "Hades", partNumber: "3", pinnedComment: "hi" });
|
||||
startNewVideo();
|
||||
expect(useEditorStore.getState()).toMatchObject({
|
||||
gameName: "Hades",
|
||||
partNumber: "3",
|
||||
pinnedComment: "",
|
||||
});
|
||||
});
|
||||
|
||||
it("starts over but keeps the channel and uses the default output language", () => {
|
||||
useEditorStore.setState({
|
||||
gameName: "Hades",
|
||||
channelName: "Skullmute",
|
||||
rig: { cpu: "X" },
|
||||
vnMomo: "0900",
|
||||
language: "en",
|
||||
});
|
||||
startOver();
|
||||
const s = useEditorStore.getState();
|
||||
expect(s.gameName).toBe("");
|
||||
expect(s.channelName).toBe("Skullmute");
|
||||
expect(s.rig).toEqual({ cpu: "X" });
|
||||
expect(s.vnMomo).toBe("0900");
|
||||
expect(s.language).toBe("vi");
|
||||
});
|
||||
});
|
||||
|
||||
describe("applying profiles, presets and templates", () => {
|
||||
it("fills every channel field a profile holds and remembers it", () => {
|
||||
applyProfile(profile);
|
||||
const s = useEditorStore.getState();
|
||||
expect(s.channelName).toBe("Skullmute");
|
||||
expect(s.vnMomo).toBe("0900000000");
|
||||
expect(s.social.youtube).toBe("https://www.youtube.com/@skullmute");
|
||||
expect(useSettingsStore.getState().lastProfileId).toBe("main");
|
||||
});
|
||||
|
||||
it("clears per-video fields when the preset is for another game", () => {
|
||||
useEditorStore.setState({ gameName: "Hades", bossName: "Megaera", timestamps: "0:00 x" });
|
||||
applyPreset(preset("Hollow Knight", { playlistLink: "https://youtube.com/playlist?list=PL1" }));
|
||||
const s = useEditorStore.getState();
|
||||
expect(s).toMatchObject({ gameName: "Hollow Knight", bossName: "", timestamps: "" });
|
||||
expect(s.playlistLink).toBe("https://youtube.com/playlist?list=PL1");
|
||||
expect(useSettingsStore.getState().lastPresetId).toBe("p-Hollow Knight");
|
||||
});
|
||||
|
||||
it("keeps per-video fields when the preset is for the same game", () => {
|
||||
useEditorStore.setState({ gameName: "Hades", bossName: "Megaera" });
|
||||
applyPreset(preset("hades"));
|
||||
expect(useEditorStore.getState().bossName).toBe("Megaera");
|
||||
});
|
||||
|
||||
it("clears per-video fields a template doesn't hold", () => {
|
||||
useEditorStore.setState({ bossName: "Megaera", thumbnailText: "old" });
|
||||
applyTemplate({ id: "t", name: "T", createdAt: NOW, snapshot: { gameName: "Hades" } });
|
||||
expect(useEditorStore.getState()).toMatchObject({
|
||||
gameName: "Hades",
|
||||
bossName: "",
|
||||
thumbnailText: "",
|
||||
});
|
||||
});
|
||||
|
||||
it("counts only filled fields that would change", () => {
|
||||
const editor = { ...initialEditorData(), gameName: "Hades", platform: "" };
|
||||
const patch = presetPatch(preset("Hollow Knight", { platform: "gog" }));
|
||||
expect(overwrittenFields(editor, patch)).toEqual(["gameName"]);
|
||||
expect(overwrittenFields({ ...editor, gameName: "Hollow Knight" }, patch)).toEqual([]);
|
||||
});
|
||||
|
||||
it("notices when the editor drifts from what a preset saved", () => {
|
||||
const patch = presetPatch(preset("Hades"));
|
||||
const editor = { ...initialEditorData(), ...patch };
|
||||
expect(changedSince(editor, patch)).toEqual([]);
|
||||
expect(changedSince({ ...editor, platform: "epic" }, patch)).toEqual(["platform"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("store links pasted anywhere", () => {
|
||||
it("recognises store links and nothing else", () => {
|
||||
expect(
|
||||
matchStoreLink("https://store.steampowered.com/app/1145350/Hades_II/?snr=1"),
|
||||
).toMatchObject({
|
||||
platformId: "steam",
|
||||
url: "https://store.steampowered.com/app/1145350/Hades_II/",
|
||||
});
|
||||
expect(matchStoreLink(" https://www.gog.com/en/game/baldurs_gate_3 ")?.platformId).toBe(
|
||||
"gog",
|
||||
);
|
||||
expect(
|
||||
matchStoreLink("https://apps.apple.com/us/app/genshin-impact/id1517783697")?.platformId,
|
||||
).toBe("appstore");
|
||||
expect(matchStoreLink("https://example.com/my-game")).toBeNull();
|
||||
expect(matchStoreLink("see https://store.steampowered.com/app/1")).toBeNull();
|
||||
expect(matchStoreLink("Hades")).toBeNull();
|
||||
});
|
||||
|
||||
it("puts the link in its field, sets the platform and names the game", () => {
|
||||
const match = matchStoreLink("https://store.steampowered.com/app/2344520/Diablo_IV/");
|
||||
if (!match) throw new Error("no match");
|
||||
useEditorStore.setState({ platform: "" });
|
||||
applyStoreLink(match);
|
||||
const s = useEditorStore.getState();
|
||||
expect(s.storeLinks.steam).toBe("https://store.steampowered.com/app/2344520/Diablo_IV/");
|
||||
expect(s.platform).toBe("steam");
|
||||
expect(s.gameName).toBe("Diablo IV");
|
||||
});
|
||||
|
||||
it("leaves a typed game name and the platform of an earlier link alone", () => {
|
||||
useEditorStore.setState({
|
||||
gameName: "My Name",
|
||||
platform: "steam",
|
||||
storeLinks: { steam: "https://store.steampowered.com/app/1" },
|
||||
});
|
||||
const match = matchStoreLink("https://www.gog.com/game/hades");
|
||||
if (!match) throw new Error("no match");
|
||||
applyStoreLink(match);
|
||||
expect(useEditorStore.getState()).toMatchObject({ gameName: "My Name", platform: "steam" });
|
||||
expect(useEditorStore.getState().storeLinks.gog).toBe("https://www.gog.com/game/hades");
|
||||
});
|
||||
});
|
||||
|
||||
describe("game names from store links", () => {
|
||||
it("restores sequel numbers and possessives", () => {
|
||||
expect(
|
||||
extractGameNameFromUrl("https://store.steampowered.com/app/1/FINAL_FANTASY_VII_REMAKE/"),
|
||||
).toBe("Final Fantasy VII Remake");
|
||||
expect(extractGameNameFromUrl("https://www.gog.com/game/baldurs_gate_3")).toBe(
|
||||
"Baldur's Gate 3",
|
||||
);
|
||||
expect(extractGameNameFromUrl("https://store.steampowered.com/app/1/Civilization_VI/")).toBe(
|
||||
"Civilization VI",
|
||||
);
|
||||
// Single letters stay ordinary words.
|
||||
expect(extractGameNameFromUrl("https://store.steampowered.com/app/1/Mega_Man_X/")).toBe(
|
||||
"Mega Man X",
|
||||
);
|
||||
});
|
||||
|
||||
it("reads the newer stores", () => {
|
||||
expect(
|
||||
extractGameNameFromUrl("https://apps.apple.com/us/app/genshin-impact/id1517783697"),
|
||||
).toBe("Genshin Impact");
|
||||
expect(
|
||||
extractGameNameFromUrl("https://www.meta.com/experiences/beat-saber/2448060205267927/"),
|
||||
).toBe("Beat Saber");
|
||||
expect(extractGameNameFromUrl("https://www.ea.com/games/battlefield/battlefield-6")).toBe(
|
||||
"Battlefield 6",
|
||||
);
|
||||
expect(extractGameNameFromUrl("https://shop.battle.net/en-us/product/diablo_iv")).toBe(
|
||||
"Diablo IV",
|
||||
);
|
||||
expect(extractGameNameFromUrl("https://www.meta.com/experiences/2448060205267927/")).toBeNull();
|
||||
});
|
||||
|
||||
it("validates every new store's links", () => {
|
||||
const cases: Record<string, string> = {
|
||||
ea: "https://www.ea.com/games/battlefield/battlefield-6",
|
||||
ubisoft: "https://store.ubisoft.com/us/assassins-creed-shadows/6427f9.html",
|
||||
battlenet: "https://us.shop.battle.net/en-us/product/diablo_iv",
|
||||
googleplay: "https://play.google.com/store/apps/details?id=com.miHoYo.GenshinImpact&hl=en",
|
||||
appstore: "https://apps.apple.com/us/app/genshin-impact/id1517783697",
|
||||
meta: "https://www.meta.com/experiences/beat-saber/2448060205267927/",
|
||||
};
|
||||
for (const [id, url] of Object.entries(cases)) {
|
||||
expect(PLATFORMS.find((p) => p.id === id)?.urlPattern.test(url), id).toBe(true);
|
||||
}
|
||||
const play = PLATFORMS.find((p) => p.id === "googleplay");
|
||||
expect(play?.urlPattern.test("https://play.google.com/store/apps/details?hl=en&id=com.x")).toBe(
|
||||
true,
|
||||
);
|
||||
expect(play?.urlPattern.test("https://play.google.com/store/apps/developer?id=x")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Vietnamese banks", () => {
|
||||
it("offers the new names of renamed banks", () => {
|
||||
expect(renamedVietnameseBank("OceanBank")).toBe("MBV");
|
||||
expect(renamedVietnameseBank(" cbbank ")).toBe("VCBNeo");
|
||||
expect(renamedVietnameseBank("DongA Bank")).toBe("Vikki Bank");
|
||||
expect(renamedVietnameseBank("Vietcombank")).toBeNull();
|
||||
for (const name of ["MBV", "VCBNeo", "Vikki Bank", "Cake by VPBank", "Timo"]) {
|
||||
expect(VIETNAMESE_BANKS as readonly string[]).toContain(name);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -19,7 +19,7 @@ describe("extractGameNameFromUrl — Steam", () => {
|
||||
extractGameNameFromUrl(
|
||||
"https://store.steampowered.com/app/2358720/Marvels_Spider-Man_Remastered/",
|
||||
),
|
||||
).toBe("Marvels Spider-Man Remastered");
|
||||
).toBe("Marvel's Spider-Man Remastered");
|
||||
});
|
||||
|
||||
it("ignores trailing query strings", () => {
|
||||
@@ -64,7 +64,7 @@ describe("extractGameNameFromUrl — GOG", () => {
|
||||
|
||||
it("supports a locale prefix", () => {
|
||||
expect(extractGameNameFromUrl("https://www.gog.com/en/game/baldurs_gate_3")).toBe(
|
||||
"Baldurs Gate 3",
|
||||
"Baldur's Gate 3",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -172,7 +172,7 @@ describe("extractGameNameFromUrl — Humble Bundle", () => {
|
||||
|
||||
it("extracts a hyphenated multi-word slug", () => {
|
||||
expect(extractGameNameFromUrl("https://www.humblebundle.com/store/baldurs-gate-3")).toBe(
|
||||
"Baldurs Gate 3",
|
||||
"Baldur's Gate 3",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ describe("validateUrlWithPattern — Steam", () => {
|
||||
describe("Steam normalize", () => {
|
||||
const steam = platform("steam");
|
||||
|
||||
it("strips trailing slug from canonical URL", () => {
|
||||
expect(steam.normalize?.("https://store.steampowered.com/app/1245620/ELDEN_RING/")).toBe(
|
||||
"https://store.steampowered.com/app/1245620",
|
||||
);
|
||||
it("keeps the name slug but drops what follows it", () => {
|
||||
expect(
|
||||
steam.normalize?.("https://store.steampowered.com/app/1245620/ELDEN_RING/reviews/"),
|
||||
).toBe("https://store.steampowered.com/app/1245620/ELDEN_RING/");
|
||||
});
|
||||
|
||||
it("is a no-op on an already-normalized URL", () => {
|
||||
|
||||
Reference in new issue
Block a user