Skip to content

refactor(link-wizard): give the queue a module - #446

Open
chiptus wants to merge 2 commits into
mainfrom
refactor/link-wizard-queue-module
Open

refactor(link-wizard): give the queue a module#446
chiptus wants to merge 2 commits into
mainfrom
refactor/link-wizard-queue-module

Conversation

@chiptus

@chiptus chiptus commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Deepens the Link Wizard's queue navigation into useLinkWizardQueue, replacing the ad-hoc state and index math spread across LinkWizard.tsx. useLinkWizardSkipped stays a separate module, passed in as a dependency so the popover and queue share one localStorage-backed instance.

Closes #445

Verification

  • Open the Link Wizard for an edition with multiple artists missing links; queue shows all of them, current artist highlighted.
  • Toggle a stage filter; queue narrows and current artist stays valid.
  • Skip an artist; it's marked skipped and the wizard advances to the next artist.
  • Save an artist's links; it's marked saved and the wizard advances to the next artist.
  • Skip/save the last artist in the (filtered) queue; wizard moves to the previous artist instead of going out of bounds.
  • Click an artist directly in the queue list; wizard jumps to it.
  • On mobile, use "View all" to expand the preview queue.
  • Restore a skipped/saved artist from the popover; it reappears in the queue.

Copilot AI lite review requested due to automatic review settings August 28, 2026 07:43
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview Aug 28, 2026 8:20pm

Copilot AI 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.

🟡 Changes recommended

The new queue hook currently reports position: 1 when the queue is empty (inconsistent state), and the new tests couple to useLinkWizardSkipped’s localStorage schema instead of its public API.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the Link Wizard’s “queue navigation” into a dedicated useLinkWizardQueue hook, moving selection, stage filtering, and skip/save-then-advance logic out of LinkWizard.tsx and tightening the UI wiring.

Changes:

  • Added useLinkWizardQueue hook to own filtered queue state, current selection, and navigation actions.
  • Updated LinkWizard.tsx to delegate queue behavior to the new hook and simplify the page component.
  • Updated LinkWizardQueue.tsx to own the mobile “View all” preview toggle locally and removed related props; added hook tests for queue behavior.
File summaries
File Description
src/pages/admin/festivals/LinkWizard/useLinkWizardQueue.ts New queue hook centralizing filtering + navigation and exposing a small semantic interface.
src/pages/admin/festivals/LinkWizard/useLinkWizardQueue.test.ts New hook tests covering filtering, selection, prev/skip/save behavior, and post-filter consistency.
src/pages/admin/festivals/LinkWizard/LinkWizardQueue.tsx Moves mobile preview “View all” state into the queue UI component and trims prop surface.
src/pages/admin/festivals/LinkWizard/LinkWizard.tsx Replaces ad-hoc queue/index math with useLinkWizardQueue and wires actions through to the UI.
Review details

Suppressed comments (1)

src/pages/admin/festivals/LinkWizard/useLinkWizardQueue.test.ts:142

  • This test asserts save persistence by reading localStorage and relying on the internal storage schema of useLinkWizardSkipped (stored[EDITION_ID].records[...]). That couples the test to storage internals instead of the hook’s public API.
    const stored = JSON.parse(localStorage.getItem("link-wizard-skipped")!);
    expect(stored[EDITION_ID].records["1"].status).toBe("saved");
  });
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/pages/admin/festivals/LinkWizard/useLinkWizardQueue.test.ts Outdated
Comment thread src/pages/admin/festivals/LinkWizard/useLinkWizardQueue.ts Outdated
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

Playwright test results

passed  62 passed

Details

stats  62 tests across 20 suites
duration  1 minute, 17 seconds
commit  cae55f1

Deepen useLinkWizardQueue to own stage filtering, position, and
skip/save-then-advance behavior, replacing the ad-hoc state and index
math previously spread across LinkWizard.tsx. useLinkWizardSkipped
stays a separate module, passed in as a dependency to keep a single
localStorage-backed instance shared with the skipped/saved popover.

Closes #445

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…storage schema

Report position 0 (not 1) when the queue is empty, matching total: 0
and an undefined currentItem. Assert skip/save persistence through
useLinkWizardSkipped's public API instead of parsing localStorage
directly, per Copilot review on #446.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

Give the Link Wizard queue a module (useLinkWizardQueue)

2 participants