Compare commits

...
10 Commits
Author SHA1 Message Date
poli0981 841df7d246 Merge pull request #146 from poli0981/fix/android-release-upload
fix(ci): upload the Android APK with gh instead of action-gh-release
2026-08-17 12:07:25 +07:00
poli0981andClaude Opus 5 b244063555 fix(ci): upload the Android APK with gh instead of action-gh-release
The v0.35.0 APK built successfully three times and was never attached. The
build was fine every time; the upload step failed with "Resource not accessible
by integration" on update-a-release.

`softprops/action-gh-release@v3` was resolving the target release from
GITHUB_REF rather than from the `tag_name` it was handed. On the tag push it
looked for a release tagged `refs/tags/v0.35.0`; on the workflow_dispatch re-run
it looked for one tagged `refs/heads/main`. Neither exists, so it fell through
to CREATING a release against a branch ref, which the token is quite right to
refuse. The permissions were never the problem — the job log shows
`Contents: write` on every run.

Replaced with `gh release upload`, which is pre-installed on every runner and
takes the tag as a positional argument, so it cannot make that substitution.
`--clobber` makes a re-run idempotent.

Also uploads the APK as a workflow artifact first, so a failed release upload
never costs another 20-minute NDK build to recover from — which is what it cost
to diagnose this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 12:06:07 +07:00
poli0981 bb0a40cfae Merge pull request #145 from poli0981/chore/v0.37.0-deps
chore: v0.37.0 — dependency modernization
2026-08-17 11:46:29 +07:00
poli0981andClaude Opus 5 0c7fb31165 chore(release): v0.37.0 — dependency modernization
Every major the project had been sitting on, brought current. No user-facing
feature changes; the app should behave identically.

  React 18 → 19 (+ types, @vitejs/plugin-react 6)
  Tailwind 3 → 4
  ESLint 9 → 10 (+ eslint-plugin-react-hooks 5 → 7)
  Zustand 4 → 5
  i18next 23 → 26, react-i18next 15 → 17
  @testing-library/*, typescript-eslint 8.67, Vite/Vitest/tsx/knip patches

**React 19** needed exactly one source change: `useRef<T>(null)` is now typed
`RefObject<T | null>` rather than `RefObject<T>`. The old type quietly claimed a
ref was non-null before its element mounted; ScrollToTopButton now matches,
which makes its existing null check honest rather than defensive.

**Tailwind 4** moves configuration from `tailwind.config.ts` (deleted) into
CSS. The tokens live in an `@theme` block that maps Tailwind's names onto the
existing `:root` / `.light` variables, so the runtime theme toggle still owns
the values and keeps working untouched. `darkMode: "class"` becomes
`@custom-variant dark` — the app toggles a class on <html> rather than
following the OS, so the default prefers-color-scheme variant would be wrong.
Verified in the browser in both themes; a CSS migration fails visually, not at
build time.

**The lint upgrade earned its keep.** `react-hooks/set-state-in-effect` (new in
v7, React Compiler-aware) flagged seven sites. Four were real extra render
passes:

  - use-online-status rewritten to `useSyncExternalStore`. It had been
    re-reading `navigator.onLine` inside an effect to close the gap between
    first render and the listeners attaching — subscribing properly removes the
    gap instead of patching it.
  - ShortcutHelpModal derives its filter from `open` instead of resetting state
    in an effect, so a modal that is closed most of the time stops scheduling
    work on unrelated parent updates.
  - DraftIndicator and use-languages-ready now guard their setters.

Three remain as warnings, deliberately. They genuinely sync state FROM an
external source (i18next bundle readiness, a text mirror of a numeric store
field, a useMemo the compiler cannot preserve) and need a restructure rather
than a guard. Recorded in eslint.config.js with the reason — downgraded, not
silenced, and not a reason to hold back ESLint 10.

**lucide-react deliberately stays at 0.577.0.** 1.x removes every brand icon;
upstream dropped them for trademark reasons. Taking it would mean either a
generic globe beside a Facebook link or re-adding the marks ourselves and
inheriting the exposure lucide just shed. 0.577 already delivered the win —
main bundle 175 kB → 137 kB.

knip now ignores `tailwindcss`: after the migration its only reference is
`@import "tailwindcss"` in CSS, which knip does not follow.

Full gate green — typecheck, typecheck:all, lint, format:check,
validate:locales, knip, check:version, 692 tests, build — plus a browser check
of both themes with the editor and batch pages functional.

0.36.0 is reserved for the two new locales.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 11:43:51 +07:00
poli0981 11a822a881 Merge pull request #144 from poli0981/docs/v0.35.0
docs: correct the i18n registration claim, document v0.35.0
2026-08-17 11:33:23 +07:00
poli0981andClaude Opus 5 08be7d1ff8 docs: correct the i18n guide's registration claim, document v0.35.0
**docs/I18N.md was wrong in a way that would waste a contributor's afternoon.**
It said adding a locale to `SUPPORTED_LANGUAGES` was "the only registration
step". It is one of four, and the missing ones fail differently: the
`SupportedLanguage` union is a compile error, `MULTILINGUAL_TAGS` is a compile
error, but `detectBrowserLanguage`'s own hardcoded copy of the list fails
*silently* — the language works and simply never auto-selects for a visitor
whose browser is set to it. Also noted: `SUPPORTED_LANGUAGES` is not type-bound
to the union and every consumer casts, so a mismatch compiles cleanly.

Also documents the `--copy-english` / `--force` flags on the locale generator,
which only started existing in v0.35.0 despite having been advertised in
package.json since v0.1.

Elsewhere:

- **DEVELOPMENT.md** — the five new npm scripts, including why `format:check`
  excludes markdown and locale JSON, and why `typecheck:all` exists.
- **TECH-SPEC.md** — the real CI job, a new Field Limits section, and how
  over-limit enforcement derives from the engine's long-ignored `warnings`.
- **ARCHITECTURE.md** — the settings→engine mapping and its two guards, the
  two-source validation state, and an honest note that the first Strict Mode
  implementation typechecked, passed tests, and did nothing.
- **FEATURES.md** — the settings table still listed `Default Genre` and
  `Auto-save Draft`, removed in v0.22.0 and v0.3. Replaced, plus a guardrails
  section.
- **README.md** — guardrails in the feature list, and a link to the wiki.

The wiki itself (12 pages: quick start, glossary, field reference, guardrails,
batch/social, import-export, languages, privacy, troubleshooting, FAQ, release
process) is published separately — it lives in its own repository.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 11:32:09 +07:00
poli0981 03174084cf Merge pull request #143 from poli0981/chore/deps-minor
chore(deps): consolidate the six Dependabot minor bumps
2026-08-17 11:29:16 +07:00
poli0981andClaude Opus 5 d6de8764f1 chore(deps): consolidate the six Dependabot minor bumps into one lockfile
The new grouped Dependabot config opened six PRs within minutes of landing.
Merging them one at a time would mean six lockfile rebases and six CI runs for
what is a single dependency resolution, so this applies all of them together:

  i18next-resources-to-backend 1.2.1 → 1.2.3
  @tauri-apps/{api,plugin-dialog,plugin-fs,plugin-opener} → latest 2.x
  lucide-react 0.400.0 → 0.577.0
  eslint + @eslint/js 9.39.4 → 9.39.5, typescript-eslint 8.58 → 8.67
  knip 6.14.1 → 6.32.2, prettier 3.8.1 → 3.9.6,
  prettier-plugin-tailwindcss 0.6.14 → 0.8.1
  vite 8.0.16 → 8.2.1, vitest 4.1.8 → 4.1.10, tsx 4.22 → 4.23,
  postcss 8.5.15 → 8.5.26, autoprefixer 10.4.27 → 10.5.4

All within-major; the majors (React 19, Tailwind 4, ESLint 10, i18next 26,
Zustand 5) are held back by the Dependabot ignore rule and belong to their own
planned release.

The `lint-and-format` group's own PR was RED, and correctly so: prettier 3.9
formats six files differently, and Dependabot cannot run `npm run format` for
itself. Reformatted here — which is the format gate doing exactly its job on
its first real outing.

lucide-react's jump also drops the main bundle 175 kB → 137 kB (gzip 48 → 37).

Verified: typecheck, typecheck:all, lint, format:check, validate:locales, knip,
check:version, 692 tests and build all pass, and the app renders with icons
intact in the browser.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 11:21:30 +07:00
poli0981 ff8c1133e6 Merge pull request #137 from poli0981/dependabot/github_actions/actions-859475a651
ci: bump the actions group with 4 updates
2026-08-17 11:18:43 +07:00
dependabot[bot] 913e82f6b5 ci: bump the actions group with 4 updates
Bumps the actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-node](https://github.com/actions/setup-node), [actions/cache](https://github.com/actions/cache) and [tauri-apps/tauri-action](https://github.com/tauri-apps/tauri-action).


Updates `actions/checkout` from 6 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

Updates `actions/setup-node` from 6 to 7
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v6...v7)

Updates `actions/cache` from 5 to 6
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v5...v6)

Updates `tauri-apps/tauri-action` from 0 to 1
- [Release notes](https://github.com/tauri-apps/tauri-action/releases)
- [Changelog](https://github.com/tauri-apps/tauri-action/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/tauri-apps/tauri-action/compare/v0...v1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-node
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: tauri-apps/tauri-action
  dependency-version: '1'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-17 03:42:57 +00:00
94 changed files with 2121 additions and 2458 deletions

No files matched your search

+2 -2
View File
@@ -24,8 +24,8 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
+2 -2
View File
@@ -16,8 +16,8 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
+28 -9
View File
@@ -17,11 +17,11 @@ jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
@@ -41,7 +41,7 @@ jobs:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Cache cargo
uses: actions/cache@v5
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
@@ -79,11 +79,30 @@ jobs:
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.3.13750724
run: cargo tauri android build --apk
- name: Upload APK to draft release
uses: softprops/action-gh-release@v3
# Keep the APK regardless of whether the release upload works, so a
# broken upload never costs a 20-minute rebuild.
- name: Upload APK as workflow artifact
uses: actions/upload-artifact@v6
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
draft: true
files: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
name: ytdescgen-android-apk
path: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
if-no-files-found: error
# Uses `gh` (pre-installed on every runner) rather than a third-party
# action. `softprops/action-gh-release@v3` resolved the target release
# from GITHUB_REF instead of the `tag_name` it was given, so on a tag push
# it looked for a release tagged `refs/tags/v0.35.0` and on a
# workflow_dispatch it looked for one tagged `refs/heads/main` — neither
# exists, so it tried to CREATE a release on a branch ref and got
# "Resource not accessible by integration". The v0.35.0 APK was built
# three times before this was pinned down.
#
# `gh release upload` takes the tag as a positional argument and cannot
# make that mistake. `--clobber` makes a re-run idempotent.
- name: Upload APK to draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.inputs.tag || github.ref_name }}
APK: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
run: |
gh release upload "$TAG" "$APK" --clobber --repo "${{ github.repository }}"
+3 -3
View File
@@ -52,12 +52,12 @@ jobs:
bundleArgs: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
# On `workflow_dispatch` checkout the requested tag; on a
# tag push we already get the tag commit by default.
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
@@ -75,7 +75,7 @@ jobs:
librsvg2-dev \
patchelf
- run: npm ci
- uses: tauri-apps/tauri-action@v0
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# AppImage bundling on hosted runners flakes: linuxdeploy (itself
+34
View File
@@ -2,6 +2,40 @@
All notable changes to YTDescGen ship as tagged releases on `main`.
## v0.37.0 — 2026-08-17
A **dependency modernization** release. No user-facing feature changes; the app
should behave identically. Every major the project had been sitting on is now
current, and the two new lint rules that came with them found four real
performance bugs.
### Changed
- **React 18 → 19**, `@types/react` 19, `@vitejs/plugin-react` 6. One source change: React 19 types `useRef<T>(null)` as `RefObject<T | null>` rather than `RefObject<T>` — the old type quietly claimed a ref was non-null before its element mounted. [ScrollToTopButton](src/components/layout/ScrollToTopButton.tsx) now matches, which keeps its existing null check honest.
- **Tailwind 3 → 4** ([src/styles/globals.css](src/styles/globals.css)) — configuration moves from `tailwind.config.ts` (deleted) into CSS. The design tokens live in an `@theme` block that maps Tailwind's names onto the existing `:root` / `.light` variables, so the runtime theme toggle keeps working exactly as before. `darkMode: "class"` becomes `@custom-variant dark`, because the app toggles a class on `<html>` rather than following the OS. PostCSS now loads `@tailwindcss/postcss`. Verified in the browser in both themes.
- **ESLint 9 → 10** + `eslint-plugin-react-hooks` 5 → 7, which enables the React Compiler diagnostics.
- **Zustand 4 → 5**, **i18next 23 → 26**, **react-i18next 15 → 17**, `@testing-library/*`, `typescript-eslint` 8.67, plus the Vite / Vitest / tsx / knip / Tauri-plugin patch line.
### Fixed
The new `react-hooks/set-state-in-effect` rule flagged seven call sites. Four were real extra render passes and are fixed:
- **[use-online-status](src/hooks/use-online-status.ts)** rewritten to `useSyncExternalStore`. It was re-reading `navigator.onLine` inside an effect to close the gap between the first render and the listeners attaching — subscribing properly removes the gap rather than patching it, and costs one render fewer on every mount.
- **[ShortcutHelpModal](src/components/ui/ShortcutHelpModal.tsx)** derives its filter from `open` instead of resetting state in an effect, so a modal that spends most of its life closed no longer schedules work on unrelated parent updates.
- **[DraftIndicator](src/components/editor/DraftIndicator.tsx)** and **[use-languages-ready](src/hooks/use-languages-ready.ts)** now guard their setters.
Three remain as **warnings**, deliberately: they genuinely sync state *from* an external source (i18next bundle readiness, a text mirror of a numeric store field, and a `useMemo` the compiler can't preserve). Each needs a restructure rather than a guard, so they are recorded in [eslint.config.js](eslint.config.js) rather than silenced or used as a reason to hold back the upgrade.
### Not upgraded
- **`lucide-react` stays at 0.577.0.** 1.x removes every brand icon (Instagram, Facebook, GitHub, YouTube, X) — upstream dropped them for trademark reasons. Taking 1.x would mean either a generic globe next to a Facebook link, or re-adding the marks ourselves and inheriting the exposure lucide just shed. Neither is worth it: 0.577 already delivered the win, cutting the main bundle **175 kB → 137 kB**.
### Under the hood
- `knip` now ignores `tailwindcss`, whose only reference after the migration is `@import "tailwindcss"` in CSS — which knip doesn't follow.
- Full gate green: typecheck, typecheck:all, lint, format:check, validate:locales, knip, check:version, **692 tests**, build. Verified live in the browser: both themes render, icons intact, editor and batch functional.
- Six manifests bumped 0.35.0 → 0.37.0. (0.36.0 is reserved for the two new locales.)
## v0.35.0 — 2026-08-17
A **guardrails** release. Four things the app quietly let you do wrong — publish
+3 -1
View File
@@ -29,7 +29,8 @@ Built for the gameplay no-commentary niche — especially horror / scary games
- **Game presets** — save game name + store links once, reuse across the entire part series.
- **Snapshot templates** — save full-form configurations and recall in one click.
- **Smart tag generation** — combines genre pool, platform, quality tier, multilingual hooks, and trending terms; auto-dedup and 500-char-limit aware.
- **Character counters** — real-time limits for title (100), description (5000), tags (500).
- **Character counters** — real-time limits for title (100), description (5000), tags (500). If **any one** is over, no field can be copied — partial copying is how a half-finished description gets published.
- **Guardrails** — hard length caps on every input field, a three-address cap per email field, and an opt-in **Strict Mode** that blocks Generate / Copy / Export while any field holds an error.
- **Batch mode** — generate metadata for all parts of a series in one pass.
- **Cross-post captions** — a dedicated **Social** tab re-packages the same YouTube source into short-form captions for **TikTok** (4,000-char), **Instagram Reels**, and **Facebook Reels** — title, rig, content warnings, copyright, thanks, and hashtags (game + genre + curated per-platform popular tags). Single + bulk modes, per-platform character limits with smart overflow trimming, and JSON import/export.
- **Desktop app** — Windows, macOS & Linux native binaries via Tauri (~8 MB).
@@ -87,6 +88,7 @@ Architecture overview: [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md).
| Document | What's in it |
| --- | --- |
| **[Wiki](https://github.com/poli0981/youtube-generator/wiki)** | **User documentation** — quick start, glossary, every field and its limit, guardrails, troubleshooting, FAQ. Start here if you're using the app rather than building it. |
| [Development Guide](./docs/DEVELOPMENT.md) | Toolchain, IDE setup, build commands, troubleshooting. *(Also: [Vietnamese](./docs/i18n/vi/DEVELOPMENT.md).)* |
| [Architecture](./docs/ARCHITECTURE.md) | Layer model, data flow, engine design. |
| [Features](./docs/FEATURES.md) | Full feature matrix. |
+44 -2
View File
@@ -261,13 +261,55 @@ Zustand Stores:
├───────────────────────────────────────────────┤
│ SettingsStore │
│ - theme: "dark" | "light" │
│ - defaultLanguage: SupportedLanguage │
│ - defaultGenres: GenreId[] │
│ - appLanguage / defaultOutputLanguage │
│ - strictMode, settingsAccordionState (v12) │
│ - (flags: quality badge / copyright / ...) │
│ Middleware: persist (localStorage + file) │
├───────────────────────────────────────────────┤
│ PendingInvalidStore (0.35) │
│ - entries: Record<fieldId, PendingInvalid> │
│ Middleware: NONE — in-flight typing, not data │
└───────────────────────────────────────────────┘
```
### Settings → engine options
`renderAll` is called from three places (the Output hook, the multi-language
Output hook, BatchPage). Each used to hand-copy the same twelve settings fields
into an options object, and they had drifted — BatchPage's copy silently omitted
`splitContactEmail` and `showThirdPartyAds`, so Batch rendered a different
description than Output from identical data.
`src/hooks/use-render-options.ts` is now the single mapping, with two guards:
- **Compile-time** — `buildRenderOptions` builds a
`Required<SettingsRenderOptions>`, so omitting a key is a type error.
- **Runtime** — `tests/hooks/render-options-parity.test.ts` diffs the produced
keys against `SETTINGS_DERIVED_RENDER_KEYS` in both directions.
`RenderOptions` is split accordingly: `SettingsRenderOptions` (from the user)
plus `RenderOptionOverrides` (`tEn`, `bilingualContentBlocks` — decided per call
site, since Output wants bilingual content blocks and Batch does not).
### Validation state
Two sources, unioned by `useStrictBlock`, because neither alone is sufficient:
| Source | Catches | Why it's needed |
|---|---|---|
| `collectEditorIssues` (pure, over `EditorData`) | Saved values that fail validation | Bad data from imports — `ValidatedInput` refuses to commit invalid text, so imports are the main way it gets in |
| `PendingInvalidStore` | Typed text that is invalid and therefore **not** saved | Otherwise a field showing a red error is invisible to every gate, because the store behind it holds the last good value |
Both are filtered through `isRelevantIssueId`, so a field that isn't currently
shown (`adEmail` with split-email off, `zaloGroupLink` outside Vietnamese
output) can never block on a value with no visible input to fix it.
The first implementation registered issues from the inputs themselves and
cleared on unmount. It typechecked and had passing tests, and did nothing: the
fields live on the Editor page while the gates live on Batch / Social / Output,
so navigating away cleared every issue. Deriving from state removes the mount
coupling entirely.
## 4. i18n Architecture
```
+7 -3
View File
@@ -86,14 +86,18 @@ npm run dev
| `npm run dev` | Vite dev server, hot reload, web only. |
| `npm run build` | Production web bundle into `dist/`. |
| `npm run preview` | Serve the production bundle for sanity-testing. |
| `npm run typecheck` | `tsc --noEmit`. Run before every PR. |
| `npm run typecheck` | `tsc --noEmit` over `src/` — what Vite actually builds. |
| `npm run typecheck:all` | Same, plus `tests/` and `scripts/`, which the base config deliberately excludes. Added in v0.35.0 after it turned out they had **never** been type-checked — and immediately found three fields silently missing from the editor→engine parity fixture. |
| `npm run lint` | ESLint. Use `npm run lint:fix` to autofix. |
| `npm run format` | Prettier write across `src/`. |
| `npm run format` | Prettier write across `src/`, `tests/`, `scripts/`. |
| `npm run format:check` | Same, read-only. CI gate. Markdown and the locale JSON are deliberately out of scope — Prettier reflows prose and expands the schema's compact arrays by ~1600 lines for no benefit. |
| `npm run knip` | Dead-code / unused-dependency check. CI gate. |
| `npm run check:version` | Asserts all **six** version fields agree (`package.json`, both `package-lock.json` entries, `tauri.conf.json`, `Cargo.toml`, `Cargo.lock`). The only thing that notices a missed one. |
| `npm run test` | Vitest watch mode. |
| `npm run test:run` | Vitest single-run (for CI / pre-commit). |
| `npm run test:coverage` | Coverage report into `coverage/`. |
| `npm run validate:locales` | Enforces all 6 locales match `_schema.json` exactly. **Must pass before any locale-touching PR merges.** |
| `npm run generate:locale` | Scaffold an empty locale from `_schema.json` for a new language. |
| `npm run generate:locale` | Scaffold a locale from the English source. `--lang <code>`, plus optional `--copy-english` / `--force`. (Advertised since v0.1 but only actually written in v0.35.0.) |
| `npm run tauri:dev` | Tauri desktop in dev mode (auto-restarts on Rust or frontend changes). |
| `npm run tauri:build` | Tauri release binary for the current platform. |
+32 -6
View File
@@ -227,16 +227,42 @@ interface HistoryEntry {
| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| Theme | dark / light | dark | App color theme |
| Default UI Language | SupportedLanguage | en | Language for app interface |
| Default Output Language | SupportedLanguage | en | Default language for generated output |
| Default Genre | Genre | action | Pre-selected genre on new session |
| Auto-save Draft | boolean | true | Auto-save form state to localStorage |
| Show Character Count | boolean | true | Display char counters on output |
| App Language | SupportedLanguage | browser-detected | Language of the interface |
| Default Output Language | SupportedLanguage | en | Pre-selected for new drafts |
| Show Character Count | boolean | true | Display char counters on output. **Does not** affect copy blocking |
| Compact Tag Display | boolean | false | Tags as comma list vs chip display |
| **Strict Mode** | boolean | **false** | v0.35.0. Blocks Generate / Copy / Export while any field has a hard error |
| History Limit | number | 100 | Max history entries to keep |
| Include Multilingual Tags | boolean | true | Add JA/VI tags to tag output |
| Log Retention | 1–90 days | 7 | Log files older than this are deleted at boot |
| Include Multilingual Tags | boolean | true | Add per-language tags to tag output |
| Include Trending Tags | boolean | true | Add year-based trending tags |
| Hashtag Count | 1-3 | 3 | Number of hashtags to generate |
| Genre Playlists | map | `{}` | One playlist URL per genre (42), collapsed by default |
`Default Genre` and `Auto-save Draft` were removed in v0.22.0 and v0.3
respectively — the draft autosaves unconditionally, so the toggle was dead.
### Description toggles
`showCopyright` · `showUsagePolicy` · `showSponsorCredit` · `showGameCopyright`
· `showThirdPartyAds` · `showTranslationQuality` · `splitContactEmail` ·
`showPinnedCommentTemplate` · `pinnedCommentIncludeAskNextGame` ·
`pinnedCommentIncludeGenrePlaylist`
## 🛡 Guardrails (v0.35.0)
Three independent mechanisms. The first two are always on.
| Mechanism | Scope |
|---|---|
| **Character limits** | Title 100 / description 5,000 / tags 500. If **any one** is over, **no** field can be copied — on Output and Batch. Batch scopes per part; Copy All Batch blocks if any part is over |
| **Field limits** | Hard `maxLength` per category: URL 200, email 320, short name 100, label 300, long text 2,000, timestamps 5,000, numeric 10. Imported values are clamped too |
| **Strict Mode** | Opt-in. Blocks Generate / Copy / Export on hard errors only; warnings (e.g. a working link on a non-standard prefix) never block. Log export is exempt |
Emails are capped at **three per field**, enforced on the increase so an
over-cap legacy value stays editable. Invalid input is never committed to the
store, so a malformed URL cannot reach the generated description whether Strict
Mode is on or off.
## 🖥 Desktop App Features (Tauri)
+32 -1
View File
@@ -45,8 +45,18 @@ npm run generate:locale -- --lang es
# This creates:
# src/i18n/locales/es/ui.json (all keys, empty values)
# src/i18n/locales/es/templates.json (all keys, empty values)
# Prefer editing in place over working from blanks? Pre-fill with English:
npm run generate:locale -- --lang es --copy-english
# Overwrite an existing locale directory:
npm run generate:locale -- --lang es --force
```
The output is key-for-key identical to English, so `npm run validate:locales`
passes the moment the files are written — it checks key parity, not whether the
values were actually translated.
Or copy from English and translate:
```bash
@@ -205,16 +215,37 @@ cp -r src/i18n/locales/en src/i18n/locales/es
### Step 4: Register the language
**Four edits, not one.** This section previously claimed `SUPPORTED_LANGUAGES`
was the only registration step; it isn't, and the missing edits fail in
different ways — one at compile time, one silently at runtime.
```typescript
// src/i18n/index.ts — add to SUPPORTED_LANGUAGES (the only registration step)
// 1. src/i18n/index.ts — the flag + native name shown in every language picker
export const SUPPORTED_LANGUAGES = [
{ id: "en", label: "English", flag: "🇬🇧", nativeName: "English" },
{ id: "vi", label: "Vietnamese", flag: "🇻🇳", nativeName: "Tiếng Việt" },
{ id: "ja", label: "Japanese", flag: "🇯🇵", nativeName: "日本語" },
{ id: "es", label: "Spanish", flag: "🇪🇸", nativeName: "Español" }, // ← Add here
] as const;
// 2. src/engine/types.ts — the union the whole engine is typed against
export type SupportedLanguage = "en" | "vi" | "ja" | "es" | "ko" | "zh";
// 3. src/store/settings-heal.ts — detectBrowserLanguage's own hardcoded copy.
// Miss this and the language works, but is never auto-selected for a
// first-time visitor whose browser is set to it.
const supported: SupportedLanguage[] = ["en", "vi", "ja", "es", "ko", "zh"];
// 4. src/engine/tag-generator.ts — MULTILINGUAL_TAGS (see Step 5).
// Typed `Record<SupportedLanguage, …>`, so TypeScript catches this one.
```
> `SUPPORTED_LANGUAGES` is **not** type-bound to `SupportedLanguage`, and every
> consumer casts (`lang.id as SupportedLanguage`). A mismatch between edits 1
> and 2 therefore compiles cleanly and fails at runtime. Do both.
`npm run generate:locale` prints this checklist on success.
No import or `resources` edits needed (v0.26+): locales are lazy-loaded
through a dynamic `import("./locales/<code>/<ns>.json")`, so Vite picks the
new files up automatically as async chunks — **the file names must stay
+67 -1
View File
@@ -323,13 +323,40 @@ jobs:
node-version: 22
cache: npm
- run: npm ci
- run: npm run typecheck
# correctness
- run: npm run typecheck # src/
- run: npm run typecheck:all # + tests/ and scripts/
- run: npm run lint
- run: npm run validate:locales
- run: npm run test:run
# consistency
- run: npm run format:check
- run: npm run knip
- run: npm run check:version
# security (advisory — a fresh transitive advisory must not redden
# every unrelated PR before Dependabot opens its fix)
- run: npm audit --audit-level=high
continue-on-error: true
- run: npm run build
```
The workflow also declares `permissions: contents: read` (least privilege, and
it clears CodeQL's `actions/missing-workflow-permissions` alert) and a
`concurrency` group that cancels superseded runs everywhere except `main`, where
each commit's result is a historical record the release process reads back.
**Why these gates exist.** Every one of them was already installed and
configured before v0.35.0, and none of them ran. `knip` was in `package.json`
with a `knip.json` beside it. Prettier had a config and a `format` script.
Turning them on found real problems immediately — most notably that
`tsconfig.json` covers only `src/`, so `tests/` and `scripts/` had **never** been
type-checked, which was hiding three fields silently missing from the
editor→engine parity fixture whose entire job is catching that class of drift.
```yaml
# .github/workflows/deploy-web.yml
name: Deploy to GitHub Pages
@@ -418,3 +445,42 @@ describe("buildTitle", () => {
| Single Tag | 30 chars | YouTube rejects that tag |
| Hashtags in description | 60 max, 3 shown | First 3 shown above title |
| Playlist title | 150 chars | Truncated |
### Enforcement (v0.35.0)
`renderAll` has always returned `warnings: CharLimitWarning[]`; until v0.35.0
nothing in the UI read it. `src/engine/limits.ts` is now the single derivation,
consumed by `useOutputLimits` on Output and precomputed per row in Batch.
The rule is **all-or-nothing per output**: one over-limit field disables every
copy button for that output. `checkTitleWarning` / `checkDescriptionWarning`
only fire when a field is *strictly over*, never at the 80 % counter threshold,
so a non-empty `warnings` array is an exact "YouTube will reject this" signal.
Deliberately not gated by `YT_LIMITS`: thumbnail text and the pinned comment
(different surfaces), the Playlist tab (150-char title, not 100), and social
captions (per-platform caps in `SOCIAL_PLATFORMS`).
## 7. Field Limits (v0.35.0)
`src/config/field-limits.ts` — caps on what can be *typed*, distinct from
YouTube's caps on what is *generated*.
```typescript
export const FIELD_LIMITS = {
URL: 200,
EMAIL_FIELD: 320, // 3 addresses; RFC 5321 caps a single one at 254
SHORT_NAME: 100,
LABEL: 300,
LONG_TEXT: 2000,
TIMESTAMPS: YT_LIMITS.DESCRIPTION_MAX,
NUMERIC: 10,
} as const;
```
Values are UTF-16 code units, matching the DOM `maxLength` attribute — an emoji
costs 2. Grapheme counting would be more correct but cannot be enforced by the
browser, and these are ceilings against absurd input, not a character budget.
`maxLength` only constrains typing and pasting, so `clampField` is applied in
`normalizeEditorPatch` to cover profile / preset / template imports.
+18
View File
@@ -13,6 +13,24 @@ export default tseslint.config(
...reactHooks.configs.recommended.rules,
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// eslint-plugin-react-hooks 7 turned on the React Compiler diagnostics.
// They are worth having — four of the seven they flagged on arrival were
// real extra render passes and were fixed (use-online-status moved to
// `useSyncExternalStore`, ShortcutHelpModal now derives instead of
// resetting in an effect, DraftIndicator and use-languages-ready were
// guarded).
//
// Three remain, all genuinely syncing state FROM an external source:
// src/hooks/use-languages-ready.ts — i18next bundle readiness
// src/components/editor/PlaytestEditor.tsx — text mirror of a store number
// src/components/editor/StoreLinkEditor.tsx — compiler can't preserve a useMemo
//
// Each needs a real restructure, not a guard, so they are warnings rather
// than a reason to hold back the ESLint 10 upgrade or to delete the rule.
// Downgrade — do not remove: the signal is the point.
"react-hooks/set-state-in-effect": "warn",
"react-hooks/preserve-manual-memoization": "warn",
},
},
{
+1
View File
@@ -6,6 +6,7 @@
"ignoreDependencies": [
"@tauri-apps/plugin-fs",
"@tauri-apps/plugin-shell",
"tailwindcss",
"@testing-library/jest-dom",
"@testing-library/react"
],
+1365 -1940
View File
File diff suppressed because it is too large. Load diff
+34 -33
View File
@@ -1,6 +1,6 @@
{
"name": "yt-desc-gen",
"version": "0.35.0",
"version": "0.37.0",
"private": true,
"license": "Apache-2.0",
"type": "module",
@@ -26,42 +26,43 @@
"tauri:build": "tauri build"
},
"dependencies": {
"@tauri-apps/api": "^2.11.0",
"@tauri-apps/plugin-dialog": "^2.0.0",
"@tauri-apps/plugin-fs": "^2.0.0",
"@tauri-apps/plugin-opener": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"clsx": "^2.1.0",
"i18next": "^23.15.0",
"i18next-resources-to-backend": "^1.2.1",
"lucide-react": "^0.400.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react-hot-toast": "^2.4.0",
"react-i18next": "^15.0.0",
"@tauri-apps/api": "^2.11.1",
"@tauri-apps/plugin-dialog": "^2.7.2",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-opener": "^2.5.4",
"@tauri-apps/plugin-shell": "^2.3.5",
"clsx": "^2.1.1",
"i18next": "^26.3.6",
"i18next-resources-to-backend": "^1.2.3",
"lucide-react": "^0.577.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-hot-toast": "^2.6.0",
"react-i18next": "^17.0.11",
"react-router-dom": "^7.18.2",
"zustand": "^4.5.0"
"zustand": "^5.0.15"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@testing-library/jest-dom": "^6.4.0",
"@testing-library/react": "^16.0.0",
"@eslint/js": "^10.0.1",
"@tailwindcss/postcss": "^4.3.3",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.2",
"@types/node": "^26.2.0",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^5.2.0",
"autoprefixer": "^10.4.0",
"eslint": "^9.0.0",
"eslint-plugin-react-hooks": "^5.0.0",
"knip": "^6.14.1",
"postcss": "^8.5.25",
"prettier": "^3.3.0",
"prettier-plugin-tailwindcss": "^0.6.0",
"tailwindcss": "^3.4.0",
"tsx": "^4.22.4",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"@vitejs/plugin-react": "^6.0.5",
"autoprefixer": "^10.5.4",
"eslint": "^10.8.1",
"eslint-plugin-react-hooks": "^7.1.1",
"knip": "^6.32.2",
"postcss": "^8.5.26",
"prettier": "^3.9.6",
"prettier-plugin-tailwindcss": "^0.8.1",
"tailwindcss": "^4.3.3",
"tsx": "^4.23.12",
"typescript": "^5.5.0",
"typescript-eslint": "^8.0.0",
"vite": "^8.0.16",
"vitest": "^4.1.8"
"typescript-eslint": "^8.67.0",
"vite": "^8.2.1",
"vitest": "^4.1.10"
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
export default {
plugins: {
tailwindcss: {},
// Tailwind 4 ships its PostCSS plugin as a separate package.
"@tailwindcss/postcss": {},
autoprefixer: {},
},
};
+2 -4
View File
@@ -81,13 +81,11 @@ function main(): void {
} catch {
return { label: source.label, version: null };
}
let version: string | null = null;
try {
version = source.extract(raw);
return { label: source.label, version: source.extract(raw) };
} catch {
version = null;
return { label: source.label, version: null };
}
return { label: source.label, version };
});
const missing = found.filter((entry) => entry.version === null);
+1 -1
View File
@@ -5529,7 +5529,7 @@ dependencies = [
[[package]]
name = "yt-desc-gen"
version = "0.35.0"
version = "0.37.0"
dependencies = [
"tauri",
"tauri-build",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "yt-desc-gen"
version = "0.35.0"
version = "0.37.0"
description = "YouTube Gameplay Description Generator"
authors = ["poli0981"]
edition = "2021"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
"productName": "YTDescGen",
"version": "0.35.0",
"version": "0.37.0",
"identifier": "com.skullmute.ytdescgen",
"build": {
"beforeBuildCommand": "npm run build",
+1 -1
View File
@@ -33,7 +33,7 @@ const LogPage = lazy(() => import("@pages/LogPage").then((m) => ({ default: m.Lo
const AboutPage = lazy(() => import("@pages/AboutPage").then((m) => ({ default: m.AboutPage })));
function PageLoader() {
return <div className="flex items-center justify-center p-12 text-text-muted">Loading...</div>;
return <div className="text-text-muted flex items-center justify-center p-12">Loading...</div>;
}
/**
+8 -8
View File
@@ -33,15 +33,15 @@ export function ConsentGate() {
role="dialog"
aria-modal="true"
aria-labelledby="consent-title"
className="flex min-h-screen flex-col items-center justify-center gap-6 bg-surface-0 px-6 py-12 text-center"
className="bg-surface-0 flex min-h-screen flex-col items-center justify-center gap-6 px-6 py-12 text-center"
>
<ShieldCheck className="h-14 w-14 text-accent" aria-hidden />
<ShieldCheck className="text-accent h-14 w-14" aria-hidden />
<div className="max-w-md space-y-2">
<h1 id="consent-title" className="text-2xl font-semibold text-text-primary">
<h1 id="consent-title" className="text-text-primary text-2xl font-semibold">
{t("consentGate.title")}
</h1>
<p className="text-sm text-text-secondary">{t("consentGate.intro")}</p>
<p className="text-text-secondary text-sm">{t("consentGate.intro")}</p>
</div>
<div className="grid w-full max-w-md gap-2 sm:grid-cols-2">
@@ -51,15 +51,15 @@ export function ConsentGate() {
href={doc.url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-3 rounded-lg border border-border bg-surface-1 px-3 py-2.5 text-sm text-text-primary transition-colors hover:border-accent hover:bg-surface-2"
className="border-border bg-surface-1 text-text-primary hover:border-accent hover:bg-surface-2 flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors"
>
<span className="flex-1 truncate text-left">{t(doc.labelKey)}</span>
<ExternalLink className="h-3.5 w-3.5 shrink-0 text-text-muted" />
<ExternalLink className="text-text-muted h-3.5 w-3.5 shrink-0" />
</a>
))}
</div>
<div className="w-full max-w-md rounded-lg border border-border bg-surface-1 p-4">
<div className="border-border bg-surface-1 w-full max-w-md rounded-lg border p-4">
<Checkbox checked={agreed} onChange={setAgreed} label={t("consentGate.agreeLabel")} />
</div>
@@ -67,7 +67,7 @@ export function ConsentGate() {
<Button variant="primary" onClick={onContinue} disabled={!agreed}>
{t("consentGate.continue")}
</Button>
{!agreed && <p className="text-xs text-text-muted">{t("consentGate.mustAgree")}</p>}
{!agreed && <p className="text-text-muted text-xs">{t("consentGate.mustAgree")}</p>}
</div>
</div>
);
+2 -2
View File
@@ -43,8 +43,8 @@ export function CommunityEditor() {
return (
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium text-text-secondary">{t("editor.community")}</span>
<p className="text-xs text-text-muted">{t("editor.communityHelp")}</p>
<span className="text-text-secondary text-sm font-medium">{t("editor.community")}</span>
<p className="text-text-muted text-xs">{t("editor.communityHelp")}</p>
</div>
<ValidatedInput
@@ -66,26 +66,26 @@ export function ContentWarningChecklist() {
return (
<div className="flex flex-col gap-2">
<div className="flex items-baseline justify-between">
<span className="text-sm font-medium text-text-secondary">{t("editor.warnings")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.warnings")}</span>
{selected.length > 0 && (
<span className="text-xs text-text-muted">{selected.length} selected</span>
<span className="text-text-muted text-xs">{selected.length} selected</span>
)}
</div>
<div className="relative">
<Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted" />
<Search className="text-text-muted pointer-events-none absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2" />
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("editor.contentWarningSearchPlaceholder")}
className="w-full rounded-md border border-border bg-surface-1 py-1.5 pl-8 pr-7 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
className="border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent w-full rounded-md border py-1.5 pr-7 pl-8 text-sm focus:outline-none"
/>
{query && (
<button
type="button"
onClick={() => setQuery("")}
className="absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-primary"
className="text-text-muted hover:text-text-primary absolute top-1/2 right-2 -translate-y-1/2"
aria-label="Clear search"
>
<X className="h-3.5 w-3.5" />
@@ -94,7 +94,7 @@ export function ContentWarningChecklist() {
</div>
{isFiltering && totalMatching === 0 ? (
<p className="py-2 text-center text-xs text-text-muted">
<p className="text-text-muted py-2 text-center text-xs">
{t("editor.contentWarningEmpty")}
</p>
) : (
@@ -105,12 +105,12 @@ export function ContentWarningChecklist() {
return (
<div
key={group.id}
className="overflow-hidden rounded-md border border-border bg-surface-1"
className="border-border bg-surface-1 overflow-hidden rounded-md border"
>
<button
type="button"
onClick={() => toggleGroup(group.id)}
className="flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium text-text-secondary hover:bg-surface-2"
className="text-text-secondary hover:bg-surface-2 flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium"
aria-expanded={isOpen}
>
<span className="flex items-center gap-1.5">
@@ -122,13 +122,13 @@ export function ContentWarningChecklist() {
{t(group.labelKey)}
</span>
{groupSelectedCount > 0 && (
<span className="bg-accent/15 rounded-full px-2 py-0.5 text-[10px] font-medium text-accent">
<span className="bg-accent/15 text-accent rounded-full px-2 py-0.5 text-[10px] font-medium">
{groupSelectedCount}
</span>
)}
</button>
{isOpen && (
<div className="grid grid-cols-1 gap-x-3 gap-y-1 border-t border-border bg-surface-1 px-3 py-2 sm:grid-cols-2">
<div className="border-border bg-surface-1 grid grid-cols-1 gap-x-3 gap-y-1 border-t px-3 py-2 sm:grid-cols-2">
{group.items.map((id) => {
const checked = selected.includes(id);
return (
@@ -145,7 +145,7 @@ export function ContentWarningChecklist() {
type="checkbox"
checked={checked}
onChange={() => toggleItem(id)}
className="focus:ring-accent/40 h-3.5 w-3.5 shrink-0 cursor-pointer rounded border-border text-accent focus:ring-1"
className="focus:ring-accent/40 border-border text-accent h-3.5 w-3.5 shrink-0 cursor-pointer rounded focus:ring-1"
/>
<span>{t(`editor.contentWarningOptions.${id}`)}</span>
</label>
+11 -4
View File
@@ -10,15 +10,22 @@ export function DraftIndicator() {
const videoType = useEditorStore((s) => s.videoType);
useEffect(() => {
setShowSaved(true);
const timer = setTimeout(() => setShowSaved(false), 2000);
return () => clearTimeout(timer);
// Show, then hide 2s later. Both transitions go through the timer rather
// than one synchronous `setShowSaved(true)` on every dependency change,
// which cost an extra render pass each keystroke-driven update
// (react-hooks/set-state-in-effect).
const show = setTimeout(() => setShowSaved(true), 0);
const hide = setTimeout(() => setShowSaved(false), 2000);
return () => {
clearTimeout(show);
clearTimeout(hide);
};
}, [gameName, videoType]);
if (!showSaved) return null;
return (
<span className="flex items-center gap-1 text-xs text-success">
<span className="text-success flex items-center gap-1 text-xs">
<Check className="h-3 w-3" />
{t("editor.draftSaved")}
</span>
+18 -18
View File
@@ -202,11 +202,11 @@ export function EndingsEditor() {
)}
</div>
{count === 0 && <p className="text-xs text-text-muted">{t("editor.endings.emptyHint")}</p>}
{count === 0 && <p className="text-text-muted text-xs">{t("editor.endings.emptyHint")}</p>}
{/* CASE A: single ending — number + name pair, with preview. */}
{count === 1 && endings[0] && (
<div className="flex flex-col gap-2 rounded-lg border border-border bg-surface-1 p-3">
<div className="border-border bg-surface-1 flex flex-col gap-2 rounded-lg border p-3">
<div className="grid grid-cols-[100px_1fr] gap-2">
<Input
label={t("editor.endings.numberLabel")}
@@ -228,12 +228,12 @@ export function EndingsEditor() {
onChange={(e) => updateEnding(0, { name: e.target.value })}
/>
</div>
<p className="text-xs text-text-muted">
<p className="text-text-muted text-xs">
{t("editor.endings.previewLabel")}:{" "}
<span className="font-mono text-text-secondary">{previewFor(endings[0])}</span>
<span className="text-text-secondary font-mono">{previewFor(endings[0])}</span>
</p>
{!endings[0].number && !endings[0].name.trim() && (
<p className="flex items-center gap-1.5 text-xs text-warning">
<p className="text-warning flex items-center gap-1.5 text-xs">
<AlertTriangle className="h-3 w-3" />
{t("editor.endings.warnings.singleEmpty")}
</p>
@@ -244,9 +244,9 @@ export function EndingsEditor() {
{/* CASE B / C: multi-ending table. */}
{count >= 2 && (
<div className="flex flex-col gap-2">
<div className="overflow-hidden rounded-lg border border-border">
<div className="border-border overflow-hidden rounded-lg border">
<table className="w-full text-sm">
<thead className="bg-surface-1 text-xs uppercase text-text-muted">
<thead className="bg-surface-1 text-text-muted text-xs uppercase">
<tr>
<th className="px-2 py-1.5 text-left">#</th>
<th className="w-[100px] px-2 py-1.5 text-left">
@@ -258,8 +258,8 @@ export function EndingsEditor() {
</thead>
<tbody>
{endings.map((entry, i) => (
<tr key={i} className="border-t border-border">
<td className="px-2 py-1.5 text-text-muted">{i + 1}</td>
<tr key={i} className="border-border border-t">
<td className="text-text-muted px-2 py-1.5">{i + 1}</td>
<td className="px-2 py-1.5">
<Input
type="number"
@@ -279,7 +279,7 @@ export function EndingsEditor() {
onChange={(e) => updateEnding(i, { name: e.target.value })}
/>
</td>
<td className="px-2 py-1.5 font-mono text-xs text-text-muted">
<td className="text-text-muted px-2 py-1.5 font-mono text-xs">
{previewFor(entry)}
</td>
</tr>
@@ -292,7 +292,7 @@ export function EndingsEditor() {
{/* Case B: timeline gate banner. */}
{isMultiEnding && !isMultiVideo && timelineEndingCount < count && (
<p className="border-warning/40 bg-warning/10 flex items-start gap-1.5 rounded border p-2 text-xs text-warning">
<p className="border-warning/40 bg-warning/10 text-warning flex items-start gap-1.5 rounded border p-2 text-xs">
<AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
<span>
{t("editor.endings.warnings.timelineShort", {
@@ -305,7 +305,7 @@ export function EndingsEditor() {
{/* CASE C: video-count input + per-video ranges. */}
{isMultiEnding && (
<div className="flex flex-col gap-2 rounded-lg border border-border bg-surface-1 p-3">
<div className="border-border bg-surface-1 flex flex-col gap-2 rounded-lg border p-3">
<Input
label={t("editor.endings.videoCountLabel")}
type="number"
@@ -316,10 +316,10 @@ export function EndingsEditor() {
/>
{isMultiVideo && (
<>
<p className="text-xs text-text-muted">{t("editor.endings.videoRangeHint")}</p>
<div className="overflow-hidden rounded border border-border">
<p className="text-text-muted text-xs">{t("editor.endings.videoRangeHint")}</p>
<div className="border-border overflow-hidden rounded border">
<table className="w-full text-sm">
<thead className="bg-surface-2 text-xs uppercase text-text-muted">
<thead className="bg-surface-2 text-text-muted text-xs uppercase">
<tr>
<th className="px-2 py-1.5 text-left">{t("editor.endings.videoLabel")}</th>
<th className="px-2 py-1.5 text-left">From</th>
@@ -328,7 +328,7 @@ export function EndingsEditor() {
</thead>
<tbody>
{endingVideoRanges.map((r, i) => (
<tr key={i} className="border-t border-border">
<tr key={i} className="border-border border-t">
<td className="px-2 py-1.5">{i + 1}</td>
<td className="px-2 py-1.5">
<Input
@@ -354,7 +354,7 @@ export function EndingsEditor() {
</table>
</div>
{rangeWarnings.length > 0 && (
<ul className="border-warning/40 bg-warning/10 flex flex-col gap-1 rounded border p-2 text-xs text-warning">
<ul className="border-warning/40 bg-warning/10 text-warning flex flex-col gap-1 rounded border p-2 text-xs">
{rangeWarnings.map((w, i) => (
<li key={i} className="flex items-start gap-1.5">
<AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
@@ -381,7 +381,7 @@ export function EndingsEditor() {
value={String(Math.min(endingVideoIndex, endingVideoCount))}
onChange={(v) => set("endingVideoIndex", Number(v) || 1)}
/>
<p className="text-xs text-text-muted">{t("editor.endings.videoIndexHint")}</p>
<p className="text-text-muted text-xs">{t("editor.endings.videoIndexHint")}</p>
</>
)}
</div>
+6 -6
View File
@@ -56,14 +56,14 @@ export function ExtraFieldsInput() {
<div className="flex flex-col gap-3">
{extraFields.includes("gachaQuestType") && (
<div className="flex flex-col gap-1">
<label htmlFor="gacha-quest-type" className="text-sm font-medium text-text-secondary">
<label htmlFor="gacha-quest-type" className="text-text-secondary text-sm font-medium">
{t("editor.gachaQuestType")}
</label>
<select
id="gacha-quest-type"
value={store.gachaQuestType ?? "main_story"}
onChange={(e) => store.set("gachaQuestType", e.target.value as GachaQuestType)}
className="focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors focus:border-accent focus:outline-none focus:ring-2"
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
>
{GACHA_QUEST_TYPE_GROUPS.map((g) => (
<optgroup key={g.group} label={t(`editor.gachaQuestTypeGroups.${g.group}`)}>
@@ -88,7 +88,7 @@ export function ExtraFieldsInput() {
)}
{isGacha && visibility.anniversaryYear && (
<div className="flex flex-col gap-1">
<label htmlFor="anniversary-year" className="text-sm font-medium text-text-secondary">
<label htmlFor="anniversary-year" className="text-text-secondary text-sm font-medium">
{t("editor.anniversaryYear")}
</label>
<select
@@ -97,7 +97,7 @@ export function ExtraFieldsInput() {
onChange={(e) =>
store.set("anniversaryYear", e.target.value === "" ? null : Number(e.target.value))
}
className="focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors focus:border-accent focus:outline-none focus:ring-2"
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
>
<option value="">—</option>
{ANNIVERSARY_YEARS.map((y) => (
@@ -201,14 +201,14 @@ export function ExtraFieldsInput() {
)}
{extraFields.includes("scheduledTime") && (
<div className="flex flex-col gap-1">
<label className="text-sm font-medium text-text-secondary">
<label className="text-text-secondary text-sm font-medium">
{t("editor.scheduledTime")}
</label>
<input
type="datetime-local"
value={store.scheduledTime ?? ""}
onChange={(e) => store.set("scheduledTime", e.target.value)}
className="focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors placeholder:text-text-muted focus:border-accent focus:outline-none focus:ring-2"
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
/>
</div>
)}
+8 -8
View File
@@ -50,8 +50,8 @@ export function GenreSelector() {
return (
<div className="flex flex-col gap-2">
<div className="flex flex-wrap items-center justify-between gap-2">
<span className="text-sm font-medium text-text-secondary">{t("editor.genre")}</span>
<span className="text-xs text-text-muted">
<span className="text-text-secondary text-sm font-medium">{t("editor.genre")}</span>
<span className="text-text-muted text-xs">
{genres.length}/{MAX_GENRES}
</span>
</div>
@@ -61,7 +61,7 @@ export function GenreSelector() {
key={groupId}
type="button"
onClick={() => applyGroup(groupId)}
className="rounded-lg border border-border bg-surface-1 px-2.5 py-1 text-xs font-medium text-text-secondary transition-colors hover:border-accent hover:text-text-primary"
className="border-border bg-surface-1 text-text-secondary hover:border-accent hover:text-text-primary rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors"
>
{t(`editor.genreGroups.${groupId}`)}
</button>
@@ -72,10 +72,10 @@ export function GenreSelector() {
value={filter}
onChange={(e) => setFilter(e.target.value)}
placeholder={t("editor.genreSearchPlaceholder")}
className="focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors placeholder:text-text-muted focus:border-accent focus:outline-none focus:ring-2"
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
/>
{visibleOptions.length === 0 ? (
<p className="py-2 text-sm text-text-muted">{t("editor.genreSearchNoResults")}</p>
<p className="text-text-muted py-2 text-sm">{t("editor.genreSearchNoResults")}</p>
) : (
<ChipGroup
multiple
@@ -86,12 +86,12 @@ export function GenreSelector() {
/>
)}
{showHint && (
<div className="border-accent/40 bg-accent/5 flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-xs text-text-secondary">
<div className="border-accent/40 bg-accent/5 text-text-secondary flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-xs">
<span>{t("editor.skipGraphicsHintLabel")}</span>
<div className="flex shrink-0 gap-2">
<button
type="button"
className="rounded bg-accent px-2 py-1 font-medium text-white"
className="bg-accent rounded px-2 py-1 font-medium text-white"
onClick={() => {
set("skipGraphicsSettings", true);
setHintDismissed(true);
@@ -101,7 +101,7 @@ export function GenreSelector() {
</button>
<button
type="button"
className="rounded px-2 py-1 font-medium text-text-secondary hover:bg-surface-2"
className="text-text-secondary hover:bg-surface-2 rounded px-2 py-1 font-medium"
onClick={() => setHintDismissed(true)}
>
{t("editor.skipGraphicsHintKeep")}
+9 -6
View File
@@ -43,11 +43,14 @@ export function PlaytestEditor() {
// (platform clamp, profile / preset load, draft reset). Only fires on a
// real store change, so it never clobbers an in-progress invalid edit.
useEffect(() => {
const current = invitesText.trim() === "" ? 0 : Number(invitesText);
if (current !== playtestInvites) {
setInvitesText(playtestInvites > 0 ? String(playtestInvites) : "");
}
// eslint-disable-next-line react-hooks/exhaustive-deps
const next = playtestInvites > 0 ? String(playtestInvites) : "";
// Functional form so the comparison happens against the *current* text
// without depending on it, and so an unchanged value returns the same
// reference instead of scheduling a render (react-hooks/set-state-in-effect).
setInvitesText((prev) => {
const current = prev.trim() === "" ? 0 : Number(prev);
return current === playtestInvites ? prev : next;
});
}, [playtestInvites]);
const handlePlatformChange = (id: string) => {
@@ -77,7 +80,7 @@ export function PlaytestEditor() {
return (
<div className="flex flex-col gap-3">
<span className="text-sm font-medium text-text-secondary">
<span className="text-text-secondary text-sm font-medium">
{t("editor.playtest.heading")}
</span>
@@ -63,7 +63,7 @@ export function PlaythroughNotesForm() {
return (
<div className="flex flex-col gap-3">
<div className="flex items-baseline justify-between">
<span className="text-sm font-medium text-text-secondary">
<span className="text-text-secondary text-sm font-medium">
{t("editor.playthroughNotes.title")}
</span>
</div>
+8 -8
View File
@@ -6,29 +6,29 @@ export function QuickPreview() {
const output = useGeneratedOutput();
return (
<div className="flex flex-col gap-3 rounded-lg border border-border bg-surface-1 p-4">
<span className="text-sm font-medium text-text-secondary">{t("editor.quickPreview")}</span>
<div className="border-border bg-surface-1 flex flex-col gap-3 rounded-lg border p-4">
<span className="text-text-secondary text-sm font-medium">{t("editor.quickPreview")}</span>
<div className="flex flex-col gap-2">
<div>
<span className="text-xs font-medium uppercase text-text-muted">{t("output.title")}</span>
<p className="mt-1 text-sm font-medium text-text-primary">{output.title || "..."}</p>
<span className="text-text-muted text-xs font-medium uppercase">{t("output.title")}</span>
<p className="text-text-primary mt-1 text-sm font-medium">{output.title || "..."}</p>
</div>
<div>
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.description")}
</span>
<p className="mt-1 line-clamp-3 whitespace-pre-wrap text-xs text-text-secondary">
<p className="text-text-secondary mt-1 line-clamp-3 text-xs whitespace-pre-wrap">
{output.description || "..."}
</p>
</div>
<div>
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.tags")} ({output.tags.length})
</span>
<p className="mt-1 line-clamp-2 text-xs text-text-muted">{output.tagString || "..."}</p>
<p className="text-text-muted mt-1 line-clamp-2 text-xs">{output.tagString || "..."}</p>
</div>
</div>
</div>
+5 -5
View File
@@ -40,7 +40,7 @@ export function RigEditor() {
const renderValidationBadge = (issue: RigValidationIssue | null) => {
if (!issue) return null;
return (
<div className="flex items-center gap-1 text-xs text-warning">
<div className="text-warning flex items-center gap-1 text-xs">
<AlertTriangle className="h-3 w-3" />
<span>{t(issue.messageKey)}</span>
</div>
@@ -87,7 +87,7 @@ export function RigEditor() {
return (
<div key={field.id} className="col-span-2 flex flex-col gap-2">
<span className="text-sm font-medium text-text-secondary">{t(field.labelKey)}</span>
<span className="text-text-secondary text-sm font-medium">{t(field.labelKey)}</span>
<div className="grid grid-cols-3 gap-2">
<Select
label={t("editor.gpu_brand")}
@@ -173,7 +173,7 @@ export function RigEditor() {
return (
<div key={field.id} className="col-span-2 flex flex-col gap-2">
<span className="text-sm font-medium text-text-secondary">{t(field.labelKey)}</span>
<span className="text-text-secondary text-sm font-medium">{t(field.labelKey)}</span>
<div className="grid grid-cols-2 gap-2">{renderedParts}</div>
{renderValidationBadge(issue)}
</div>
@@ -223,7 +223,7 @@ export function RigEditor() {
onChange={(e) => onCustomChange(e.target.value)}
/>
{part.customSuffix && (
<span className="text-sm text-text-muted">{part.customSuffix.trim()}</span>
<span className="text-text-muted text-sm">{part.customSuffix.trim()}</span>
)}
</div>
)}
@@ -263,7 +263,7 @@ export function RigEditor() {
return (
<div className="flex flex-col gap-3">
<span className="text-sm font-medium text-text-secondary">{t("editor.rig")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.rig")}</span>
<div className="grid grid-cols-2 gap-2">
{RIG_FIELDS.map((field) => {
if (field.type === "cascading_dropdown") return renderCascading(field);
+3 -3
View File
@@ -15,10 +15,10 @@ export function SocialEditor() {
return (
<div className="flex flex-col gap-4">
<span className="text-sm font-medium text-text-secondary">{t("editor.social")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.social")}</span>
<div className="flex flex-col gap-2">
<span className="text-xs font-medium uppercase text-text-muted">Donate</span>
<span className="text-text-muted text-xs font-medium uppercase">Donate</span>
{donateFields.map((field) => (
<ValidatedInput
key={field.id}
@@ -37,7 +37,7 @@ export function SocialEditor() {
</div>
<div className="flex flex-col gap-2">
<span className="text-xs font-medium uppercase text-text-muted">Social</span>
<span className="text-text-muted text-xs font-medium uppercase">Social</span>
{socialFields.map((field) => (
<ValidatedInput
key={field.id}
+6 -6
View File
@@ -77,11 +77,11 @@ export function StoreLinkEditor() {
setField("gameName", extracted);
toast.custom(
(item) => (
<div className="flex items-center gap-3 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary shadow">
<div className="border-border bg-surface-2 text-text-primary flex items-center gap-3 rounded-lg border px-3 py-2 text-sm shadow">
<span>{t("editor.toast.urlAutoFilled", { name: extracted })}</span>
<button
type="button"
className="rounded px-2 py-0.5 text-xs font-medium text-accent hover:bg-surface-1"
className="text-accent hover:bg-surface-1 rounded px-2 py-0.5 text-xs font-medium"
onClick={() => {
setField("gameName", "");
toast.dismiss(item.id);
@@ -97,10 +97,10 @@ export function StoreLinkEditor() {
return (
<div className="flex flex-col gap-3">
<span className="text-sm font-medium text-text-secondary">{t("editor.storeLinks")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.storeLinks")}</span>
{mismatch && (
<div className="flex items-start gap-2 rounded-lg border border-warning bg-surface-2 px-3 py-2 text-sm">
<span className="flex-1 text-text-primary">
<div className="border-warning bg-surface-2 flex items-start gap-2 rounded-lg border px-3 py-2 text-sm">
<span className="text-text-primary flex-1">
{t("editor.warning.linkNameMismatch", {
host: mismatch.host,
suggestedName: mismatch.suggestedName,
@@ -110,7 +110,7 @@ export function StoreLinkEditor() {
<button
type="button"
aria-label={t("common.dismiss")}
className="shrink-0 rounded px-2 py-0.5 text-base leading-none text-text-secondary hover:bg-surface-1"
className="text-text-secondary hover:bg-surface-1 shrink-0 rounded px-2 py-0.5 text-base leading-none"
onClick={() =>
setDismissedFingerprints((prev) => {
const next = new Set(prev);
+11 -11
View File
@@ -67,26 +67,26 @@ export function TechNotesChecklist() {
return (
<div className="flex flex-col gap-2">
<div className="flex items-baseline justify-between">
<span className="text-sm font-medium text-text-secondary">{t("editor.techNotes")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.techNotes")}</span>
{selected.length > 0 && (
<span className="text-xs text-text-muted">{selected.length} selected</span>
<span className="text-text-muted text-xs">{selected.length} selected</span>
)}
</div>
<div className="relative">
<Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-muted" />
<Search className="text-text-muted pointer-events-none absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2" />
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("editor.techNoteSearchPlaceholder")}
className="w-full rounded-md border border-border bg-surface-1 py-1.5 pl-8 pr-7 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"
className="border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent w-full rounded-md border py-1.5 pr-7 pl-8 text-sm focus:outline-none"
/>
{query && (
<button
type="button"
onClick={() => setQuery("")}
className="absolute right-2 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-primary"
className="text-text-muted hover:text-text-primary absolute top-1/2 right-2 -translate-y-1/2"
aria-label="Clear search"
>
<X className="h-3.5 w-3.5" />
@@ -95,7 +95,7 @@ export function TechNotesChecklist() {
</div>
{isFiltering && totalMatching === 0 ? (
<p className="py-2 text-center text-xs text-text-muted">{t("editor.techNoteEmpty")}</p>
<p className="text-text-muted py-2 text-center text-xs">{t("editor.techNoteEmpty")}</p>
) : (
<div className="flex flex-col gap-1">
{filteredGroups.map((group) => {
@@ -104,12 +104,12 @@ export function TechNotesChecklist() {
return (
<div
key={group.id}
className="overflow-hidden rounded-md border border-border bg-surface-1"
className="border-border bg-surface-1 overflow-hidden rounded-md border"
>
<button
type="button"
onClick={() => toggleGroup(group.id)}
className="flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium text-text-secondary hover:bg-surface-2"
className="text-text-secondary hover:bg-surface-2 flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium"
aria-expanded={isOpen}
>
<span className="flex items-center gap-1.5">
@@ -121,13 +121,13 @@ export function TechNotesChecklist() {
{t(group.labelKey)}
</span>
{groupSelectedCount > 0 && (
<span className="bg-accent/15 rounded-full px-2 py-0.5 text-[10px] font-medium text-accent">
<span className="bg-accent/15 text-accent rounded-full px-2 py-0.5 text-[10px] font-medium">
{groupSelectedCount}
</span>
)}
</button>
{isOpen && (
<div className="grid grid-cols-1 gap-x-3 gap-y-1 border-t border-border bg-surface-1 px-3 py-2 sm:grid-cols-2">
<div className="border-border bg-surface-1 grid grid-cols-1 gap-x-3 gap-y-1 border-t px-3 py-2 sm:grid-cols-2">
{group.items.map((id) => {
const checked = selected.includes(id);
return (
@@ -144,7 +144,7 @@ export function TechNotesChecklist() {
type="checkbox"
checked={checked}
onChange={() => toggleItem(id)}
className="focus:ring-accent/40 h-3.5 w-3.5 shrink-0 cursor-pointer rounded border-border text-accent focus:ring-1"
className="focus:ring-accent/40 border-border text-accent h-3.5 w-3.5 shrink-0 cursor-pointer rounded focus:ring-1"
/>
<span>{t(`editor.techNoteOptions.${id}`)}</span>
</label>
+3 -3
View File
@@ -112,7 +112,7 @@ export function VideoSettingsForm() {
return (
<div className="flex flex-col gap-3">
<span className="text-sm font-medium text-text-secondary">{t("editor.videoSettings")}</span>
<span className="text-text-secondary text-sm font-medium">{t("editor.videoSettings")}</span>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
<Select
@@ -151,14 +151,14 @@ export function VideoSettingsForm() {
value={store.videoStyleEra}
onChange={(v) => store.set("videoStyleEra", v as VideoStyleEra)}
/>
<p className="-mt-1 text-xs text-text-muted">{t("editor.videoStyleHelp")}</p>
<p className="text-text-muted -mt-1 text-xs">{t("editor.videoStyleHelp")}</p>
<Toggle
label={t("editor.skipGraphicsSettings")}
checked={store.skipGraphicsSettings}
onChange={(v) => store.set("skipGraphicsSettings", v)}
/>
<p className="-mt-1 text-xs text-text-muted">{t("editor.skipGraphicsSettingsHelp")}</p>
<p className="text-text-muted -mt-1 text-xs">{t("editor.skipGraphicsSettingsHelp")}</p>
{!store.skipGraphicsSettings && (
<>
@@ -61,8 +61,8 @@ export function VietnameseDonateEditor() {
return (
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium text-text-secondary">{t("editor.vnDonate")}</span>
<p className="text-xs text-text-muted">{t("editor.vnDonateHelp")}</p>
<span className="text-text-secondary text-sm font-medium">{t("editor.vnDonate")}</span>
<p className="text-text-muted text-xs">{t("editor.vnDonateHelp")}</p>
</div>
<div className="grid grid-cols-2 gap-3">
+8 -8
View File
@@ -52,16 +52,16 @@ function FullscreenError({ kind }: ErrorPageProps) {
useDocumentTitle(title);
return (
<div className="flex min-h-screen flex-col items-center justify-center gap-6 bg-surface-0 px-6 py-12 text-center">
<div className="bg-surface-0 flex min-h-screen flex-col items-center justify-center gap-6 px-6 py-12 text-center">
<Icon className={clsx("h-16 w-16", colour)} aria-hidden />
{meta.code !== null && (
<p className={clsx("font-mono text-6xl font-bold tabular-nums leading-none", colour)}>
<p className={clsx("font-mono text-6xl leading-none font-bold tabular-nums", colour)}>
{meta.code}
</p>
)}
<div className="max-w-md space-y-2">
<h1 className="text-2xl font-semibold text-text-primary">{title}</h1>
<p className="text-sm text-text-secondary">{description}</p>
<h1 className="text-text-primary text-2xl font-semibold">{title}</h1>
<p className="text-text-secondary text-sm">{description}</p>
</div>
<div className="flex flex-wrap items-center justify-center gap-3">
<Button
@@ -99,14 +99,14 @@ function ContainedError({ kind, onReset, detail }: ErrorPageProps) {
return (
<div className="flex min-h-[200px] items-center justify-center p-6">
<div className="border-danger/40 w-full max-w-md rounded-lg border bg-surface-2 p-5 shadow-md shadow-black/10">
<div className="border-danger/40 bg-surface-2 w-full max-w-md rounded-lg border p-5 shadow-md shadow-black/10">
<div className={clsx("mb-3 flex items-center gap-2", colour)}>
<Icon className="h-4 w-4" />
<h2 className="text-sm font-semibold">{title}</h2>
</div>
<p className="mb-3 text-xs text-text-secondary">{description}</p>
<p className="text-text-secondary mb-3 text-xs">{description}</p>
{detail && (
<pre className="mb-4 max-h-32 overflow-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[11px] text-text-muted">
<pre className="bg-surface-3 text-text-muted mb-4 max-h-32 overflow-auto rounded p-2 text-[11px] whitespace-pre-wrap">
{detail}
</pre>
)}
@@ -140,7 +140,7 @@ function ReportBugLink({ size = "md" }: { size?: "sm" | "md" }) {
target="_blank"
rel="noopener noreferrer"
className={clsx(
"focus:ring-accent/50 inline-flex items-center justify-center gap-2 rounded-lg font-medium text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary focus:outline-none focus:ring-2",
"focus:ring-accent/50 text-text-secondary hover:bg-surface-2 hover:text-text-primary inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus:ring-2 focus:outline-none",
sizeClass,
)}
>
+4 -4
View File
@@ -35,18 +35,18 @@ export function OfflineBanner() {
return (
<div
role="status"
className="border-warning/40 fixed inset-x-0 bottom-0 z-50 flex items-center justify-center gap-3 border-t bg-surface-2 px-4 py-2 text-sm text-text-primary shadow-md shadow-black/20"
className="border-warning/40 bg-surface-2 text-text-primary fixed inset-x-0 bottom-0 z-50 flex items-center justify-center gap-3 border-t px-4 py-2 text-sm shadow-md shadow-black/20"
>
<WifiOff className="h-4 w-4 shrink-0 text-warning" aria-hidden />
<WifiOff className="text-warning h-4 w-4 shrink-0" aria-hidden />
<span>{t("errorPages.offlineBanner.message")}</span>
<Link to="/offline" className="font-medium text-accent hover:text-accent-hover">
<Link to="/offline" className="text-accent hover:text-accent-hover font-medium">
{t("errorPages.offlineBanner.details")}
</Link>
<button
type="button"
onClick={() => setDismissed(true)}
aria-label={t("common.dismiss")}
className="ml-1 rounded p-1 text-text-muted transition-colors hover:bg-surface-3 hover:text-text-primary"
className="text-text-muted hover:bg-surface-3 hover:text-text-primary ml-1 rounded p-1 transition-colors"
>
<X className="h-4 w-4" />
</button>
+8 -8
View File
@@ -19,7 +19,7 @@ export function HistoryCard({ entry }: HistoryCardProps) {
const date = new Date(entry.createdAt).toLocaleDateString();
return (
<div className="hover:border-accent/30 rounded-lg border border-border-strong bg-surface-2 shadow-md shadow-black/10 transition-colors">
<div className="hover:border-accent/30 border-border-strong bg-surface-2 rounded-lg border shadow-md shadow-black/10 transition-colors">
<div
className="flex cursor-pointer items-center justify-between p-3"
onClick={() => setExpanded(!expanded)}
@@ -27,9 +27,9 @@ export function HistoryCard({ entry }: HistoryCardProps) {
<div className="flex-1">
<div className="flex items-center gap-2">
{videoType && <span>{videoType.icon}</span>}
<span className="text-sm font-medium text-text-primary">{entry.title}</span>
<span className="text-text-primary text-sm font-medium">{entry.title}</span>
</div>
<div className="mt-1 flex gap-2 text-xs text-text-muted">
<div className="text-text-muted mt-1 flex gap-2 text-xs">
<span>{entry.gameName}</span>
<span>{entry.language.toUpperCase()}</span>
<span>{date}</span>
@@ -44,24 +44,24 @@ export function HistoryCard({ entry }: HistoryCardProps) {
deleteEntry(entry.id);
}}
>
<Trash2 className="h-3.5 w-3.5 text-danger" />
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
{expanded ? (
<ChevronUp className="h-4 w-4 text-text-muted" />
<ChevronUp className="text-text-muted h-4 w-4" />
) : (
<ChevronDown className="h-4 w-4 text-text-muted" />
<ChevronDown className="text-text-muted h-4 w-4" />
)}
</div>
</div>
{expanded && (
<div className="border-t border-border p-3">
<div className="border-border border-t p-3">
<div className="mb-2 flex gap-2">
<CopyButton text={entry.title} label={t("output.copyTitle")} />
<CopyButton text={entry.description} label={t("output.copyDescription")} />
<CopyButton text={entry.tags} label={t("output.copyTags")} />
</div>
<pre className="max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-2 p-2 font-sans text-xs text-text-secondary">
<pre className="bg-surface-2 text-text-secondary max-h-48 overflow-y-auto rounded p-2 font-sans text-xs whitespace-pre-wrap">
{entry.description}
</pre>
</div>
+1 -1
View File
@@ -23,7 +23,7 @@ export function AppShell() {
useGlobalErrorHandler();
return (
<div className="flex h-screen overflow-hidden bg-surface-0">
<div className="bg-surface-0 flex h-screen overflow-hidden">
<Sidebar />
<div className="flex min-w-0 flex-1 flex-col">
<Header onOpenMobileNav={() => setMobileNavOpen(true)} />
+10 -10
View File
@@ -37,23 +37,23 @@ export function Header({ onOpenMobileNav }: HeaderProps) {
};
return (
<header className="flex items-center justify-between gap-2 border-b border-border bg-surface-1 px-3 py-3 pt-[max(0.75rem,env(safe-area-inset-top))] sm:px-6">
<header className="border-border bg-surface-1 flex items-center justify-between gap-2 border-b px-3 py-3 pt-[max(0.75rem,env(safe-area-inset-top))] sm:px-6">
<div className="flex min-w-0 items-center gap-2">
{onOpenMobileNav && (
<button
type="button"
onClick={onOpenMobileNav}
aria-label="Open navigation menu"
className="-ml-1 rounded-lg p-2 text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary md:hidden"
className="text-text-secondary hover:bg-surface-2 hover:text-text-primary -ml-1 rounded-lg p-2 transition-colors md:hidden"
>
<Menu className="h-5 w-5" />
</button>
)}
<div className="min-w-0">
<h1 className="truncate text-base font-bold text-text-primary sm:text-lg">
<h1 className="text-text-primary truncate text-base font-bold sm:text-lg">
{t("app.title")}
</h1>
<p className="hidden truncate text-xs text-text-muted sm:block">{t("app.subtitle")}</p>
<p className="text-text-muted hidden truncate text-xs sm:block">{t("app.subtitle")}</p>
</div>
</div>
<div className="flex shrink-0 items-center gap-2">
@@ -71,7 +71,7 @@ export function Header({ onOpenMobileNav }: HeaderProps) {
<button
type="button"
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
className="rounded-lg p-2 text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary"
className="text-text-secondary hover:bg-surface-2 hover:text-text-primary rounded-lg p-2 transition-colors"
title={t("header.toggleTheme")}
aria-label={t("header.toggleTheme")}
>
@@ -80,22 +80,22 @@ export function Header({ onOpenMobileNav }: HeaderProps) {
<div className="relative" ref={dropdownRef}>
<button
onClick={() => setOpen(!open)}
className="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm transition-colors hover:bg-surface-2 sm:px-3"
className="hover:bg-surface-2 flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm transition-colors sm:px-3"
aria-haspopup="listbox"
aria-expanded={open}
>
<span>{current?.flag}</span>
<span className="hidden text-text-primary sm:inline">{current?.nativeName}</span>
<ChevronDown className="h-3.5 w-3.5 text-text-muted" />
<span className="text-text-primary hidden sm:inline">{current?.nativeName}</span>
<ChevronDown className="text-text-muted h-3.5 w-3.5" />
</button>
{open && (
<div className="absolute right-0 top-full z-50 mt-1 min-w-[200px] max-w-[calc(100vw-2rem)] rounded-lg border border-border bg-surface-1 py-1 shadow-xl">
<div className="border-border bg-surface-1 absolute top-full right-0 z-50 mt-1 max-w-[calc(100vw-2rem)] min-w-[200px] rounded-lg border py-1 shadow-xl">
{SUPPORTED_LANGUAGES.map((lang) => (
<button
key={lang.id}
onClick={() => handleSwitch(lang.id as SupportedLanguage)}
className={clsx(
"flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors hover:bg-surface-2",
"hover:bg-surface-2 flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors",
lang.id === appLanguage ? "bg-accent-muted text-accent" : "text-text-primary",
)}
>
+11 -5
View File
@@ -6,7 +6,13 @@ import clsx from "clsx";
interface ScrollToTopButtonProps {
/** The scrollable container to watch and scroll back to the top. */
scrollRef: RefObject<HTMLElement>;
/**
* React 19 types `useRef<T>(null)` as `RefObject<T | null>` rather than
* `RefObject<T>` — the ref genuinely is null before the element mounts, and
* the old type quietly lied about it. Matching that here rather than casting
* at the call site keeps the null-check below honest.
*/
scrollRef: RefObject<HTMLElement | null>;
}
/** Scroll distance (px) past which the button fades in. */
@@ -62,10 +68,10 @@ export function ScrollToTopButton({ scrollRef }: ScrollToTopButtonProps) {
aria-hidden={!visible}
tabIndex={visible ? 0 : -1}
className={clsx(
"fixed bottom-6 right-6 z-40 flex h-touch w-touch items-center justify-center",
"rounded-full border border-border bg-surface-1 text-text-primary shadow-lg",
"transition-opacity duration-200 hover:bg-surface-2",
"focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
"h-touch w-touch fixed right-6 bottom-6 z-40 flex items-center justify-center",
"border-border bg-surface-1 text-text-primary rounded-full border shadow-lg",
"hover:bg-surface-2 transition-opacity duration-200",
"focus-visible:ring-accent focus:outline-none focus-visible:ring-2",
visible ? "opacity-100" : "pointer-events-none opacity-0",
)}
>
+2 -2
View File
@@ -110,7 +110,7 @@ export function Sidebar() {
return (
<aside
className={clsx(
"hidden shrink-0 flex-col border-r border-border bg-surface-1 transition-[width] duration-200 md:flex",
"border-border bg-surface-1 hidden shrink-0 flex-col border-r transition-[width] duration-200 md:flex",
collapsed ? "w-14" : "w-56",
)}
>
@@ -119,7 +119,7 @@ export function Sidebar() {
onClick={toggle}
aria-label={t(collapsed ? "sidebar.expand" : "sidebar.collapse")}
title={t(collapsed ? "sidebar.expand" : "sidebar.collapse")}
className="flex h-12 items-center justify-center border-b border-border text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary"
className="border-border text-text-muted hover:bg-surface-2 hover:text-text-primary flex h-12 items-center justify-center border-b transition-colors"
>
{collapsed ? <PanelLeftOpen className="h-5 w-5" /> : <PanelLeftClose className="h-5 w-5" />}
</button>
+11 -11
View File
@@ -33,7 +33,7 @@ export function LogEntryCard({ entry }: LogEntryProps) {
return (
<div
className={clsx(
"rounded-lg border bg-surface-2 transition-colors",
"bg-surface-2 rounded-lg border transition-colors",
entry.level === "error" ? "border-red-500/30" : "border-border",
)}
>
@@ -49,39 +49,39 @@ export function LogEntryCard({ entry }: LogEntryProps) {
>
{entry.level}
</span>
<span className="shrink-0 rounded bg-surface-3 px-1.5 py-0.5 text-[10px] text-text-muted">
<span className="bg-surface-3 text-text-muted shrink-0 rounded px-1.5 py-0.5 text-[10px]">
{entry.source}
</span>
<span className="min-w-0 flex-1 truncate text-xs text-text-primary">{entry.message}</span>
<span className="shrink-0 text-[10px] text-text-muted">{time}</span>
<span className="text-text-primary min-w-0 flex-1 truncate text-xs">{entry.message}</span>
<span className="text-text-muted shrink-0 text-[10px]">{time}</span>
<div className="flex shrink-0 items-center gap-0.5">
<button
onClick={handleCopy}
className="rounded p-1 text-text-muted hover:bg-surface-3 hover:text-text-primary"
className="text-text-muted hover:bg-surface-3 hover:text-text-primary rounded p-1"
>
{copied ? <Check className="h-3 w-3 text-success" /> : <Copy className="h-3 w-3" />}
{copied ? <Check className="text-success h-3 w-3" /> : <Copy className="h-3 w-3" />}
</button>
<button
onClick={(e) => {
e.stopPropagation();
deleteEntry(entry.id);
}}
className="rounded p-1 text-text-muted hover:bg-surface-3 hover:text-danger"
className="text-text-muted hover:bg-surface-3 hover:text-danger rounded p-1"
>
<Trash2 className="h-3 w-3" />
</button>
{entry.details &&
(expanded ? (
<ChevronUp className="h-3.5 w-3.5 text-text-muted" />
<ChevronUp className="text-text-muted h-3.5 w-3.5" />
) : (
<ChevronDown className="h-3.5 w-3.5 text-text-muted" />
<ChevronDown className="text-text-muted h-3.5 w-3.5" />
))}
</div>
</div>
{expanded && entry.details && (
<div className="border-t border-border px-3 py-2">
<pre className="max-h-40 overflow-auto whitespace-pre-wrap font-mono text-[11px] text-text-secondary">
<div className="border-border border-t px-3 py-2">
<pre className="text-text-secondary max-h-40 overflow-auto font-mono text-[11px] whitespace-pre-wrap">
{entry.details}
</pre>
</div>
+1 -1
View File
@@ -22,7 +22,7 @@ export function CharCounter({ text, limit }: CharCounterProps) {
"font-mono text-xs font-semibold transition-colors",
isOver && "text-danger",
isWarning && "text-warning",
!isOver && !isWarning && "font-normal text-text-muted",
!isOver && !isWarning && "text-text-muted font-normal",
)}
>
{count}/{limit}
+1 -1
View File
@@ -30,7 +30,7 @@ export function CopyAllBar({ text, status }: CopyAllBarProps) {
const { copy } = useClipboard();
return (
<div className="sticky bottom-0 flex flex-col gap-2 border-t border-border bg-surface-0 px-3 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-4">
<div className="border-border bg-surface-0 sticky bottom-0 flex flex-col gap-2 border-t px-3 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-4">
<LimitBlockBanner status={status} />
<div className="flex items-center justify-end">
<Button
+1 -1
View File
@@ -22,7 +22,7 @@ export function LimitBlockBanner({ status, titleKey }: LimitBlockBannerProps) {
return (
<div
role="alert"
className="border-danger/40 bg-danger/10 flex flex-col gap-1 rounded-lg border px-3 py-2 text-xs text-danger"
className="border-danger/40 bg-danger/10 text-danger flex flex-col gap-1 rounded-lg border px-3 py-2 text-xs"
>
<span className="flex items-center gap-1.5 font-semibold">
<AlertTriangle className="h-3.5 w-3.5 shrink-0" />
+9 -9
View File
@@ -73,11 +73,11 @@ export function OutputExtras() {
{hasThumbnail && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">{t("output.thumbnailText")}</h3>
<h3 className="text-text-primary text-sm font-semibold">{t("output.thumbnailText")}</h3>
<CopyButton text={thumbnailText} label={t("output.copyThumbnailText")} />
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<pre className="whitespace-pre-wrap font-sans text-sm text-text-secondary">
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{thumbnailText}
</pre>
</div>
@@ -87,11 +87,11 @@ export function OutputExtras() {
{hasPinned && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">{t("output.pinnedComment")}</h3>
<h3 className="text-text-primary text-sm font-semibold">{t("output.pinnedComment")}</h3>
<CopyButton text={pinnedComment} label={t("output.copyPinnedComment")} />
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<pre className="whitespace-pre-wrap font-sans text-sm text-text-secondary">
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{pinnedComment}
</pre>
</div>
@@ -101,13 +101,13 @@ export function OutputExtras() {
{hasTemplate && (
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">
<h3 className="text-text-primary text-sm font-semibold">
{t("output.pinnedCommentTemplate")}
</h3>
<CopyButton text={templateText} label={t("output.copyPinnedCommentTemplate")} />
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<pre className="whitespace-pre-wrap font-sans text-sm text-text-secondary">
<div className="border-border bg-surface-1 rounded-lg border p-3">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{templateText}
</pre>
</div>
+10 -10
View File
@@ -28,7 +28,7 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
{/* Title */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">{t("output.title")}</h3>
<h3 className="text-text-primary text-sm font-semibold">{t("output.title")}</h3>
<div className="flex items-center gap-3">
{showCharCount && <CharCounter text={output.title} limit={YT_LIMITS.TITLE_MAX} />}
<CopyButton
@@ -40,15 +40,15 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
/>
</div>
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<p className="text-sm font-medium text-text-primary">{output.title}</p>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<p className="text-text-primary text-sm font-medium">{output.title}</p>
</div>
</section>
{/* Description */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">{t("output.description")}</h3>
<h3 className="text-text-primary text-sm font-semibold">{t("output.description")}</h3>
<div className="flex items-center gap-3">
{showCharCount && (
<CharCounter text={output.description} limit={YT_LIMITS.DESCRIPTION_MAX} />
@@ -62,8 +62,8 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
/>
</div>
</div>
<div className="max-h-[60vh] overflow-y-auto rounded-lg border border-border bg-surface-1 p-3 sm:max-h-[400px]">
<pre className="whitespace-pre-wrap font-sans text-sm text-text-secondary">
<div className="border-border bg-surface-1 max-h-[60vh] overflow-y-auto rounded-lg border p-3 sm:max-h-[400px]">
<pre className="text-text-secondary font-sans text-sm whitespace-pre-wrap">
{output.description}
</pre>
</div>
@@ -72,7 +72,7 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
{/* Tags */}
<section className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-sm font-semibold text-text-primary">
<h3 className="text-text-primary text-sm font-semibold">
{t("output.tags")} ({output.tags.length})
</h3>
<div className="flex items-center gap-3">
@@ -86,15 +86,15 @@ export function OutputPreview({ output: outputProp, status }: OutputPreviewProps
/>
</div>
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<div className="border-border bg-surface-1 rounded-lg border p-3">
{compactTagDisplay ? (
<p className="text-xs text-text-secondary">{output.tagString}</p>
<p className="text-text-secondary text-xs">{output.tagString}</p>
) : (
<div className="flex flex-wrap gap-1.5">
{output.tags.map((tag, i) => (
<span
key={i}
className="rounded-md bg-surface-2 px-2 py-0.5 text-xs text-text-secondary"
className="bg-surface-2 text-text-secondary rounded-md px-2 py-0.5 text-xs"
>
{tag}
</span>
+3 -3
View File
@@ -92,7 +92,7 @@ export function VariantPicker({ open, onClose }: VariantPickerProps) {
{variants.map((variant) => (
<section key={variant.id} className="flex flex-col gap-2">
<div className="flex items-center justify-between">
<h3 className="text-xs font-semibold uppercase tracking-wide text-text-muted">
<h3 className="text-text-muted text-xs font-semibold tracking-wide uppercase">
{t(variant.labelKey)}
</h3>
<div className="flex items-center gap-3">
@@ -100,8 +100,8 @@ export function VariantPicker({ open, onClose }: VariantPickerProps) {
<CopyButton text={variant.title} label={t("output.copyTitle")} />
</div>
</div>
<div className="rounded-lg border border-border bg-surface-1 p-3">
<p className="text-sm font-medium text-text-primary">{variant.title}</p>
<div className="border-border bg-surface-1 rounded-lg border p-3">
<p className="text-text-primary text-sm font-medium">{variant.title}</p>
</div>
</section>
))}
+5 -5
View File
@@ -46,12 +46,12 @@ export function PresetCard({ preset }: PresetCardProps) {
return (
<>
<div className="hover:border-accent/30 flex flex-col gap-3 rounded-lg border border-border-strong bg-surface-2 p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-sm font-semibold text-text-primary">{preset.gameName}</h3>
<div className="mt-1.5 flex flex-wrap items-center gap-1.5 text-xs text-text-muted">
<h3 className="text-text-primary text-sm font-semibold">{preset.gameName}</h3>
<div className="text-text-muted mt-1.5 flex flex-wrap items-center gap-1.5 text-xs">
{genreDefs.map((g) => (
<span key={g.id} className="rounded bg-surface-2 px-1.5 py-0.5">
<span key={g.id} className="bg-surface-2 rounded px-1.5 py-0.5">
{g.icon} {t(g.labelKey)}
</span>
))}
@@ -67,7 +67,7 @@ export function PresetCard({ preset }: PresetCardProps) {
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="h-3.5 w-3.5 text-danger" />
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
+2 -2
View File
@@ -14,7 +14,7 @@ export function PresetList() {
return (
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<h2 className="text-base font-semibold text-text-primary">{t("presets.title")}</h2>
<h2 className="text-text-primary text-base font-semibold">{t("presets.title")}</h2>
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus className="h-4 w-4" />
{t("presets.createNew")}
@@ -22,7 +22,7 @@ export function PresetList() {
</div>
{presets.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("presets.emptyState")}
</p>
) : (
+1 -1
View File
@@ -66,7 +66,7 @@ export function PresetSaveForm({ open, onClose, editPreset }: PresetSaveFormProp
onChange={(e) => setGameName(e.target.value)}
autoFocus
/>
<p className="text-xs text-text-muted">
<p className="text-text-muted text-xs">
{editPreset
? "Update the game name. Other fields are saved from the editor."
: "Preset will save your current game name, genre, platform, store links, and warning settings."}
+5 -5
View File
@@ -45,13 +45,13 @@ export function ProfileCard({ profile }: ProfileCardProps) {
return (
<>
<div className="hover:border-accent/30 flex flex-col gap-3 rounded-lg border border-border-strong bg-surface-2 p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-sm font-semibold text-text-primary">{profile.name}</h3>
<p className="mt-0.5 text-xs text-text-secondary">
<h3 className="text-text-primary text-sm font-semibold">{profile.name}</h3>
<p className="text-text-secondary mt-0.5 text-xs">
{profile.channelName || "No channel"}
</p>
<div className="mt-1.5 flex flex-wrap gap-3 text-xs text-text-muted">
<div className="text-text-muted mt-1.5 flex flex-wrap gap-3 text-xs">
{socialCount > 0 && <span>{socialCount} social links</span>}
{rigCount > 0 && <span>{rigCount} rig fields</span>}
</div>
@@ -65,7 +65,7 @@ export function ProfileCard({ profile }: ProfileCardProps) {
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="h-3.5 w-3.5 text-danger" />
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
+2 -2
View File
@@ -14,7 +14,7 @@ export function ProfileList() {
return (
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between">
<h2 className="text-base font-semibold text-text-primary">{t("profiles.title")}</h2>
<h2 className="text-text-primary text-base font-semibold">{t("profiles.title")}</h2>
<Button size="sm" onClick={() => setShowCreate(true)}>
<Plus className="h-4 w-4" />
{t("profiles.createNew")}
@@ -22,7 +22,7 @@ export function ProfileList() {
</div>
{profiles.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("profiles.emptyState")}
</p>
) : (
+2 -2
View File
@@ -84,8 +84,8 @@ export function ProfileSaveForm({ open, onClose, editProfile }: ProfileSaveFormP
onChange={(e) => setAdText(e.target.value)}
rows={4}
/>
<p className="text-xs text-text-muted">{t("profiles.thirdPartyAdTextHelp")}</p>
<p className="text-xs text-text-muted">
<p className="text-text-muted text-xs">{t("profiles.thirdPartyAdTextHelp")}</p>
<p className="text-text-muted text-xs">
{editProfile
? "Update this profile's name and ad copy. Other fields are saved from the editor."
: "Profile will save your current channel name, social links, rig info, and video settings."}
+4 -4
View File
@@ -37,10 +37,10 @@ export function TemplateCard({ template }: TemplateCardProps) {
return (
<>
<div className="hover:border-accent/30 flex flex-col gap-3 rounded-lg border border-border-strong bg-surface-2 p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="hover:border-accent/30 border-border-strong bg-surface-2 flex flex-col gap-3 rounded-lg border p-4 shadow-md shadow-black/10 transition-colors sm:flex-row sm:items-center sm:justify-between">
<div className="min-w-0 flex-1">
<h3 className="text-sm font-semibold text-text-primary">{template.name}</h3>
<div className="mt-1.5 flex flex-wrap items-center gap-2 text-xs text-text-muted">
<h3 className="text-text-primary text-sm font-semibold">{template.name}</h3>
<div className="text-text-muted mt-1.5 flex flex-wrap items-center gap-2 text-xs">
<span>{template.snapshot.gameName || "—"}</span>
<span>·</span>
<span>{date}</span>
@@ -52,7 +52,7 @@ export function TemplateCard({ template }: TemplateCardProps) {
{t("templates.loadTemplate")}
</Button>
<Button variant="ghost" size="sm" onClick={() => setShowDelete(true)}>
<Trash2 className="h-3.5 w-3.5 text-danger" />
<Trash2 className="text-danger h-3.5 w-3.5" />
</Button>
</div>
</div>
+1 -1
View File
@@ -8,7 +8,7 @@ export function TemplateList() {
if (templates.length === 0) {
return (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("templates.emptyState")}
</p>
);
@@ -118,7 +118,7 @@ export function TemplateSaveForm({ open, onClose }: TemplateSaveFormProps) {
onChange={(e) => setName(e.target.value)}
autoFocus
/>
<p className="text-xs text-text-muted">{t("templates.saveHint")}</p>
<p className="text-text-muted text-xs">{t("templates.saveHint")}</p>
</div>
</Modal>
);
+5 -5
View File
@@ -27,22 +27,22 @@ export function Accordion({ id, title, icon, badge, open, onToggle, children }:
return (
<section
data-accordion-id={id}
className="overflow-hidden rounded-lg border border-border bg-surface-1"
className="border-border bg-surface-1 overflow-hidden rounded-lg border"
>
<button
type="button"
onClick={onToggle}
aria-expanded={open}
className="flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-surface-2"
className="hover:bg-surface-2 flex w-full items-center justify-between gap-3 px-4 py-3 text-left transition-colors"
>
<div className="flex items-center gap-2">
{icon && <span className="text-base leading-none">{icon}</span>}
<span className="text-sm font-semibold text-text-primary">{title}</span>
<span className="text-text-primary text-sm font-semibold">{title}</span>
{badge}
</div>
<ChevronDown
className={clsx(
"h-4 w-4 text-text-muted transition-transform duration-200",
"text-text-muted h-4 w-4 transition-transform duration-200",
open && "rotate-180",
)}
/>
@@ -54,7 +54,7 @@ export function Accordion({ id, title, icon, badge, open, onToggle, children }:
)}
>
<div className="overflow-hidden">
<div className="flex flex-col gap-3 border-t border-border px-4 py-4">{children}</div>
<div className="border-border flex flex-col gap-3 border-t px-4 py-4">{children}</div>
</div>
</div>
</section>
+1 -1
View File
@@ -23,7 +23,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
<button
ref={ref}
className={clsx(
"focus:ring-accent/50 inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-50",
"focus:ring-accent/50 inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus:ring-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
variantClasses[variant],
sizeClasses[size],
className,
+3 -3
View File
@@ -26,7 +26,7 @@ export function Checkbox({ checked, onChange, label, className, id }: CheckboxPr
<label
htmlFor={inputId}
className={clsx(
"group flex min-h-touch cursor-pointer items-start gap-3 text-left",
"group min-h-touch flex cursor-pointer items-start gap-3 text-left",
className,
)}
>
@@ -44,12 +44,12 @@ export function Checkbox({ checked, onChange, label, className, id }: CheckboxPr
"peer-focus-visible:ring-accent/50 peer-focus-visible:ring-2",
checked
? "border-accent bg-accent text-white"
: "border-border bg-surface-1 text-transparent group-hover:border-border-strong",
: "border-border bg-surface-1 group-hover:border-border-strong text-transparent",
)}
>
<Check className="h-3.5 w-3.5" strokeWidth={3} />
</span>
<span className="text-sm leading-snug text-text-primary">{label}</span>
<span className="text-text-primary text-sm leading-snug">{label}</span>
</label>
);
}
+3 -3
View File
@@ -58,8 +58,8 @@ export function ChipGroup(props: ChipGroupProps) {
<div className={clsx("flex flex-col gap-2", className)}>
{(label || counter) && (
<div className="flex items-center justify-between">
{label && <span className="text-sm font-medium text-text-secondary">{label}</span>}
{counter && <span className="text-xs text-text-muted">{counter}</span>}
{label && <span className="text-text-secondary text-sm font-medium">{label}</span>}
{counter && <span className="text-text-muted text-xs">{counter}</span>}
</div>
)}
<div className="flex flex-wrap gap-2">
@@ -77,7 +77,7 @@ export function ChipGroup(props: ChipGroupProps) {
selected
? "bg-accent text-white"
: disabled
? "cursor-not-allowed bg-surface-2 text-text-muted opacity-40"
? "bg-surface-2 text-text-muted cursor-not-allowed opacity-40"
: "bg-surface-2 text-text-secondary hover:bg-surface-3 hover:text-text-primary",
)}
>
+1 -1
View File
@@ -43,7 +43,7 @@ export function ConfirmDialog({
</>
}
>
<p className="text-sm text-text-secondary">{message}</p>
<p className="text-text-secondary text-sm">{message}</p>
</Modal>
);
}
+5 -5
View File
@@ -49,8 +49,8 @@ export function Drawer({
aria-modal="true"
aria-label={ariaLabel ?? title}
className={clsx(
"absolute bottom-0 top-0 flex w-64 max-w-[85vw] flex-col bg-surface-1 shadow-2xl transition-transform duration-200",
side === "left" ? "left-0 border-r border-border" : "right-0 border-l border-border",
"bg-surface-1 absolute top-0 bottom-0 flex w-64 max-w-[85vw] flex-col shadow-2xl transition-transform duration-200",
side === "left" ? "border-border left-0 border-r" : "border-border right-0 border-l",
open ? "translate-x-0" : side === "left" ? "-translate-x-full" : "translate-x-full",
className,
)}
@@ -60,12 +60,12 @@ export function Drawer({
}}
>
{title && (
<div className="flex items-center justify-between border-b border-border px-4 py-3">
<h2 className="text-base font-semibold text-text-primary">{title}</h2>
<div className="border-border flex items-center justify-between border-b px-4 py-3">
<h2 className="text-text-primary text-base font-semibold">{title}</h2>
<button
type="button"
onClick={onClose}
className="rounded-lg p-2 text-text-muted hover:bg-surface-2 hover:text-text-primary"
className="text-text-muted hover:bg-surface-2 hover:text-text-primary rounded-lg p-2"
aria-label="Close"
>
<X className="h-4 w-4" />
+4 -4
View File
@@ -18,7 +18,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={inputId} className="text-sm font-medium text-text-secondary">
<label htmlFor={inputId} className="text-text-secondary text-sm font-medium">
{label}
</label>
)}
@@ -27,14 +27,14 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
id={inputId}
aria-invalid={isError || undefined}
className={clsx(
"focus:ring-accent/50 min-h-touch rounded-lg border bg-surface-1 px-3 py-2.5 text-base text-text-primary transition-colors placeholder:text-text-muted focus:outline-none focus:ring-2 sm:text-sm",
"focus:ring-accent/50 min-h-touch bg-surface-1 text-text-primary placeholder:text-text-muted rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
isError ? "border-danger" : "border-border focus:border-accent",
className,
)}
{...props}
/>
{errorText && <p className="text-xs text-danger">{errorText}</p>}
{helpText && !errorText && <p className="text-xs text-text-muted">{helpText}</p>}
{errorText && <p className="text-danger text-xs">{errorText}</p>}
{helpText && !errorText && <p className="text-text-muted text-xs">{helpText}</p>}
</div>
);
},
+5 -5
View File
@@ -35,16 +35,16 @@ export function Modal({ open, onClose, title, children, footer, className }: Mod
>
<div
className={clsx(
"mx-4 flex max-h-[85vh] w-[calc(100%-2rem)] max-w-lg flex-col rounded-xl border border-border bg-surface-1 shadow-2xl",
"border-border bg-surface-1 mx-4 flex max-h-[85vh] w-[calc(100%-2rem)] max-w-lg flex-col rounded-xl border shadow-2xl",
className,
)}
>
{title && (
<div className="flex items-center justify-between border-b border-border px-5 py-4">
<h2 className="text-base font-semibold text-text-primary">{title}</h2>
<div className="border-border flex items-center justify-between border-b px-5 py-4">
<h2 className="text-text-primary text-base font-semibold">{title}</h2>
<button
onClick={onClose}
className="rounded-lg p-1 text-text-muted hover:bg-surface-2 hover:text-text-primary"
className="text-text-muted hover:bg-surface-2 hover:text-text-primary rounded-lg p-1"
>
<X className="h-4 w-4" />
</button>
@@ -52,7 +52,7 @@ export function Modal({ open, onClose, title, children, footer, className }: Mod
)}
<div className="flex-1 overflow-y-auto px-5 py-4">{children}</div>
{footer && (
<div className="flex justify-end gap-2 border-t border-border px-5 py-3">{footer}</div>
<div className="border-border flex justify-end gap-2 border-t px-5 py-3">{footer}</div>
)}
</div>
</div>
+2 -2
View File
@@ -19,7 +19,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={selectId} className="text-sm font-medium text-text-secondary">
<label htmlFor={selectId} className="text-text-secondary text-sm font-medium">
{label}
</label>
)}
@@ -29,7 +29,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
value={value}
onChange={(e) => onChange(e.target.value)}
className={clsx(
"focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors focus:border-accent focus:outline-none focus:ring-2",
"focus:ring-accent/50 border-border bg-surface-1 text-text-primary focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none",
className,
)}
{...props}
+12 -13
View File
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useState } from "react";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Modal } from "./Modal";
@@ -22,34 +22,33 @@ export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
const { t } = useTranslation("ui");
const [query, setQuery] = useState("");
// Reset the filter every time the modal closes so a re-open starts
// fresh — otherwise the previous filter persists invisibly.
useEffect(() => {
if (!open) setQuery("");
}, [open]);
// A closed modal has no filter. Deriving this rather than resetting `query`
// in an effect means a re-open always starts fresh without an extra render
// pass on every parent update while the modal is closed.
const activeQuery = open ? query : "";
const filtered = useMemo(() => {
const trimmed = query.trim().toLowerCase();
const trimmed = activeQuery.trim().toLowerCase();
if (!trimmed) return SHORTCUTS;
return SHORTCUTS.filter((s) => {
const label = t(s.labelKey).toLowerCase();
return label.includes(trimmed) || s.keys.toLowerCase().includes(trimmed);
});
}, [query, t]);
}, [activeQuery, t]);
return (
<Modal open={open} onClose={onClose} title={t("shortcuts.title")}>
<div className="flex flex-col gap-3">
<input
type="text"
value={query}
value={activeQuery}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("shortcuts.searchPlaceholder")}
className="focus:ring-accent/50 rounded-lg border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary transition-colors placeholder:text-text-muted focus:border-accent focus:outline-none focus:ring-2"
className="focus:ring-accent/50 border-border bg-surface-1 text-text-primary placeholder:text-text-muted focus:border-accent rounded-lg border px-3 py-2 text-sm transition-colors focus:ring-2 focus:outline-none"
autoFocus
/>
{filtered.length === 0 ? (
<p className="py-2 text-sm text-text-muted">{t("shortcuts.noResults")}</p>
<p className="text-text-muted py-2 text-sm">{t("shortcuts.noResults")}</p>
) : (
<div className="flex flex-col gap-2">
{filtered.map((s) => (
@@ -57,8 +56,8 @@ export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
key={`${s.keys}-${s.labelKey}`}
className="flex items-center justify-between py-1"
>
<span className="text-sm text-text-secondary">{t(s.labelKey)}</span>
<kbd className="rounded bg-surface-2 px-2 py-0.5 font-mono text-xs text-text-primary">
<span className="text-text-secondary text-sm">{t(s.labelKey)}</span>
<kbd className="bg-surface-2 text-text-primary rounded px-2 py-0.5 font-mono text-xs">
{s.keys}
</kbd>
</div>
+1 -1
View File
@@ -21,7 +21,7 @@ export function StrictModeBanner() {
return (
<div
role="alert"
className="border-danger/40 bg-danger/10 flex flex-col gap-1 rounded-lg border px-3 py-2 text-xs text-danger"
className="border-danger/40 bg-danger/10 text-danger flex flex-col gap-1 rounded-lg border px-3 py-2 text-xs"
>
<span className="flex items-center gap-1.5 font-semibold">
<ShieldAlert className="h-3.5 w-3.5 shrink-0" />
+2 -2
View File
@@ -13,7 +13,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<div className="flex flex-col gap-1">
{label && (
<label htmlFor={inputId} className="text-sm font-medium text-text-secondary">
<label htmlFor={inputId} className="text-text-secondary text-sm font-medium">
{label}
</label>
)}
@@ -21,7 +21,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
ref={ref}
id={inputId}
className={clsx(
"focus:ring-accent/50 min-h-[96px] resize-y rounded-lg border bg-surface-1 px-3 py-2.5 text-base text-text-primary transition-colors placeholder:text-text-muted focus:outline-none focus:ring-2 sm:text-sm",
"focus:ring-accent/50 bg-surface-1 text-text-primary placeholder:text-text-muted min-h-[96px] resize-y rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
error ? "border-danger" : "border-border focus:border-accent",
className,
)}
+2 -2
View File
@@ -16,7 +16,7 @@ export function Toggle({ label, checked, onChange, className }: ToggleProps) {
aria-checked={checked}
onClick={() => onChange(!checked)}
className={clsx(
"focus:ring-accent/50 relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2",
"focus:ring-accent/50 relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus:ring-2 focus:outline-none",
checked ? "bg-accent" : "bg-surface-3",
)}
>
@@ -27,7 +27,7 @@ export function Toggle({ label, checked, onChange, className }: ToggleProps) {
)}
/>
</button>
<span className="text-sm text-text-primary">{label}</span>
<span className="text-text-primary text-sm">{label}</span>
</label>
);
}
+4 -4
View File
@@ -164,7 +164,7 @@ export function ValidatedInput({
return (
<div className="flex flex-col gap-1">
<label className="text-sm font-medium text-text-secondary">{label}</label>
<label className="text-text-secondary text-sm font-medium">{label}</label>
<input
type="text"
value={displayValue}
@@ -178,12 +178,12 @@ export function ValidatedInput({
maxLength={maxLength}
aria-invalid={touched && Boolean(message) ? true : undefined}
className={clsx(
"focus:ring-accent/50 min-h-touch rounded-lg border bg-surface-1 px-3 py-2.5 text-base text-text-primary transition-colors placeholder:text-text-muted focus:outline-none focus:ring-2 sm:text-sm",
"focus:ring-accent/50 min-h-touch bg-surface-1 text-text-primary placeholder:text-text-muted rounded-lg border px-3 py-2.5 text-base transition-colors focus:ring-2 focus:outline-none sm:text-sm",
touched && message ? "border-danger" : "border-border focus:border-accent",
)}
/>
{touched && message && <p className="text-xs text-danger">{message}</p>}
{helpText && !message && <p className="text-xs text-text-muted">{helpText}</p>}
{touched && message && <p className="text-danger text-xs">{message}</p>}
{helpText && !message && <p className="text-text-muted text-xs">{helpText}</p>}
</div>
);
}
+1 -6
View File
@@ -21,12 +21,7 @@ import {
* - `runtime` — a render crash caught by ErrorBoundary
*/
export type ErrorKind =
| "notFound"
| "forbidden"
| "expired"
| "serverError"
| "offline"
| "runtime";
"notFound" | "forbidden" | "expired" | "serverError" | "offline" | "runtime";
type ErrorSeverity = "accent" | "danger" | "warning";
+1 -5
View File
@@ -42,11 +42,7 @@ export type GachaQuestType = (typeof GACHA_QUEST_TYPES)[number];
export const DEFAULT_GACHA_QUEST_TYPE: GachaQuestType = "main_story";
export type GachaQuestTypeGroup =
| "story"
| "events"
| "tutorial_trial"
| "endgame_multiplayer"
| "showcase";
"story" | "events" | "tutorial_trial" | "endgame_multiplayer" | "showcase";
/**
* Display-order grouping for the quest-type dropdown. Each group
+1 -2
View File
@@ -36,8 +36,7 @@ interface RigFieldOption {
* both). Existing static-array call sites continue to work unchanged.
*/
type RigFieldOptionResolver =
| readonly RigFieldOption[]
| ((previousParts: readonly string[]) => readonly RigFieldOption[]);
readonly RigFieldOption[] | ((previousParts: readonly string[]) => readonly RigFieldOption[]);
export interface CompositePart {
/** Stable id, used to assemble the storage tuple in declaration order. */
+1 -8
View File
@@ -5,14 +5,7 @@ import type { SupportedLanguage, TranslationFn } from "./types";
* translation key under `timeline.keywords.*` in templates.json.
*/
type TimelineKeyword =
| "chapter"
| "part"
| "boss"
| "final_boss"
| "intro"
| "ending"
| "tutorial"
| "credits";
"chapter" | "part" | "boss" | "final_boss" | "intro" | "ending" | "tutorial" | "credits";
export interface TimelineEntry {
/** Raw timecode as it appeared in the input (e.g. "0:00", "1:23:45"). */
+3 -1
View File
@@ -27,7 +27,9 @@ export function useLanguagesReady(langs: readonly SupportedLanguage[]): boolean
useEffect(() => {
const wanted = (key ? key.split(",") : []) as SupportedLanguage[];
if (wanted.every(hasLanguageBundles)) {
setReadyKey(key);
// Already in memory. Guarded so a re-run with an unchanged key doesn't
// schedule a redundant render (react-hooks/set-state-in-effect).
setReadyKey((prev) => (prev === key ? prev : key));
return;
}
let cancelled = false;
+25 -22
View File
@@ -1,16 +1,34 @@
import { useEffect, useState } from "react";
import { useSyncExternalStore } from "react";
function readOnline(): boolean {
function subscribe(onChange: () => void): () => void {
if (typeof window === "undefined") return () => {};
window.addEventListener("online", onChange);
window.addEventListener("offline", onChange);
return () => {
window.removeEventListener("online", onChange);
window.removeEventListener("offline", onChange);
};
}
function getSnapshot(): boolean {
return typeof navigator === "undefined" ? true : navigator.onLine;
}
/** SSR / non-browser: assume online, since nothing here gates core features. */
function getServerSnapshot(): boolean {
return true;
}
/**
* Track the browser's connectivity. Returns `true` when online.
*
* SSR/Tauri-safe (guards `navigator` / `window`). Re-syncs once on mount in
* case the status flipped between the initial `useState` read and the effect
* attaching. Mirrors the add/remove-listener shape of
* {@link import("@hooks/use-global-error-handler").useGlobalErrorHandler}.
* `useSyncExternalStore` rather than `useState` + `useEffect`: connectivity is
* an external store, and the hand-rolled version had to re-read `navigator`
* inside the effect to close the gap between the initial render and the
* listeners attaching — a synchronous `setState` in an effect, which costs an
* extra render pass on every mount and is what
* `react-hooks/set-state-in-effect` exists to catch. Subscribing properly
* removes the gap instead of patching it.
*
* Note: `navigator.onLine` only reports the OS/browser link state, not whether
* the wider internet is reachable — which is exactly right here, since the app
@@ -18,20 +36,5 @@ function readOnline(): boolean {
* links, never core functionality.
*/
export function useOnlineStatus(): boolean {
const [online, setOnline] = useState(readOnline);
useEffect(() => {
if (typeof window === "undefined") return;
const goOnline = () => setOnline(true);
const goOffline = () => setOnline(false);
window.addEventListener("online", goOnline);
window.addEventListener("offline", goOffline);
setOnline(readOnline());
return () => {
window.removeEventListener("online", goOnline);
window.removeEventListener("offline", goOffline);
};
}, []);
return online;
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
}
+18 -18
View File
@@ -105,16 +105,16 @@ export function AboutPage() {
<div className="mx-auto flex max-w-3xl flex-col gap-8 p-6">
<header className="flex flex-col gap-2">
<div className="flex items-baseline gap-3">
<h1 className="text-2xl font-bold text-text-primary">{ABOUT.appName}</h1>
<span className="rounded bg-surface-2 px-2 py-0.5 font-mono text-xs text-text-secondary">
<h1 className="text-text-primary text-2xl font-bold">{ABOUT.appName}</h1>
<span className="bg-surface-2 text-text-secondary rounded px-2 py-0.5 font-mono text-xs">
v{ABOUT.version}
</span>
</div>
<p className="text-sm text-text-secondary">{t("about.tagline")}</p>
<p className="text-text-secondary text-sm">{t("about.tagline")}</p>
</header>
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold uppercase tracking-wide text-text-muted">
<h2 className="text-text-muted text-sm font-semibold tracking-wide uppercase">
{t("about.repoHeading")}
</h2>
<div className="grid gap-2 sm:grid-cols-2">
@@ -135,7 +135,7 @@ export function AboutPage() {
</section>
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold uppercase tracking-wide text-text-muted">
<h2 className="text-text-muted text-sm font-semibold tracking-wide uppercase">
{t("about.legalHeading")}
</h2>
<div className="grid gap-2 sm:grid-cols-2">
@@ -151,10 +151,10 @@ export function AboutPage() {
</section>
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold uppercase tracking-wide text-text-muted">
<h2 className="text-text-muted text-sm font-semibold tracking-wide uppercase">
{t("about.donateHeading")}
</h2>
<p className="text-xs text-text-muted">{t("about.donateHelp")}</p>
<p className="text-text-muted text-xs">{t("about.donateHelp")}</p>
<div className="grid gap-2 sm:grid-cols-2">
{donateLinks.map((d) => (
<ExternalLinkRow key={d.id} href={d.url} icon={d.icon} label={t(d.labelKey)} accent />
@@ -164,7 +164,7 @@ export function AboutPage() {
{socials.length > 0 && (
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold uppercase tracking-wide text-text-muted">
<h2 className="text-text-muted text-sm font-semibold tracking-wide uppercase">
{t("about.connectHeading")}
</h2>
<div className="grid gap-2 sm:grid-cols-2">
@@ -176,26 +176,26 @@ export function AboutPage() {
)}
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold uppercase tracking-wide text-text-muted">
<h2 className="text-text-muted text-sm font-semibold tracking-wide uppercase">
{t("about.thirdPartyHeading")}
</h2>
<p className="text-xs text-text-muted">{t("about.thirdPartyHelp")}</p>
<p className="text-text-muted text-xs">{t("about.thirdPartyHelp")}</p>
<ul className="grid gap-1.5 sm:grid-cols-2">
{THIRD_PARTY.map((entry) => (
<li
key={entry.name}
className="flex items-center justify-between rounded-lg border border-border bg-surface-1 px-3 py-2"
className="border-border bg-surface-1 flex items-center justify-between rounded-lg border px-3 py-2"
>
<a
href={entry.url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 text-sm text-text-primary hover:text-accent"
className="text-text-primary hover:text-accent flex items-center gap-2 text-sm"
>
<span className="font-medium">{entry.name}</span>
<span className="font-mono text-xs text-text-muted">{entry.version}</span>
<span className="text-text-muted font-mono text-xs">{entry.version}</span>
</a>
<span className="text-xs text-text-muted">{entry.license}</span>
<span className="text-text-muted text-xs">{entry.license}</span>
</li>
))}
</ul>
@@ -219,17 +219,17 @@ function ExternalLinkRow({ href, icon: Icon, label, accent }: ExternalLinkRowPro
rel="noopener noreferrer"
className={
accent
? "flex items-center gap-3 rounded-lg border border-pink-500/30 bg-pink-500/5 px-3 py-2.5 text-sm text-text-primary transition-colors hover:border-pink-400/60 hover:bg-pink-500/10"
: "flex items-center gap-3 rounded-lg border border-border bg-surface-1 px-3 py-2.5 text-sm text-text-primary transition-colors hover:border-accent hover:bg-surface-2"
? "text-text-primary flex items-center gap-3 rounded-lg border border-pink-500/30 bg-pink-500/5 px-3 py-2.5 text-sm transition-colors hover:border-pink-400/60 hover:bg-pink-500/10"
: "border-border bg-surface-1 text-text-primary hover:border-accent hover:bg-surface-2 flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors"
}
>
<Icon
className={
accent ? "h-4 w-4 shrink-0 text-pink-300" : "h-4 w-4 shrink-0 text-text-secondary"
accent ? "h-4 w-4 shrink-0 text-pink-300" : "text-text-secondary h-4 w-4 shrink-0"
}
/>
<span className="flex-1 truncate">{label}</span>
<ExternalLink className="h-3.5 w-3.5 shrink-0 text-text-muted" />
<ExternalLink className="text-text-muted h-3.5 w-3.5 shrink-0" />
</a>
);
}
+14 -14
View File
@@ -158,11 +158,11 @@ export function BatchPage() {
return (
<div className="mx-auto max-w-4xl p-4 sm:p-6">
<h1 className="mb-4 text-lg font-bold text-text-primary">{t("batch.title")}</h1>
<h1 className="text-text-primary mb-4 text-lg font-bold">{t("batch.title")}</h1>
{/* Language selector */}
<div className="mb-4">
<span className="mb-2 block text-sm font-medium text-text-secondary">
<span className="text-text-secondary mb-2 block text-sm font-medium">
{t("output.selectLanguages")}
</span>
<div className="flex flex-wrap gap-2">
@@ -215,7 +215,7 @@ export function BatchPage() {
{rangeError && (
<p
role="alert"
className="border-warning/40 bg-warning/10 mb-6 rounded-lg border px-3 py-2 text-xs text-warning"
className="border-warning/40 bg-warning/10 text-warning mb-6 rounded-lg border px-3 py-2 text-xs"
>
{rangeError}
</p>
@@ -225,7 +225,7 @@ export function BatchPage() {
</div>
{results.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("batch.emptyState")}
</p>
) : (
@@ -233,7 +233,7 @@ export function BatchPage() {
<div className="mb-4 flex flex-col gap-2">
<LimitBlockBanner status={batchStatus} titleKey="output.limits.batchAllBlocked" />
<div className="flex flex-wrap items-center justify-between gap-2">
<span className="text-sm text-text-secondary">
<span className="text-text-secondary text-sm">
{results.length} parts x {selectedLangs.length} languages
</span>
<CopyButton
@@ -247,16 +247,16 @@ export function BatchPage() {
{results.map((result) => (
<div
key={result.partNumber}
className="rounded-lg border border-border bg-surface-1 p-4"
className="border-border bg-surface-1 rounded-lg border p-4"
>
<h3 className="mb-3 text-sm font-semibold text-text-primary">
<h3 className="text-text-primary mb-3 text-sm font-semibold">
Part {result.partNumber}
</h3>
<div className="flex flex-col gap-3">
{result.languages.map((lang) => (
<div key={lang.language} className="rounded-lg bg-surface-2 p-3">
<div key={lang.language} className="bg-surface-2 rounded-lg p-3">
<div className="mb-1 flex flex-wrap items-center justify-between gap-2">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{lang.language.toUpperCase()}
</span>
<div className="flex items-center gap-2">
@@ -270,26 +270,26 @@ export function BatchPage() {
/>
</div>
</div>
<p className="mb-2 text-sm font-medium text-text-primary">
<p className="text-text-primary mb-2 text-sm font-medium">
{lang.output.title}
</p>
<pre className="mb-2 max-h-20 overflow-y-auto whitespace-pre-wrap font-sans text-xs text-text-secondary">
<pre className="text-text-secondary mb-2 max-h-20 overflow-y-auto font-sans text-xs whitespace-pre-wrap">
{lang.output.description.slice(0, 200)}...
</pre>
{/* Batch showed a counter for the title only, so a row
could be 1500 characters over on the description with
nothing on screen saying so. */}
<div className="mb-2 flex flex-wrap items-center gap-3">
<span className="text-xs text-text-muted">{t("output.description")}</span>
<span className="text-text-muted text-xs">{t("output.description")}</span>
<CharCounter
text={lang.output.description}
limit={YT_LIMITS.DESCRIPTION_MAX}
/>
<span className="text-xs text-text-muted">{t("output.tags")}</span>
<span className="text-text-muted text-xs">{t("output.tags")}</span>
<CharCounter text={lang.output.tagString} limit={YT_LIMITS.TAGS_MAX} />
</div>
{lang.status.blocked && (
<p role="alert" className="mb-2 text-xs font-medium text-danger">
<p role="alert" className="text-danger mb-2 text-xs font-medium">
{t("output.limits.batchRowBlocked")}
</p>
)}
+2 -2
View File
@@ -26,7 +26,7 @@ export function HistoryPage() {
return (
<div className="mx-auto max-w-3xl p-6">
<div className="mb-4 flex items-center justify-between">
<h1 className="text-lg font-bold text-text-primary">{t("history.title")}</h1>
<h1 className="text-text-primary text-lg font-bold">{t("history.title")}</h1>
{entries.length > 0 && (
<Button variant="ghost" size="sm" onClick={() => setShowClearAll(true)}>
<Trash2 className="h-3.5 w-3.5" />
@@ -46,7 +46,7 @@ export function HistoryPage() {
)}
{filtered.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("history.emptyState")}
</p>
) : (
+12 -12
View File
@@ -128,8 +128,8 @@ export function LogPage() {
<div className="mx-auto max-w-4xl p-6">
<div className="mb-4 flex items-center justify-between">
<div className="flex items-center gap-3">
<h1 className="text-lg font-bold text-text-primary">{t("logs.title")}</h1>
<span className="text-xs text-text-muted">
<h1 className="text-text-primary text-lg font-bold">{t("logs.title")}</h1>
<span className="text-text-muted text-xs">
{entries.length} entries · {sessions.length} sessions
{totalErrorCount > 0 && (
<span className="ml-1 text-red-400">({totalErrorCount} errors)</span>
@@ -161,7 +161,7 @@ export function LogPage() {
{/* Filters */}
<div className="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center">
<div className="flex gap-1 rounded-lg bg-surface-1 p-1">
<div className="bg-surface-1 flex gap-1 rounded-lg p-1">
{LEVEL_FILTERS.map((f) => (
<button
key={f.value}
@@ -188,7 +188,7 @@ export function LogPage() {
{/* Session-grouped entries */}
{sessions.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-12 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-12 text-center text-sm">
{t("logs.emptyState")}
</p>
) : (
@@ -203,7 +203,7 @@ export function LogPage() {
: !collapsedSessions.has(`__expanded__${session.id}`);
return (
<div key={session.id} className="rounded-lg border border-border bg-surface-1">
<div key={session.id} className="border-border bg-surface-1 rounded-lg border">
<div
className="flex cursor-pointer items-center gap-2 px-3 py-2"
onClick={() => {
@@ -220,19 +220,19 @@ export function LogPage() {
}}
>
{effectivelyCollapsed ? (
<ChevronRight className="h-4 w-4 text-text-muted" />
<ChevronRight className="text-text-muted h-4 w-4" />
) : (
<ChevronDown className="h-4 w-4 text-text-muted" />
<ChevronDown className="text-text-muted h-4 w-4" />
)}
<span className="text-sm font-semibold text-text-primary">
<span className="text-text-primary text-sm font-semibold">
{session.isCurrent
? t("logs.sessionCurrent")
: t("logs.sessionLabel", { n: sessions.length - idx })}
</span>
<span className="text-xs text-text-muted">
<span className="text-text-muted text-xs">
{formatRange(session.firstAt, session.lastAt)}
</span>
<span className="text-xs text-text-muted">
<span className="text-text-muted text-xs">
· {session.entries.length} {t("logs.entriesShort")}
</span>
{session.errorCount > 0 && (
@@ -247,14 +247,14 @@ export function LogPage() {
e.stopPropagation();
clearSession(session.id);
}}
className="rounded p-1 text-text-muted hover:bg-surface-3 hover:text-danger"
className="text-text-muted hover:bg-surface-3 hover:text-danger rounded p-1"
title={t("logs.clearSession")}
>
<Trash2 className="h-3 w-3" />
</button>
</div>
{!effectivelyCollapsed && (
<div className="flex flex-col gap-1 border-t border-border p-2">
<div className="border-border flex flex-col gap-1 border-t p-2">
{session.entries.map((entry) => (
<LogEntryCard key={entry.id} entry={entry} />
))}
+4 -4
View File
@@ -141,7 +141,7 @@ export function OutputPage() {
</div>
<div className="mb-4 flex flex-wrap items-start justify-between gap-3">
<div className="flex-1">
<span className="mb-2 block text-sm font-medium text-text-secondary">
<span className="text-text-secondary mb-2 block text-sm font-medium">
{t("output.selectLanguages")}
</span>
<div className="flex flex-wrap gap-2">
@@ -184,7 +184,7 @@ export function OutputPage() {
</div>
{isMultiLang && (
<div className="mb-4 flex gap-1 rounded-lg bg-surface-1 p-1">
<div className="bg-surface-1 mb-4 flex gap-1 rounded-lg p-1">
{selectedLangs.map((lang) => (
<button
key={lang}
@@ -203,8 +203,8 @@ export function OutputPage() {
)}
{isMultiVideoEnding && (
<div className="border-accent/40 bg-accent/10 mb-4 flex items-center gap-2 rounded-lg border px-3 py-2 text-xs text-text-secondary">
<Film className="h-3.5 w-3.5 shrink-0 text-accent" />
<div className="border-accent/40 bg-accent/10 text-text-secondary mb-4 flex items-center gap-2 rounded-lg border px-3 py-2 text-xs">
<Film className="text-accent h-3.5 w-3.5 shrink-0" />
<span>
{t("output.previewingVideo", {
index: Math.min(endingVideoIndex, endingVideoCount),
+8 -8
View File
@@ -119,7 +119,7 @@ export function PlaylistPage() {
<div className="mx-auto flex max-w-5xl flex-col gap-6 p-6 lg:flex-row">
{/* Form */}
<div className="flex flex-1 flex-col gap-5">
<h1 className="text-lg font-bold text-text-primary">{t("playlist.title")}</h1>
<h1 className="text-text-primary text-lg font-bold">{t("playlist.title")}</h1>
<Select
label={t("editor.language")}
@@ -193,37 +193,37 @@ export function PlaylistPage() {
{/* Output */}
<div className="w-full shrink-0 lg:w-96">
<div className="sticky top-6 flex flex-col gap-4 rounded-lg border border-border bg-surface-1 p-4">
<div className="border-border bg-surface-1 sticky top-6 flex flex-col gap-4 rounded-lg border p-4">
<div>
<div className="mb-1 flex items-center justify-between">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.title")}
</span>
<CopyButton text={output.title} label={t("output.copyTitle")} />
</div>
<p className="text-sm font-medium text-text-primary">{output.title || "..."}</p>
<p className="text-text-primary text-sm font-medium">{output.title || "..."}</p>
</div>
<div>
<div className="mb-1 flex items-center justify-between">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t("output.description")}
</span>
<CopyButton text={output.description} label={t("output.copyDescription")} />
</div>
<pre className="max-h-64 overflow-y-auto whitespace-pre-wrap rounded bg-surface-2 p-2 font-sans text-xs text-text-secondary">
<pre className="bg-surface-2 text-text-secondary max-h-64 overflow-y-auto rounded p-2 font-sans text-xs whitespace-pre-wrap">
{output.description || "..."}
</pre>
</div>
<div>
<div className="mb-1 flex items-center justify-between">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t("playlist.pinnedComment")}
</span>
<CopyButton text={output.comment} label={t("output.copyComment")} />
</div>
<pre className="max-h-64 overflow-y-auto whitespace-pre-wrap rounded bg-surface-2 p-2 font-sans text-xs text-text-secondary">
<pre className="bg-surface-2 text-text-secondary max-h-64 overflow-y-auto rounded p-2 font-sans text-xs whitespace-pre-wrap">
{output.comment || "..."}
</pre>
</div>
+1 -1
View File
@@ -177,7 +177,7 @@ export function ProfilesPage() {
return (
<div className="mx-auto max-w-3xl p-4 sm:p-6">
<div className="mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex gap-1 rounded-lg bg-surface-1 p-1">
<div className="bg-surface-1 flex gap-1 rounded-lg p-1">
{(["profiles", "presets", "templates"] as const).map((t2) => (
<button
key={t2}
+8 -8
View File
@@ -61,7 +61,7 @@ export function SettingsPage() {
return (
<div className="mx-auto max-w-2xl p-4 sm:p-6">
<div className="mb-6 flex flex-wrap items-center justify-between gap-2">
<h1 className="text-lg font-bold text-text-primary">{t("settings.title")}</h1>
<h1 className="text-text-primary text-lg font-bold">{t("settings.title")}</h1>
{/* Ungated since v0.35.0. This pair used to be desktop-only, a leftover
from when "export" meant dumping the on-disk settings.json. Import
has always been a plain <input type="file"> that needs no Tauri, and
@@ -157,7 +157,7 @@ export function SettingsPage() {
checked={settings.strictMode}
onChange={(v) => settings.setSetting("strictMode", v)}
/>
<p className="text-xs text-text-muted">{t("settings.strictModeHint")}</p>
<p className="text-text-muted text-xs">{t("settings.strictModeHint")}</p>
</Accordion>
{/* 4. Title format — NEW in v0.7. Quality badge + format knobs. */}
@@ -211,7 +211,7 @@ export function SettingsPage() {
checked={settings.showGameCopyright}
onChange={(v) => settings.setSetting("showGameCopyright", v)}
/>
<p className="-mt-1 ml-14 text-xs text-text-muted">
<p className="text-text-muted -mt-1 ml-14 text-xs">
{t("settings.showGameCopyrightHint")}
</p>
<Toggle
@@ -230,7 +230,7 @@ export function SettingsPage() {
onChange={(v) => settings.setSetting("showThirdPartyAds", v)}
/>
{settings.showThirdPartyAds && (
<p className="-mt-1 ml-14 text-xs text-text-muted">{t("settings.thirdPartyAdsHint")}</p>
<p className="text-text-muted -mt-1 ml-14 text-xs">{t("settings.thirdPartyAdsHint")}</p>
)}
<Toggle
label={t("settings.splitContactEmail")}
@@ -238,7 +238,7 @@ export function SettingsPage() {
onChange={(v) => settings.setSetting("splitContactEmail", v)}
/>
{settings.splitContactEmail && (
<p className="-mt-1 ml-14 text-xs text-text-muted">
<p className="text-text-muted -mt-1 ml-14 text-xs">
{t("settings.splitContactEmailHint")}
</p>
)}
@@ -247,7 +247,7 @@ export function SettingsPage() {
checked={settings.showTranslationQuality}
onChange={(v) => settings.setSetting("showTranslationQuality", v)}
/>
<p className="-mt-1 ml-14 text-xs text-text-muted">
<p className="text-text-muted -mt-1 ml-14 text-xs">
{t("settings.showTranslationQualityHint")}
</p>
<Toggle
@@ -256,7 +256,7 @@ export function SettingsPage() {
onChange={(v) => settings.setSetting("showPinnedCommentTemplate", v)}
/>
{settings.showPinnedCommentTemplate && (
<div className="ml-4 flex flex-col gap-2 border-l-2 border-border pl-4">
<div className="border-border ml-4 flex flex-col gap-2 border-l-2 pl-4">
<Toggle
label={t("settings.pinnedCommentIncludeAskNextGame")}
checked={settings.pinnedCommentIncludeAskNextGame}
@@ -339,7 +339,7 @@ export function SettingsPage() {
settings.setSetting("logRetentionDays", val);
}}
/>
<p className="text-xs text-text-muted">{t("settings.logRetentionHint")}</p>
<p className="text-text-muted text-xs">{t("settings.logRetentionHint")}</p>
</Accordion>
</div>
</div>
+23 -23
View File
@@ -225,8 +225,8 @@ export function SocialPage() {
return (
<div className="mx-auto max-w-4xl p-6">
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
<h1 className="text-lg font-bold text-text-primary">{t("socialPost.title")}</h1>
<div className="flex gap-1 rounded-lg bg-surface-1 p-1">
<h1 className="text-text-primary text-lg font-bold">{t("socialPost.title")}</h1>
<div className="bg-surface-1 flex gap-1 rounded-lg p-1">
{(["single", "bulk"] as const).map((m) => (
<button
key={m}
@@ -245,7 +245,7 @@ export function SocialPage() {
{mode === "single" ? (
<>
{/* Platform switcher */}
<div className="mb-4 flex flex-wrap gap-1 rounded-lg bg-surface-1 p-1">
<div className="bg-surface-1 mb-4 flex flex-wrap gap-1 rounded-lg p-1">
{SOCIAL_PLATFORMS.map((p) => {
const Icon = p.icon;
return (
@@ -282,16 +282,16 @@ export function SocialPage() {
</div>
{!gameName ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("socialPost.emptyState")}
</p>
) : (
activePost && (
<div className="rounded-lg border border-border bg-surface-1 p-4">
<div className="border-border bg-surface-1 rounded-lg border p-4">
<div className="mb-2 flex items-center justify-between">
<div className="flex items-center gap-2">
<ActiveIcon className="h-4 w-4 text-accent" />
<span className="text-sm font-semibold text-text-primary">
<ActiveIcon className="text-accent h-4 w-4" />
<span className="text-text-primary text-sm font-semibold">
{t(activeConfig.labelKey)}
</span>
</div>
@@ -306,20 +306,20 @@ export function SocialPage() {
</div>
</div>
{activePost.isOver && (
<p className="mb-2 text-xs text-danger">
<p className="text-danger mb-2 text-xs">
{t("socialPost.overLimitHint", {
platform: t(activeConfig.labelKey),
})}
</p>
)}
{activePost.droppedBlocks.length > 0 && (
<p className="mb-2 text-xs text-warning">
<p className="text-warning mb-2 text-xs">
{t("socialPost.trimmedHint", {
count: activePost.droppedBlocks.length,
})}
</p>
)}
<pre className="whitespace-pre-wrap break-words font-sans text-sm text-text-secondary">
<pre className="text-text-secondary font-sans text-sm break-words whitespace-pre-wrap">
{activePost.text}
</pre>
</div>
@@ -329,7 +329,7 @@ export function SocialPage() {
{imported && (
<div className="border-accent/40 bg-accent/5 mt-6 rounded-lg border p-4">
<div className="mb-3 flex items-center justify-between">
<h2 className="text-sm font-semibold text-text-primary">
<h2 className="text-text-primary text-sm font-semibold">
{t("socialPost.importedHeading")}
{imported.gameName ? ` — ${imported.gameName}` : ""}
</h2>
@@ -339,9 +339,9 @@ export function SocialPage() {
</div>
<div className="flex flex-col gap-3">
{imported.posts.map((p) => (
<div key={p.platform} className="rounded-lg bg-surface-2 p-3">
<div key={p.platform} className="bg-surface-2 rounded-lg p-3">
<div className="mb-1 flex items-center justify-between">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{platformLabel(p.platform)}
</span>
<CopyButton
@@ -350,7 +350,7 @@ export function SocialPage() {
limit={p.charLimit}
/>
</div>
<pre className="whitespace-pre-wrap break-words font-sans text-xs text-text-secondary">
<pre className="text-text-secondary font-sans text-xs break-words whitespace-pre-wrap">
{p.text}
</pre>
</div>
@@ -363,7 +363,7 @@ export function SocialPage() {
<div className="flex flex-col gap-4">
{/* Language selector */}
<div>
<span className="mb-2 block text-sm font-medium text-text-secondary">
<span className="text-text-secondary mb-2 block text-sm font-medium">
{t("output.selectLanguages")}
</span>
<div className="flex flex-wrap gap-2">
@@ -415,7 +415,7 @@ export function SocialPage() {
{rangeError && (
<p
role="alert"
className="border-warning/40 bg-warning/10 rounded-lg border px-3 py-2 text-xs text-warning"
className="border-warning/40 bg-warning/10 text-warning rounded-lg border px-3 py-2 text-xs"
>
{rangeError}
</p>
@@ -423,13 +423,13 @@ export function SocialPage() {
<StrictModeBanner />
{bulkResults.length === 0 ? (
<p className="rounded-lg border border-dashed border-border py-8 text-center text-sm text-text-muted">
<p className="border-border text-text-muted rounded-lg border border-dashed py-8 text-center text-sm">
{t("batch.emptyState")}
</p>
) : (
<>
<div className="flex items-center justify-between">
<span className="text-sm text-text-secondary">
<span className="text-text-secondary text-sm">
{bulkResults.length} × {SOCIAL_PLATFORMS.length}
</span>
<CopyButton
@@ -442,9 +442,9 @@ export function SocialPage() {
{bulkResults.map((row) => (
<div
key={`${row.partNumber}-${row.language}`}
className="rounded-lg border border-border bg-surface-1 p-4"
className="border-border bg-surface-1 rounded-lg border p-4"
>
<h3 className="mb-3 text-sm font-semibold text-text-primary">
<h3 className="text-text-primary mb-3 text-sm font-semibold">
{row.partNumber} · {row.language.toUpperCase()}
</h3>
<div className="flex flex-col gap-3">
@@ -452,9 +452,9 @@ export function SocialPage() {
const post = row.posts[p.id];
if (!post) return null;
return (
<div key={p.id} className="rounded-lg bg-surface-2 p-3">
<div key={p.id} className="bg-surface-2 rounded-lg p-3">
<div className="mb-1 flex items-center justify-between">
<span className="text-xs font-medium uppercase text-text-muted">
<span className="text-text-muted text-xs font-medium uppercase">
{t(p.labelKey)}
</span>
<div className="flex items-center gap-2">
@@ -466,7 +466,7 @@ export function SocialPage() {
/>
</div>
</div>
<pre className="max-h-24 overflow-y-auto whitespace-pre-wrap break-words font-sans text-xs text-text-secondary">
<pre className="text-text-secondary max-h-24 overflow-y-auto font-sans text-xs break-words whitespace-pre-wrap">
{post.text}
</pre>
</div>
+3 -3
View File
@@ -32,13 +32,13 @@ export function GenrePlaylistsSection() {
open={accordion.genrePlaylists ?? false}
onToggle={() => toggleAccordion("genrePlaylists")}
badge={
<span className="rounded bg-surface-2 px-1.5 py-0.5 text-xs text-text-muted">
<span className="bg-surface-2 text-text-muted rounded px-1.5 py-0.5 text-xs">
{t("settings.genrePlaylistsBadge", { filled, total: GENRES.length })}
</span>
}
>
<p className="text-xs text-text-muted">{t("settings.genrePlaylistsHelp")}</p>
<p className="text-xs text-text-muted">{t("settings.genrePlaylistsEmptyHint")}</p>
<p className="text-text-muted text-xs">{t("settings.genrePlaylistsHelp")}</p>
<p className="text-text-muted text-xs">{t("settings.genrePlaylistsEmptyHint")}</p>
<div className="flex flex-col gap-2">
{GENRES.map((g) => (
<ValidatedInput
+48 -7
View File
@@ -1,6 +1,47 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";
/*
* Tailwind 4 is configured in CSS, not `tailwind.config.ts` — the file is gone.
*
* Two things replace it:
* @custom-variant dark — the project toggles a `.dark` / `.light` class on
* <html> rather than following the OS, so the default
* `prefers-color-scheme` variant would be wrong.
* @theme — the design tokens, which now generate the utility
* classes directly (bg-surface-1, text-text-muted…).
*
* The palette itself still lives in the plain `:root` / `.light` blocks below,
* because those are what the theme *toggle* rewrites at runtime. `@theme` maps
* Tailwind's names onto those variables; it does not own the values.
*/
@custom-variant dark (&:where(.dark, .dark *));
@theme {
--color-surface-0: var(--surface-0);
--color-surface-1: var(--surface-1);
--color-surface-2: var(--surface-2);
--color-surface-3: var(--surface-3);
--color-border: var(--border);
--color-border-strong: var(--border-strong);
--color-text-primary: var(--text-primary);
--color-text-secondary: var(--text-secondary);
--color-text-muted: var(--text-muted);
--color-accent: var(--accent);
--color-accent-hover: var(--accent-hover);
--color-accent-muted: var(--accent-muted);
--color-success: var(--success);
--color-warning: var(--warning);
--color-danger: var(--danger);
--font-sans: var(--font-sans-stack);
--font-mono: var(--font-mono-stack);
--spacing-touch: 44px;
}
:root {
/* Dark theme (default) */
@@ -24,8 +65,8 @@
--warning: #eab308;
--danger: #ef4444;
--font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
--font-sans-stack: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
--font-mono-stack: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
}
.light {
@@ -51,7 +92,7 @@
}
body {
@apply bg-surface-0 font-sans text-text-primary;
@apply bg-surface-0 text-text-primary font-sans;
margin: 0;
min-height: 100vh;
}
@@ -66,7 +107,7 @@ body {
}
::-webkit-scrollbar-thumb {
@apply rounded-full bg-surface-3;
@apply bg-surface-3 rounded-full;
}
::-webkit-scrollbar-thumb:hover {
+1 -2
View File
@@ -149,8 +149,7 @@ function isExportType(value: string): value is ExportType {
*/
function guessArrayType(arr: unknown[]): ExportType | null {
const sample = arr.find((x) => !!x && typeof x === "object") as
| Record<string, unknown>
| undefined;
Record<string, unknown> | undefined;
if (!sample) return null;
// Templates have a top-level `snapshot` object — most distinctive
+2 -4
View File
@@ -37,8 +37,7 @@ export type ImportFailure =
| { kind: "newer-schema"; expected: ExportType; actual: number; supported: number };
export type ImportResult<T> =
| { ok: true; data: T; sourceVersion?: number }
| { ok: false; failure: ImportFailure };
{ ok: true; data: T; sourceVersion?: number } | { ok: false; failure: ImportFailure };
/**
* Write `data` to a user-chosen file as a typed envelope JSON file. The
@@ -88,8 +87,7 @@ export function importParsedFromJsonFile(): Promise<
let settled = false;
const settle = (
result:
| { ok: true; shape: DetectedShape; rawText: string }
| { ok: false; failure: ImportFailure },
{ ok: true; shape: DetectedShape; rawText: string } | { ok: false; failure: ImportFailure },
) => {
if (settled) return;
settled = true;
-46
View File
@@ -1,46 +0,0 @@
import type { Config } from "tailwindcss";
export default {
content: ["./index.html", "./src/**/*.{ts,tsx}"],
darkMode: "class",
theme: {
extend: {
colors: {
surface: {
0: "var(--surface-0)",
1: "var(--surface-1)",
2: "var(--surface-2)",
3: "var(--surface-3)",
},
border: {
DEFAULT: "var(--border)",
strong: "var(--border-strong)",
},
text: {
primary: "var(--text-primary)",
secondary: "var(--text-secondary)",
muted: "var(--text-muted)",
},
accent: {
DEFAULT: "var(--accent)",
hover: "var(--accent-hover)",
muted: "var(--accent-muted)",
},
success: "var(--success)",
warning: "var(--warning)",
danger: "var(--danger)",
},
fontFamily: {
sans: ["var(--font-sans)"],
mono: ["var(--font-mono)"],
},
spacing: {
touch: "44px",
},
minHeight: {
touch: "44px",
},
},
},
plugins: [],
} satisfies Config;