Skip to content

Commit 10d8adf

Browse files
docs(ui): add stories for PDS page (#2514)
1 parent 85333b0 commit 10d8adf

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.storybook/handlers.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,37 @@ export const contributorsHandler = http.get('/api/contributors', () => {
5757
},
5858
])
5959
})
60+
61+
export const pdsUsersHandler = http.get('/api/atproto/pds-users', () => {
62+
return HttpResponse.json([
63+
{
64+
did: 'did:plc:mock0001',
65+
handle: 'patak.dog',
66+
displayName: 'Patak Dog',
67+
avatar:
68+
'https://cdn.bsky.app/img/avatar/plain/did:plc:zjfptjaegvgc7r2axkkyyzqn/bafkreihrcqhp575f6dph4uztbeyxfrmfnbv7x2gvovrgu4idgdsdw7wety',
69+
},
70+
{
71+
did: 'did:plc:mock0002',
72+
handle: 'patakllama.mockpmx.social',
73+
displayName: 'Patak Llama',
74+
avatar: 'https://api.dicebear.com/9.x/initials/svg?seed=llama',
75+
},
76+
{
77+
did: 'did:plc:mock0003',
78+
handle: 'patak.horse',
79+
displayName: 'Patak Horse',
80+
avatar:
81+
'https://cdn.bsky.app/img/avatar/plain/did:plc:vqh7id7sddkrfkhgt7tstlpd/bafkreifodkgqszgpt2qnoyljnbafokr6eujqwztj2kxo473adv5b57hjse',
82+
},
83+
{
84+
did: 'did:plc:mock0004',
85+
handle: 'patakcatapiller.mockpmx.social',
86+
},
87+
{
88+
did: 'did:plc:mock0005',
89+
handle: 'patakgoat.mockpmx.social',
90+
displayName: 'Patak Goat',
91+
},
92+
])
93+
})

app/pages/pds.stories.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Pds from './pds.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import { pageDecorator } from '../../.storybook/decorators'
4+
import { pdsUsersHandler } from '../../.storybook/handlers'
5+
6+
const meta = {
7+
component: Pds,
8+
parameters: {
9+
layout: 'fullscreen',
10+
msw: {
11+
handlers: [pdsUsersHandler],
12+
},
13+
},
14+
decorators: [pageDecorator],
15+
} satisfies Meta<typeof Pds>
16+
17+
export default meta
18+
type Story = StoryObj<typeof meta>
19+
20+
/** `/api/atproto/pds-users` is intercepted by MSW so the community section displays both avatar images and text-only entries. */
21+
export const Default: Story = {}
22+
23+
/** Community section shows an empty/loading state with no API response. */
24+
export const WithoutUsers: Story = {
25+
parameters: {
26+
msw: {
27+
handlers: [],
28+
},
29+
},
30+
}

0 commit comments

Comments
 (0)