Files
astrolabe/src/app/modals/UrlStateSync.ts
T

27 lines
1.2 KiB
TypeScript

/**
* Modal ↔ URL hash sync (docs/architecture/03 → "URL & Keyboard Integration").
*
* The coordinator calls these so a navigable modal (Datasets, Settings, Chart
* Builder) becomes a shareable / back-navigable location, e.g.
* `#datasets/dataset-<id>`. Full hash routing — view-state restore on load,
* Back/Forward — is milestone M6 (spec §01E, docs/architecture/04). Until then
* these are intentional no-ops so the coordinator's shape is final and M6 fills
* the bodies in without the call sites changing.
*/
import type { ModalName } from './types';
import { getModalConfig } from './modal-registry';
/** Reflect an open navigable modal (and optional sub-target) in the URL hash. */
export function syncModalToUrl(name: ModalName, _arg?: string): void {
if (!getModalConfig(name)?.isUrlNavigable) return;
// TODO (M6, spec §01E): write `#${name}` / `#${name}/dataset-${arg}` to the
// hash via the routing layer (docs/architecture/04).
}
/** Return the hash to the underlying workspace when a navigable modal closes. */
export function clearModalFromUrl(name: ModalName): void {
if (!getModalConfig(name)?.isUrlNavigable) return;
// TODO (M6, spec §01E): restore the pre-modal workspace hash.
}