feat(WP-67): merge behandelportal into this repo as a monorepo

Restructures into apps/ssp + apps/behandelportal (two Angular projects)
plus libs/shared + libs/beheer (cross-app libraries), replacing WP-61's
separate sibling repo. That split had already produced real drift: a
hand-vendored copy of the backend's OpenAPI doc, a shared/ui+layout tree
forked and silently diverging (7 files), and beheer + the styles.scss
token bridge duplicated byte-for-byte across both repos.

- git mv the SSP's src/app/* into apps/ssp/; fold shared/, beheer/,
  environments/, the Storybook docs/*.mdx, and styles.scss into
  libs/shared + libs/beheer (all confirmed identical between the two
  repos before merging). auth stays deliberately duplicated per
  ADR-0002 (actor-specific, expected to diverge) - amended there.
- One generated API client (libs/shared), no more vendored swagger.json.
- .dependency-cruiser split into a base factory + one config per app,
  and Storybook into .storybook-ssp/.storybook-behandelportal - both
  forced by the @auth/* alias resolving to different directories per app.
- SiteHeaderComponent/ShellComponent gained HEADER_NAV_ITEMS/
  HEADER_ADMIN_LINKS/DEBUG_PANEL injection tokens so each app supplies
  its own nav/admin-links/dev-panel instead of one being hardcoded.
- CLAUDE.md, ARCHITECTURE.md, dependencies.md, and ADR-0002 updated;
  WP-67 backlog entry documents the full decision trail.

npm run ci green (lint, dep:check x2, 360 tests across ssp/
behandelportal/shared/beheer, both localized builds, backend tests,
snippet + api-client drift); both dev servers, both Storybook
instances, and docker compose verified working.

The old sibling repo (/home/eho/repos/behandelportal) is left
untouched, not deleted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
eho
2026-08-02 21:01:57 +02:00
co-authored by Claude Sonnet 5
parent d3f3b13345
commit e7156c5132
403 changed files with 7103 additions and 60917 deletions
@@ -0,0 +1,109 @@
import { Component, computed, input, linkedSignal, output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CheckboxComponent } from '@shared/ui/checkbox/checkbox.component';
import { RadioGroupComponent, RadioOption } from '@shared/ui/radio-group/radio-group.component';
import { HeadingComponent } from '@shared/ui/heading/heading.component';
import { Besluit, LibraryPassage } from '@brief/domain/brief';
import { redenenFor } from '@brief/domain/besluit';
/** Organism: the guided-drafting selector. The behandelaar picks the besluit
(positief/negatief) and — for a negatief besluit — the reden(en); the kern's
standaardteksten follow the selection LIVE (`selectionChange` → the store recomposes
the kern). This is the "no detective work" step: which passages belong is decided by
the besluit, not by the drafter hunting the library.
ponytail: view-state signals, not a form-machine — no validation/submission of its own;
it just reports the selection. `besluit`/`redenen` inputs re-seed it (via linkedSignal)
from the persisted letter on reload/undo, so it always reflects the letter's real state. */
@Component({
selector: 'app-besluit-panel',
imports: [FormsModule, CheckboxComponent, RadioGroupComponent, HeadingComponent],
styles: [
`
:host {
display: block;
padding: var(--rhc-space-max-lg);
border: 1px solid var(--rhc-color-border);
border-radius: var(--rhc-radius-md, 4px);
background: var(--rhc-color-background-subtle, transparent);
}
.redenen {
display: grid;
gap: var(--rhc-space-max-sm);
margin-block-start: var(--rhc-space-max-md);
}
`,
],
template: `
<app-heading [level]="3">{{ heading() }}</app-heading>
<p class="app-text-subtle">{{ intro() }}</p>
<app-radio-group
name="besluit"
[options]="besluitOptions()"
[ngModel]="selected()"
(ngModelChange)="onBesluit($event)"
/>
@if (redenen().length > 0) {
<div class="redenen" role="group" [attr.aria-label]="redenenLabel()">
@for (r of redenen(); track r.code) {
<app-checkbox
[checkboxId]="'reden-' + r.code"
[label]="r.label"
[ngModel]="checked().has(r.code)"
(ngModelChange)="toggle(r.code, $event)"
/>
}
</div>
}
`,
})
export class BesluitPanelComponent {
/** The passage library — the redenen checkboxes are derived from its negatief tags. */
passages = input<readonly LibraryPassage[]>([]);
/** The letter's current selection, inferred from its kern passages — re-seeds the panel. */
besluit = input<Besluit | null>(null);
initialRedenen = input<readonly string[]>([]);
selectionChange = output<{ besluit: Besluit | null; reasons: string[] }>();
protected selected = linkedSignal<Besluit | ''>(() => this.besluit() ?? '');
protected checked = linkedSignal<ReadonlySet<string>>(() => new Set(this.initialRedenen()));
/** The reden checkboxes for the chosen besluit — derived from the reason-tagged passages. */
protected redenen = computed(() =>
this.selected() === '' ? [] : redenenFor(this.passages(), this.selected() as Besluit),
);
protected onBesluit(value: string) {
this.selected.set(value === 'positief' || value === 'negatief' ? value : '');
this.checked.set(new Set()); // redenen only apply to the chosen besluit
this.emit();
}
protected toggle(code: string, on: boolean) {
const next = new Set(this.checked());
if (on) next.add(code);
else next.delete(code);
this.checked.set(next);
this.emit();
}
private emit() {
this.selectionChange.emit({
besluit: this.selected() === '' ? null : (this.selected() as Besluit),
reasons: [...this.checked()],
});
}
protected besluitOptions = input<RadioOption[]>([
{ value: 'positief', label: $localize`:@@brief.besluit.positief:Positief besluit (toewijzen)` },
{ value: 'negatief', label: $localize`:@@brief.besluit.negatief:Negatief besluit (afwijzen)` },
]);
protected heading = input($localize`:@@brief.besluit.heading:Besluit`);
protected intro = input(
$localize`:@@brief.besluit.intro:Kies het besluit; de juiste standaardteksten verschijnen meteen in de brief.`,
);
protected redenenLabel = input($localize`:@@brief.besluit.redenen:Reden(en) voor afwijzing`);
}
@@ -0,0 +1,65 @@
import type { Meta, StoryObj } from '@storybook/angular';
import { LibraryPassage } from '@brief/domain/brief';
import { BesluitPanelComponent } from './besluit-panel.component';
const text = (t: string): LibraryPassage['content'] => ({
paragraphs: [{ nodes: [{ type: 'text', text: t }] }],
});
const passages: LibraryPassage[] = [
{
passageId: 'p-kern-positief',
scope: 'global',
sectionKey: 'kern',
label: 'Toewijzing',
version: 1,
besluit: 'positief',
content: text('Toegewezen.'),
},
{
passageId: 'p-kern-negatief',
scope: 'global',
sectionKey: 'kern',
label: 'Afwijzing',
version: 1,
besluit: 'negatief',
content: text('Afgewezen.'),
},
{
passageId: 'p-kern-scholing',
scope: 'global',
sectionKey: 'kern',
label: 'Onvoldoende scholing',
version: 1,
besluit: 'negatief',
reason: 'onvoldoende_scholing',
content: text('Onvoldoende scholing.'),
},
{
passageId: 'p-kern-gegevens',
scope: 'global',
sectionKey: 'kern',
label: 'Onjuiste gegevens',
version: 1,
besluit: 'negatief',
reason: 'onjuiste_gegevens',
content: text('Onjuiste gegevens.'),
},
];
const meta: Meta<BesluitPanelComponent> = {
title: 'Domein/Brief/Besluit Panel',
component: BesluitPanelComponent,
args: { passages },
};
export default meta;
type Story = StoryObj<BesluitPanelComponent>;
/** Pick a besluit; a negatief besluit reveals the reason checkboxes. Each change emits
`selectionChange` and the kern's standaardteksten follow live — no generate button. */
export const Default: Story = {};
/** Re-seeded from a persisted letter: a negatief besluit with a reden already ticked. */
export const NegatiefMetReden: Story = {
args: { besluit: 'negatief', initialRedenen: ['onvoldoende_scholing'] },
};