Skip to content

feat(subtitles): add a settings toggle menu for video subtitles#1283

Merged
taiiiyang merged 7 commits intomainfrom
feat/subtitles-menu-toggle
Apr 6, 2026
Merged

feat(subtitles): add a settings toggle menu for video subtitles#1283
taiiiyang merged 7 commits intomainfrom
feat/subtitles-menu-toggle

Conversation

@taiiiyang
Copy link
Copy Markdown
Collaborator

@taiiiyang taiiiyang commented Apr 5, 2026

Type of Changes

  • ✨ New feature (feat)
  • 🐛 Bug fix (fix)
  • 📝 Documentation change (docs)
  • 💄 UI/style change (style)
  • ♻️ Code refactoring (refactor)
  • ⚡ Performance improvement (perf)
  • ✅ Test related (test)
  • 🔧 Build or dependencies update (build)
  • 🔄 CI/CD related (ci)
  • 🌐 Internationalization (i18n)
  • 🧠 AI model related (ai)
  • 🔄 Revert a previous commit (revert)
  • 📦 Other changes that do not modify src or test files (chore)

Description

  • change the subtitles toolbar button from a direct toggle into a settings entry point
  • add an inline settings panel with a dedicated subtitles visibility switch
  • move subtitles toggle handling into the shared UI context so manual and auto-start flows stay consistent
  • keep the settings panel aligned with player controls and close it on outside click, escape, or navigation
image

Related Issue

Closes #

How Has This Been Tested?

  • Added unit tests
  • Verified through manual testing

Screenshots

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • 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.

Additional Information

  • test plan intentionally left unchanged per request

Summary by cubic

Adds a subtitles settings panel and makes the toolbar button open it. Subtitles toggling (manual and auto-start) now runs through the adapter for consistent state and analytics.

  • New Features

    • Toolbar button opens a settings panel (not a direct toggle); shows ON/OFF and pressed state.
    • Panel includes a subtitles switch; positions above controls with a dynamic offset; closes on outside click or Esc.
    • Auto-start is respected after the scheduler is ready; state mirrors in the button and panel.
    • Reduced panel opacity to be less distracting.
  • Refactors

    • Added SubtitlesUIContext; UI calls toggleSubtitles from context and reads controlsConfig.
    • UniversalVideoAdapter.initialize() is async; renders the button, initializes the scheduler, then auto-starts via tryAutoStartSubtitles; exposes toggleSubtitlesManually.
    • YouTube setup returns the adapter; UI mounts with { onToggleSubtitles: adapter.toggleSubtitlesManually }, then calls initialize().
    • Simplified button API (renderSubtitlesTranslateButton()); new SubtitlesTranslateButton toggles the panel; panel state tracked in subtitlesSettingsPanelOpenAtom and reset on navigation.
    • Shadow host uses visible overflow for correct panel layering.

Written for commit 4124bc5. Summary will update on new commits.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 5, 2026

🦋 Changeset detected

Latest commit: 4124bc5

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

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 5, 2026
@github-actions github-actions bot added feat contrib-trust:trusted PR author trust score is 60-79. labels Apr 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Contributor trust score

70/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 32/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: 66 (author commits reachable from the repository default branch)
  • Repo PR history: merged 75, open 1, closed-unmerged 6
  • Repo reviews: 9
  • PR changed lines: 609 (+413 / -196)
  • Repo permission: write
  • Followers: 15
  • Account age: 77 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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 15 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/entrypoints/subtitles.content/platforms/youtube/index.ts">

<violation number="1" location="src/entrypoints/subtitles.content/platforms/youtube/index.ts:8">
P1: Initialize the adapter before returning it; otherwise the UI can call `toggleSubtitlesManually` before the scheduler exists, so the first toggle may hide native captions without ever showing translated subtitles.</violation>
</file>

<file name="src/entrypoints/subtitles.content/init-youtube-subtitles.ts">

<violation number="1" location="src/entrypoints/subtitles.content/init-youtube-subtitles.ts:23">
P2: Only initialize the adapter when subtitle UI mount succeeds; currently initialization proceeds even if mount exits early.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2c083548e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 5, 2026
@mengxi-ream
Copy link
Copy Markdown
Owner

感觉之后可以给这个菜单加一点透明度

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1876bf8f77

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

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. feat lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants