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>
71 lines
3.5 KiB
TypeScript
71 lines
3.5 KiB
TypeScript
import {
|
|
ApplicationConfig,
|
|
LOCALE_ID,
|
|
isDevMode,
|
|
provideBrowserGlobalErrorListeners,
|
|
} from '@angular/core';
|
|
import { provideRouter, withInMemoryScrolling, withViewTransitions } from '@angular/router';
|
|
import type { ActivatedRouteSnapshot } from '@angular/router';
|
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
import { registerLocaleData } from '@angular/common';
|
|
import localeNl from '@angular/common/locales/nl';
|
|
import localeEn from '@angular/common/locales/en';
|
|
|
|
import { routes } from './app.routes';
|
|
import { scenarioInterceptor } from '@shared/infrastructure/scenario.interceptor';
|
|
import { roleInterceptor } from '@shared/infrastructure/role.interceptor';
|
|
import { provideApiClient } from '@shared/infrastructure/api-client.provider';
|
|
import { SESSION_PORT } from '@shared/application/session.port';
|
|
import { SessionStore } from '@auth/application/session.store';
|
|
import { provideRouteFocus } from '@shared/layout/route-focus';
|
|
import { provideUnloadFlush } from '@shared/application/pending-saves';
|
|
import { HEADER_ADMIN_LINKS, HEADER_NAV_ITEMS } from '@shared/layout/site-header/nav-config';
|
|
import { DEBUG_PANEL } from '@shared/layout/shell/shell.component';
|
|
import { ADMIN_LINKS, NAV_ITEMS } from './shell/nav.config';
|
|
import { DebugStateComponent } from './shell/debug-state/debug-state.component';
|
|
|
|
// Both locales' data so DatePipe/number pipes work for whichever bundle is active.
|
|
registerLocaleData(localeNl);
|
|
registerLocaleData(localeEn);
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
provideBrowserGlobalErrorListeners(),
|
|
provideRouter(
|
|
routes,
|
|
withInMemoryScrolling({ scrollPositionRestoration: 'enabled' }),
|
|
// Cross-fade page-to-page navigations only. A silent same-route nav — e.g.
|
|
// draft-sync stamping `?aanvraag=<id>` into the URL mid-wizard — must NOT
|
|
// animate: for the transition's duration Firefox's `::view-transition`
|
|
// overlay swallows pointer events (Chrome sets pointer-events:none, so it
|
|
// doesn't), which loses a click landing on it and makes the wizard's "next"
|
|
// button need a second click. Skip the transition when the route is unchanged.
|
|
withViewTransitions({
|
|
onViewTransitionCreated: ({ transition, from, to }) => {
|
|
// `from`/`to` are the ROOT snapshots (the shared shell), so descend to the
|
|
// leaf before comparing — otherwise every navigation looks "same route".
|
|
const leaf = (r: ActivatedRouteSnapshot) => {
|
|
while (r.firstChild) r = r.firstChild;
|
|
return r;
|
|
};
|
|
if (leaf(from).routeConfig === leaf(to).routeConfig) transition.skipTransition();
|
|
},
|
|
}),
|
|
),
|
|
// Dev-only: the ?scenario= toggle must never reach a production build, where
|
|
// a query param could otherwise force errors on the live app.
|
|
provideHttpClient(withInterceptors(isDevMode() ? [scenarioInterceptor, roleInterceptor] : [])),
|
|
provideApiClient(),
|
|
{ provide: SESSION_PORT, useExisting: SessionStore },
|
|
// Per-bundle locale: the localize build sets `$localize.locale` ('nl'/'en'); the
|
|
// non-localized dev/source build leaves it undefined → fall back to 'nl'. (Was hardcoded
|
|
// 'nl', which mis-formatted dates/numbers in the en bundle.)
|
|
{ provide: LOCALE_ID, useFactory: () => $localize.locale ?? 'nl' },
|
|
provideRouteFocus(),
|
|
provideUnloadFlush(),
|
|
{ provide: HEADER_NAV_ITEMS, useValue: NAV_ITEMS },
|
|
{ provide: HEADER_ADMIN_LINKS, useValue: ADMIN_LINKS },
|
|
{ provide: DEBUG_PANEL, useValue: DebugStateComponent },
|
|
],
|
|
};
|