refactor: split dashboard.page.ts into per-concern sections
Each dashboard section (Mijn aanvragen, Wat moet ik regelen, Mijn registratie, Specialismen, Wat wilt u doen, Beheer) now owns its own store access, async state, and template. DashboardPage becomes pure composition. Extract the repeated RemoteData Success-narrowing pattern into successOf() and the dashboard sort/split logic into sortForDashboard/concepten/ingediend, both with tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import type { Meta, StoryObj } from '@storybook/angular';
|
||||
import { applicationConfig } from '@storybook/angular';
|
||||
import { SpecialismenSection } from './specialismen.section';
|
||||
import { BigProfileStore } from '@registratie/application/big-profile.store';
|
||||
import { Aantekening } from '@registratie/domain/registration';
|
||||
import { RemoteData } from '@shared/application/remote-data';
|
||||
import { loading, success, empty, failure } from '@shared/testing/remote-data';
|
||||
|
||||
const rows: Aantekening[] = [
|
||||
{ type: 'Specialisme', omschrijving: 'Huisartsgeneeskunde', datum: '2016-04-12' },
|
||||
{ type: 'Aantekening', omschrijving: 'Erkend opleider huisartsgeneeskunde', datum: '2019-01-08' },
|
||||
];
|
||||
|
||||
/** Minimal store stand-in — only the members the section's template reads. */
|
||||
function storeStub(aantekeningen: RemoteData<Error | undefined, Aantekening[]>) {
|
||||
return { aantekeningen: () => aantekeningen, reloadAantekeningen: () => {} };
|
||||
}
|
||||
|
||||
const meta: Meta<SpecialismenSection> = {
|
||||
title: 'Domein/Registratie/Dashboard/Specialismen',
|
||||
component: SpecialismenSection,
|
||||
};
|
||||
export default meta;
|
||||
type Story = StoryObj<SpecialismenSection>;
|
||||
|
||||
export const Loading: Story = {
|
||||
decorators: [
|
||||
applicationConfig({
|
||||
providers: [{ provide: BigProfileStore, useValue: storeStub(loading()) }],
|
||||
}),
|
||||
],
|
||||
};
|
||||
export const Loaded: Story = {
|
||||
decorators: [
|
||||
applicationConfig({
|
||||
providers: [{ provide: BigProfileStore, useValue: storeStub(success(rows)) }],
|
||||
}),
|
||||
],
|
||||
};
|
||||
export const Empty: Story = {
|
||||
decorators: [
|
||||
applicationConfig({ providers: [{ provide: BigProfileStore, useValue: storeStub(empty()) }] }),
|
||||
],
|
||||
};
|
||||
export const Failed: Story = {
|
||||
decorators: [
|
||||
applicationConfig({
|
||||
providers: [{ provide: BigProfileStore, useValue: storeStub(failure(new Error('offline'))) }],
|
||||
}),
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user