Skip to content

refactor(subtitles): replace route-based navigation with flat panel navigator#1368

Merged
taiiiyang merged 1 commit intomainfrom
feat/subtitles-settings-router
Apr 23, 2026
Merged

refactor(subtitles): replace route-based navigation with flat panel navigator#1368
taiiiyang merged 1 commit intomainfrom
feat/subtitles-settings-router

Conversation

@taiiiyang
Copy link
Copy Markdown
Collaborator

@taiiiyang taiiiyang commented Apr 23, 2026

Type of Changes

  • ♻️ Code refactoring (refactor)

Description

Refactor the subtitles settings panel from a flat component structure into a view-based panel navigator, preparing for future submenus (e.g., subtitle style settings).

Key changes:

  • Add views/ directory as single source of truth for panel navigation (ViewId, SUBPAGES config, component registry)
  • Replace monolithic settings-panel-shell.tsx with a presentational panel-shell.tsx that receives resolved header? and transition? props
  • Add SubpageMenuEntry component for navigable submenu entries
  • Extract panel dismiss logic (click-outside, Escape) into dedicated use-subtitles-panel-dismiss hook
  • Add subtitlesSettingsPanelViewAtom to track current view, with reset on panel close and video navigation
  • Support forward/back transition animation for subpage navigation

Adding a new subpage now requires:

  1. Add a literal to ViewId type
  2. Add an entry to SUBPAGES array
  3. Create a view component file

No other files need to change — main menu picks it up automatically.

How Has This Been Tested?

  • Verified through manual testing
  • Type-check passes (pnpm type-check)
  • All 116 test files pass (pnpm test)

Checklist

  • I have tested these changes locally
  • My code follows the code style of this project
  • My changes do not break existing functionality
  • If my code was generated by AI, I have proofread and improved it as necessary.

…avigator

Replace the multi-file route system (routes/defs.ts, routes/config.tsx,
routes/index.ts) with a single-source-of-truth views/ directory using
flat ViewId strings instead of path-style RoutePath.

- Merge route definitions, metadata, and component map into views/index.tsx
- Make PanelShell purely presentational (header? + transition? props)
- Simplify translate button onClick to one-line reset + toggle
- Rename SubtitlesSettingsAction to SubpageMenuEntry
- Extract panel dismiss logic into dedicated hook

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

🦋 Changeset detected

Latest commit: 895f526

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@read-frog/extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added refactor contrib-trust:trusted PR author trust score is 60-79. labels Apr 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Contributor trust score

73/100 — Trusted

This score estimates contributor familiarity with mengxi-ream/read-frog using public GitHub signals. It is advisory only and does not block merges automatically.

Outcome

Score breakdown

Dimension Score Signals
Repo familiarity 35/35 commits in repo, merged PRs, reviews
Community standing 17/25 account age, followers, repo role
OSS influence 3/20 stars on owned non-fork repositories
PR track record 18/20 merge rate across resolved PRs in this repo

Signals used

  • Repo commits: 73 (author commits reachable from the repository default branch)
  • Repo PR history: merged 82, open 1, closed-unmerged 6
  • Repo reviews: 11
  • PR changed lines: 452 (+351 / -101)
  • Repo permission: write
  • Followers: 17
  • Account age: 78 months
  • Owned non-fork repos considered: max 2, total 2 (taiiiyang/oss-stamp (2), taiiiyang/homepage (0), taiiiyang/gsap_cocktail (0), taiiiyang/visactor-image (0), taiiiyang/react-components (0), taiiiyang/TinyVis (0), taiiiyang/taiiiyang (0), taiiiyang/toolbox (0), taiiiyang/find_txt (0), taiiiyang/rustlings_answer (0), taiiiyang/vue-mini (0))

Policy

  • Low-score review threshold: < 30
  • Auto-close: score < 20 and changed lines > 1000
  • Policy version: v1.1

Updated automatically when the PR changes or when a maintainer reruns the workflow.

@taiiiyang taiiiyang merged commit 26b06af into main Apr 23, 2026
6 checks passed
@taiiiyang taiiiyang deleted the feat/subtitles-settings-router branch April 23, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib-trust:trusted PR author trust score is 60-79. refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant