-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ux): inline editor + visual grouper + scroll fixes for meus treinos #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6f017d6
docs: meus treinos UX improvements design spec
EmiyaKiritsugu3 0152a0f
docs: detailed implementation plan for meus treinos UX improvements
EmiyaKiritsugu3 e3ca417
feat(workout-editor): add compact prop to drop outer Card wrapper
EmiyaKiritsugu3 d5377ee
feat(ux): expose planName from useWorkoutGeneration for visual groupe…
EmiyaKiritsugu3 74777c1
feat(ux): inline editor inside treino cards, remove bottom editor
EmiyaKiritsugu3 47ff225
fix(test): update use-workout-crud tests for inline editor changes
EmiyaKiritsugu3 aced7c8
feat(ux): visual grouper banner + after-gen scroll anchor
EmiyaKiritsugu3 b178f03
test(ux): update meus-treinos-client tests for planName banner
EmiyaKiritsugu3 e177695
fix(ux): reset planName before each generation
EmiyaKiritsugu3 e49ed5f
fix(ux): add plan description to banner card
EmiyaKiritsugu3 e7900ca
fix(ux): retry scroll with requestAnimationFrame until DOM ready
EmiyaKiritsugu3 1e287c4
fix(auth): resolve Prisma alunoId vs Auth UUID in delete+update autho…
EmiyaKiritsugu3 2c65f93
fix(review): address PR #175 review findings — all severity levels
EmiyaKiritsugu3 e798b1e
fix(type): make onSuccess optional in useWorkoutGeneration
EmiyaKiritsugu3 2133cfe
fix(ux): keep editor open on save failure + dead code cleanup
EmiyaKiritsugu3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
431 changes: 431 additions & 0 deletions
431
docs/superpowers/plans/2026-07-05-meus-treinos-ux-improvements.md
Large diffs are not rendered by default.
Oops, something went wrong.
88 changes: 88 additions & 0 deletions
88
docs/superpowers/specs/2026-07-05-meus-treinos-ux-improvements-design.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Design: Meus Treinos UX Improvements | ||
|
|
||
| **Date:** 2026-07-05 | ||
| **Branch:** `fix/meus-treinos-ux-improvements` | ||
| **Scope:** UX only — zero schema/API changes | ||
|
|
||
| ## Problem | ||
|
|
||
| 1. **Scroll paradox** — clicking "Editar" on a treino card runs `window.scrollTo({top:0})` but the editor appears at page bottom. User loses context, must scroll down manually. | ||
| 2. **No visual grouping** — AI generates 3-day split (e.g. Peito/Triceps + Costas/Biceps + Pernas/Ombros). Three independent cards with no visual connection. | ||
| 3. **After-gen feedback gap** — `router.refresh()` fixed (commit 1118d92), but no visual anchor after generation completes. | ||
|
|
||
| ## Design | ||
|
|
||
| ### 1. Inline Editor | ||
|
|
||
| Clicking "Editar" on a card renders `WorkoutEditor` **inside the card**, replacing exercise list. No scroll. Cancel/Save collapses back to normal view. | ||
|
|
||
| **Card states:** | ||
|
|
||
| ``` | ||
| NORMAL: EDITING: | ||
| ┌─────────────────────────────┐ ┌──────────────────────────────────┐ | ||
| │ Peito/Triceps [Seg] [▶][✏][🗑]│ │ ✏ Editando: Peito/Triceps │ | ||
| │ 5 exercicios │ │ ┌──────────────────────────────┐ │ | ||
| │ │ │ │ WorkoutEditor (exercises) │ │ | ||
| │ Dropdown agendamento │ │ └──────────────────────────────┘ │ | ||
| └─────────────────────────────┘ │ [Cancelar] [Salvar] │ | ||
| └──────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| **Files:** | ||
| - `card-treino.tsx` — add `isEditing` state + inline render of WorkoutEditor | ||
| - `workout-editor.tsx` — add `compact?: boolean` prop to suppress outer Card wrapper | ||
| - `meus-treinos-client.tsx` — remove bottom-of-page editor, wire inline mode | ||
|
|
||
| ### 2. Visual Grouper — Plano Semanal | ||
|
|
||
| After AI generation, banner appears above "Meus Treinos Pessoais" for 30s. | ||
|
|
||
| **Detection:** `useWorkoutGeneration` exposes `planName` from `streamWorkoutPlan` return. Client stores in state, renders banner, auto-clears after 30s. | ||
|
|
||
| ```tsx | ||
| <Card className="bg-gradient-to-r from-primary/5 to-secondary/5 border-primary/20"> | ||
| <CardHeader> | ||
| <CardTitle className="flex items-center gap-2"> | ||
| <Sparkles className="text-primary" /> | ||
| Plano Semanal: {planName} | ||
| </CardTitle> | ||
| <CardDescription>{diaLabels.join(' → ')}</CardDescription> | ||
| </CardHeader> | ||
| </Card> | ||
| ``` | ||
|
|
||
| Cards part of plan get `border-l-2 border-primary/30 ml-2 pl-4` timeline visual. | ||
|
|
||
| ### 3. After-gen Scroll | ||
|
|
||
| Scroll smooth to `#treinos-pessoais` after `router.refresh()`. | ||
|
|
||
| ### 4. Remove Bottom Editor | ||
|
|
||
| "Criar Novo Treino Manualmente" button moves **above** treino list. When clicked, renders `WorkoutEditor` inline above first card. Bottom conditional editor removed. | ||
|
|
||
| ## Files Changed | ||
|
|
||
| | File | Change | Risk | | ||
| |---|---|---| | ||
| | `card-treino.tsx` | +isEditing state, inline WorkoutEditor render | Low | | ||
| | `workout-editor.tsx` | +`compact?: boolean` prop | Low | | ||
| | `meus-treinos-client.tsx` | -bottom editor, +banner, +planName, +scroll anchor | Medium | | ||
| | `use-workout-generation.ts` | +expose planName from hook return | Low | | ||
| | `card-treino.test.tsx` | +inline edit tests | Low | | ||
| | `meus-treinos-client.test.tsx` | +banner tests | Low | | ||
|
|
||
| ## Out of Scope | ||
|
|
||
| - PlanoSemanal Prisma model | ||
| - Plan-wide progress tracking | ||
| - 1-day = 1-card data model change | ||
|
|
||
| ## Success Criteria | ||
|
|
||
| 1. Click "Editar" → editor appears inside same card, zero page jump | ||
| 2. "Cancelar" / "Salvar" → card returns to normal | ||
| 3. AI gen: banner 30s + day sequence + scroll to treino list | ||
| 4. "Criar Manual" above list, opens inline editor | ||
| 5. All quality gates pass | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The design doc now points implementation to
card-treino.tsx, while the implementation plan explicitly says inline editing must not be done there. This conflict can send contributors to modify the wrong component path, so aligning both docs to the same target file(s) would avoid rework.Prompt for AI agents