Files
frontend/apps/sn/src/features/window-popup/registry.tsx
T

242 lines
7.2 KiB
TypeScript

"use client";
import LoadingOverlay from "@/components/ui/loading-bar";
import dynamic from "next/dynamic";
import type { ComponentType } from "react";
import {
windowPopupDefinitions,
type WindowPopupKey,
} from "./model/popup-definitions";
import type {
WindowPopupContentProps,
WindowPopupRegistryItem,
} from "./model/types";
import FeaturePlaceholderPopupContent from "./ui/feature-placeholder-popup-content";
type WindowPopupModule = {
default: ComponentType<WindowPopupContentProps>;
};
const PopupChunkLoading = () => (
<div className="relative min-h-dvh">
<LoadingOverlay isLoading />
</div>
);
const loadPopupContent = (loader: () => Promise<WindowPopupModule>) =>
dynamic(loader, {
ssr: false,
loading: PopupChunkLoading,
});
const CfmtnBgtPopupContent = loadPopupContent(
() => import("../cfmtn-bgt/ui/cfmtn-bgt-popup-content"),
);
const AgedPipePopupContent = loadPopupContent(
() => import("./ui/aged-pipe-popup-content"),
);
const AgedPipeStatusByCtpvPopupContent = loadPopupContent(
() => import("./ui/aged-pipe-status-by-ctpv-popup-content"),
);
const DredgingRegisterPopupContent = loadPopupContent(
() => import("./ui/dredging-register-popup-content"),
);
const DredgingEditPopupContent = loadPopupContent(
() => import("./ui/dredging-edit-popup-content"),
);
const ExmnBusinessRegisterPopupContent = loadPopupContent(
() => import("./ui/exmn-business-register-popup-content"),
);
const ExmnPipeReportPopupContent = loadPopupContent(
() => import("./ui/exmn-pipe-report-popup-content"),
);
const ExmnResultRegisterPopupContent = loadPopupContent(
() => import("./ui/exmn-result-register-popup-content"),
);
const ExmnSurveyDetailPopupContent = loadPopupContent(
() => import("./ui/exmn-survey-detail-popup-content"),
);
const InfilChartPopupContent = loadPopupContent(
() => import("./ui/infil-chart-popup-content"),
);
const InftwtResultPopupContent = loadPopupContent(
() => import("./ui/inftwt-result-popup-content"),
);
const RdiiChartPopupContent = loadPopupContent(
() => import("./ui/rdii-chart-popup-content"),
);
const RdiiResultPopupContent = loadPopupContent(
() => import("./ui/rdii-result-popup-content"),
);
const ReportFilesPopupContent = loadPopupContent(
() => import("./ui/report-files-popup-content"),
);
const ReportTabPopupContent = loadPopupContent(
() => import("./ui/report-tab-popup-content"),
);
const SearchModalPopupContent = loadPopupContent(
() => import("./ui/search-modal-popup-content"),
);
const SinkholePopupContent = loadPopupContent(
() => import("./ui/sinkhole-popup-content"),
);
const SbmrgDngrMapPopupContent = loadPopupContent(
() => import("./ui/sbmrg-dngr-map-popup-content"),
);
const FloodDngrMapPopupContent = loadPopupContent(
() => import("./ui/flood-dngr-map-popup-content"),
);
const SscDetailPopupContent = loadPopupContent(
() => import("./ui/ssc-detail-popup-content"),
);
const FldngHstryPopupContent = loadPopupContent(
() => import("./ui/fldng-hstry-popup-content"),
);
const GisEditSessionPopupContent = loadPopupContent(
() => import("./ui/gis-edit-session-popup-content"),
);
const GisManagementPopupContent = loadPopupContent(
() => import("./ui/gis-management-popup-content"),
);
const PipeAnalysisPopupContent = loadPopupContent(
() => import("./ui/pipe-analysis-popup-content"),
);
const PipeAnalysisDetailPopupContent = loadPopupContent(
() => import("./ui/pipe-analysis-detail-popup-content"),
);
const RepairHistoryPopupContent = loadPopupContent(
() => import("./ui/repair-history-popup-content"),
);
const WaterRiskPopupContent = loadPopupContent(
() => import("./ui/water-risk-popup-content"),
);
const FldngPredcPrstPopupContent = loadPopupContent(
() => import("../fldng-predc-prst/ui/fldng-predc-prst-popup-content"),
);
const GisEditPopupContent = (_props: WindowPopupContentProps) => (
<FeaturePlaceholderPopupContent
title={windowPopupDefinitions.gisEditPopup.title}
/>
);
export const windowPopupRegistry = {
cfmtnBgt: {
...windowPopupDefinitions.cfmtnBgt,
component: CfmtnBgtPopupContent,
},
exmnBusinessRegister: {
...windowPopupDefinitions.exmnBusinessRegister,
component: ExmnBusinessRegisterPopupContent,
},
exmnResultRegister: {
...windowPopupDefinitions.exmnResultRegister,
component: ExmnResultRegisterPopupContent,
},
exmnSurveyDetail: {
...windowPopupDefinitions.exmnSurveyDetail,
component: ExmnSurveyDetailPopupContent,
},
dredgingRegister: {
...windowPopupDefinitions.dredgingRegister,
component: DredgingRegisterPopupContent,
},
dredgingEdit: {
...windowPopupDefinitions.dredgingEdit,
component: DredgingEditPopupContent,
},
exmnPipeReport: {
...windowPopupDefinitions.exmnPipeReport,
component: ExmnPipeReportPopupContent,
},
reportTab: {
...windowPopupDefinitions.reportTab,
component: ReportTabPopupContent,
},
reportFiles: {
...windowPopupDefinitions.reportFiles,
component: ReportFilesPopupContent,
},
mapSearch: {
...windowPopupDefinitions.mapSearch,
component: SearchModalPopupContent,
},
inftwtResultPopup: {
...windowPopupDefinitions.inftwtResultPopup,
component: InftwtResultPopupContent,
},
rdiiResultPopup: {
...windowPopupDefinitions.rdiiResultPopup,
component: RdiiResultPopupContent,
},
infilChart: {
...windowPopupDefinitions.infilChart,
component: InfilChartPopupContent,
},
rdiiChart: {
...windowPopupDefinitions.rdiiChart,
component: RdiiChartPopupContent,
},
sscDetail: {
...windowPopupDefinitions.sscDetail,
component: SscDetailPopupContent,
},
agedPipePopup: {
...windowPopupDefinitions.agedPipePopup,
component: AgedPipePopupContent,
},
sinkholePopup: {
...windowPopupDefinitions.sinkholePopup,
component: SinkholePopupContent,
},
sbmrgDngrMapPopup: {
...windowPopupDefinitions.sbmrgDngrMapPopup,
component: SbmrgDngrMapPopupContent,
},
floodDngrMapPopup: {
...windowPopupDefinitions.floodDngrMapPopup,
component: FloodDngrMapPopupContent,
},
pipeAnalysisPopup: {
...windowPopupDefinitions.pipeAnalysisPopup,
component: PipeAnalysisPopupContent,
},
pipeAnalysisDetailPopup: {
...windowPopupDefinitions.pipeAnalysisDetailPopup,
component: PipeAnalysisDetailPopupContent,
},
repairHistoryPopup: {
...windowPopupDefinitions.repairHistoryPopup,
component: RepairHistoryPopupContent,
},
fldngPredcPrst: {
...windowPopupDefinitions.fldngPredcPrst,
component: FldngPredcPrstPopupContent,
},
agedPipeStatusByCtpvPopup: {
...windowPopupDefinitions.agedPipeStatusByCtpvPopup,
component: AgedPipeStatusByCtpvPopupContent,
},
fldngHstryPopup: {
...windowPopupDefinitions.fldngHstryPopup,
component: FldngHstryPopupContent,
},
gisEditPopup: {
...windowPopupDefinitions.gisEditPopup,
component: GisEditPopupContent,
},
gisEditSessionPopup: {
...windowPopupDefinitions.gisEditSessionPopup,
component: GisEditSessionPopupContent,
},
gisManagementPopup: {
...windowPopupDefinitions.gisManagementPopup,
component: GisManagementPopupContent,
},
flowRiskPopup: {
...windowPopupDefinitions.flowRiskPopup,
component: WaterRiskPopupContent,
},
} as const satisfies Record<WindowPopupKey, WindowPopupRegistryItem>;