204 WP-NN/RB-NN comments named a closed ticket instead of the code they sit next to. git blame already records history and stays correct when code moves; the comment does not. This sweep removes the reference and keeps the sentence, across 95 files in apps/ and libs/ plus the behaviour-spec generator's header text. Eleven references stay: five story files justify an a11y disable per the README's rule, and one line in a11y.mdx documents that convention. Two sentences needed a rewrite, not a deletion, so the reference's meaning survives its removal. behaviour-spec.mdx is regenerated, not hand-edited. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
223 lines
6.0 KiB
TypeScript
223 lines
6.0 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/angular';
|
|
import { LetterComposerComponent } from './letter-composer.component';
|
|
import { Brief, BriefDecisions, BriefStatus, LibraryPassage } from '@brief/domain/brief';
|
|
import { allDiagnostics } from '@brief/domain/brief';
|
|
import { OrgTemplate } from '@brief/domain/org-template';
|
|
import { BlockDiffKind } from '@brief/domain/brief-diff';
|
|
|
|
const orgTemplate: OrgTemplate = {
|
|
subOrgId: 'cibg-registers',
|
|
orgName: 'CIBG — Registers',
|
|
returnAddress: 'BIG-register\nPostbus 00000\n2500 AA Den Haag',
|
|
footerContact: 'www.bigregister.nl\ninfo@voorbeeld.example',
|
|
footerLegal: 'Ons kenmerk vermelden bij correspondentie.',
|
|
signatureName: 'A. de Vries',
|
|
signatureRole: 'Hoofd Registratie',
|
|
signatureClosing: 'Met vriendelijke groet,',
|
|
margins: { topMm: 25, rightMm: 25, bottomMm: 25, leftMm: 25 },
|
|
version: 1,
|
|
};
|
|
|
|
const passages: LibraryPassage[] = [
|
|
{
|
|
passageId: 'p1',
|
|
scope: 'global',
|
|
sectionKey: 'aanhef',
|
|
label: 'Standaard aanhef',
|
|
version: 1,
|
|
content: {
|
|
paragraphs: [
|
|
{
|
|
nodes: [
|
|
{ type: 'text', text: 'Geachte heer/mevrouw ' },
|
|
{ type: 'placeholder', key: 'naam_zorgverlener' },
|
|
{ type: 'text', text: ',' },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
passageId: 'p2',
|
|
scope: 'beroep',
|
|
beroep: 'arts',
|
|
sectionKey: 'kern',
|
|
label: 'Toelichting arts',
|
|
version: 1,
|
|
content: { paragraphs: [{ nodes: [{ type: 'text', text: 'Als arts ...' }] }] },
|
|
},
|
|
];
|
|
|
|
function brief(status: BriefStatus): Brief {
|
|
return {
|
|
briefId: 'b1',
|
|
beroep: 'arts',
|
|
templateId: 't1',
|
|
drafterId: 'demo-drafter',
|
|
status,
|
|
placeholders: [
|
|
{ key: 'naam_zorgverlener', label: 'Naam zorgverlener', autoResolvable: true },
|
|
{ key: 'reden_besluit', label: 'Reden besluit', autoResolvable: false },
|
|
],
|
|
sections: [
|
|
{
|
|
sectionKey: 'aanhef',
|
|
title: 'Aanhef',
|
|
required: true,
|
|
locked: true,
|
|
blocks: [
|
|
{
|
|
type: 'passage',
|
|
blockId: 'local-1',
|
|
sourcePassageId: 'p1',
|
|
sourceVersion: 1,
|
|
edited: false,
|
|
content: passages[0].content,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
sectionKey: 'kern',
|
|
title: 'Kern van het besluit',
|
|
required: true,
|
|
locked: false,
|
|
blocks: [
|
|
{
|
|
type: 'freeText',
|
|
blockId: 'local-2',
|
|
content: {
|
|
paragraphs: [
|
|
{
|
|
nodes: [
|
|
{ type: 'text', text: 'Wij hebben besloten om reden ' },
|
|
{ type: 'placeholder', key: 'reden_besluit' },
|
|
{ type: 'text', text: '.' },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
sectionKey: 'slot',
|
|
title: 'Slot',
|
|
required: false,
|
|
locked: true,
|
|
blocks: [
|
|
{
|
|
type: 'freeText',
|
|
blockId: 'local-3',
|
|
content: {
|
|
paragraphs: [{ nodes: [{ type: 'text', text: 'Met vriendelijke groet,' }] }],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
}
|
|
|
|
const render = (
|
|
b: Brief,
|
|
decisions: BriefDecisions,
|
|
extra: {
|
|
blockDiffs?: ReadonlyMap<string, BlockDiffKind>;
|
|
removedCount?: number;
|
|
logoUrl?: string | null;
|
|
} = {},
|
|
) => ({
|
|
props: {
|
|
brief: b,
|
|
orgTemplate,
|
|
diagnostics: allDiagnostics(b),
|
|
...decisions,
|
|
busy: false,
|
|
blockDiffs: extra.blockDiffs ?? new Map<string, BlockDiffKind>(),
|
|
removedCount: extra.removedCount ?? 0,
|
|
logoUrl: extra.logoUrl ?? null,
|
|
},
|
|
template: `<app-letter-composer [brief]="brief" [orgTemplate]="orgTemplate" [logoUrl]="logoUrl"
|
|
[diagnostics]="diagnostics" [canApprove]="canApprove" [canReject]="canReject"
|
|
[canSend]="canSend" [busy]="busy" [blockDiffs]="blockDiffs"
|
|
[removedCount]="removedCount"></app-letter-composer>`,
|
|
});
|
|
|
|
const meta: Meta<LetterComposerComponent> = {
|
|
title: 'Domein/Brief/Letter Composer',
|
|
component: LetterComposerComponent,
|
|
};
|
|
export default meta;
|
|
type Story = StoryObj<LetterComposerComponent>;
|
|
|
|
export const SubmittedApprover: Story = {
|
|
render: () =>
|
|
render(brief({ tag: 'submitted', submittedBy: 'demo-drafter', submittedAt: '2026-07-01' }), {
|
|
canEdit: false,
|
|
canApprove: true,
|
|
canReject: true,
|
|
canSend: false,
|
|
canRevealBigNummer: false,
|
|
}),
|
|
};
|
|
export const ApprovedSender: Story = {
|
|
render: () =>
|
|
render(brief({ tag: 'approved', approvedBy: 'demo-approver', approvedAt: '2026-07-01' }), {
|
|
canEdit: false,
|
|
canApprove: false,
|
|
canReject: false,
|
|
canSend: true,
|
|
canRevealBigNummer: false,
|
|
}),
|
|
};
|
|
export const Sent: Story = {
|
|
render: () =>
|
|
render(brief({ tag: 'sent', sentAt: '2026-07-01' }), {
|
|
canEdit: false,
|
|
canApprove: false,
|
|
canReject: false,
|
|
canSend: false,
|
|
canRevealBigNummer: false,
|
|
}),
|
|
};
|
|
|
|
/** Approver's "Toon wijzigingen": a resubmitted letter with blocks changed,
|
|
added and removed since the last rejection. */
|
|
export const RejectionDiff: Story = {
|
|
render: () =>
|
|
render(
|
|
brief({
|
|
tag: 'submitted',
|
|
submittedBy: 'demo-drafter',
|
|
submittedAt: '2026-07-02',
|
|
}),
|
|
{
|
|
canEdit: false,
|
|
canApprove: true,
|
|
canReject: true,
|
|
canSend: false,
|
|
canRevealBigNummer: false,
|
|
},
|
|
{
|
|
blockDiffs: new Map<string, BlockDiffKind>([
|
|
['local-2', 'changed'],
|
|
['local-3', 'added'],
|
|
]),
|
|
removedCount: 1,
|
|
},
|
|
),
|
|
};
|
|
|
|
/** A pure viewer (e.g. admin) has no approve/reject/send capability on this letter —
|
|
the read-only notice, not a broken-looking editor. */
|
|
export const AlleenLezen: Story = {
|
|
render: () =>
|
|
render(brief({ tag: 'submitted', submittedBy: 'demo-drafter', submittedAt: '2026-07-01' }), {
|
|
canEdit: false,
|
|
canApprove: false,
|
|
canReject: false,
|
|
canSend: false,
|
|
canRevealBigNummer: false,
|
|
}),
|
|
};
|