Add About & Privacy and Donate modals (M6, §01)

This commit is contained in:
2026-06-07 20:04:08 +03:00
parent 30ff7ae357
commit 123f1498b4
8 changed files with 400 additions and 2 deletions
+17 -2
View File
@@ -10,16 +10,17 @@
* single shell-level Save/Cancel doesn't fit). The registry therefore omits
* `hasError`/`getError` (validity is the modal's own concern) and keeps only
* `getState` for unsaved-change detection on close. The registry is a partial
* map: modals land milestone by milestone (about/donate → M6, chartBuilder → M4),
* so only the implemented ones are registered here. Settings is deliberately NOT
* map — only the implemented ones are registered here. Settings is deliberately NOT
* a modal — preferences are distributed to per-pane disclosure popovers (spec §07;
* see components/SettingsPopover).
*/
import type { ComponentType } from 'react';
import type { ActiveModal, ModalName } from './types';
import { AboutModal } from '../components/AboutModal';
import { ChartBuilderModal } from '../components/ChartBuilderModal';
import { DatasetsModal } from '../components/DatasetsModal';
import { DonateModal } from '../components/DonateModal';
import { ExtractModal } from '../components/ExtractModal';
import { useChartBuilderStore } from '../stores/ChartBuilderStore';
import { useDatasetStore } from '../stores/DatasetStore';
@@ -77,6 +78,20 @@ export const MODAL_REGISTRY: Partial<Record<ModalName, ModalConfig>> = {
isUrlNavigable: true,
init: (datasetId) => useChartBuilderStore.getState().init(datasetId ? Number(datasetId) : null),
},
// Pure info modals — no state, no validity check, no discard prompt on close.
// `about` is URL-navigable (reload-restore); `donate` is not (spec §01E hash
// table omits both, but `about` is still a permanent, bookmark-worthy surface).
about: {
name: 'about',
title: 'About & Help',
component: AboutModal,
},
donate: {
name: 'donate',
title: 'Donate',
component: DonateModal,
},
};
export const getModalConfig = (name: ActiveModal): ModalConfig | undefined =>