feat: refine subtitle flow and study UI

This commit is contained in:
TTlaji committed 2026-06-04 01:26:41 +08:00
1 parent 6a6fd347bd
commit 0608b84664
24 files changed
+795 -730

No files matched your search

@@ -0,0 +1,75 @@
# Speaking Lab Home Premium Cards UI Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Restyle the home page with a spacious premium card-based learning library look.
**Architecture:** Keep the existing HTML and JavaScript. Implement the design through `styles.css` by updating page background, home grid layout, dashboard surfaces, metric button states, material card presentation, stat bar styling, and chip styling.
**Tech Stack:** CSS, existing vanilla HTML/JS, existing local FastAPI server for browser verification.
---
## Task 1: Restyle Home Layout And Dashboard
**Files:**
- Modify: `F:\ooo\speaking-practice-local\styles.css`
- [ ] **Step 1: Update page background and home shell**
Set `.home-page` to `#f8fafc`, and `.home-shell` to a 280px sidebar grid with larger gap and padding.
- [ ] **Step 2: Update dashboard surface**
Make `.home-dashboard-title` and `.home-metric` feel premium: white background, 16px radius, soft gray shadow, smooth transition.
- [ ] **Step 3: Add metric hover and active states**
Hover should lift slightly and deepen the border/shadow. Active should use a subtle blue-tinted or teal-tinted background, not harsh black.
## Task 2: Restyle Material Grid And Cards
**Files:**
- Modify: `F:\ooo\speaking-practice-local\styles.css`
- [ ] **Step 1: Update card grid**
Use `repeat(auto-fill, minmax(320px, 1fr))` and `gap: 24px`.
- [ ] **Step 2: Update material cards**
Use white cards, 16px radius, overflow hidden, soft shadow, and `translateY(-4px)` hover.
- [ ] **Step 3: Update cover and card body**
Set cover height to 180px. Increase card body padding. Improve title weight/color/line-height.
- [ ] **Step 4: Update stats**
Make `.home-card-stats` a compact bottom bar with a dashed top border and horizontal flex-like grid.
## Task 3: Restyle Chips And Verify
**Files:**
- Modify: `F:\ooo\speaking-practice-local\styles.css`
- [ ] **Step 1: Update `.chip`**
Make chips capsule-shaped with soft gray default state and strong active state.
- [ ] **Step 2: Run checks**
Run:
```powershell
node --check home.js
node --check app.js
node --check admin.js
python -m py_compile backend\main.py backend\db.py
node tests\progress-helpers.test.mjs
node tests\admin-file-input.test.mjs
```
- [ ] **Step 3: Browser verify**
Open `http://127.0.0.1:8000/` and confirm layout, cards, hover behavior, chips, and no text overlap.
@@ -0,0 +1,64 @@
# Speaking Lab Study Toolbar Polish Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Center the main sentence controls, enlarge the loop toggle, remove continue/watch-later actions from the study toolbar, and polish the study page visual consistency.
**Architecture:** Update `study.html` toolbar zones, remove now-unused visible bindings from `app.js`, and restyle the toolbar in `styles.css`. Keep existing recording, favorite, sentence navigation, and loop behavior.
**Tech Stack:** Vanilla HTML, CSS, JavaScript.
---
## Task 1: Update Toolbar Markup
**Files:**
- Modify: `F:\ooo\speaking-practice-local\study.html`
- [ ] Replace toolbar content with three zones:
- `.recording-controls`: `录音 / 停止 / 回放`
- `.sentence-controls`: `上一句 / 重播 / 下一句`
- `.study-side-actions`: enlarged loop toggle and `收藏`
## Task 2: Remove Deleted Button Bindings
**Files:**
- Modify: `F:\ooo\speaking-practice-local\app.js`
- [ ] Remove `continueBtn` and `watchLaterBtn` DOM references.
- [ ] Remove event listeners for `continueLearning` and `watchLater`.
- [ ] Remove visible text updates for `watchLaterBtn`.
- [ ] Guard or remove `renderContinueAction()` calls so no missing element is referenced.
## Task 3: Style Unified Toolbar
**Files:**
- Modify: `F:\ooo\speaking-practice-local\styles.css`
- [ ] Make `.tool-row` a three-column grid: left, center, right.
- [ ] Style `.sentence-controls` as the centered primary control group.
- [ ] Style `.recording-controls` as secondary.
- [ ] Enlarge `.toggle` inside `.study-side-actions`.
- [ ] Keep narrow viewport wrapping without horizontal overflow.
## Task 4: Verify
Run:
```powershell
node --check app.js
node --check home.js
node --check admin.js
python -m py_compile backend\main.py backend\db.py
node tests\progress-helpers.test.mjs
node tests\admin-file-input.test.mjs
```
Browser check:
- Open `http://127.0.0.1:8000/study.html`.
- Confirm `继续学习` and `稍后再看` are gone.
- Confirm `上一句 / 重播 / 下一句` are centered.
- Confirm loop toggle is larger.
- Confirm favorite remains.
- Confirm no horizontal overflow.
@@ -0,0 +1,86 @@
# Speaking Lab Home Premium Cards UI Design
## Goal
Upgrade the home page visual design into a cleaner, higher-quality learning library interface.
This pass focuses on spacing, cards, dashboard polish, material card quality, and category chips.
## Scope
Included:
- Home page background and layout spacing.
- Home shell grid with a 280px sidebar and adaptive content area.
- White dashboard surface with 16px radius and soft shadow.
- Metric card hover and active transitions.
- Larger, clearer metric numbers.
- Responsive material card grid using `repeat(auto-fill, minmax(320px, 1fr))`.
- Premium white material cards with 16px radius, soft shadow, and hover lift.
- Fixed 180px cover area.
- More comfortable card content spacing and title hierarchy.
- Dashed divider above card stats.
- Card stats as a compact horizontal bottom bar.
- Capsule category chips with soft default state and strong active state.
Excluded:
- README changes.
- Backend changes.
- Study page changes.
- Admin page changes.
- New data fields.
- Custom thumbnail upload.
- Real image extraction.
## Visual Rules
Use:
- page background `#f8fafc`
- cards `#ffffff`
- soft gray borders
- soft non-black shadows
- 16px radii for dashboard and material cards
- 20px pill radii for chips
- subtle motion: `translateY(-4px)` on material card hover
Avoid:
- heavy dark shadows
- large gradients dominating cards
- reducing readability
- layout shifts on hover
## Implementation Notes
The existing HTML structure already supports the design.
Implementation should primarily modify `styles.css`.
The existing generated cover tones can remain, but the cover area should have a stable 180px height and feel more refined.
The existing `dl.home-card-stats` should be restyled as a bottom stat bar instead of boxed mini cards.
## Verification
Automated checks:
```powershell
node --check home.js
node --check app.js
node --check admin.js
python -m py_compile backend\main.py backend\db.py
node tests\progress-helpers.test.mjs
node tests\admin-file-input.test.mjs
```
Browser checks:
1. Open `http://127.0.0.1:8000/`.
2. Confirm the page background is light gray-blue.
3. Confirm sidebar width and spacing feel more premium.
4. Confirm material card grid uses wider cards.
5. Hover a material card and confirm it lifts smoothly.
6. Confirm category chips are capsule-shaped.
7. Confirm no text overlaps on desktop or narrow viewport.
@@ -0,0 +1,73 @@
# Speaking Lab Study Toolbar Polish Design
## Goal
Refine the study page toolbar so the core English practice controls feel centered, focused, and visually consistent with the upgraded home page UI.
## Scope
Included:
- Remove `继续学习` from the study page toolbar.
- Remove `稍后再看` from the study page toolbar.
- Keep `收藏`.
- Place `上一句 / 重播 / 下一句` in the visual center as the primary practice controls.
- Place recording controls as secondary controls on the left.
- Place a larger loop toggle and favorite action on the right.
- Style the toolbar and buttons with a premium white-card look matching the home page.
Excluded:
- Removing existing localStorage `watchLater` data.
- Removing helper functions unrelated to visible toolbar behavior.
- Backend changes.
- README changes.
- Home page changes.
## Layout
The toolbar uses three zones:
- Left: `录音 / 停止 / 回放`
- Center: `上一句 / 重播 / 下一句`
- Right: large `循环` toggle and `收藏`
On narrow screens, the zones may wrap but should remain readable and should not overflow horizontally.
## Behavior
Existing behavior remains:
- Previous sentence jumps back one cue.
- Replay jumps to current sentence.
- Next sentence jumps forward one cue.
- Loop checkbox controls sentence loop.
- Favorite toggles current material in favorites.
- Recording controls keep existing browser recording behavior.
Removed behavior:
- The study page no longer exposes a `继续学习` button.
- The study page no longer exposes a `稍后再看` button.
## Verification
Run:
```powershell
node --check app.js
node --check home.js
node --check admin.js
python -m py_compile backend\main.py backend\db.py
node tests\progress-helpers.test.mjs
node tests\admin-file-input.test.mjs
```
Browser checks:
1. Open `http://127.0.0.1:8000/study.html`.
2. Confirm `上一句 / 重播 / 下一句` are centered.
3. Confirm `循环` is larger and easy to see.
4. Confirm `继续学习` and `稍后再看` do not appear.
5. Confirm `收藏` still works.
6. Confirm no horizontal overflow on a narrow viewport.