Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CitizenClaimWidget } from '@goodwidget/citizen-claim-widget'
import {
CustodialClaimExecutionClaimAllStory,
CustodialLocalFixtureStory,
MockClaimExecutionWidgetStory,
} from '../helpers/citizenClaimWidgetStories'
import type { NextTaskContent } from '@goodwidget/ui'
import { BRAND_PRESET_OPTIONS, brandPresetOverrides, type BrandPreset } from '../helpers/themeOverridePresets'
Expand Down Expand Up @@ -51,7 +52,7 @@ export const CustodialExecutionClaimAllContract: Story = {
const nextTaskContent: NextTaskContent = {
title: 'Stake your G$ and earn',
description: 'Put your claimed G$ to work by staking it for rewards.',
ctaLabel: 'Open Proposal',
ctaLabel: 'Explore staking',
ctaTarget: 'https://gooddollar.org/stake',
imageUrl: 'https://placehold.co/96x96',
contentId: 'stake-prompt',
Expand Down Expand Up @@ -82,3 +83,75 @@ export const CustodialLocalFixtureWithNextTask: Story = {
/>
),
}

const mockNextTaskProps = {
nextTaskContent,
nextTaskResolveNavigation: (ctaTarget: string) => {
if (typeof document !== 'undefined') {
document.body.dataset.nextTaskNavigated = ctaTarget
}
console.info('[next-task] host navigates to', ctaTarget)
},
onNextTaskShown: (payload: { contentId?: string }) => {
if (typeof document !== 'undefined') {
document.body.dataset.nextTaskLastEvent = `shown:${payload.contentId ?? ''}`
}
console.info('[next-task] shown', payload)
},
onNextTaskClicked: (payload: { ctaTarget: string }) => {
if (typeof document !== 'undefined') {
document.body.dataset.nextTaskLastEvent = `clicked:${payload.ctaTarget}`
}
console.info('[next-task] clicked', payload)
},
onNextTaskDismissed: (payload: { reason: string }) => {
if (typeof document !== 'undefined') {
document.body.dataset.nextTaskLastEvent = `dismissed:${payload.reason}`
}
console.info('[next-task] dismissed', payload)
},
}

export const MockClaimExecutionWithNextTask: Story = {
render: () => <MockClaimExecutionWidgetStory nextTaskProps={mockNextTaskProps} />,
}

export const MockClaimExecutionPartialSuccessWithNextTask: Story = {
render: () => <MockClaimExecutionWidgetStory partialSuccess nextTaskProps={mockNextTaskProps} />,
}

export const MockClaimExecutionSingleChainWithNextTask: Story = {
render: () => (
<MockClaimExecutionWidgetStory
singleChain
nextTaskProps={{
nextTaskContent,
}}
/>
),
}

export const MockClaimExecutionSingleClaimFallbackWithNextTask: Story = {
render: () => (
<MockClaimExecutionWidgetStory
singleChain
emptyClaimables
nextTaskProps={mockNextTaskProps}
/>
),
}

export const MockClaimExecutionAllFailsWithNextTask: Story = {
render: () => (
<MockClaimExecutionWidgetStory
allFail
nextTaskProps={{
nextTaskContent,
}}
/>
),
}

export const MockClaimExecutionWithoutNextTask: Story = {
render: () => <MockClaimExecutionWidgetStory />,
}
Loading