feat(VOC-131): add GenerateButton component and dashboard integration - #29
Open
FSS3096 wants to merge 1 commit into
Open
feat(VOC-131): add GenerateButton component and dashboard integration#29FSS3096 wants to merge 1 commit into
FSS3096 wants to merge 1 commit into
Conversation
- Create components/GenerateButton.tsx with all required states:
- Idle (no repo): disabled button with muted 'Select a repo first' label
- Idle (repo selected): primary blue CTA — 'Generate Post from Latest Activity'
- Loading: button replaced by LoadingView spinner (no double-submit possible)
- Error: ErrorView with retry + button reappears for retry
- Success: stores response in sessionStorage['voca_drafts'], push('/drafts)
- Create components/DashboardClient.tsx — Client Component boundary that owns
selectedRepo state and passes it to both RepoSelector and GenerateButton.
This cleanly solves the Server Component → state ownership problem without
prop drilling.
- Refactor components/RepoSelector.tsx to support controlled mode:
- New optional props: onRepoSelect (callback) + selectedRepo (controlled value)
- Controlled mode: used by DashboardClient for VOC-131 flow
- Uncontrolled/legacy mode: original behaviour preserved for existing callers
- Update app/dashboard/page.tsx to use DashboardClient instead of bare
RepoSelector; page stays a Server Component for auth guard.
Acceptance criteria covered:
✅ Button visible after repo selection
✅ Button disabled (not hidden) when no repo selected
✅ POST /api/generate called with { repoFullName }
✅ Loading state replaces button (no double-submit)
✅ Error state with retry (coordinates with Arthakram#18)
✅ sessionStorage key 'voca_drafts' on success
✅ router.push('/drafts') on success
✅ Mobile: w-full, capped at max-w-[400px] centered on desktop
✅ Accessible: aria-label, aria-disabled, role=status/alert, focus-visible ring
Placeholder stubs for LoadingView and ErrorView are intentionally co-located
in GenerateButton.tsx — swap to real components (Arthakram#17, Arthakram#18) is a one-line
import change.
Relates to: VOC-131
Blocks: Arthakram#17 (loading state), Arthakram#18 (error handling)
Depends on: /api/generate endpoint (Arthakram#15)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Create components/GenerateButton.tsx with all required states:
Create components/DashboardClient.tsx — Client Component boundary that owns selectedRepo state and passes it to both RepoSelector and GenerateButton. This cleanly solves the Server Component → state ownership problem without prop drilling.
Refactor components/RepoSelector.tsx to support controlled mode:
Update app/dashboard/page.tsx to use DashboardClient instead of bare RepoSelector; page stays a Server Component for auth guard.
Acceptance criteria covered:
✅ Button visible after repo selection ✅ Button disabled (not hidden) when no repo selected ✅ POST /api/generate called with { repoFullName } ✅ Loading state replaces button (no double-submit) ✅ Error state with retry (coordinates with #18) ✅ sessionStorage key 'voca_drafts' on success ✅ router.push('/drafts') on success ✅ Mobile: w-full, capped at max-w-[400px] centered on desktop ✅ Accessible: aria-label, aria-disabled, role=status/alert, focus-visible ring
Placeholder stubs for LoadingView and ErrorView are intentionally co-located in GenerateButton.tsx — swap to real components (#17, #18) is a one-line import change.
Relates to: VOC-131
Blocks: #17 (loading state), #18 (error handling)
Depends on: /api/generate endpoint (#15)
Summary
Type of Change
🐛 Bug fix
- [ ] ✨ New feature
- [ ] 🔨 Refactor / tech debt
- [ ] 📝 Documentation update
- [ ] 🚀 Performance improvement
- [ ] 🔧 Config / tooling change
## What Changed
-
-
## Testing
- [ ] Manual testing done
- [ ] Existing tests pass
- [ ] New tests added (if applicable)
## Screenshots / Demo
## Checklist
- [ ] Self-reviewed the code
- [ ] No console errors or warnings
- [ ] PR title follows
type: short descriptionconvention- [ ] Linked to relevant issue (closes #)
- [ ] Ready for review (not a draft)