feat: check-in scanner and fix bugs
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -19,7 +19,7 @@ const meta = {
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Prompt: Story = {
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
checkinCode: '114514',
|
||||
},
|
||||
|
||||
27
client/cms/src/stories/events/checkin-scanner.stories.tsx
Normal file
27
client/cms/src/stories/events/checkin-scanner.stories.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import { CheckinScannerDialogView } from '@/components/checkin/checkin-scanner.dialog.view';
|
||||
import { Dialog } from '@/components/ui/dialog';
|
||||
|
||||
const meta = {
|
||||
title: 'Events/CheckinScannerDialog',
|
||||
component: CheckinScannerDialogView,
|
||||
decorators: [
|
||||
Story => (
|
||||
<Dialog open={true}>
|
||||
<Story />
|
||||
</Dialog>
|
||||
),
|
||||
],
|
||||
} satisfies Meta<typeof CheckinScannerDialogView>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Primary: Story = {
|
||||
args: {
|
||||
onScan: (value) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Scanned value:', value);
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -32,6 +32,7 @@ export const Loading: Story = {
|
||||
description: '',
|
||||
startTime: new Date(0),
|
||||
endTime: new Date(0),
|
||||
isCheckedIn: false,
|
||||
},
|
||||
actionFooter: <Button className="w-full">加入活动(示例)</Button>,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import { EventGridSkeleton } from '@/components/events/event-grid/event-grid.skeleton';
|
||||
import { EventGridView } from '@/components/events/event-grid/event-grid.view';
|
||||
import { JoinedEventGridFooter } from '@/components/events/joined-events.containers';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton as UiSkeleton } from '@/components/ui/skeleton';
|
||||
import { exampleMultiEvents } from './event.example';
|
||||
@@ -24,7 +23,12 @@ export const Primary: Story = {
|
||||
export const Joined: Story = {
|
||||
args: {
|
||||
events: exampleMultiEvents,
|
||||
footer: event => <JoinedEventGridFooter event={event} />,
|
||||
footer: () => (
|
||||
<div className="flex flex-row justify-between w-full gap-4">
|
||||
<Button className="flex-1">签到</Button>
|
||||
<Button className="flex-1">查看详情</Button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export const exampleEvent: EventInfo = {
|
||||
description: 'Event Description',
|
||||
startTime: new Date('2026-06-13T04:00:00.000Z'),
|
||||
endTime: new Date('2026-06-14T04:00:00.000Z'),
|
||||
isCheckedIn: false,
|
||||
};
|
||||
|
||||
export const exampleMultiEvents: EventInfo[] = [
|
||||
@@ -23,6 +24,7 @@ export const exampleMultiEvents: EventInfo[] = [
|
||||
description: 'Event Description',
|
||||
startTime: new Date('2026-06-13T04:00:00.000Z'),
|
||||
endTime: new Date('2026-06-14T04:00:00.000Z'),
|
||||
isCheckedIn: false,
|
||||
},
|
||||
{
|
||||
eventId: '2',
|
||||
@@ -34,6 +36,7 @@ export const exampleMultiEvents: EventInfo[] = [
|
||||
description: 'Event Description',
|
||||
startTime: new Date('2026-06-13T04:00:00.000Z'),
|
||||
endTime: new Date('2026-06-14T04:00:00.000Z'),
|
||||
isCheckedIn: false,
|
||||
},
|
||||
{
|
||||
eventId: '3',
|
||||
@@ -45,6 +48,7 @@ export const exampleMultiEvents: EventInfo[] = [
|
||||
description: 'Event Description',
|
||||
startTime: new Date('2026-06-13T04:00:00.000Z'),
|
||||
endTime: new Date('2026-06-14T04:00:00.000Z'),
|
||||
isCheckedIn: false,
|
||||
},
|
||||
{
|
||||
eventId: '4',
|
||||
@@ -56,5 +60,6 @@ export const exampleMultiEvents: EventInfo[] = [
|
||||
description: 'Event Description',
|
||||
startTime: new Date('2026-06-13T04:00:00.000Z'),
|
||||
endTime: new Date('2026-06-14T04:00:00.000Z'),
|
||||
isCheckedIn: false,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user