Skip to content

feat(ui,citizen-claim-widget): finalize next task component and claim - #299

Open
HushLuxe wants to merge 10 commits into
GoodDollar:feat/gw246-next-task-componentfrom
HushLuxe:feat/gw246-next-task-component
Open

HushLuxe wants to merge 10 commits into
GoodDollar:feat/gw246-next-task-componentfrom
HushLuxe:feat/gw246-next-task-component

Conversation

@HushLuxe

@HushLuxe HushLuxe commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Finalizes the NextTaskModal component and CitizenClaimWidget post-claim flow to resolve issue #276 (following PR #248 and parent issue #246).

Key Updates

  1. Figma Visual Alignment: Styled the primary action button consistently in both Anchor (link) mode and Button (callback) mode with full-width primary styling, matching the Figma design reference.
  2. Error Retention & Toasts: On navigation rejection or invalid URL errors, the modal stays open and displays the error toast instead of prematurely closing.
  3. Responsive Inner Scrolling: Added overflowY: auto and a responsive container so that on compact viewports (small mobile 320×568, iPhone SE 375×667, landscape 667×375) the headline, task card, and action buttons remain fully scrollable and interactable without clipping.
  4. Configurable Copy: Made headline, supportingCopy, recommendedLabel, skipLabel, and statusLabel configurable on NextTaskContent with fallback defaults.
  5. CitizenClaimWidget Claim Flow Tests: Added mock claim execution fixtures in Storybook and automated Playwright integration tests covering single-chain claim, multi-chain claim, all-fail fallback, and post-claim next-task drawer presentation.

Closes #276
Follows #248 #246


Acceptance Criteria Checklist

  • Align visual styling with Figma (primary CTA button in link and button modes)
  • Modal remains open when navigation fails or link cannot be opened
  • Responsive layout with inner scrolling on small mobile (320px) and landscape viewports
  • Configurable text/labels with backwards-compatible defaults
  • Storybook stories updated for error retention, custom copy, and claim execution
  • Automated Playwright integration tests covering claim flow and next task drawer
  • Visual QA screenshots captured and added as verification evidence
  • Single clean commit authored by contributor

Visual QA Evidence

1. CTA Primary Button (Anchor / Link mode matching Figma)

01-cta-primary-button

2. Navigation Error Handling (Modal retained, error toast displayed)

02-navigation-error-retained

3. Small Mobile Viewport (320×568) — Inner Scroll & Action Buttons

03-small-mobile-320x568

4. iPhone SE (375×667) — Top Viewport

04-iphone-se-top

5. iPhone SE (375×667) — Bottom Action Buttons

05-iphone-se-bottom

6. CitizenClaimWidget — Claim In Progress

06-claim-in-progress

7. CitizenClaimWidget — Next Task Drawer Open After Claim

07-claim-drawer-opened


Verification

Local Run Results (HEAD 1a944d0)

Note: a later comment-only commit (05efda67) corrects the resolveNavigation JSDoc wording; no code or tests changed after these runs, so the results below stand for the current head.

  • pnpm install — passed
  • pnpm build — passed (18/18 packages)
  • NextTaskModal smoke spec (-g NextTaskModal) — 21/21 passed, including regression tests for stale navigation completions across close/reopen and a throwing onClose after successful navigation
  • tests/widgets/citizen-claim-widget/states.spec.ts — 12/12 passed (2 live-RPC tests flaky, passed on retry)
  • packages/ui unit tests — 5/5 passed
  • Full pnpm test:demo — 344 passed, 1 flaky (passed on retry), 1 skipped, 1 failed; the single failure is the pre-existing, unrelated tests/widgets/ai-credits-widget/states.spec.ts:247
  • cd packages/ui && npx tsc --noEmit — exactly the 9 pre-existing errors; none in this PR's files
  • Lint — @goodwidget/ui and @goodwidget/citizen-claim-widget filters at 0 errors (root-level lint failures are pre-existing in unrelated apps)

Remaining risks

… flow (GoodDollar#276)

- Match visual reference with primary button styling in both Anchor and Button CTA modes
- Retain modal on host navigation error/rejection and invalid URLs with error toast
- Add responsive inner scrolling for small mobile and landscape viewports
- Support configurable copy fields with fallback defaults on NextTaskContent
- Add Playwright tests and Storybook fixtures for CitizenClaimWidget claim flow
- Refresh visual evidence in design-system and citizen-claim-widget test-results

Closes GoodDollar#276
Follows GoodDollar#248 GoodDollar#246
@HushLuxe HushLuxe changed the title feat(ui,citizen-claim-widget): finalize next task component and claim… feat(ui,citizen-claim-widget): finalize next task component and claim Nov 9, 2026
@L03TJ3 L03TJ3 linked an issue Nov 10, 2026 that may be closed by this pull request
17 tasks
@HushLuxe
HushLuxe requested a balanced review from Copilot November 10, 2026 09:38

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 modal permits concurrent navigation attempts and nests a button inside a link, while widget tests leave partial-success handling and CTA callback wiring unverified.

4 open issues
What changed in this PR

This PR addresses the remaining Next Task work from #248 for issue #276, refining the shared modal and adding real CitizenClaimWidget post-claim flow coverage.

Changes:

  • Gives link-mode CTAs primary styling, retains the drawer on navigation errors, and adds inner scrolling.
  • Adds configurable copy fields and exports default text constants.
  • Adds Storybook fixtures and Playwright coverage for claim outcomes, custom copy, and responsive layouts.
File Description
tests/​widgets/​citizen-claim-widget/​states.spec.ts Adds real-widget post-claim drawer tests.
tests/​design-system/​smoke.spec.ts Updates error-retention, responsive, and copy checks.
packages/​ui/​src/​index.ts Exports Next Task default copy and error constants.
packages/​ui/​src/​components/​NextTaskModal.tsx Updates navigation handling, CTA styling, scrolling, and configurable copy.
examples/​storybook/​src/​stories/​helpers/​citizenClaimWidgetStories.tsx Adds mocked claim execution for real-widget stories.
examples/​storybook/​src/​stories/​design-system/​NextTaskModal.stories.tsx Adds custom and long-copy stories; updates error expectations.
examples/​storybook/​src/​stories/​citizen-claim-widget/​CitizenClaimWidgetQA.stories.tsx Adds claim outcome and next-task configuration scenarios.

Review effort: Balanced

…t task component

- Fix 1: Set navigation guard immediately on entry to prevent concurrent double-fire, reset on failure to allow retries
- Fix 2: Render styled CTA child inside Anchor as non-interactive span (tag="span", role="presentation", tabIndex={-1}, pointerEvents="none")
- Fix 3: Add multi-chain partial-success fixture and story to ensure drawer opens when at least one chain succeeds
- Fix 4: Strengthen widget flow tests to press CTA, verify host-side navigation callback, and test Skip dismissal independently

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.

🔵 Needs a closer look

Responsive tests can miss drawer-clipped actions, while fixed waits and missing claim-outcome checks allow drawer-state assertions to pass before completion or when a claim unexpectedly fails.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Assert drawer actions are fully in the viewport after scrolling

tests/​design-system/​smoke.spec.ts:608

toBeVisible() and toBeEnabled() can pass for controls clipped by the drawer, and scrollIntoViewIfNeeded() does not assert that scrolling exposed them. Restore toBeInViewport({ ratio: 1 }) after each scroll so unreachable actions fail the responsive tests. Apply the same assertion to the CTA and Skip action in the long-copy test at tests/design-system/smoke.spec.ts:700–704.

Medium severity Wait for claim completion before asserting drawer outcomes

tests/​widgets/​citizen-claim-widget/​states.spec.ts:340

The fixed two-second waits let these negative assertions pass before claim execution finishes; the absent-content test also passes if the claim fails. Wait for both expected per-chain outcomes and for the Claim button to become enabled again before checking the drawer state. Apply this to both the all-failed case here and the successful-claim-without-content case at tests/widgets/citizen-claim-widget/states.spec.ts:339–342.

4 resolved since last review

Review effort: Balanced

…w tests

- Fix A: Assert controls are fully in viewport (ratio: 1) in NextTaskModal viewport and RealisticLongCopy tests
- Fix B: Replace fixed timeouts with deterministic completion waits on claim failure/success outcomes in negative flow tests

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.

🔵 Needs a closer look

Tests leave the single-claim fallback and long-copy responsive layouts insufficiently covered, while the duplicate-click check has a timing race that can cause false failures.

No open issues 🎉

3 previously missed issues

In code that hasn't changed since last review

Medium severity Cover long-copy layouts across viewports and image states

tests/​design-system/​smoke.spec.ts:697

The viewport matrix uses only short copy, while the sole long-copy test always includes an image and sets the Storybook manager—not the story iframe—to 375×667. Long-copy landscape and image-free layouts can therefore regress without failing these checks. Run realistic copy with and without an image through direct iframe URLs at small-mobile, landscape, and desktop sizes, checking that the headline, card, and both actions are reachable and capturing screenshots.

Medium severity Dispatch rejection-guard clicks in one browser task

tests/​design-system/​smoke.spec.ts:720

These two awaited Playwright clicks are not guaranteed to arrive within the story's 200ms rejection delay. On a slow runner, the first attempt can reject and reset the guard before the second click, turning that click into the successful retry; the subsequent open-state and call-count assertions then fail even though the guard works correctly. Dispatch both presses in one browser task so the rejection cannot occur between them.

Medium severity Test the single-claim fallback success path

tests/​widgets/​citizen-claim-widget/​states.spec.ts:298

The Celo mock still returns a positive entitlement in the singleChain fixture, so claimablesByChain contains one entry and the widget executes actions.claimAll([42220]), not actions.claim() (see CitizenClaimWidget.tsx:262–274,319). The separate singleClaimSucceeded opening branch could therefore break without this test failing. Please add a fixture that reaches the single-claim fallback branch and assert that its successful claim opens the drawer.

Review effort: Balanced

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

Active test gaps leave rapid-click behavior vulnerable to CI timing and fail to cover the single-claim success drawer trigger and realistic long-content responsive cases.

3 open issues

Review effort: Balanced

Comment thread tests/design-system/smoke.spec.ts Resolved
Comment thread tests/design-system/smoke.spec.ts Resolved

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

Active findings show that stale navigation rejections can permit duplicate navigation, while errors from onClose are misreported as navigation failures and can also enable repeat navigation.

2 open issues
3 resolved since last review

Review effort: Balanced

@goodbounties-nanoclaw-agent

goodbounties-nanoclaw-agent Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@HushLuxe thanks for the work. Please update the PR description and PR so they match your latest commit (db51580):

  1. Design reference: add the current design image to the PR description. Update it whenever the UI changes. Your screenshots and test results are from before the Nov 18 layout change, so please redo them.
  2. Re-run the checks from issue [GoodBounty] Finalize Next Task component PR (#248) #276 on the latest commit and update the results in the description.
  3. Fix two lines in the description: it says "single clean commit" but there are 9 commits (no need to squash, just change the text), and "Remaining risks" mentions ai-credits, while the failing test in CI is the live-RPC one.
  4. Shared code: you changed the shared Drawer (height='fit', maxHeight) and added an xs breakpoint in config.ts. Issue [GoodBounty] Finalize Next Task component PR (#248) #276 says not to change the shared Drawer. Please explain why it was needed, or move it out of shared code.
  5. Docs: please update the NextTaskContent docs, as issue [GoodBounty] Finalize Next Task component PR (#248) #276 asks.
  6. PR template: please use the repo's PR template (title, checklist, a short gif, and @mention the reviewers).
  7. Handoff comment: please add it in the format from issue [GoodBounty] Finalize Next Task component PR (#248) #276, including what you tested by hand.

The failing preview check is a Vercel setup problem, not your code.

// The drawer stays open so the user can retry or dismiss.
const handleHostNavigationPress = useCallback(async () => {
if (!content || !resolveNavigation || hasResolvedRef.current) return
hasResolvedRef.current = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Blocking: Setting the guard before await resolveNavigation(...) means dismissWithReason (L131) returns early for as long as the promise is pending. The close button, the overlay and “Skip for now” all do nothing, and fit mode also disables drag. If the host router hangs or is slow, the user is stuck with no feedback.

Suggestion: let dismissal go through while navigation is pending. Bump navigationGenerationRef so the late result is ignored, then report onDismissed and call onClose. Also show a loading/disabled state on the CTA while it’s pending. Could you add a test: a never-settling resolveNavigation, then press Skip, then assert the sheet closes?

if (!content || !resolveNavigation || hasResolvedRef.current) return
hasResolvedRef.current = true
const attemptGeneration = ++navigationGenerationRef.current
invokeHostCallbackSafely('onClicked', onClicked, { ctaTarget: content.ctaTarget })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because the guard resets after a failure, each retry fires onClicked again, so analytics will count several clicks for one intent. Either document that, or fire onClicked only after navigation succeeds.

minHeight={0}
maxHeight="100%"
paddingBottom="$2"
style={{ overflowY: 'auto', WebkitOverflowScrolling: 'touch' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These styles only work on web. On native the long copy will clip without scrolling. Consider Sheet.ScrollView (or a ScrollView inside the frame). Also, maxHeight="100%" inside a sheet with no set height probably doesn’t resolve to anything useful, which may be why the long-copy clipping concern is still open.

<Button
variant="primary"
fullWidth
tag="span"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This works on web. Could you check it once by hand on native? Tamagui’s Anchor renders as Text there, so this becomes a View inside Text, and layout or press behaviour can differ.

const handleButtonCtaPress = resolveNavigation ? handleHostNavigationPress : handleRejectedUrlPress

// `height="full"` (80% snap point): the half-height drawer clips the CTA on a 375x667 phone.
const effectiveStatusLabel = content.statusLabel ?? statusLabel

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The content value silently overrides the prop. That’s fine, but please say so in the statusLabel prop JSDoc.

const REJECTED_URL_TOAST_MESSAGE = 'This link cannot be opened.'
export const NEXT_TASK_RECOMMENDED_LABEL = 'RECOMMENDED'
export const NEXT_TASK_SKIP_LABEL = 'Skip for now'
export const NEXT_TASK_STATUS_LABEL = 'Claim completed'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is exported but never used as a fallback, and the widget hardcodes "Claim completed". Either use the constant or remove it.

>
<DrawerOverlay style={{ backdropFilter: 'blur(2px)' }} />
<DrawerFrame>
<DrawerFrame maxHeight="calc(100vh - 48px)">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This applies to every drawer, half/full included, across all widgets, not just fit. Also:

calc()/vh strings aren’t supported on React Native.
On iOS Safari, 100vh includes the area behind the URL bar, so the bottom of the sheet (where the CTA sits) can still be clipped. dvh handles this better.

Since #276 asks not to change the shared Drawer, could this live in NextTaskModal, or at least apply only when height === 'fit'?

dismissOnOverlayPress
dismissOnSnapToBottom
dismissOnSnapToBottom={height !== 'fit'}
disableDrag={height === 'fit'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With drag disabled, the handle is still rendered but does nothing. Either hide it in fit mode or keep drag-to-dismiss.

Comment thread packages/ui/src/config.ts
},
defaultFont: 'body',
media: {
xs: { maxWidth: 360 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adding a global breakpoint affects every widget and every host config, and could clash with a host that defines its own xs. It’s only used for one heading size. Could that use $sm or a local useMedia check instead?

@pheobeayo pheobeayo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the iteration. The stale-navigation generation guard, keep-open-on-error behaviour, URL allowlisting and the expanded Playwright coverage are all solid.

Requesting changes for two things:

  • A pending resolveNavigation makes the sheet impossible to dismiss (see inline on NextTaskModal.tsx).

  • The shared Drawer is modified despite #276 asking not to, and the maxHeight change applies to every drawer in every widget. Please scope it to fit mode or move it into NextTaskModal, and explain the change in the PR body.

  • Also: please drop the qa-evidence/*.jpg files from the repo (attach them to the PR instead), and fix the “single clean commit” line in the description.

Checked against #276: items 2, 3 and 4 are fully met. Still outstanding:

  • Item 1: refresh the screenshots against the current layout.
  • Item 5: add docs for nextTaskContent and the new copy fields.
  • Item 6: add a test that missing fields fall back to the defaults.
  • Drawer: the height: 'fit' and maxHeight changes conflict with the “no Drawer API redesign” constraint.
  • Process: document the Anchor theme-manifest limitation in the PR, rerun the required commands (including tsc --noEmit) on the latest commit, and post the handoff comment.

This branch is waiting to be deployed

1 failed (outdated) and 1 waiting deployments
external — 3cb2ed34 Waiting Nov 23, 2026 by HushLuxe via authorize-preview #664
preview-storybook — db51580b Deployed Nov 23, 2026 by HushLuxe via preview #640
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.

[GoodBounty] Finalize Next Task component PR (#248)

5 participants