|
| 1 | +import type { Meta, StoryObj } from '@storybook/react-vite' |
| 2 | +import type { Commit } from '../../../index' |
| 3 | +import { LogPanelView } from './log-panel-view' |
| 4 | + |
| 5 | +const now = Date.now() |
| 6 | + |
| 7 | +const commits: Commit[] = [ |
| 8 | + { hash: 'a1b2c3d4e5f6', shortHash: 'a1b2c3d', parents: ['b2c3d4e', 'c3d4e5f'], author: 'Ada Lovelace', email: 'ada@example.dev', date: now - 36e5, subject: 'Merge branch feature/graph into main', body: '', refs: ['HEAD -> main'] }, |
| 9 | + { hash: 'b2c3d4e', shortHash: 'b2c3d4e', parents: ['d4e5f60'], author: 'Ada Lovelace', email: 'ada@example.dev', date: now - 72e5, subject: 'Tidy up dashboard layout', body: '', refs: [] }, |
| 10 | + { hash: 'c3d4e5f', shortHash: 'c3d4e5f', parents: ['d4e5f60'], author: 'Lin Chen', email: 'lin@example.dev', date: now - 9e6, subject: 'Add commit graph lanes', body: '', refs: ['origin/feature/graph'] }, |
| 11 | + { hash: 'd4e5f60', shortHash: 'd4e5f60', parents: [], author: 'Ada Lovelace', email: 'ada@example.dev', date: now - 9e8, subject: 'Initial commit', body: '', refs: ['v0.1.0'] }, |
| 12 | +] |
| 13 | + |
| 14 | +const meta = { |
| 15 | + title: 'Panels/Log', |
| 16 | + component: LogPanelView, |
| 17 | + args: { |
| 18 | + rpcConnected: true, |
| 19 | + isRepo: true, |
| 20 | + commits, |
| 21 | + hasMore: false, |
| 22 | + loading: false, |
| 23 | + error: null, |
| 24 | + liveBackend: true, |
| 25 | + onRefresh: () => undefined, |
| 26 | + onLoadMore: () => undefined, |
| 27 | + }, |
| 28 | +} satisfies Meta<typeof LogPanelView> |
| 29 | + |
| 30 | +export default meta |
| 31 | +type Story = StoryObj<typeof meta> |
| 32 | + |
| 33 | +export const Default: Story = {} |
| 34 | +export const Connecting: Story = { args: { rpcConnected: false } } |
| 35 | +export const Empty: Story = { args: { commits: [] } } |
| 36 | +export const NotARepo: Story = { args: { isRepo: false, commits: [] } } |
| 37 | +export const HasMore: Story = { args: { hasMore: true } } |
| 38 | +export const StaticMode: Story = { args: { hasMore: true, liveBackend: false } } |
| 39 | +export const Error: Story = { args: { error: 'fatal: bad revision' } } |
0 commit comments