veza/apps/web/src/components/ui/WaveformVisualizer.stories.tsx
senke de12f5036c fix(web): resolve all 568 TypeScript errors — tsc --noEmit now passes with zero errors
Major categories fixed:
- TS6133 (188): Remove unused imports (React, icons, types) and variables
- TS2322 (222): Fix type mismatches in stories (satisfies Meta -> const meta: Meta),
  add nullish coalescing for optional values, fix component prop types
- TS2345 (43): Fix argument type mismatches with proper null checks and type narrowing
- TS2741 (21): Add missing required properties to mock/story data
- TS2339 (19): Fix property access on incorrect types, add type guards
- TS2353 (13): Remove extra properties from object literals or extend interfaces
- TS2352 (11): Fix type conversion chains
- TS2307 (9): Fix import paths and module references
- Other (42): Fix implicit any, possibly undefined, export declarations

Vite build and tsc --noEmit both pass cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 00:32:08 +01:00

76 lines
1.8 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react';
import { WaveformVisualizer } from './WaveformVisualizer';
import { useState } from 'react';
const meta: Meta = {
title: 'UI/WaveformVisualizer',
component: WaveformVisualizer,
tags: ['autodocs'],
argTypes: {
progress: { control: { type: 'range', min: 0, max: 100 } },
height: { control: 'number' },
color: { control: 'color' },
playedColor: { control: 'color' },
},
decorators: [
(Story) => (
<div className="bg-card p-6 rounded-lg">
<Story />
</div>
),
],
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
render: (args) => {
const [progress, setProgress] = useState(30);
return (
<WaveformVisualizer
{...args}
progress={progress}
onSeek={setProgress}
/>
);
},
};
export const CustomColors: Story = {
args: {
progress: 60,
color: '#333',
playedColor: '#ff0055',
height: 100,
},
render: (args) => {
const [progress, setProgress] = useState(args.progress);
return (
<WaveformVisualizer
{...args}
progress={progress}
onSeek={setProgress}
/>
);
},
};
export const CustomData: Story = {
render: () => {
const [progress, setProgress] = useState(45);
// Generate sine wave data
const data = Array.from({ length: 50 }, (_, i) =>
(Math.sin(i * 0.5) + 1) / 2
);
return (
<WaveformVisualizer
progress={progress}
onSeek={setProgress}
waveformData={data}
height={120}
/>
);
},
};