Feat/voc 132 loading view - #30
Open
FSS3096 wants to merge 2 commits into
Open
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)
…sages
- Create components/LoadingView.tsx with full step cycling behaviour:
- Step 0 (0–3s): 'Reading your latest commits...'
- Step 1 (3–6s): 'Finding the most meaningful changes...'
- Step 2 (6–10s): 'Writing 3 post variations for you...'
- Step 3 (10–20s): 'Almost there — polishing the drafts...'
- Step 4 (20s+): 'Taking a bit longer than usual — still working...'
└─ Infinity duration: never auto-advances, persists until success/error
- Zero layout shift: text container has min-h-[3.5rem] (56px) sized to the
tallest two-line message, so spinner/dots stay pinned during step transitions
- Dot progress indicator (4 dots for planned steps 0–3):
- Past and current steps filled (bg-blue-600)
- Future steps muted (bg-gray-300)
- Overflow step (4): all dots filled to signal 'phases complete, waiting on API'
- Overflow sub-label on step 4 sets correct expectations
('Complex repositories... can take up to 30 seconds')
- Memory safe: clearTimeout in useEffect cleanup prevents leaks if the
component unmounts mid-timer (error fires, user navigates away, etc.)
- Accessible: role=status, aria-live=polite, aria-label, aria-hidden on
decorative spinner
- Update components/GenerateButton.tsx: swap inline LoadingView stub for
real import from VOC-132 (one-line change as designed)
Acceptance criteria:
✅ Zero delay render (fully client-side, no API calls)
✅ Steps auto-advance at correct timings (±500ms)
✅ Step 5 appears only after 20s, never auto-advances
✅ Spinner animates continuously
✅ Dot indicators correctly highlight current step
✅ Mobile responsive (px-4, max-w-sm text, flex layout)
✅ No memory leaks (clearTimeout in cleanup)
✅ No layout shift (min-h reserved on text container)
Linear: VOC-132
Depends on: VOC-131 (Arthakram#16)
Blocks: VOC-133 (Arthakram#18)
AradhyaTiwari10
approved these changes
Jul 18, 2026
AradhyaTiwari10
left a comment
Contributor
There was a problem hiding this comment.
The LoadingView implementation is clean. Timer cleanup in useEffect, layout stability using min-h, and aria-live="polite" are all implemented correctly.
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.
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)