All files / web/src/components/tutorial SkillTutorialLauncher.stories.tsx

0% Statements 0/157
0% Branches 0/1
0% Functions 0/1
0% Lines 0/157

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 145 146 147 148 149 150 151 152 153 154 155 156 157 158                                                                                                                                                                                                                                                                                                                           
import type { Meta, StoryObj } from '@storybook/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { SkillTutorialLauncher } from './SkillTutorialLauncher'

// Create a query client for the story wrapper
const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: false,
    },
  },
})

// Story wrapper with query client
function StoryWrapper({ children }: { children: React.ReactNode }) {
  return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
}

const meta: Meta<typeof SkillTutorialLauncher> = {
  title: 'Tutorial/SkillTutorialLauncher',
  component: SkillTutorialLauncher,
  parameters: {
    layout: 'centered',
  },
  tags: ['autodocs'],
  decorators: [
    (Story) => (
      <StoryWrapper>
        <div style={{ width: '600px', padding: '2rem', background: '#f0f0f0' }}>
          <Story />
        </div>
      </StoryWrapper>
    ),
  ],
}

export default meta
type Story = StoryObj<typeof SkillTutorialLauncher>

// Default handlers
const defaultHandlers = {
  onComplete: () => console.log('Tutorial completed'),
  onSkip: () => console.log('Tutorial skipped'),
  onCancel: () => console.log('Tutorial cancelled'),
}

/**
 * Basic skill tutorial - Direct Addition
 */
export const BasicDirectAddition: Story = {
  args: {
    skillId: 'basic.directAddition',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Heaven bead tutorial
 */
export const BasicHeavenBead: Story = {
  args: {
    skillId: 'basic.heavenBead',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Five-complement addition tutorial
 */
export const FiveComplementAdd4: Story = {
  args: {
    skillId: 'fiveComplements.4=5-1',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Ten-complement addition tutorial
 */
export const TenComplementAdd9: Story = {
  args: {
    skillId: 'tenComplements.9=10-1',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Dark theme variant
 */
export const DarkTheme: Story = {
  args: {
    skillId: 'fiveComplements.3=5-2',
    playerId: 'test-player-1',
    theme: 'dark',
    ...defaultHandlers,
  },
  decorators: [
    (Story) => (
      <StoryWrapper>
        <div
          style={{
            width: '600px',
            padding: '2rem',
            background: '#1a1a2e',
            borderRadius: '12px',
          }}
        >
          <Story />
        </div>
      </StoryWrapper>
    ),
  ],
}

/**
 * Unknown skill - shows fallback UI
 */
export const UnknownSkill: Story = {
  args: {
    skillId: 'unknown.skill',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Ten-complement subtraction tutorial
 */
export const TenComplementSubtract9: Story = {
  args: {
    skillId: 'tenComplementsSub.-9=+1-10',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}

/**
 * Five-complement subtraction tutorial
 */
export const FiveComplementSubtract4: Story = {
  args: {
    skillId: 'fiveComplementsSub.-4=-5+1',
    playerId: 'test-player-1',
    theme: 'light',
    ...defaultHandlers,
  },
}