♻️ refactor(frontend): split HealthDashboard into smart wrapper + dumb View for state-based stories (#33)
SRP split: HealthDashboardView (presentational, props-based) + HealthDashboard (smart wrapper, useFetch). Enables 4 Storybook stories per state + unit testability per branch. Existing testids preserved, Playwright tests still pass. Co-authored-by: Gabriel Radureau <arcodange@gmail.com> Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
This commit was merged in pull request #33.
This commit is contained in:
@@ -5,6 +5,16 @@ const meta: Meta<typeof HealthDashboard> = {
|
||||
title: 'Components/HealthDashboard',
|
||||
component: HealthDashboard,
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
'Smart wrapper that calls /api/healthz internally and delegates rendering to HealthDashboardView. ' +
|
||||
'For state-by-state previews (Healthy, Loading, Error), see ' +
|
||||
'[HealthDashboardView stories](?path=/docs/components-healthdashboardview--docs).',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
export default meta
|
||||
|
||||
@@ -14,20 +24,3 @@ type Story = StoryObj<typeof meta>
|
||||
export const Default: Story = {
|
||||
args: {},
|
||||
}
|
||||
|
||||
// Documents the loading/error visuals so reviewers see them in Storybook
|
||||
// without needing a backend down. The component currently doesn't accept overrides
|
||||
// because it uses useFetch internally - this story is a placeholder for a future
|
||||
// refactor that exposes data/pending/error as props for testability.
|
||||
export const DocumentationStub: Story = {
|
||||
args: {},
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
story:
|
||||
'Renders the same as Default. The HealthDashboard fetches /api/healthz internally, so loading/error states only appear when the backend is down or slow. ' +
|
||||
'Future improvement: accept healthData/pending/error as props for easy state-based stories. Until then, see frontend/docs/e2e/ for screenshots of both healthy and error states.',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user