Skip to content

Feat/voc 132 loading view - #30

Open
FSS3096 wants to merge 2 commits into
Arthakram:mainfrom
FSS3096:feat/VOC-132-loading-view
Open

Feat/voc 132 loading view#30
FSS3096 wants to merge 2 commits into
Arthakram:mainfrom
FSS3096:feat/VOC-132-loading-view

Conversation

@FSS3096

@FSS3096 FSS3096 commented Jul 15, 2026

Copy link
Copy Markdown

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 description convention

  • - [ ] Linked to relevant issue (closes #)

  • - [ ] Ready for review (not a draft)

FSS3096 added 2 commits July 15, 2026 22:36
- 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 AradhyaTiwari10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The LoadingView implementation is clean. Timer cleanup in useEffect, layout stability using min-h, and aria-live="polite" are all implemented correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants