|
| 1 | +import { type Meta, type StoryObj } from '@storybook/react-vite'; |
| 2 | +import { MemoryRouter } from 'react-router-dom'; |
| 3 | + |
| 4 | +import { type BackendContact } from '@/shared/core'; |
| 5 | +import { TEST_ACCOUNTS, TEST_ADDRESS } from '@/shared/lib/utils'; |
| 6 | + |
| 7 | +import { CachedWithErrorView } from './CachedWithErrorView'; |
| 8 | + |
| 9 | +const mockContacts: BackendContact[] = [ |
| 10 | + { |
| 11 | + id: '1', |
| 12 | + name: 'Treasury Multisig', |
| 13 | + address: TEST_ADDRESS, |
| 14 | + accountId: TEST_ACCOUNTS[0], |
| 15 | + source: 'backend', |
| 16 | + entityNames: ['Nova Foundation'], |
| 17 | + chainId: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3', |
| 18 | + chainName: 'Polkadot', |
| 19 | + categoryName: 'Infrastructure', |
| 20 | + contactTypeName: 'Multisig', |
| 21 | + derivationPath: null, |
| 22 | + ownerAccountId: null, |
| 23 | + }, |
| 24 | + { |
| 25 | + id: '2', |
| 26 | + name: 'Validator Node', |
| 27 | + address: TEST_ADDRESS, |
| 28 | + accountId: TEST_ACCOUNTS[1], |
| 29 | + source: 'backend', |
| 30 | + entityNames: ['Staking Ops'], |
| 31 | + chainId: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3', |
| 32 | + chainName: 'Kusama', |
| 33 | + categoryName: 'Validators', |
| 34 | + contactTypeName: null, |
| 35 | + derivationPath: null, |
| 36 | + ownerAccountId: null, |
| 37 | + }, |
| 38 | +]; |
| 39 | + |
| 40 | +const meta: Meta<typeof CachedWithErrorView> = { |
| 41 | + title: 'Address Book/CachedWithErrorView', |
| 42 | + component: CachedWithErrorView, |
| 43 | + decorators: [ |
| 44 | + (Story) => ( |
| 45 | + <MemoryRouter> |
| 46 | + <Story /> |
| 47 | + </MemoryRouter> |
| 48 | + ), |
| 49 | + ], |
| 50 | + args: { |
| 51 | + error: 'TypeError: Failed to fetch — ECONNREFUSED', |
| 52 | + items: mockContacts, |
| 53 | + onSendTo: () => {}, |
| 54 | + onRetry: () => {}, |
| 55 | + }, |
| 56 | +}; |
| 57 | + |
| 58 | +export default meta; |
| 59 | + |
| 60 | +type Story = StoryObj<typeof CachedWithErrorView>; |
| 61 | + |
| 62 | +export const Default: Story = {}; |
0 commit comments