Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | import type { Meta, StoryObj } from '@storybook/react' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { ThemeProvider } from '@/contexts/ThemeContext' import type { SessionMode } from '@/lib/curriculum/session-mode' import type { CurriculumPhase } from '@/lib/curriculum/definitions' import { css } from '../../../../styled-system/css' import { StartPracticeModalProvider } from '../StartPracticeModalContext' import { PurposeDistributionBar } from './PurposeDistributionBar' function createQueryClient() { return new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity }, }, }) } const mockPhase: CurriculumPhase = { id: 'L1.add.+1.direct', levelId: 1, operation: 'addition', targetNumber: 1, usesFiveComplement: false, usesTenComplement: false, name: 'Direct +1', description: 'Learn direct addition of +1', primarySkillId: 'add-direct-1', order: 1, } const defaultSessionMode: SessionMode = { type: 'progression', nextSkill: { skillId: 'test-skill', displayName: 'Test Skill', pKnown: 0.8, hasMathSentence: true, }, tutorialRequired: false, phase: mockPhase, skipCount: 0, focusDescription: 'Test focus', canSkipTutorial: true, } function StoryWrapper({ children, theme = 'light', }: { children: React.ReactNode theme?: 'light' | 'dark' }) { const queryClient = createQueryClient() return ( <QueryClientProvider client={queryClient}> <ThemeProvider> <div data-theme={theme} className={css({ minHeight: '200px', padding: '2rem', display: 'flex', flexDirection: 'column', gap: '2rem', backgroundColor: theme === 'dark' ? '#1a1a2e' : '#f5f5f5', })} > <StartPracticeModalProvider studentId="story-student" studentName="Story Student" focusDescription="Test focus" sessionMode={defaultSessionMode} initialExpanded={true} practiceApprovedGamesOverride={[ { manifest: { name: 'game1', displayName: 'Game One', icon: '🎮' } }, ]} > {children} </StartPracticeModalProvider> </div> </ThemeProvider> </QueryClientProvider> ) } const meta: Meta<typeof PurposeDistributionBar> = { title: 'Practice/PurposeDistributionBar', component: PurposeDistributionBar, tags: ['autodocs'], } export default meta type Story = StoryObj<typeof PurposeDistributionBar> /** * Default state: focus=3, reinforce=1, review=1, challenge=1. * Tap segments to cycle weights. Each purpose has its own color. */ export const Default: Story = { render: () => ( <StoryWrapper> <div className={css({ maxWidth: '400px' })}> <PurposeDistributionBar /> </div> </StoryWrapper> ), } /** * Dark theme variant */ export const DefaultDark: Story = { render: () => ( <StoryWrapper theme="dark"> <div className={css({ maxWidth: '400px' })}> <PurposeDistributionBar /> </div> </StoryWrapper> ), } /** * Full-width rendering */ export const FullWidth: Story = { render: () => ( <StoryWrapper> <PurposeDistributionBar /> </StoryWrapper> ), } /** * Full-width dark theme */ export const FullWidthDark: Story = { render: () => ( <StoryWrapper theme="dark"> <PurposeDistributionBar /> </StoryWrapper> ), } |