Skip to content

Commit 533d456

Browse files
authored
Add signature status badge and logo upload functionality (#333)
1 parent 125f1fa commit 533d456

44 files changed

Lines changed: 3584 additions & 582 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.storybook/decorators/TRPCDecorator.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1-
import React from 'react'
1+
import React, { useMemo } from 'react'
22
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
3-
import { httpBatchLink } from '@trpc/client'
3+
import { httpLink } from '@trpc/client'
44
import { api } from '@/lib/trpc/client'
55
import type { Decorator } from '@storybook/nextjs-vite'
66

7-
// Create these outside the decorator to avoid recreating on every render
8-
const queryClient = new QueryClient({
9-
defaultOptions: {
10-
queries: {
11-
retry: false,
12-
refetchOnWindowFocus: false,
13-
staleTime: Infinity,
14-
},
15-
},
16-
})
17-
7+
// Use httpLink (not httpBatchLink) so each tRPC call is a separate HTTP request
8+
// that MSW can intercept individually
189
const trpcClient = api.createClient({
1910
links: [
20-
httpBatchLink({
11+
httpLink({
2112
url: '/api/trpc',
22-
// MSW will intercept these requests (relative URL for cross-origin compatibility)
2313
}),
2414
],
2515
})
2616

27-
export const TRPCDecorator: Decorator = (Story) => {
17+
function createQueryClient() {
18+
return new QueryClient({
19+
defaultOptions: {
20+
queries: {
21+
retry: false,
22+
refetchOnWindowFocus: false,
23+
},
24+
},
25+
})
26+
}
27+
28+
export const TRPCDecorator: Decorator = (Story, context) => {
29+
// Fresh QueryClient per story so cached data doesn't leak between stories.
30+
// Keyed on story id so switching stories forces a new cache.
31+
// eslint-disable-next-line react-hooks/exhaustive-deps
32+
const queryClient = useMemo(() => createQueryClient(), [context.id])
33+
2834
return (
2935
<api.Provider client={trpcClient} queryClient={queryClient}>
3036
<QueryClientProvider client={queryClient}>

.storybook/preview.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,21 @@ const preview: Preview = {
124124
'SponsorBulkActions',
125125
'MobileFilterSheet',
126126
'OnboardingLinkButton',
127+
'SendContractButton',
127128
'ContractReadinessIndicator',
128129
'ImportHistoricSponsorsButton',
129130
],
130131
'Dashboard',
131132
['Metrics', 'Action Items', 'Activity Timeline'],
132133
'Tiers',
133134
[
135+
'SponsorTiersPage',
134136
'SponsorTierManagement',
135137
'SponsorTierEditor',
136138
'SponsorAddModal',
137139
],
140+
'Contracts',
141+
['ContractTemplateListPage', 'ContractTemplateEditorPage'],
138142
'Contacts',
139143
[
140144
'SponsorContactTable',
@@ -164,7 +168,7 @@ const preview: Preview = {
164168
'Components',
165169
['SponsorLogo', 'Sponsors', 'SponsorThankYou'],
166170
'Onboarding',
167-
['SponsorOnboardingForm'],
171+
['SponsorOnboardingForm', 'SponsorOnboardingLogoUpload'],
168172
'Email',
169173
['SponsorTemplatePicker', 'SponsorEmailTemplateEditor'],
170174
'Form',

0 commit comments

Comments
 (0)