통수위험분석 프로토타입 구현

This commit is contained in:
kiminchan
2026-05-19 13:39:25 +09:00
parent ef7bae98d4
commit 0c66a8f3b7
11 changed files with 3177 additions and 8 deletions
@@ -0,0 +1,876 @@
"use client";
import { Fragment, useEffect, useMemo, useState } from "react";
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import { Button } from "@common/components";
import {
WINDOW_POPUP_MESSAGE_TYPE,
type WindowPopupContentProps,
} from "@/features/windowPopup/model/types";
import {
buildWaterRiskMethodLabel,
buildWaterRiskSettingAreaName,
buildWaterRiskStatusLabel,
EMPTY_WATER_RISK_SESSION_SNAPSHOT,
WATER_RISK_RESULT_ROWS,
WATER_RISK_SETTING_ROWS,
WATER_RISK_SGG_OPTIONS_BY_SIDO,
WATER_RISK_SIDO_OPTIONS,
type WaterRiskResultRow,
type WaterRiskSessionSnapshot,
type WaterRiskSettingRow,
type WaterRiskStagedPipe,
} from "./waterRiskTypes";
type WaterRiskView = "result" | "setting";
type ResultFilters = {
analysisDate: string;
analysisTime: string;
sidoName: string;
sggName: string;
areaId: string;
riskStatus: "ALL" | "DANGER" | "NORMAL";
};
type SettingFilters = {
sidoName: string;
sggName: string;
areaId: string;
};
const DEFAULT_RESULT_FILTERS: ResultFilters = {
analysisDate: "2026-05-18",
analysisTime: "09:00",
sidoName: "전체",
sggName: "전체",
areaId: "ALL",
riskStatus: "ALL",
};
const DEFAULT_SETTING_FILTERS: SettingFilters = {
sidoName: "전체",
sggName: "전체",
areaId: "ALL",
};
const TOOLBAR_INPUT_CLASS_NAME =
"h-[30px] rounded-none border border-[#8f98a3] bg-white px-2 text-[12px] text-[#1f2937] outline-none";
const TOOLBAR_BUTTON_CLASS_NAME =
"h-[30px] min-w-[44px] rounded-none border border-[#7c5a20] bg-[#ef8d2f] px-3 text-[12px] font-semibold text-white hover:bg-[#df7f24]";
const SECONDARY_BUTTON_CLASS_NAME =
"h-[28px] rounded-none border border-[#8f98a3] bg-white px-3 text-[12px] text-[#334155] hover:bg-[#f8fafc]";
const ACTION_BUTTON_CLASS_NAME =
"h-[28px] rounded-[6px] border border-[#2e77bc] bg-[#3f8fd7] px-3 text-[12px] font-semibold text-white hover:bg-[#337ec1]";
const WATER_RISK_PAGE_SIZE = 10;
const RESULT_TABLE_CONTAINER_CLASS_NAME =
"min-h-0 overflow-hidden rounded-[10px] border border-[#d6e1ee] bg-[linear-gradient(180deg,#ffffff_0%,#f9fbfe_100%)] shadow-[0_6px_16px_rgba(31,59,87,0.06)]";
const SETTING_TABLE_CONTAINER_CLASS_NAME =
"min-h-0 overflow-hidden rounded-[10px] border border-[#d6e1ee] bg-[linear-gradient(180deg,#ffffff_0%,#f9fbfe_100%)] shadow-[0_6px_16px_rgba(31,59,87,0.06)]";
const postMessageToOpener = (type: string, payload?: Record<string, unknown>) => {
if (typeof window === "undefined" || !window.opener) return;
window.opener.postMessage({ type, payload }, window.location.origin);
};
const buildPreviewTimestamp = () => new Date().toISOString();
const buildResultDownloadPreview = (
filters: ResultFilters,
rows: WaterRiskResultRow[],
) => ({
endpoint: "/api/v1/map/wraResults/download",
method: "POST",
generatedAt: buildPreviewTimestamp(),
filters,
resultCount: rows.length,
});
const buildSettingDownloadPreview = (
filters: SettingFilters,
rows: WaterRiskSettingRow[],
) => ({
endpoint: "/api/v1/map/wraOutletPipeSettings/download",
method: "POST",
generatedAt: buildPreviewTimestamp(),
filters,
resultCount: rows.length,
});
const buildSavePreview = (
snapshot: WaterRiskSessionSnapshot,
stagedPipes: WaterRiskStagedPipe[],
) => ({
endpoint: "/api/v1/map/wraOutletPipeSettings/save",
method: "POST",
generatedAt: buildPreviewTimestamp(),
body: {
focusAreaId: snapshot.selectedSettingAreaId,
focusAreaName: snapshot.selectedSettingAreaName,
pipes: stagedPipes.map((pipe, index) => ({
pipeId: pipe.pipeId,
setSeq: index + 1,
})),
},
});
const getRiskBadgeClassName = (riskStatus: "DANGER" | "NORMAL") =>
riskStatus === "DANGER"
? "bg-[#ff1c15] text-white"
: "bg-white text-[#111827]";
export default function WaterRiskPopupPage(_props: WindowPopupContentProps) {
const [activeView, setActiveView] = useState<WaterRiskView>("result");
const [snapshot, setSnapshot] = useState<WaterRiskSessionSnapshot>(
EMPTY_WATER_RISK_SESSION_SNAPSHOT,
);
const [draftResultFilters, setDraftResultFilters] = useState<ResultFilters>(
DEFAULT_RESULT_FILTERS,
);
const [appliedResultFilters, setAppliedResultFilters] = useState<ResultFilters>(
DEFAULT_RESULT_FILTERS,
);
const [draftSettingFilters, setDraftSettingFilters] = useState<SettingFilters>(
DEFAULT_SETTING_FILTERS,
);
const [appliedSettingFilters, setAppliedSettingFilters] = useState<SettingFilters>(
DEFAULT_SETTING_FILTERS,
);
const [selectedResultAreaId, setSelectedResultAreaId] = useState<string>(
WATER_RISK_RESULT_ROWS[0]?.areaId ?? "",
);
const [selectedSettingAreaId, setSelectedSettingAreaId] = useState<string>("");
const [resultCurrentPage, setResultCurrentPage] = useState(1);
const [settingCurrentPage, setSettingCurrentPage] = useState(1);
const [noticeMessage, setNoticeMessage] = useState("");
useEffect(() => {
const handleMessage = (event: MessageEvent) => {
if (event.origin !== window.location.origin) return;
if (event.data?.type !== WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_SYNC) return;
const nextSnapshot = (event.data.payload ??
EMPTY_WATER_RISK_SESSION_SNAPSHOT) as WaterRiskSessionSnapshot;
setSnapshot(nextSnapshot);
if (nextSnapshot.selectedAreaId) {
setSelectedResultAreaId(nextSnapshot.selectedAreaId);
}
if (nextSnapshot.selectedSettingAreaId) {
setSelectedSettingAreaId(nextSnapshot.selectedSettingAreaId);
}
};
window.addEventListener("message", handleMessage);
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_READY);
return () => {
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_STOP_SETTING_EDIT);
window.removeEventListener("message", handleMessage);
};
}, []);
const visibleResultRows = useMemo(() => {
return WATER_RISK_RESULT_ROWS.filter((row) => {
if (
appliedResultFilters.sidoName !== "전체" &&
row.sidoName !== appliedResultFilters.sidoName
) {
return false;
}
if (
appliedResultFilters.sggName !== "전체" &&
row.sggName !== appliedResultFilters.sggName
) {
return false;
}
if (
appliedResultFilters.areaId !== "ALL" &&
row.areaId !== appliedResultFilters.areaId
) {
return false;
}
if (
appliedResultFilters.riskStatus !== "ALL" &&
row.riskStatus !== appliedResultFilters.riskStatus
) {
return false;
}
return true;
});
}, [appliedResultFilters]);
const visibleSettingRows = useMemo(() => {
return WATER_RISK_SETTING_ROWS.filter((row) => {
if (
appliedSettingFilters.sidoName !== "전체" &&
row.sidoName !== appliedSettingFilters.sidoName
) {
return false;
}
if (
appliedSettingFilters.sggName !== "전체" &&
row.sggName !== appliedSettingFilters.sggName
) {
return false;
}
if (
appliedSettingFilters.areaId !== "ALL" &&
row.areaId !== appliedSettingFilters.areaId
) {
return false;
}
return true;
});
}, [appliedSettingFilters]);
const maxPipeCount = useMemo(
() =>
visibleResultRows.reduce(
(maxCount, row) => Math.max(maxCount, row.pipeSummaries.length),
0,
),
[visibleResultRows],
);
const resultAreaOptions = useMemo(
() =>
WATER_RISK_RESULT_ROWS.map((row) => ({
areaId: row.areaId,
areaName: row.areaName,
})),
[],
);
const settingAreaOptions = useMemo(() => {
const areaMap = new Map<string, { areaId: string; areaName: string }>();
WATER_RISK_SETTING_ROWS.forEach((row) => {
areaMap.set(row.areaId, {
areaId: row.areaId,
areaName: row.areaName,
});
});
return Array.from(areaMap.values());
}, []);
const resultSggOptions =
WATER_RISK_SGG_OPTIONS_BY_SIDO[draftResultFilters.sidoName] ??
WATER_RISK_SGG_OPTIONS_BY_SIDO["전체"] ??
[];
const settingSggOptions =
WATER_RISK_SGG_OPTIONS_BY_SIDO[draftSettingFilters.sidoName] ??
WATER_RISK_SGG_OPTIONS_BY_SIDO["전체"] ??
[];
const currentSettingAreaName =
snapshot.selectedSettingAreaName ||
buildWaterRiskSettingAreaName(selectedSettingAreaId || snapshot.selectedSettingAreaId);
const pagedResultRows = useMemo(() => {
const startIndex = (resultCurrentPage - 1) * WATER_RISK_PAGE_SIZE;
return visibleResultRows.slice(startIndex, startIndex + WATER_RISK_PAGE_SIZE);
}, [resultCurrentPage, visibleResultRows]);
const pagedSettingRows = useMemo(() => {
const startIndex = (settingCurrentPage - 1) * WATER_RISK_PAGE_SIZE;
return visibleSettingRows.slice(startIndex, startIndex + WATER_RISK_PAGE_SIZE);
}, [settingCurrentPage, visibleSettingRows]);
const showSettingEditor = snapshot.isSettingEditMode || snapshot.stagedPipes.length > 0;
const resultPipeGroupCount = Math.max(1, maxPipeCount);
const resultTableMinWidth = 560 + resultPipeGroupCount * 180;
const settingTableMinWidth = 900;
useEffect(() => {
if (typeof window === "undefined" || !window.resizeTo) return;
const popupWidth =
activeView === "result"
? Math.min(1320, Math.max(860, 620 + resultPipeGroupCount * 180))
: showSettingEditor
? 1180
: 980;
const popupHeight = activeView === "setting" && showSettingEditor ? 900 : 720;
window.resizeTo(popupWidth, popupHeight);
}, [activeView, resultPipeGroupCount, showSettingEditor]);
const handleApplyResultFilters = () => {
if (!draftResultFilters.analysisDate || !draftResultFilters.analysisTime) {
setNoticeMessage("기준 날짜와 시간을 입력해야 조회할 수 있습니다.");
return;
}
setResultCurrentPage(1);
setAppliedResultFilters(draftResultFilters);
setNoticeMessage("통수위험 분석 결과를 갱신했습니다.");
};
const handleOpenSettingView = () => {
setActiveView("setting");
setNoticeMessage("");
};
const handleReturnToResultView = () => {
setActiveView("result");
setNoticeMessage("");
};
const handleSelectResultRow = (row: WaterRiskResultRow) => {
setSelectedResultAreaId(row.areaId);
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_SELECT_RESULT, {
areaId: row.areaId,
});
setNoticeMessage(`${row.areaName}을 지도에서 강조했습니다.`);
};
const handlePreviewResultDownload = () => {
const preview = buildResultDownloadPreview(appliedResultFilters, visibleResultRows);
console.info("WaterRisk result download preview", preview);
setNoticeMessage("결과 다운로드 preview를 생성했습니다. 콘솔을 확인하세요.");
};
const handleApplySettingFilters = () => {
setSettingCurrentPage(1);
setAppliedSettingFilters(draftSettingFilters);
setNoticeMessage("설정 현황 목록을 갱신했습니다.");
};
const handleStopSettingEdit = () => {
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_STOP_SETTING_EDIT);
setNoticeMessage("통수위험 설정 편집 모드를 종료했습니다.");
};
const handleRemoveStagedPipe = (pipeId: string) => {
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_REMOVE_STAGED_PIPE, {
pipeId,
});
};
const handleMoveStagedPipe = (pipeId: string, direction: "UP" | "DOWN") => {
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_REORDER_STAGED_PIPE, {
pipeId,
direction,
});
};
const handleClearStagedPipes = () => {
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_CLEAR_STAGED_PIPES);
};
const handlePreviewSave = () => {
if (!snapshot.selectedSettingAreaId || snapshot.stagedPipes.length === 0) {
setNoticeMessage("저장할 유출관로가 없습니다.");
return;
}
const preview = buildSavePreview(snapshot, snapshot.stagedPipes);
console.info("WaterRisk save preview", preview);
setNoticeMessage("설정 저장 payload preview를 생성했습니다. 콘솔을 확인하세요.");
};
const handleSelectSettingArea = (areaId: string) => {
setSelectedSettingAreaId(areaId);
const targetAreaName =
settingAreaOptions.find((item) => item.areaId === areaId)?.areaName ??
buildWaterRiskSettingAreaName(areaId);
postMessageToOpener(WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_START_SETTING_EDIT, {
areaId,
areaName: targetAreaName,
});
setNoticeMessage(`${targetAreaName} 설정 편집 대상을 선택했습니다.`);
};
return (
<main className="flex h-screen flex-col overflow-hidden bg-[linear-gradient(180deg,#f7f9fc_0%,#eef4fa_100%)] text-[#202a36]">
<header className="flex h-[46px] items-center border-b border-[#e2ebf5] bg-[linear-gradient(180deg,#ffffff_0%,#f3f8fd_100%)] px-[18px]">
{activeView === "setting" ? (
<button
type="button"
className="mr-3 text-[12px] font-semibold text-[#51657a] hover:text-[#1f2937]"
onClick={handleReturnToResultView}
>
← 결과조회
</button>
) : null}
<h1 className="text-[1.1rem] font-semibold tracking-[-0.01em] text-[#1f3b57]">
{activeView === "result" ? "통수위험분석" : "통수위험분석 설정"}
</h1>
</header>
<section className="flex-1 overflow-hidden px-[12px] pb-[12px] pt-[10px]">
{activeView === "result" ? (
<section className="flex h-full min-h-0 flex-col gap-[8px]">
<div className="overflow-x-auto">
<div className="flex min-w-max items-center gap-[12px] rounded-[10px] border border-[#d6e1ee] bg-[linear-gradient(180deg,#ffffff_0%,#f9fbfe_100%)] px-[10px] py-[8px] shadow-[0_6px_16px_rgba(31,59,87,0.06)]">
<div className="flex flex-1 items-center gap-[4px]">
<input
type="date"
value={draftResultFilters.analysisDate}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
analysisDate: event.target.value,
}))
}
aria-label="년월일"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[120px]`}
/>
<input
type="time"
value={draftResultFilters.analysisTime}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
analysisTime: event.target.value,
}))
}
aria-label="시간"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[100px]`}
/>
<select
value={draftResultFilters.sidoName}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
sidoName: event.target.value,
sggName: "전체",
}))
}
aria-label="시도"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[94px]`}
>
{WATER_RISK_SIDO_OPTIONS.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<select
value={draftResultFilters.sggName}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
sggName: event.target.value,
}))
}
aria-label="시군구"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[94px]`}
>
{resultSggOptions.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<select
value={draftResultFilters.areaId}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
areaId: event.target.value,
}))
}
aria-label="중점관리지역"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[120px]`}
>
<option value="ALL">중점관리지역</option>
{resultAreaOptions.map((option) => (
<option key={option.areaId} value={option.areaId}>
{option.areaName}
</option>
))}
</select>
<select
value={draftResultFilters.riskStatus}
onChange={(event) =>
setDraftResultFilters((current) => ({
...current,
riskStatus: event.target.value as ResultFilters["riskStatus"],
}))
}
aria-label="위험상태"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[74px]`}
>
<option value="ALL">위험</option>
<option value="DANGER">위험</option>
<option value="NORMAL">정상</option>
</select>
</div>
<div className="ml-auto flex items-center gap-[4px]">
<Button
type="button"
size="sm"
className="h-[30px] min-w-[48px] rounded-[4px] bg-[#2f7ec4] px-[10px] text-[12px] font-semibold text-white hover:bg-[#266fad]"
onClick={handleApplyResultFilters}
>
조회
</Button>
<Button
type="button"
size="sm"
className="h-[30px] min-w-[48px] rounded-[4px] bg-[#ef8d2f] px-[10px] text-[12px] font-semibold text-white hover:bg-[#df7f24]"
onClick={handleOpenSettingView}
>
설정
</Button>
</div>
</div>
</div>
<div className={RESULT_TABLE_CONTAINER_CLASS_NAME}>
<div className="overflow-x-auto overflow-y-hidden">
<table
className="border-collapse text-[12px]"
style={{ minWidth: `${resultTableMinWidth}px`, width: "100%" }}
>
<thead>
<tr className="bg-[#eaf3fb] text-[#647784]">
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">no</th>
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">시도</th>
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">시군구</th>
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">중점관리지역</th>
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">예측강우량(mm)</th>
{Array.from({ length: maxPipeCount }).map((_, index) => (
<th
key={`pipe-group-${index + 1}`}
colSpan={2}
className="border border-[#d1dae2] px-2 py-2"
>
관로 ID {index + 1}
</th>
))}
<th rowSpan={2} className="border border-[#d1dae2] px-2 py-2">통수위험</th>
</tr>
<tr className="bg-[#eaf3fb] text-[#647784]">
{Array.from({ length: maxPipeCount }).map((_, index) => (
<Fragment key={`pipe-sub-${index + 1}`}>
<th className="border border-[#d1dae2] px-2 py-1">유출유량(㎥/hr)</th>
<th className="border border-[#d1dae2] px-2 py-1">통수량(㎥/hr)</th>
</Fragment>
))}
</tr>
</thead>
<tbody>
{pagedResultRows.map((row, index) => {
const isSelected = row.areaId === selectedResultAreaId;
const rowNumber =
(resultCurrentPage - 1) * WATER_RISK_PAGE_SIZE + index + 1;
return (
<tr
key={row.areaId}
className={`cursor-pointer ${isSelected ? "bg-[#eef6ff]" : "bg-white"}`}
onClick={() => handleSelectResultRow(row)}
>
<td className="border border-[#dbe4ec] px-2 py-2 text-center">{rowNumber}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.sidoName}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.sggName}</td>
<td className="border border-[#dbe4ec] px-2 py-2 font-semibold">{row.areaName}</td>
<td className="border border-[#dbe4ec] px-2 py-2 text-right">{row.forecastRainQty.toFixed(1)}</td>
{Array.from({ length: maxPipeCount }).map((_, pipeIndex) => {
const pipe = row.pipeSummaries[pipeIndex];
return (
<Fragment key={`${row.areaId}-pipe-${pipeIndex}`}>
<td className="border border-[#dbe4ec] px-2 py-2 text-right">
{pipe ? pipe.runoffFlowQty.toFixed(1) : ""}
</td>
<td className="border border-[#dbe4ec] px-2 py-2 text-right">
{pipe ? pipe.conveyQty.toFixed(1) : ""}
</td>
</Fragment>
);
})}
<td className="border border-[#dbe4ec] px-2 py-2 text-center">
<span className={`inline-flex min-w-[56px] items-center justify-center px-2 py-1 text-[12px] font-semibold ${getRiskBadgeClassName(row.riskStatus)}`}>
{buildWaterRiskStatusLabel(row.riskStatus)}
</span>
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
{visibleResultRows.length > WATER_RISK_PAGE_SIZE ? (
<div className="flex justify-center">
<UiPageNations
total={visibleResultRows.length}
cur={resultCurrentPage}
pageSize={WATER_RISK_PAGE_SIZE}
onPageChange={setResultCurrentPage}
/>
</div>
) : null}
</section>
) : (
<section className="flex h-full min-h-0 flex-col gap-2">
<div className="overflow-x-auto">
<div className="flex min-w-max items-center gap-[12px] rounded-[10px] border border-[#d6e1ee] bg-[linear-gradient(180deg,#ffffff_0%,#f9fbfe_100%)] px-[8px] py-[8px] shadow-[0_6px_16px_rgba(31,59,87,0.06)]">
<div className="flex flex-1 items-center gap-[4px]">
<select
value={draftSettingFilters.sidoName}
onChange={(event) =>
setDraftSettingFilters((current) => ({
...current,
sidoName: event.target.value,
sggName: "전체",
}))
}
aria-label="시도"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[94px]`}
>
{WATER_RISK_SIDO_OPTIONS.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<select
value={draftSettingFilters.sggName}
onChange={(event) =>
setDraftSettingFilters((current) => ({
...current,
sggName: event.target.value,
}))
}
aria-label="시군구"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[94px]`}
>
{settingSggOptions.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
<select
value={draftSettingFilters.areaId}
onChange={(event) =>
setDraftSettingFilters((current) => ({
...current,
areaId: event.target.value,
}))
}
aria-label="중점관리지역"
className={`${TOOLBAR_INPUT_CLASS_NAME} w-[120px]`}
>
<option value="ALL">중점관리지역</option>
{settingAreaOptions.map((option) => (
<option key={option.areaId} value={option.areaId}>
{option.areaName}
</option>
))}
</select>
</div>
<div className="ml-auto flex items-center gap-[4px]">
<Button
type="button"
size="sm"
className="h-[30px] min-w-[48px] rounded-[4px] bg-[#2f7ec4] px-[10px] text-[12px] font-semibold text-white hover:bg-[#266fad]"
onClick={handleApplySettingFilters}
>
조회
</Button>
</div>
</div>
</div>
<div
className={`${SETTING_TABLE_CONTAINER_CLASS_NAME} ${showSettingEditor ? "flex-[0_0_44%]" : ""}`}
>
<div className="overflow-x-auto overflow-y-hidden">
<table
className="border-collapse text-[12px]"
style={{ minWidth: `${settingTableMinWidth}px`, width: "100%" }}
>
<thead className="bg-[#eaf3fb] text-[#647784]">
<tr>
<th className="border border-[#d1dae2] px-2 py-2">시도</th>
<th className="border border-[#d1dae2] px-2 py-2">시군구</th>
<th className="border border-[#d1dae2] px-2 py-2">중점관리지역</th>
<th className="border border-[#d1dae2] px-2 py-2">유출관로ID</th>
<th className="border border-[#d1dae2] px-2 py-2">관경</th>
<th className="border border-[#d1dae2] px-2 py-2">연장</th>
<th className="border border-[#d1dae2] px-2 py-2">재질</th>
<th className="border border-[#d1dae2] px-2 py-2">설정순번</th>
<th className="border border-[#d1dae2] px-2 py-2">설정완료여부</th>
</tr>
</thead>
<tbody>
{pagedSettingRows.map((row, index) => {
const isSelected =
row.areaId === (selectedSettingAreaId || snapshot.selectedSettingAreaId);
return (
<tr
key={`${row.areaId}-${row.pipeId}`}
className={`cursor-pointer ${isSelected ? "bg-[#eef6ff]" : "bg-white"}`}
onClick={() => handleSelectSettingArea(row.areaId)}
>
<td className="border border-[#dbe4ec] px-2 py-2">{row.sidoName}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.sggName}</td>
<td className="border border-[#dbe4ec] px-2 py-2 font-semibold">{row.areaName}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.pipeId}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.pipeDia}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.pipeLen}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{row.pipeMaterial}</td>
<td className="border border-[#dbe4ec] px-2 py-2 text-center">{row.setSeq}</td>
<td className="border border-[#dbe4ec] px-2 py-2 text-center">
{row.setCompleteYn === "Y" ? "완료" : "미완료"}
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
{visibleSettingRows.length > WATER_RISK_PAGE_SIZE ? (
<div className="flex justify-center">
<UiPageNations
total={visibleSettingRows.length}
cur={settingCurrentPage}
pageSize={WATER_RISK_PAGE_SIZE}
onPageChange={setSettingCurrentPage}
/>
</div>
) : null}
{showSettingEditor ? (
<div className="min-h-0 flex-1 overflow-hidden rounded-[10px] border border-[#d6e1ee] bg-[linear-gradient(180deg,#ffffff_0%,#f9fbfe_100%)] shadow-[0_6px_16px_rgba(31,59,87,0.06)]">
<div className="flex h-full min-h-0 flex-col">
<div className="flex items-center justify-between border-b border-[#e2ebf5] px-3 py-2">
<div className="text-[12px] font-semibold text-[#1f3b57]">
설정 편집 대상: {currentSettingAreaName || "선택 전"}
</div>
<div className="flex items-center gap-2">
<Button
type="button"
size="sm"
color="white"
className="h-[28px] rounded-[4px] border border-[#cad7e6] bg-white px-[10px] text-[12px] text-[#43566b] hover:bg-[#f8fbff]"
onClick={handleStopSettingEdit}
>
편집 종료
</Button>
<Button
type="button"
size="sm"
color="white"
className="h-[28px] rounded-[4px] border border-[#cad7e6] bg-white px-[10px] text-[12px] text-[#43566b] hover:bg-[#f8fbff]"
onClick={handleClearStagedPipes}
disabled={snapshot.stagedPipes.length === 0}
>
목록 초기화
</Button>
<Button
type="button"
size="sm"
className={ACTION_BUTTON_CLASS_NAME}
onClick={handlePreviewSave}
>
저장 preview
</Button>
</div>
</div>
<div className="min-h-0 flex-1 overflow-auto">
<table className="w-full border-collapse text-[12px]">
<thead className="bg-[#e1ebf5] text-[#24364d]">
<tr>
<th className="border border-[#dbe4ec] px-2 py-2">순번</th>
<th className="border border-[#dbe4ec] px-2 py-2">유출관로ID</th>
<th className="border border-[#dbe4ec] px-2 py-2">관경</th>
<th className="border border-[#dbe4ec] px-2 py-2">연장</th>
<th className="border border-[#dbe4ec] px-2 py-2">재질</th>
<th className="border border-[#dbe4ec] px-2 py-2">선택원천</th>
<th className="border border-[#dbe4ec] px-2 py-2">조작</th>
</tr>
</thead>
<tbody>
{snapshot.stagedPipes.length === 0 ? (
<tr>
<td
colSpan={7}
className="border border-[#dbe4ec] px-3 py-6 text-center text-[#64748b]"
>
staged 유출관로가 없습니다. 지도에서 하수관로를 선택하세요.
</td>
</tr>
) : (
snapshot.stagedPipes.map((pipe, index) => (
<tr
key={pipe.pipeId}
className="bg-white"
>
<td className="border border-[#dbe4ec] px-2 py-2 text-center">{index + 1}</td>
<td className="border border-[#dbe4ec] px-2 py-2 font-semibold">{pipe.pipeId}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{pipe.pipeDia}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{pipe.pipeLen}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{pipe.pipeMaterial}</td>
<td className="border border-[#dbe4ec] px-2 py-2">{pipe.source}</td>
<td className="border border-[#dbe4ec] px-2 py-2">
<div className="flex items-center gap-1">
<Button
type="button"
size="sm"
color="white"
className="h-[28px] rounded-[4px] border border-[#cad7e6] bg-white px-[10px] text-[12px] text-[#43566b] hover:bg-[#f8fbff]"
onClick={() => handleMoveStagedPipe(pipe.pipeId, "UP")}
disabled={index === 0}
>
위
</Button>
<Button
type="button"
size="sm"
color="white"
className="h-[28px] rounded-[4px] border border-[#cad7e6] bg-white px-[10px] text-[12px] text-[#43566b] hover:bg-[#f8fbff]"
onClick={() => handleMoveStagedPipe(pipe.pipeId, "DOWN")}
disabled={index === snapshot.stagedPipes.length - 1}
>
아래
</Button>
<Button
type="button"
size="sm"
color="white"
className="h-[28px] rounded-none border border-[#e7b7b7] bg-white px-3 text-[12px] text-[#c62828] hover:bg-[#fff8f8]"
onClick={() => handleRemoveStagedPipe(pipe.pipeId)}
>
삭제
</Button>
</div>
</td>
</tr>
))
)}
</tbody>
</table>
</div>
</div>
</div>
) : null}
</section>
)}
</section>
</main>
);
}
@@ -0,0 +1,936 @@
"use client";
export type WaterRiskStatus = "DANGER" | "NORMAL";
export type WaterRiskCalculationMethod = "METHOD_1" | "METHOD_2";
export type WaterRiskTab = "result" | "setting";
export type WaterRiskPipeSummary = {
pipeId: string;
runoffFlowQty: number;
conveyQty: number;
};
export type WaterRiskResultRow = {
areaId: string;
areaName: string;
sidoName: string;
sggName: string;
forecastRainQty: number;
riskStatus: WaterRiskStatus;
calculationMethod: WaterRiskCalculationMethod;
pipeSummaries: WaterRiskPipeSummary[];
};
export type WaterRiskSettingRow = {
areaId: string;
areaName: string;
sidoName: string;
sggName: string;
pipeId: string;
pipeDia: string;
pipeLen: string;
pipeMaterial: string;
setSeq: number;
setCompleteYn: "Y" | "N";
};
export type WaterRiskStagedPipe = {
pipeId: string;
pipeDia: string;
pipeLen: string;
pipeMaterial: string;
setSeq: number;
source: "MAP" | "MOCK";
};
export type WaterRiskGridCell = {
gridId: string;
rainQty: number;
colorLevel: "LEVEL_1" | "LEVEL_2" | "LEVEL_3" | "LEVEL_4";
polygonCoordinates: number[][][];
};
export type WaterRiskAreaMapData = {
areaId: string;
areaName: string;
polygonCoordinates: number[][][];
gridCells: WaterRiskGridCell[];
};
export type WaterRiskMapPipe = {
pipeId: string;
displayLabel: string;
lineCoordinates: number[][];
};
export type WaterRiskSessionSnapshot = {
selectedAreaId: string | null;
selectedSettingAreaId: string | null;
selectedSettingAreaName: string;
isSettingEditMode: boolean;
stagedPipes: WaterRiskStagedPipe[];
statusMessage: string;
};
export const EMPTY_WATER_RISK_SESSION_SNAPSHOT: WaterRiskSessionSnapshot = {
selectedAreaId: null,
selectedSettingAreaId: null,
selectedSettingAreaName: "",
isSettingEditMode: false,
stagedPipes: [],
statusMessage: "",
};
const buildRectanglePolygon = (
centerX: number,
centerY: number,
halfWidth: number,
halfHeight: number,
) => {
return [[
[centerX - halfWidth, centerY - halfHeight],
[centerX + halfWidth, centerY - halfHeight],
[centerX + halfWidth, centerY + halfHeight],
[centerX - halfWidth, centerY + halfHeight],
[centerX - halfWidth, centerY - halfHeight],
]];
};
const buildGridCells = (
centerX: number,
centerY: number,
values: number[],
): WaterRiskGridCell[] => {
const cellHalfSize = 180;
const offsets = [
[-190, 190],
[190, 190],
[-190, -190],
[190, -190],
] as const;
return offsets.map(([offsetX, offsetY], index) => {
const rainQty = values[index] ?? values[values.length - 1] ?? 0;
const colorLevel = rainQty >= 40
? "LEVEL_4"
: rainQty >= 30
? "LEVEL_3"
: rainQty >= 20
? "LEVEL_2"
: "LEVEL_1";
return {
gridId: `GRID-${index + 1}`,
rainQty,
colorLevel,
polygonCoordinates: buildRectanglePolygon(
centerX + offsetX,
centerY + offsetY,
cellHalfSize,
cellHalfSize,
),
};
});
};
export const WATER_RISK_RESULT_ROWS: WaterRiskResultRow[] = [
{
areaId: "AREA-001",
areaName: "A 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 42.0,
riskStatus: "DANGER",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-10284", runoffFlowQty: 18.5, conveyQty: 15.2 },
{ pipeId: "PIPE-10291", runoffFlowQty: 11.3, conveyQty: 12.8 },
],
},
{
areaId: "AREA-002",
areaName: "B 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 31.4,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-45103", runoffFlowQty: 9.8, conveyQty: 14.7 },
],
},
{
areaId: "AREA-003",
areaName: "C 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 37.8,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-60014", runoffFlowQty: 16.1, conveyQty: 12.9 },
{ pipeId: "PIPE-60018", runoffFlowQty: 10.2, conveyQty: 11.1 },
{ pipeId: "PIPE-60021", runoffFlowQty: 8.7, conveyQty: 9.5 },
],
},
{
areaId: "AREA-004",
areaName: "D 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 24.3,
riskStatus: "NORMAL",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-72010", runoffFlowQty: 7.2, conveyQty: 11.4 },
{ pipeId: "PIPE-72018", runoffFlowQty: 6.1, conveyQty: 9.8 },
],
},
{
areaId: "AREA-005",
areaName: "E 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 28.6,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-83014", runoffFlowQty: 8.3, conveyQty: 12.1 },
],
},
{
areaId: "AREA-006",
areaName: "F 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 45.1,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-83018", runoffFlowQty: 17.4, conveyQty: 12.3 },
{ pipeId: "PIPE-83019", runoffFlowQty: 13.6, conveyQty: 10.1 },
],
},
{
areaId: "AREA-007",
areaName: "G 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 33.2,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-91004", runoffFlowQty: 9.7, conveyQty: 12.5 },
],
},
{
areaId: "AREA-008",
areaName: "H 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 39.4,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-91010", runoffFlowQty: 15.5, conveyQty: 11.6 },
{ pipeId: "PIPE-91012", runoffFlowQty: 12.4, conveyQty: 10.8 },
{ pipeId: "PIPE-91014", runoffFlowQty: 9.2, conveyQty: 9.0 },
],
},
{
areaId: "AREA-009",
areaName: "I 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 26.1,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-99001", runoffFlowQty: 6.7, conveyQty: 10.4 },
],
},
{
areaId: "AREA-010",
areaName: "J 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 41.8,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-99007", runoffFlowQty: 14.8, conveyQty: 10.9 },
{ pipeId: "PIPE-99009", runoffFlowQty: 10.1, conveyQty: 9.7 },
],
},
{
areaId: "AREA-011",
areaName: "K 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 29.7,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-11001", runoffFlowQty: 8.8, conveyQty: 12.5 },
{ pipeId: "PIPE-11002", runoffFlowQty: 7.9, conveyQty: 11.4 },
],
},
{
areaId: "AREA-012",
areaName: "L 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 43.6,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-12001", runoffFlowQty: 16.7, conveyQty: 12.2 },
],
},
{
areaId: "AREA-013",
areaName: "M 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 35.2,
riskStatus: "DANGER",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-13001", runoffFlowQty: 14.4, conveyQty: 11.6 },
{ pipeId: "PIPE-13002", runoffFlowQty: 10.5, conveyQty: 10.9 },
{ pipeId: "PIPE-13003", runoffFlowQty: 8.6, conveyQty: 9.3 },
],
},
{
areaId: "AREA-014",
areaName: "N 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 21.9,
riskStatus: "NORMAL",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-14001", runoffFlowQty: 5.8, conveyQty: 8.7 },
],
},
{
areaId: "AREA-015",
areaName: "O 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 47.3,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-15001", runoffFlowQty: 18.2, conveyQty: 13.4 },
{ pipeId: "PIPE-15002", runoffFlowQty: 12.7, conveyQty: 10.8 },
],
},
{
areaId: "AREA-016",
areaName: "P 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 27.5,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-16001", runoffFlowQty: 7.1, conveyQty: 10.3 },
{ pipeId: "PIPE-16002", runoffFlowQty: 6.2, conveyQty: 9.8 },
],
},
{
areaId: "AREA-017",
areaName: "Q 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 32.8,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-17001", runoffFlowQty: 9.9, conveyQty: 11.7 },
],
},
{
areaId: "AREA-018",
areaName: "R 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 44.9,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-18001", runoffFlowQty: 17.1, conveyQty: 12.4 },
{ pipeId: "PIPE-18002", runoffFlowQty: 13.4, conveyQty: 10.6 },
{ pipeId: "PIPE-18003", runoffFlowQty: 9.8, conveyQty: 9.1 },
],
},
{
areaId: "AREA-019",
areaName: "S 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
forecastRainQty: 23.4,
riskStatus: "NORMAL",
calculationMethod: "METHOD_1",
pipeSummaries: [
{ pipeId: "PIPE-19001", runoffFlowQty: 6.4, conveyQty: 9.6 },
],
},
{
areaId: "AREA-020",
areaName: "T 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
forecastRainQty: 40.7,
riskStatus: "DANGER",
calculationMethod: "METHOD_2",
pipeSummaries: [
{ pipeId: "PIPE-20001", runoffFlowQty: 15.2, conveyQty: 11.4 },
{ pipeId: "PIPE-20002", runoffFlowQty: 11.9, conveyQty: 10.1 },
],
},
];
export const WATER_RISK_SETTING_ROWS: WaterRiskSettingRow[] = [
{
areaId: "AREA-001",
areaName: "A 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-10284",
pipeDia: "900 mm",
pipeLen: "186 m",
pipeMaterial: "콘크리트",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-001",
areaName: "A 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-10291",
pipeDia: "700 mm",
pipeLen: "142 m",
pipeMaterial: "흄관",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-002",
areaName: "B 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-45103",
pipeDia: "600 mm",
pipeLen: "98 m",
pipeMaterial: "PE",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-003",
areaName: "C 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-60014",
pipeDia: "800 mm",
pipeLen: "154 m",
pipeMaterial: "강관",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-003",
areaName: "C 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-60018",
pipeDia: "700 mm",
pipeLen: "119 m",
pipeMaterial: "흄관",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-004",
areaName: "D 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-72010",
pipeDia: "500 mm",
pipeLen: "101 m",
pipeMaterial: "PVC",
setSeq: 1,
setCompleteYn: "N",
},
{
areaId: "AREA-005",
areaName: "E 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-83014",
pipeDia: "650 mm",
pipeLen: "133 m",
pipeMaterial: "PE",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-006",
areaName: "F 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-83018",
pipeDia: "900 mm",
pipeLen: "176 m",
pipeMaterial: "흄관",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-006",
areaName: "F 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-83019",
pipeDia: "800 mm",
pipeLen: "167 m",
pipeMaterial: "콘크리트",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-007",
areaName: "G 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-91004",
pipeDia: "700 mm",
pipeLen: "111 m",
pipeMaterial: "PVC",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-008",
areaName: "H 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-91010",
pipeDia: "1000 mm",
pipeLen: "201 m",
pipeMaterial: "강관",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-008",
areaName: "H 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-91012",
pipeDia: "900 mm",
pipeLen: "184 m",
pipeMaterial: "흄관",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-008",
areaName: "H 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-91014",
pipeDia: "800 mm",
pipeLen: "159 m",
pipeMaterial: "콘크리트",
setSeq: 3,
setCompleteYn: "Y",
},
{
areaId: "AREA-009",
areaName: "I 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-99001",
pipeDia: "600 mm",
pipeLen: "94 m",
pipeMaterial: "PE",
setSeq: 1,
setCompleteYn: "N",
},
{
areaId: "AREA-010",
areaName: "J 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-99007",
pipeDia: "850 mm",
pipeLen: "143 m",
pipeMaterial: "흄관",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-010",
areaName: "J 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-99009",
pipeDia: "750 mm",
pipeLen: "128 m",
pipeMaterial: "강관",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-011",
areaName: "K 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-11001",
pipeDia: "700 mm",
pipeLen: "121 m",
pipeMaterial: "콘크리트",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-012",
areaName: "L 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-12001",
pipeDia: "820 mm",
pipeLen: "147 m",
pipeMaterial: "강관",
setSeq: 1,
setCompleteYn: "N",
},
{
areaId: "AREA-013",
areaName: "M 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-13001",
pipeDia: "900 mm",
pipeLen: "163 m",
pipeMaterial: "흄관",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-013",
areaName: "M 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-13002",
pipeDia: "800 mm",
pipeLen: "152 m",
pipeMaterial: "콘크리트",
setSeq: 2,
setCompleteYn: "Y",
},
{
areaId: "AREA-014",
areaName: "N 중점관리지역",
sidoName: "부산광역시",
sggName: "해운대구",
pipeId: "PIPE-14001",
pipeDia: "500 mm",
pipeLen: "88 m",
pipeMaterial: "PVC",
setSeq: 1,
setCompleteYn: "Y",
},
{
areaId: "AREA-015",
areaName: "O 중점관리지역",
sidoName: "서울특별시",
sggName: "강남구",
pipeId: "PIPE-15001",
pipeDia: "980 mm",
pipeLen: "194 m",
pipeMaterial: "강관",
setSeq: 1,
setCompleteYn: "Y",
},
];
export const WATER_RISK_MAP_AREAS: WaterRiskAreaMapData[] = [
{
areaId: "AREA-001",
areaName: "A 중점관리지역",
polygonCoordinates: buildRectanglePolygon(955300, 1948770, 360, 240),
gridCells: buildGridCells(955300, 1948770, [38.2, 42.0, 31.5, 28.4]),
},
{
areaId: "AREA-002",
areaName: "B 중점관리지역",
polygonCoordinates: buildRectanglePolygon(954480, 1948350, 320, 210),
gridCells: buildGridCells(954480, 1948350, [22.4, 24.1, 20.5, 18.9]),
},
{
areaId: "AREA-003",
areaName: "C 중점관리지역",
polygonCoordinates: buildRectanglePolygon(956260, 1948220, 390, 250),
gridCells: buildGridCells(956260, 1948220, [35.1, 37.8, 32.4, 29.6]),
},
{
areaId: "AREA-004",
areaName: "D 중점관리지역",
polygonCoordinates: buildRectanglePolygon(957020, 1948660, 300, 210),
gridCells: buildGridCells(957020, 1948660, [19.3, 24.3, 21.7, 17.8]),
},
{
areaId: "AREA-005",
areaName: "E 중점관리지역",
polygonCoordinates: buildRectanglePolygon(954900, 1949020, 290, 200),
gridCells: buildGridCells(954900, 1949020, [24.8, 28.6, 22.5, 20.7]),
},
{
areaId: "AREA-006",
areaName: "F 중점관리지역",
polygonCoordinates: buildRectanglePolygon(955980, 1949040, 330, 220),
gridCells: buildGridCells(955980, 1949040, [41.7, 45.1, 36.2, 31.5]),
},
{
areaId: "AREA-007",
areaName: "G 중점관리지역",
polygonCoordinates: buildRectanglePolygon(956760, 1947990, 280, 190),
gridCells: buildGridCells(956760, 1947990, [27.4, 33.2, 24.2, 21.1]),
},
{
areaId: "AREA-008",
areaName: "H 중점관리지역",
polygonCoordinates: buildRectanglePolygon(957420, 1948090, 340, 230),
gridCells: buildGridCells(957420, 1948090, [34.7, 39.4, 32.8, 28.6]),
},
{
areaId: "AREA-009",
areaName: "I 중점관리지역",
polygonCoordinates: buildRectanglePolygon(954020, 1947900, 260, 180),
gridCells: buildGridCells(954020, 1947900, [18.4, 26.1, 17.6, 15.9]),
},
{
areaId: "AREA-010",
areaName: "J 중점관리지역",
polygonCoordinates: buildRectanglePolygon(957980, 1948900, 300, 210),
gridCells: buildGridCells(957980, 1948900, [37.9, 41.8, 33.8, 29.4]),
},
];
export const WATER_RISK_MAP_PIPES_BY_AREA: Record<string, WaterRiskMapPipe[]> = {
"AREA-001": [
{
pipeId: "PIPE-10284",
displayLabel: "관로 ID 1",
lineCoordinates: [
[955020, 1948450],
[955210, 1948570],
[955320, 1948690],
],
},
{
pipeId: "PIPE-10291",
displayLabel: "관로 ID 2",
lineCoordinates: [
[955350, 1948820],
[955470, 1948680],
[955560, 1948550],
],
},
],
"AREA-002": [
{
pipeId: "PIPE-45103",
displayLabel: "관로 ID 1",
lineCoordinates: [
[954230, 1948500],
[954360, 1948420],
[954520, 1948340],
],
},
],
"AREA-003": [
{
pipeId: "PIPE-60014",
displayLabel: "관로 ID 1",
lineCoordinates: [
[956000, 1948420],
[956110, 1948320],
[956220, 1948210],
],
},
{
pipeId: "PIPE-60018",
displayLabel: "관로 ID 2",
lineCoordinates: [
[956180, 1948480],
[956270, 1948360],
[956410, 1948240],
],
},
{
pipeId: "PIPE-60021",
displayLabel: "관로 ID 3",
lineCoordinates: [
[956420, 1948420],
[956520, 1948340],
[956650, 1948240],
],
},
],
"AREA-004": [
{
pipeId: "PIPE-72010",
displayLabel: "관로 ID 1",
lineCoordinates: [
[956770, 1948790],
[956900, 1948720],
[957050, 1948650],
],
},
{
pipeId: "PIPE-72018",
displayLabel: "관로 ID 2",
lineCoordinates: [
[956980, 1948840],
[957090, 1948740],
[957210, 1948640],
],
},
],
"AREA-005": [
{
pipeId: "PIPE-83014",
displayLabel: "관로 ID 1",
lineCoordinates: [
[954710, 1949160],
[954840, 1949080],
[954980, 1949000],
],
},
],
"AREA-006": [
{
pipeId: "PIPE-83018",
displayLabel: "관로 ID 1",
lineCoordinates: [
[955760, 1949180],
[955910, 1949100],
[956030, 1949020],
],
},
{
pipeId: "PIPE-83019",
displayLabel: "관로 ID 2",
lineCoordinates: [
[955980, 1949240],
[956120, 1949140],
[956240, 1949040],
],
},
],
"AREA-007": [
{
pipeId: "PIPE-91004",
displayLabel: "관로 ID 1",
lineCoordinates: [
[956520, 1948120],
[956660, 1948050],
[956820, 1947980],
],
},
],
"AREA-008": [
{
pipeId: "PIPE-91010",
displayLabel: "관로 ID 1",
lineCoordinates: [
[957150, 1948220],
[957300, 1948160],
[957470, 1948100],
],
},
{
pipeId: "PIPE-91012",
displayLabel: "관로 ID 2",
lineCoordinates: [
[957350, 1948290],
[957480, 1948200],
[957610, 1948110],
],
},
{
pipeId: "PIPE-91014",
displayLabel: "관로 ID 3",
lineCoordinates: [
[957540, 1948340],
[957670, 1948220],
[957790, 1948100],
],
},
],
"AREA-009": [
{
pipeId: "PIPE-99001",
displayLabel: "관로 ID 1",
lineCoordinates: [
[953810, 1948010],
[953940, 1947960],
[954080, 1947910],
],
},
],
"AREA-010": [
{
pipeId: "PIPE-99007",
displayLabel: "관로 ID 1",
lineCoordinates: [
[957750, 1949040],
[957900, 1948970],
[958040, 1948900],
],
},
{
pipeId: "PIPE-99009",
displayLabel: "관로 ID 2",
lineCoordinates: [
[957980, 1949120],
[958120, 1949010],
[958260, 1948900],
],
},
],
};
export const WATER_RISK_SIDO_OPTIONS = ["전체", "서울특별시", "부산광역시"];
export const WATER_RISK_SGG_OPTIONS_BY_SIDO: Record<string, string[]> = {
전체: ["전체", "강남구", "해운대구"],
서울특별시: ["전체", "강남구"],
부산광역시: ["전체", "해운대구"],
};
export const WATER_RISK_PIPE_LAYER_TYPE = "tb_ms_swage_ppl";
export const WATER_RISK_COLOR_LABELS: Record<WaterRiskGridCell["colorLevel"], string> = {
LEVEL_1: "0.0~20.0 미만",
LEVEL_2: "20.0~30.0 미만",
LEVEL_3: "30.0~40.0 미만",
LEVEL_4: "40.0 이상",
};
export const buildWaterRiskStatusLabel = (status: WaterRiskStatus) =>
status === "DANGER" ? "위험" : "정상";
export const buildWaterRiskMethodLabel = (method: WaterRiskCalculationMethod) =>
method === "METHOD_1" ? "방법 1" : "방법 2";
export const buildWaterRiskSettingAreaName = (areaId: string | null) => {
if (!areaId) return "";
return WATER_RISK_RESULT_ROWS.find((row) => row.areaId === areaId)?.areaName ?? "";
};
+797 -2
View File
@@ -18,7 +18,7 @@
"use client";
import dynamic from "next/dynamic";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { usePathname } from "next/navigation";
import Collection from "ol/Collection.js";
@@ -27,7 +27,9 @@ import GeoJSON from "ol/format/GeoJSON.js";
import Draw from "ol/interaction/Draw.js";
import Translate from "ol/interaction/Translate.js";
import Fill from "ol/style/Fill.js";
import LineString from "ol/geom/LineString.js";
import Point from "ol/geom/Point.js";
import Polygon from "ol/geom/Polygon.js";
import VectorLayer from "ol/layer/Vector.js";
import { unByKey } from "ol/Observable.js";
import VectorSource from "ol/source/Vector.js";
@@ -75,6 +77,17 @@ import { downloadAgedPipeCsv } from "./components/agedPipe/agedPipeExport";
import FeatureClickEventPopup from "./components/popupComponent/featureClickEventPopup";
import SearchModal from "./searchModal/searchModal";
import { WATER_DEPTH_LAYER_TYPES, WaterDepth } from "./waterDepth/waterDepth";
import {
buildWaterRiskStatusLabel,
EMPTY_WATER_RISK_SESSION_SNAPSHOT,
WATER_RISK_MAP_AREAS,
WATER_RISK_MAP_PIPES_BY_AREA,
WATER_RISK_PIPE_LAYER_TYPE,
WATER_RISK_RESULT_ROWS,
WATER_RISK_SETTING_ROWS,
type WaterRiskSessionSnapshot,
type WaterRiskStagedPipe,
} from "./components/waterRisk/waterRiskTypes";
const AnalysisPopupMenu = dynamic(
() => import("./components/analysisMenu/AnalysisPopupMenu"),
@@ -104,6 +117,9 @@ const FLOW_DIRECTION_NETWORK_CORRECTION_COLOR = "rgba(0, 168, 132, 0.95)";
const FLOW_DIRECTION_BBOX_BUFFER_RATIO = 0.35;
const GIS_EDIT_PREVIEW_LAYER_ID = "SN_GIS_EDIT_PREVIEW";
const GIS_EDIT_VERTEX_LAYER_ID = "SN_GIS_EDIT_VERTEX_HANDLES";
const WATER_RISK_AREA_LAYER_ID = "SN_WATER_RISK_AREA";
const WATER_RISK_GRID_LAYER_ID = "SN_WATER_RISK_GRID";
const WATER_RISK_PIPE_LAYER_ID = "SN_WATER_RISK_PIPE";
type FlowDirectionUsageStyle = {
color: string;
@@ -402,6 +418,180 @@ const GIS_EDIT_VERTEX_DRAGGING_STYLE = new Style({
const geometryObjectToKey = (geometry: Record<string, unknown> | null) =>
geometry ? JSON.stringify(geometry) : "";
const getWaterRiskAreaMapData = (areaId: string | null) =>
WATER_RISK_MAP_AREAS.find((area) => area.areaId === areaId) ?? null;
const getWaterRiskResultRow = (areaId: string | null) =>
WATER_RISK_RESULT_ROWS.find((row) => row.areaId === areaId) ?? null;
const buildWaterRiskInfoAnchor = (areaId: string | null) => {
const areaData = getWaterRiskAreaMapData(areaId);
if (!areaData) return null;
const polygon = new Polygon(areaData.polygonCoordinates);
const extent = polygon.getExtent();
const [, minY = 0, maxX = 0, maxY = 0] = extent;
return [maxX, (minY + maxY) / 2] as [number, number];
};
const buildWaterRiskSeedPipes = (areaId: string) =>
WATER_RISK_SETTING_ROWS
.filter((row) => row.areaId === areaId)
.sort((a, b) => a.setSeq - b.setSeq)
.map<WaterRiskStagedPipe>((row) => ({
pipeId: row.pipeId,
pipeDia: row.pipeDia,
pipeLen: row.pipeLen,
pipeMaterial: row.pipeMaterial,
setSeq: row.setSeq,
source: "MOCK",
}));
const buildWaterRiskStatusFillColor = (riskStatus: "DANGER" | "NORMAL") =>
riskStatus === "DANGER" ? "rgba(198, 40, 40, 0.24)" : "rgba(21, 101, 192, 0.2)";
const buildWaterRiskStatusStrokeColor = (riskStatus: "DANGER" | "NORMAL") =>
riskStatus === "DANGER" ? "rgba(198, 40, 40, 0.92)" : "rgba(21, 101, 192, 0.92)";
const buildWaterRiskGridFillColor = (colorLevel: string) => {
switch (colorLevel) {
case "LEVEL_4":
return "rgba(198, 40, 40, 0.28)";
case "LEVEL_3":
return "rgba(245, 124, 0, 0.24)";
case "LEVEL_2":
return "rgba(251, 192, 45, 0.22)";
default:
return "rgba(33, 150, 243, 0.18)";
}
};
const createWaterRiskAreaStyle = (feature: any) => {
const areaName = String(feature.get("areaName") ?? "");
const riskStatus = String(feature.get("riskStatus") ?? "NORMAL") as "DANGER" | "NORMAL";
return new Style({
fill: new Fill({ color: buildWaterRiskStatusFillColor(riskStatus) }),
stroke: new Stroke({
color: buildWaterRiskStatusStrokeColor(riskStatus),
width: 3,
}),
text: new Text({
text: `${areaName}\n${buildWaterRiskStatusLabel(riskStatus)}`,
font: "700 13px sans-serif",
fill: new Fill({ color: "#ffffff" }),
backgroundFill: new Fill({ color: buildWaterRiskStatusStrokeColor(riskStatus) }),
padding: [5, 8, 5, 8],
overflow: true,
}),
zIndex: 9996,
});
};
const createWaterRiskGridStyle = (feature: any) => {
const rainQty = Number(feature.get("rainQty") ?? 0);
const colorLevel = String(feature.get("colorLevel") ?? "LEVEL_1");
return new Style({
fill: new Fill({ color: buildWaterRiskGridFillColor(colorLevel) }),
stroke: new Stroke({
color: "rgba(71, 85, 105, 0.36)",
width: 1,
}),
text: new Text({
text: `${rainQty.toFixed(1)}mm`,
font: "600 11px sans-serif",
fill: new Fill({ color: "#0f172a" }),
overflow: true,
}),
zIndex: 9995,
});
};
const createWaterRiskPipeStyle = (feature: any) => {
const displayLabel = String(feature.get("displayLabel") ?? "");
return [
new Style({
stroke: new Stroke({
color: "rgba(255,255,255,0.98)",
width: 9,
lineCap: "round",
lineJoin: "round",
}),
zIndex: 9997,
}),
new Style({
stroke: new Stroke({
color: "rgba(205, 52, 52, 0.96)",
width: 4,
lineCap: "round",
lineJoin: "round",
}),
zIndex: 9998,
text: new Text({
text: displayLabel,
font: "700 12px sans-serif",
fill: new Fill({ color: "#ffffff" }),
backgroundFill: new Fill({ color: "rgba(60, 60, 60, 0.9)" }),
padding: [3, 6, 3, 6],
overflow: true,
}),
}),
];
};
const getSelectedFeatureLayerTypeName = (data: any) => {
if (typeof data?.getId === "function") {
return String(data.getId() ?? "").split(".")[0];
}
if (typeof data?.id_ === "string") {
return String(data.id_).split(".")[0];
}
return String(data?.lyrTypeNm ?? data?.values_?.lyrTypeNm ?? "").trim();
};
const formatWaterRiskPipeField = (value: unknown, suffix: string) => {
const normalized = String(value ?? "").trim();
if (!normalized) return "-";
if (normalized.endsWith(suffix) || suffix === "") return normalized;
return `${normalized} ${suffix}`.trim();
};
const buildWaterRiskPipeFromFeature = (data: any): WaterRiskStagedPipe | null => {
const values = data?.values_ ?? data;
const pipeId = String(
values?.fclt_mng_no ??
values?.fcltMngNo ??
values?.pipeId ??
values?.id ??
data?.fid ??
"",
).trim();
if (!pipeId) return null;
return {
pipeId,
pipeDia: formatWaterRiskPipeField(
values?.pipe_diameter ?? values?.pdmt_vl ?? values?.pdmtVl,
"mm",
),
pipeLen: formatWaterRiskPipeField(
values?.pipe_lt ?? values?.pipeLt ?? values?.extn_lt ?? values?.extnLt,
"m",
),
pipeMaterial: String(
values?.pipe_material ??
values?.pipeMaterial ??
values?.mqlt_cd ??
values?.mqltCd ??
"-",
).trim() || "-",
setSeq: 0,
source: "MAP",
};
};
type VertexHandleMeta = {
kind: "vertex" | "midpoint";
geometryType: string;
@@ -1210,6 +1400,8 @@ const Map = () => {
const agedPipePopupWindowRef = useRef<Window | null>(null);
const pipeAnalysisPopupWindowRef = useRef<Window | null>(null);
const gisEditSessionPopupWindowRef = useRef<Window | null>(null);
const waterRiskPopupWindowRef = useRef<Window | null>(null);
const waterRiskPopupCloseWatcherRef = useRef<number | null>(null);
// 유하방향 레이어 체크 여부를 React 렌더링 흐름에 반영하기 위한 state이다.
const [isFlowDirectionChecked, setIsFlowDirectionChecked] = useState(false);
// 체크된 유하방향 트리 노드의 레이어 설정을 보관해 API 조회와 vector layer 스타일에 사용한다.
@@ -1242,10 +1434,21 @@ const Map = () => {
const gisEditPreviewSourceRef = useRef<VectorSource | null>(null);
const gisEditVertexLayerRef = useRef<VectorLayer<any> | null>(null);
const gisEditVertexSourceRef = useRef<VectorSource | null>(null);
const waterRiskAreaLayerRef = useRef<VectorLayer<any> | null>(null);
const waterRiskAreaSourceRef = useRef<VectorSource | null>(null);
const waterRiskGridLayerRef = useRef<VectorLayer<any> | null>(null);
const waterRiskGridSourceRef = useRef<VectorSource | null>(null);
const waterRiskPipeLayerRef = useRef<VectorLayer<any> | null>(null);
const waterRiskPipeSourceRef = useRef<VectorSource | null>(null);
const gisEditDrawSourceRef = useRef<VectorSource | null>(null);
const gisEditDrawRef = useRef<any | null>(null);
const gisEditTranslateRef = useRef<any | null>(null);
const gisEditModifyRef = useRef<any | null>(null);
const [waterRiskSession, setWaterRiskSession] = useState<WaterRiskSessionSnapshot>(
EMPTY_WATER_RISK_SESSION_SNAPSHOT,
);
const [waterRiskInfoAnchor, setWaterRiskInfoAnchor] = useState<[number, number] | null>(null);
const [waterRiskInfoCardStyle, setWaterRiskInfoCardStyle] = useState<Record<string, number> | null>(null);
const gisEditSessionSnapshot = useMemo<GisEditSessionSnapshot>(() => ({
isEditMode: gisEdit.isEditMode,
selectedLayerName: gisEdit.selectedLayer?.layerName ?? "",
@@ -1263,6 +1466,10 @@ const Map = () => {
gisEdit.lastSavedPayload,
gisEdit.selectedLayer,
]);
const waterRiskSessionSnapshot = useMemo<WaterRiskSessionSnapshot>(
() => waterRiskSession,
[waterRiskSession],
);
const syncGisEditSessionPopup = useCallback(() => {
const popup = gisEditSessionPopupWindowRef.current;
if (!popup || popup.closed) {
@@ -1279,6 +1486,61 @@ const Map = () => {
);
}, [gisEditSessionSnapshot]);
const syncWaterRiskPopup = useCallback(() => {
const popup = waterRiskPopupWindowRef.current;
if (!popup || popup.closed) {
waterRiskPopupWindowRef.current = null;
return;
}
popup.postMessage(
{
type: WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_SYNC,
payload: waterRiskSessionSnapshot,
},
window.location.origin,
);
}, [waterRiskSessionSnapshot]);
const selectedWaterRiskResultRow = useMemo(
() => getWaterRiskResultRow(waterRiskSession.selectedAreaId),
[waterRiskSession.selectedAreaId],
);
const syncWaterRiskInfoCardPosition = useCallback(() => {
const map = gisMaps.current;
if (!map || !waterRiskInfoAnchor) {
setWaterRiskInfoCardStyle(null);
return;
}
const [mapWidth = 0, mapHeight = 0] = map.getSize?.() ?? [];
const [pixelX = 0, pixelY = 0] = map.getPixelFromCoordinate?.(waterRiskInfoAnchor) ?? [];
const cardWidth = 244;
const cardHeight = 236;
const left = pixelX + 22;
const top = pixelY - cardHeight / 2;
if (
pixelX < 0 ||
pixelY < 0 ||
pixelX > mapWidth ||
pixelY > mapHeight ||
left > mapWidth ||
top > mapHeight ||
left + cardWidth < 0 ||
top + cardHeight < 0
) {
setWaterRiskInfoCardStyle(null);
return;
}
setWaterRiskInfoCardStyle({
left,
top,
});
}, [waterRiskInfoAnchor]);
const setGisEditPreviewCursor = useCallback((cursor: string) => {
const targetElement = gisMaps.current?.getTargetElement?.();
if (targetElement?.style) {
@@ -1414,6 +1676,363 @@ const Map = () => {
}
};
const clearWaterRiskPopupCloseWatcher = useCallback(() => {
if (waterRiskPopupCloseWatcherRef.current !== null) {
window.clearInterval(waterRiskPopupCloseWatcherRef.current);
waterRiskPopupCloseWatcherRef.current = null;
}
}, []);
const ensureWaterRiskAreaLayer = useCallback(() => {
const map = gisMaps.current;
if (!map) return null;
if (waterRiskAreaLayerRef.current && waterRiskAreaSourceRef.current) {
return waterRiskAreaSourceRef.current;
}
const source = new VectorSource();
const layer = new VectorLayer({
source,
zIndex: 9996,
});
layer.set("id", WATER_RISK_AREA_LAYER_ID);
layer.set("lyrNm", "통수위험 중점관리지역");
layer.set("lyrTyNm", WATER_RISK_AREA_LAYER_ID);
map.addLayer(layer);
waterRiskAreaLayerRef.current = layer;
waterRiskAreaSourceRef.current = source;
return source;
}, []);
const ensureWaterRiskGridLayer = useCallback(() => {
const map = gisMaps.current;
if (!map) return null;
if (waterRiskGridLayerRef.current && waterRiskGridSourceRef.current) {
return waterRiskGridSourceRef.current;
}
const source = new VectorSource();
const layer = new VectorLayer({
source,
zIndex: 9995,
});
layer.set("id", WATER_RISK_GRID_LAYER_ID);
layer.set("lyrNm", "통수위험 예측강우 격자");
layer.set("lyrTyNm", WATER_RISK_GRID_LAYER_ID);
map.addLayer(layer);
waterRiskGridLayerRef.current = layer;
waterRiskGridSourceRef.current = source;
return source;
}, []);
const ensureWaterRiskPipeLayer = useCallback(() => {
const map = gisMaps.current;
if (!map) return null;
if (waterRiskPipeLayerRef.current && waterRiskPipeSourceRef.current) {
return waterRiskPipeSourceRef.current;
}
const source = new VectorSource();
const layer = new VectorLayer({
source,
zIndex: 9998,
});
layer.set("id", WATER_RISK_PIPE_LAYER_ID);
layer.set("lyrNm", "통수위험 유출관로");
layer.set("lyrTyNm", WATER_RISK_PIPE_LAYER_ID);
map.addLayer(layer);
waterRiskPipeLayerRef.current = layer;
waterRiskPipeSourceRef.current = source;
return source;
}, []);
const clearWaterRiskLayers = useCallback(() => {
waterRiskAreaSourceRef.current?.clear();
waterRiskGridSourceRef.current?.clear();
waterRiskPipeSourceRef.current?.clear();
}, []);
const renderWaterRiskSelection = useCallback((areaId: string | null) => {
const map = gisMaps.current;
if (!map) return;
const areaSource = ensureWaterRiskAreaLayer();
const gridSource = ensureWaterRiskGridLayer();
if (!areaSource || !gridSource) return;
areaSource.clear();
gridSource.clear();
if (!areaId) return;
const areaData = getWaterRiskAreaMapData(areaId);
const resultRow = getWaterRiskResultRow(areaId);
if (!areaData || !resultRow) return;
const areaFeature = new Feature({
geometry: new Polygon(areaData.polygonCoordinates),
areaId: areaData.areaId,
areaName: areaData.areaName,
riskStatus: resultRow.riskStatus,
});
areaFeature.setStyle(createWaterRiskAreaStyle(areaFeature));
areaSource.addFeature(areaFeature);
areaData.gridCells.forEach((cell) => {
const cellFeature = new Feature({
geometry: new Polygon(cell.polygonCoordinates),
gridId: cell.gridId,
rainQty: cell.rainQty,
colorLevel: cell.colorLevel,
});
cellFeature.setStyle(createWaterRiskGridStyle(cellFeature));
gridSource.addFeature(cellFeature);
});
const pipeSource = ensureWaterRiskPipeLayer();
const pipes = WATER_RISK_MAP_PIPES_BY_AREA[areaId] ?? [];
pipeSource?.clear();
pipes.forEach((pipe) => {
if (!pipeSource) return;
const pipeFeature = new Feature({
geometry: new LineString(pipe.lineCoordinates),
pipeId: pipe.pipeId,
displayLabel: pipe.displayLabel,
});
pipeFeature.setStyle(createWaterRiskPipeStyle(pipeFeature));
pipeSource.addFeature(pipeFeature);
});
const areaGeometry = areaFeature.getGeometry();
if (!areaGeometry) return;
map.getView().fit(areaGeometry.getExtent(), {
duration: 300,
padding: [120, 120, 120, 120],
maxZoom: 15,
constrainResolution: true,
nearest: true,
});
}, [ensureWaterRiskAreaLayer, ensureWaterRiskGridLayer, ensureWaterRiskPipeLayer]);
const setWaterRiskStatusMessage = useCallback((statusMessage: string) => {
setWaterRiskSession((current) => ({
...current,
statusMessage,
}));
}, []);
const startWaterRiskSettingEdit = useCallback((areaId: string, areaName: string) => {
setWaterRiskSession((current) => {
const shouldSeedPipes =
current.selectedSettingAreaId !== areaId || current.stagedPipes.length === 0;
return {
...current,
selectedAreaId: areaId,
selectedSettingAreaId: areaId,
selectedSettingAreaName: areaName,
isSettingEditMode: true,
stagedPipes: shouldSeedPipes ? buildWaterRiskSeedPipes(areaId) : current.stagedPipes,
statusMessage: `${areaName} 설정 편집 모드입니다. 지도에서 하수관로를 클릭하세요.`,
};
});
setIsOpen(false);
setFeatureData(null);
}, []);
const stopWaterRiskSettingEdit = useCallback(() => {
setWaterRiskSession((current) => ({
...current,
isSettingEditMode: false,
statusMessage: "",
}));
}, []);
const removeWaterRiskStagedPipe = useCallback((pipeId: string) => {
setWaterRiskSession((current) => ({
...current,
stagedPipes: current.stagedPipes
.filter((pipe) => pipe.pipeId !== pipeId)
.map((pipe, index) => ({
...pipe,
setSeq: index + 1,
})),
statusMessage: `${pipeId} 관로를 staged 목록에서 제거했습니다.`,
}));
}, []);
const reorderWaterRiskStagedPipe = useCallback((pipeId: string, direction: "UP" | "DOWN") => {
setWaterRiskSession((current) => {
const currentIndex = current.stagedPipes.findIndex((pipe) => pipe.pipeId === pipeId);
if (currentIndex < 0) return current;
const nextIndex =
direction === "UP" ? currentIndex - 1 : currentIndex + 1;
if (nextIndex < 0 || nextIndex >= current.stagedPipes.length) {
return current;
}
const reordered = [...current.stagedPipes];
const [targetPipe] = reordered.splice(currentIndex, 1);
if (!targetPipe) {
return current;
}
reordered.splice(nextIndex, 0, targetPipe);
return {
...current,
stagedPipes: reordered.map((pipe, index) => ({
...pipe,
setSeq: index + 1,
})),
statusMessage: `${pipeId} 관로 순번을 조정했습니다.`,
};
});
}, []);
const clearWaterRiskStagedPipes = useCallback(() => {
setWaterRiskSession((current) => ({
...current,
stagedPipes: [],
statusMessage: "staged 유출관로 목록을 초기화했습니다.",
}));
}, []);
useEffect(() => {
if (!mapReady || !gisMaps.current) return;
if (!waterRiskSession.selectedAreaId) {
clearWaterRiskLayers();
setWaterRiskInfoAnchor(null);
setWaterRiskInfoCardStyle(null);
return;
}
renderWaterRiskSelection(waterRiskSession.selectedAreaId);
}, [
clearWaterRiskLayers,
mapReady,
renderWaterRiskSelection,
waterRiskSession.selectedAreaId,
]);
useEffect(() => {
setWaterRiskInfoAnchor(buildWaterRiskInfoAnchor(waterRiskSession.selectedAreaId));
}, [waterRiskSession.selectedAreaId]);
useEffect(() => {
const popup = waterRiskPopupWindowRef.current;
if (!popup || popup.closed) return;
syncWaterRiskPopup();
}, [syncWaterRiskPopup, waterRiskSession]);
useEffect(() => {
if (!mapReady || !gisMaps.current || !waterRiskInfoAnchor) return;
const map = gisMaps.current;
const syncDuringMapRender = () => {
syncWaterRiskInfoCardPosition();
};
syncWaterRiskInfoCardPosition();
map.on?.("postrender", syncDuringMapRender);
map.on?.("moveend", syncDuringMapRender);
return () => {
map.un?.("postrender", syncDuringMapRender);
map.un?.("moveend", syncDuringMapRender);
};
}, [mapReady, syncWaterRiskInfoCardPosition, waterRiskInfoAnchor]);
useEffect(() => {
const handleWaterRiskPopupMessage = (event: MessageEvent) => {
if (event.origin !== window.location.origin) return;
const data = event.data;
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_READY) {
syncWaterRiskPopup();
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_SELECT_RESULT) {
const areaId = String(data.payload?.areaId ?? "").trim();
if (!areaId) return;
setWaterRiskInfoAnchor(buildWaterRiskInfoAnchor(areaId));
setWaterRiskSession((current) => ({
...current,
selectedAreaId: areaId,
statusMessage: `${getWaterRiskResultRow(areaId)?.areaName ?? areaId} 지도 강조를 갱신했습니다.`,
}));
setIsOpen(false);
setFeatureData(null);
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_START_SETTING_EDIT) {
const areaId = String(data.payload?.areaId ?? "").trim();
const areaName = String(data.payload?.areaName ?? "").trim();
if (!areaId) return;
startWaterRiskSettingEdit(areaId, areaName || getWaterRiskResultRow(areaId)?.areaName || areaId);
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_STOP_SETTING_EDIT) {
stopWaterRiskSettingEdit();
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_REMOVE_STAGED_PIPE) {
const pipeId = String(data.payload?.pipeId ?? "").trim();
if (pipeId) {
removeWaterRiskStagedPipe(pipeId);
}
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_REORDER_STAGED_PIPE) {
const pipeId = String(data.payload?.pipeId ?? "").trim();
const direction = data.payload?.direction === "UP" ? "UP" : "DOWN";
if (pipeId) {
reorderWaterRiskStagedPipe(pipeId, direction);
}
return;
}
if (data?.type === WINDOW_POPUP_MESSAGE_TYPE.WATER_RISK_CLEAR_STAGED_PIPES) {
clearWaterRiskStagedPipes();
}
};
window.addEventListener("message", handleWaterRiskPopupMessage);
return () => {
window.removeEventListener("message", handleWaterRiskPopupMessage);
};
}, [
clearWaterRiskStagedPipes,
removeWaterRiskStagedPipe,
reorderWaterRiskStagedPipe,
startWaterRiskSettingEdit,
stopWaterRiskSettingEdit,
syncWaterRiskPopup,
]);
useEffect(() => {
return () => {
clearWaterRiskPopupCloseWatcher();
const popup = waterRiskPopupWindowRef.current;
if (popup && !popup.closed) {
popup.close();
}
waterRiskPopupWindowRef.current = null;
};
}, [clearWaterRiskPopupCloseWatcher]);
// 유하방향은 일반 Gis core 레이어 등록 흐름을 타지 않으므로 전용 layer/source/cache를 직접 정리한다.
const removeFlowDirectionLayer = useCallback(() => {
const core = GisApp.Module.core as any;
@@ -1700,6 +2319,59 @@ const Map = () => {
return;
}
if (waterRiskSession.isSettingEditMode) {
const layerTypeName = getSelectedFeatureLayerTypeName(data);
if (layerTypeName !== WATER_RISK_PIPE_LAYER_TYPE) {
setWaterRiskStatusMessage("통수위험 설정 모드에서는 하수관로만 선택할 수 있습니다.");
setFeatureData(null);
setIsOpen(false);
setIsSearchModalOpen(false);
return;
}
const nextPipe = buildWaterRiskPipeFromFeature(data);
if (!nextPipe) {
setWaterRiskStatusMessage("선택한 하수관로 정보를 staged 목록으로 옮기지 못했습니다.");
setFeatureData(null);
setIsOpen(false);
setIsSearchModalOpen(false);
return;
}
setWaterRiskSession((current) => {
if (current.stagedPipes.some((pipe) => pipe.pipeId === nextPipe.pipeId)) {
return {
...current,
statusMessage: `${nextPipe.pipeId} 관로는 이미 staged 목록에 있습니다.`,
};
}
if (current.stagedPipes.length >= 3) {
return {
...current,
statusMessage: "유출관로는 최대 3건까지만 staged 목록에 담을 수 있습니다.",
};
}
return {
...current,
stagedPipes: [
...current.stagedPipes,
{
...nextPipe,
setSeq: current.stagedPipes.length + 1,
},
],
statusMessage: `${nextPipe.pipeId} 관로를 staged 목록에 추가했습니다.`,
};
});
setFeatureData(null);
setIsOpen(false);
setIsSearchModalOpen(false);
return;
}
let map = gisMaps.current;
if (!map) {
console.warn("지도가 초기화되지 않았습니다.");
@@ -2109,8 +2781,19 @@ const Map = () => {
pipeAnalysisPopupWindowRef.current = popup;
}
if (popupKey === "flowRiskPopup") {
clearWaterRiskPopupCloseWatcher();
waterRiskPopupWindowRef.current = popup;
waterRiskPopupCloseWatcherRef.current = window.setInterval(() => {
if (!popup.closed) return;
clearWaterRiskPopupCloseWatcher();
waterRiskPopupWindowRef.current = null;
stopWaterRiskSettingEdit();
}, 300);
}
return popup;
}, []);
}, [clearWaterRiskPopupCloseWatcher, stopWaterRiskSettingEdit]);
const openGisEditSessionPopup = useCallback(() => {
const existingPopup = gisEditSessionPopupWindowRef.current;
@@ -2718,6 +3401,118 @@ const Map = () => {
{agedPipeDownloadProgressText}
</div>
) : null}
{waterRiskSession.isSettingEditMode ? (
<div className="absolute left-4 top-36 z-[60] max-w-[560px] rounded border border-[#f0d27b] bg-white px-4 py-3 text-sm text-[#7a5b00] shadow">
<div className="font-semibold">
통수위험 설정 모드: {waterRiskSession.selectedSettingAreaName || "중점관리지역 선택 전"}
</div>
<div className="mt-1">
지도에서 하수관로를 클릭하면 staged 목록에 추가됩니다. 최대 3건까지 선택할 수 있습니다.
</div>
</div>
) : null}
{selectedWaterRiskResultRow && waterRiskInfoCardStyle ? (
<div
style={waterRiskInfoCardStyle}
className="absolute z-[61] w-[244px] overflow-hidden rounded-[12px] border border-[#d8dee8] bg-[rgba(255,255,255,0.98)] shadow-[0_14px_28px_rgba(15,23,42,0.16)]"
>
<div className="flex items-center justify-between border-b border-[#e5eaf1] bg-[#f8fafc] px-[9px] py-[7px]">
<div>
<div className="text-[10px] font-semibold text-[#64748b]">중점관리지역</div>
<div className="mt-[2px] text-[13px] font-bold text-[#1f2937]">
{selectedWaterRiskResultRow.areaName}
</div>
</div>
<span
className={`inline-flex min-w-[48px] items-center justify-center rounded-full px-[7px] py-[5px] text-[10px] font-bold ${
selectedWaterRiskResultRow.riskStatus === "DANGER"
? "bg-[#ff1c15] text-white"
: "bg-[#e8f6f4] text-[#0f766e]"
}`}
>
{buildWaterRiskStatusLabel(selectedWaterRiskResultRow.riskStatus)}
</span>
</div>
<div className="px-[8px] py-[8px]">
<div className="overflow-hidden rounded-[10px] border border-[#d8dee8] bg-white shadow-[0_6px_14px_rgba(15,23,42,0.05)]">
<table className="w-full table-fixed border-collapse">
<colgroup>
<col className="w-[46%]" />
<col className="w-[30%]" />
<col className="w-[24%]" />
</colgroup>
<tbody>
<tr className="border-b border-[#e5eaf1]">
<td colSpan={2} className="border-r border-[#e5eaf1] bg-[#fbfdff] px-[9px] py-[7px] text-[10px] font-semibold leading-[1.2] text-[#1f2937]">
예측강우량(mm/hr)
</td>
<td className="px-[9px] py-[7px] text-right text-[12px] font-bold text-[#1f2937]">
{selectedWaterRiskResultRow.forecastRainQty.toFixed(1)}
</td>
</tr>
{selectedWaterRiskResultRow.pipeSummaries.map((pipe, index) => {
const isDanger = pipe.runoffFlowQty > pipe.conveyQty;
const isLast = index === selectedWaterRiskResultRow.pipeSummaries.length - 1;
return (
<Fragment key={`${pipe.pipeId}-row`}>
<tr>
<td
rowSpan={2}
className={`align-top border-r border-[#e5eaf1] px-[9px] py-[8px] ${!isLast ? "border-b border-[#e5eaf1]" : ""}`}
>
<div className="flex items-start justify-between gap-2">
<div className="min-w-0">
<div className="text-[10px] font-semibold leading-[1.15] text-[#1f2937]">
관로
<br />
ID {index + 1}
</div>
<div className="mt-[5px] whitespace-nowrap text-[11px] font-bold leading-none text-[#1f2937]">
{pipe.pipeId}
</div>
</div>
<span
className={`inline-flex min-w-[40px] shrink-0 items-center justify-center rounded-[6px] px-[5px] py-[4px] text-[9px] font-bold ${
isDanger
? "bg-[#ff1c15] text-white"
: "bg-[#eaf4ff] text-[#1565c0]"
}`}
>
{isDanger ? "위험" : "정상"}
</span>
</div>
</td>
<td className="border-b border-r border-[#e5eaf1] bg-[#fbfdff] px-[9px] py-[7px] text-[10px] font-semibold leading-[1.15] text-[#1f2937]">
통수량
<br />
(㎥/hr)
</td>
<td className="border-b border-[#e5eaf1] px-[9px] py-[7px] text-right text-[11px] font-medium text-[#1f2937]">
{pipe.conveyQty.toFixed(1)}
</td>
</tr>
<tr className={!isLast ? "border-b border-[#e5eaf1]" : ""}>
<td className="border-r border-[#e5eaf1] bg-[#fbfdff] px-[9px] py-[7px] text-[10px] font-semibold leading-[1.15] text-[#1f2937]">
유출유량
<br />
(㎥/hr)
</td>
<td className={`px-[9px] py-[7px] text-right text-[11px] ${isDanger ? "font-bold text-[#d32f2f]" : "font-medium text-[#1f2937]"}`}>
{pipe.runoffFlowQty.toFixed(1)}
</td>
</tr>
</Fragment>
);
})}
</tbody>
</table>
</div>
</div>
</div>
) : null}
<AnalysisPopupMenu
onOpenPopup={openAnalysisPopup}
onOpenInfoSearch={() => setIsSearchModalOpen(true)}
@@ -0,0 +1,93 @@
# SFR-011-007 통수위험분석 통합 검증 계획
## 1. 문서 목적
- `SFR-011-007 통수위험분석`의 FE 검증 계획을 기능당 1개 문서로 누적 관리한다.
- 현재 문서는 FE-only 프로토타입 구현 완료 기준의 검증 범위와 후속 통합 검증 포인트를 정의한다.
## 2. 검증 기준 요약
- `통수위험` 아이콘으로 기능 진입 가능
- 결과 조회 popup 열림/닫힘 동작
- 날짜/시간 필수값 검증
- 위험상태 필터 동작
- 관로 1건, 2건, 3건 동적 컬럼 렌더링
- 결과 행 선택 시 지도 강조 및 상세 popup 갱신
- 예측강우 sample grid overlay 노출
- 결과/설정 목록 페이지네이션 노출
- 설정 현황 조회와 staged 설정 편집 진입
- 유출관로 중복 선택 차단
- 최소 1건, 최대 3건 저장 규칙
- 저장 실패 시 staged 목록 유지
## 3. 라운드별 검증 계획
### 3.1 설계 승인 직후 FE-only 검증
- popup 진입/전환/닫기
- 조회조건 유효성
- 결과 그리드 렌더링
- 위험/정상 스타일 전환
- 예측강우 sample overlay 가시성
- 설정 현황 목록과 staged 유출관로 편집
- 저장 payload preview
- 상세정보 카드의 표 구조, 위치, 강조 규칙
### 3.2 BE 연동 후 통합 검증
- 실제 조회조건 전달
- 실제 geometry와 격자 overlay 정합성
- 설정 저장/재조회
- 결과/설정 다운로드
- 권한 범위 제어
## 4. 현재 검증 범위
### 4.1 진행 전제
- FE-only 프로토타입 코드는 구현 완료 상태다.
- 자동 브라우저 검증은 환경 제약으로 제한적이므로, 현재는 코드 점검과 사용자 피드백 기반 수동 검증 포인트를 우선 기록한다.
### 4.2 자동 또는 반자동 관측 포인트
| 구분 | 관측 포인트 | 기대 결과 |
| --- | --- | --- |
| 진입 | `통수위험` 버튼 | popup 열림 |
| 결과 | 날짜/시간 누락 | 조회 차단 메시지 |
| 결과 | 위험상태 필터 | 결과 건수와 목록 반영 |
| 결과 | 동적 관로 컬럼 | 1~3건 반복 렌더링 |
| 결과 | 페이지네이션 | 결과 2페이지, 설정 3페이지 이상 노출 |
| 지도 | 선택 지역 | 중심 이동, 강조 색상 반영 |
| 지도 | 예측강우 격자 | sample overlay 표시 |
| 지도 | 상세정보 카드 | 표 구조, 숫자 강조, 중점관리지역 오른쪽 anchor 동작 확인 |
| 설정 | 설정 현황 전환 | 탭 또는 화면 전환 성공 |
| 설정 | 유출관로 선택 | staged 목록 누적 |
| 설정 | 4번째 관로 선택 | 차단 메시지 |
| 저장 | payload preview | focusAreaId, pipes, setSeq 구조 확인 |
## 5. 차단 사유 분류 기준
- `기능 결함`
- 기대한 상태 전이나 렌더링이 깨짐
- `인증 차단`
- 로그인 또는 권한 문제로 진입 불가
- `환경 차단`
- dev 서버, API, 지도 리소스 미기동
- `데이터 차단`
- 지역 목록, 샘플 결과, geometry 부족
- `자동화 한계`
- 지도 canvas overlay 체감 확인이 도구상 제한적
## 6. 다음 검증 순서
1. 결과 조회 popup 열림/닫힘
2. 조회조건 필수값/초기화
3. 동적 관로 컬럼 렌더링
4. 결과/설정 목록 페이지네이션
5. 결과 행 선택과 지도 강조
6. 예측강우 sample overlay
7. 상세정보 카드 레이아웃과 중점관리지역 오른쪽 anchor 규칙
8. 설정 현황 목록 조회
9. staged 유출관로 1~3건 제어
10. 저장 payload preview
11. BE 연동 후 실제 저장/다운로드
@@ -0,0 +1,116 @@
# SFR-011-007 통수위험분석 통합 검증 결과
## 1. 문서 목적
- `SFR-011-007 통수위험분석`의 FE 검증 결과를 기능당 1개 문서로 누적 관리한다.
- 현재 문서는 설계 초안 점검부터 FE-only 프로토타입 코드 점검, 수동 피드백 반영 상태까지의 결과를 기록한다.
## 2. 수행한 검증 요약
### 2.1 2026-05-18 설계 단계 점검
- 수행 범위
- 작업지시 문서 해석
- 템플릿 문서 구조 확인
- 공통/FE 문서 세트 정의
- 예상 수정 파일, FE-only 범위, BE 필요 범위 분리
- 미수행 범위
- FE 코드 구현
- 브라우저 검증
- API 응답 확인
### 2.2 2026-05-18 FE-only 1차 구현 점검
- 코드 기준 확인
- `flowRiskPopup` registry가 실제 `WaterRiskPopupContent`로 연결됐다.
- `WaterRiskPopupPage.tsx`에서 결과 조회/설정 현황/staged 편집/preview UI가 구현됐다.
- `map/page.tsx`에서 popup sync, 선택 지역 강조, sample rain grid overlay, 설정 편집 중 하수관로 선택 인터셉트가 구현됐다.
- 타입체크
- `NODE_OPTIONS=--max-old-space-size=4096 pnpm exec tsc --noEmit --incremental false --pretty false`
- 결과: 이번 변경분 관련 신규 오류는 제거됐다.
- 잔여 오류: 저장소 기존 오류만 남음
- `components/common/index.ts` 타입 불일치
- `PipeAnalysisPopupPage.tsx`의 `JSON[]` 캐스팅 경고
- `app/html/**` 기존 타입/모듈 오류
- `packages/common/business_components` chart implicit any
- 미수행
- 실제 브라우저 동작 검증
- 실제 API 연동 검증
### 2.3 2026-05-19 FE 프로토타입 UI 보완 점검
- 코드 기준 확인
- 결과 조회/설정 현황 mock 데이터가 확대되어 페이지네이션이 실제로 노출되는 상태로 바뀌었다.
- 결과/설정 toolbar 버튼 정렬, 헤더 컬러, 본문 행 배경이 프로토타입 기준으로 정리됐다.
- 상세정보 카드는 표 구조, compact spacing, 유출유량 초과 강조 등 사용자 피드백 기반 보완이 반영됐다.
- 수동 피드백 반영
- 페이지네이션과 상세정보 카드 UI는 사용자 확인 기준으로 여러 차례 보정됐다.
- 상세정보 카드의 지도 기준 고정 규칙은 현재도 추가 브라우저 확인이 필요한 항목으로 남아 있다.
- 미수행
- 자동 브라우저 캡처 기반 검증
- 실제 API 응답/저장/다운로드 검증
### 2.4 2026-05-19 FE 추가 검증 실행
- 로컬 응답 확인
- `http://localhost:3002/popup/flowRiskPopup`
- 결과: HTTP 200 응답 확인
- 타입체크
- 실행 위치: `frontend/apps/sn`
- 실행 명령: `.\node_modules\.bin\tsc.cmd --noEmit --incremental false --pretty false`
- 결과: 이번 통수위험분석 변경으로 새로 유입된 타입 오류 1건(`buildWaterRiskInfoAnchor`)을 수정했고, 재실행 후 남은 오류는 저장소 기존 오류만 확인됐다.
- 잔여 기존 오류
- `app/(map-layout)/map/components/common/index.ts` props 타입 불일치
- `app/(map-layout)/map/components/pipeAnalysis/PipeAnalysisPopupPage.tsx` `JSON[]` 캐스팅 경고
- `app/html/(map-layout)/map/components/common/index.ts` props 타입 불일치
- `app/html/(with-base-layout)/layout.tsx` 모듈 경로 오류
- `packages/common/business_components/src/ui/chart/*.tsx` implicit any
- 미수행
- 지도 상호작용을 포함한 실제 브라우저 자동 검증
- 실제 API 연동 검증
### 2.5 2026-05-19 상세정보 카드 상호작용 보정
- 코드 기준 확인
- 상세정보 카드는 선택된 중점관리지역 geometry를 기준으로 오른쪽 anchor를 잡는 방식으로 재조정됐다.
- 지도 렌더링 중에는 같은 anchor를 기준으로 카드 위치를 갱신하는 구조로 정리됐다.
- 수동 피드백 반영
- 사용자 기준으로 “화면 고정”이 아니라 “중점관리지역 오른쪽에 붙은 상태로 이동”해야 한다는 요구를 반영했다.
- 미수행
- 실제 브라우저 drag/zoom 상황에서 최종 체감 확인
## 3. 현재 검증 상태
### 3.1 통과
- 문서 구조가 `SFR-012-003` 템플릿 기준과 맞는지 확인
- 공통 설계서, 공유기록, FE 작업카드, 구현기록, 검증 계획/결과 문서 세트 정의 완료
- 구현 승인 전 코드 미수정 원칙 반영
- FE-only 프로토타입 범위의 결과 조회/설정 현황/지도 강조/staged 편집 코드 반영 완료
- 로컬 `flowRiskPopup` 경로의 HTTP 200 응답 확인
- 이번 통수위험분석 변경으로 인한 신규 타입 오류 제거
### 3.2 미실행
- 실제 브라우저에서의 `통수위험` 아이콘 진입
- 실제 popup 렌더링 재확인
- 실제 지도 drag/zoom 상태에서 상세정보 카드 anchor 규칙 재확인
- 실제 API 연동 검증
### 3.3 보류
- 실제 BE 연동 검증
- 다운로드 파일 검증
- 권한 범위 검증
## 4. 보류/리스크
- 상세정보 카드 anchor 규칙은 FE 프로토타입 단계에서 반복 조정된 항목이라 운영 규칙 확정 전 재검토가 필요하다.
- 동적 관로 컬럼과 지도 overlay는 실제 API 응답 구조 확정 전까지 mock 기준으로만 검토 가능하다.
- 실제 다운로드/저장 후처리와 파일 결과는 아직 확인되지 않았다.
## 5. 다음 검증 착수 조건
- dev 서버 또는 로컬 미리보기 진입 가능
- mock 데이터 또는 초기 API 응답 구조 준비
- 인증 가능한 브라우저 환경에서 지도 조작 수동 검증 가능
@@ -0,0 +1,175 @@
# SFR-011-007 통수위험분석 작업카드
## 1. 작업 개요
- 작업 ID: `SFR-011-007-FE`
- 작업명: 통수위험분석 프론트엔드 구현 계획
- 상태: 완료
- 작성일: 2026-05-18
- 담당 역할: FE
- 관련 역할: DE, BE, QA
- 담당 범위: `apps/sn` 지도 화면에서 통수위험 진입, 결과 조회 popup, 지도보기, 설정 현황, staged 유출관로 선택, 저장 payload 준비까지
- 근거 문서
- `COMMON_DOCS_ROOT/작업계획/SFR-011-007-통수위험분석/001-de-SFR-011-007-통수위험분석-설계.md`
- `COMMON_DOCS_ROOT/작업내용/SFR-011-007-통수위험분석/001-fe-SFR-011-007-통수위험분석-통합공유기록.md`
- `COMMON_DOCS_ROOT/작업지시/SFR-011-007-통수위험분석/통수위험분석_요구사항명세서_v1_2.docx`
- `COMMON_DOCS_ROOT/작업지시/SFR-011-007-통수위험분석/통수위험분석_화면_v1.1.html`
- `COMMON_DOCS_ROOT/작업지시/SFR-011-007-통수위험분석/통수위험분석_통수위험분석결과 조회_화면설계서.png`
- `COMMON_DOCS_ROOT/작업지시/SFR-011-007-통수위험분석/통수위험분석_통수위험분석결과 지도보기_화면설계서.png`
- `COMMON_DOCS_ROOT/작업지시/SFR-011-007-통수위험분석/통합위험분석_화면구성시나리오_v1.1.md`
## 1-1. 공통 동기화 확인
- 공통 작업현황판 확인 여부: 확인
- 파일점유현황 확인 여부: 확인
- 결정로그 확인 여부: 확인
- 기존 진행 중 작업과의 관계: `map/page.tsx`, `AnalysisPopupMenu.tsx`, `windowPopup/**`는 최근 지도형 기능 작업 이력이 있어 충돌 주의가 필요하다.
## 2. 작업 목적
- 기존 하수관망도 지도 화면에 `통수위험` 기능을 추가해 사용자가 결과 조회, 지도보기, 설정 현황 조회, 유출관로 설정 편집을 한 흐름 안에서 수행할 수 있게 한다.
- 프론트는 백엔드 연결 전 단계에서 popup UI, 동적 관로 컬럼, mock 지도 강조, staged 설정 목록, 저장 payload preview까지 먼저 구현한다.
- 실제 산정 로직, geometry 데이터, 다운로드 파일, 저장 API는 BE 범위로 분리하고 FE는 그 계약을 맞출 준비 상태까지 수행한다.
## 2-1. 최근 진행 갱신
- 2026-05-18
- `통수위험` 메뉴의 placeholder popup을 실제 `WaterRiskPopupContent`로 교체했다.
- popup 안에서 결과 조회, 설정 현황, staged 유출관로 목록, 결과/설정 다운로드 preview, 저장 payload preview가 동작하도록 FE-only mock 흐름을 연결했다.
- `map/page.tsx`에는 popup과 동기화되는 선택 지역 강조, 예측강우 sample grid overlay, 설정 편집 모드, 지도 하수관로 클릭 기반 staged 추가 흐름을 연결했다.
- 실제 API 호출은 아직 붙이지 않았고, BE 신규 API 계약과 mock 상태를 기준으로만 동작한다.
- 2026-05-19
- 결과 조회/설정 현황 mock 데이터를 확대해 페이지네이션이 실제로 보이도록 조정했다.
- 결과 조회와 설정 현황 toolbar 버튼을 우측 정렬로 정리하고, 본문 행 배경과 헤더 컬러를 관로분석 계열 톤으로 맞췄다.
- 지도 상세정보 카드는 프로토타입 표 구조, 위험/정상 배지, 유출유량 초과 강조, compact spacing을 기준으로 재정리했다.
- 지도 상세정보 카드는 선택 중점관리지역의 오른쪽에 붙어 움직이는 프로토타입 기준으로 다시 조정했다.
- 지도 강조와 상세정보 카드는 계속 실험이 반복된 항목이라, 최종 운영 규칙은 BE 연동 및 수동 브라우저 검증 단계에서 한 번 더 확정한다.
## 3. 수정 대상 파일
| 구분 | 파일 경로 | 수정 여부 | 근거 |
| --- | --- | --- | --- |
| 화면 | `FE_APP_ROOT/app/(map-layout)/map/page.tsx` | 완료 | 지도 이동, 강조 overlay, 상태 연결, 상세정보 카드 프로토타입 |
| 우측 메뉴 | `FE_APP_ROOT/app/(map-layout)/map/components/analysisMenu/AnalysisPopupMenu.tsx` | 완료 | `통수위험` 아이콘 진입점 추가 |
| popup 정의 | `FE_APP_ROOT/src/features/windowPopup/model/popupDefinitions.ts` | 완료 | 신규 popup 정의 |
| popup 등록 | `FE_APP_ROOT/src/features/windowPopup/registry.tsx` | 완료 | popup content 연결 |
| 신규 컴포넌트 | `FE_APP_ROOT/app/(map-layout)/map/components/waterRisk/*` | 완료 | 결과/설정 UI, mock 데이터, 타입 분리 |
| popup content | `FE_APP_ROOT/src/features/windowPopup/ui/WaterRiskPopupContent.tsx` | 완료 | window popup 본문 연결 |
| 공통 비즈니스 컴포넌트 | `FE_BC_ROOT/**` | 기본 제외 | 초기 구현은 `apps/sn` 내부 해결 우선 |
## 4. 화면 흐름
- 진입 경로
- 하수관망도 지도 화면 우측 기능 아이콘 `통수위험`
- 정상 흐름
- 결과 조회 popup 열기
- 조회조건 입력
- 결과 목록 표시
- 결과 행 선택 후 지도 강조/상세정보 표시
- `설정`으로 화면 전환
- 설정 현황 조회
- 중점관리지역 선택 후 유출관로 staged 편집
- 저장 payload 생성
- 오류 흐름
- 날짜/시간 누락
- 결과 없음
- 중복 유출관로 선택
- 3건 초과 선택
- 저장 실패 시 staged 목록 유지
## 5. API 연동
| 기능 | Method | URL | 요청 | 응답 | 확인 상태 |
| --- | --- | --- | --- | --- | --- |
| 결과 조회 | `GET` | `/api/v1/map/wraResults` | 분석일시, 지역, 위험상태 | 요약 + 결과 목록 + 관로 반복형 데이터 | BE 신규 필요 |
| 지도 상세 | `GET` | `/api/v1/map/wraResults/{focusAreaId}/mapView` | 중점관리지역 식별값 | polygon + rain grid + 상세 popup 데이터 | BE 신규 필요 |
| 설정 현황 조회 | `GET` | `/api/v1/map/wraOutletPipeSettings` | 지역 조건 | 설정 목록 | BE 신규 필요 |
| 설정 저장 | `POST` | `/api/v1/map/wraOutletPipeSettings/save` | 중점관리지역 + 유출관로 1~3건 + 순번 | 저장 결과 + 최신 상태 | BE 신규 필요 |
| 결과 다운로드 | `POST` | `/api/v1/map/wraResults/download` | 현재 조회조건 | 파일 또는 파일 토큰 | BE 신규 필요 |
| 설정 다운로드 | `POST` | `/api/v1/map/wraOutletPipeSettings/download` | 현재 조회조건 | 파일 또는 파일 토큰 | BE 신규 필요 |
- FE 메모
- 1차 구현은 실제 네트워크 대신 payload preview 또는 mock service 기준으로 상태를 먼저 맞춘다.
- 동적 관로 그룹은 `pipeSummaries[]` 반복 렌더링 기준으로 구현한다.
## 6. 영향 범위
- `apps/sn` 영향
- 지도 메인 화면
- 우측 분석 기능 메뉴
- popup registry와 popup content
- 지도 선택/강조/overlay 상태
- 지도 상세정보 카드와 표형 mock UI
- `business_components` 영향
- 현재 계획상 없음
- overlay 또는 popup wrapper 요구가 기존 패턴으로 해결되지 않을 때만 추가 검토
- 백엔드 영향
- 결과 조회/상세/설정/저장/다운로드 API
- 권한과 지역 조건 cascade
## 7. 구현 범위 분리
### 7.1 FE 단독 구현 범위
- popup 레이아웃
- 조회/설정 폼
- mock 결과/설정 데이터
- 동적 관로 그룹 컬럼
- 위험/정상 스타일 변경
- 예측강우 sample overlay
- staged 유출관로 목록
- 저장/다운로드 payload preview
### 7.2 BE 필요 범위
- 실제 분석 결과 수치
- geometry와 grid 데이터
- 저장/다운로드
- 권한 검증
- 중복/유효성 서버 검증
## 8. 검증 방법
- 브라우저 기준
- `통수위험` 아이콘 클릭
- 결과 popup 열림
- 날짜/시간 필수값 검증
- 위험상태 필터 동작
- 1건/2건/3건 동적 관로 그룹 표시
- 페이지네이션 노출과 행 수 변화
- 결과 행 선택 후 지도 강조
- 설정 화면 전환
- 유출관로 staged 목록 추가/삭제/순번 변경
- 저장 payload preview 확인
- 정적 확인
- FE-only 프로토타입 코드는 완료됐고, 실제 브라우저 검증/BE 연동은 후속으로 진행한다.
## 9. 현재 결정 상태
- popup 구조는 결과 조회와 설정 현황을 같은 popup 내부 전환 구조로 유지한다.
- 격자 overlay는 FE 1차 범위에 sample overlay로 포함했다.
- 다운로드는 실제 파일 처리 없이 preview까지를 FE 프로토타입 범위로 본다.
- staged 설정 편집 화면은 popup 내부 + 지도 연동 구조를 유지한다.
## 10. 롤백 방법
- `통수위험` 아이콘 진입점 제거
- waterRisk 전용 popup/hook/overlay 제거
- 기존 지도 기본 기능만 남기기
## 11. 예상 위험
- 동적 관로 그룹 헤더/컬럼 렌더링이 테이블 공통 컴포넌트와 맞물리며 복잡해질 수 있다.
- 지도 강조와 예측강우 격자 overlay가 동시에 올라가면 렌더 성능 이슈가 생길 수 있다.
- 설정 편집 모드에서 기존 피처 클릭 상세와 충돌 가능성이 있다.
- 상세정보 카드의 지도 기준 고정 규칙은 사용자 피드백에 따라 다시 조정될 수 있다.
## 12. 완료 기준
- `통수위험` 진입과 popup UI가 동작한다.
- 결과/설정 화면 전환이 가능하다.
- 동적 관로 그룹 렌더링이 1~3건 모두 자연스럽다.
- 지도 강조/상세정보/mock 격자 표시가 가능하다.
- staged 설정 목록과 저장 payload preview가 준비된다.
- FE-only 프로토타입 기준 구현이 완료되고, BE 연동 및 실제 통합 검증 후속 범위가 문서로 정리된다.
- 지도 상세정보 카드 위치 규칙은 현재 프로토타입 기준 동작으로 마감하고, 운영 기준 확정은 후속 검증으로 넘긴다.
@@ -0,0 +1,161 @@
# SFR-011-007 통수위험분석 통합 구현 기록
## 1. 문서 목적
- `SFR-011-007 통수위험분석`의 FE 구현 이력과 남은 리스크를 기능당 1개 문서로 누적 관리한다.
- 현재 문서는 설계 초안부터 FE-only 프로토타입 구현까지의 누적 이력을 기록하며, 이후 실제 BE 연동과 통합 검증 결과를 계속 추가한다.
## 2. 입력 근거
- `COMMON_DOCS_ROOT/작업계획/SFR-011-007-통수위험분석/001-de-SFR-011-007-통수위험분석-설계.md`
- `COMMON_DOCS_ROOT/작업내용/SFR-011-007-통수위험분석/001-fe-SFR-011-007-통수위험분석-통합공유기록.md`
- `FE_APP_DOCS_ROOT/작업계획/SFR-011-007-통수위험분석/001-fe-SFR-011-007-통수위험분석-작업카드.md`
## 3. 공통 계약
- 작성자 승인 전에는 코드 수정 없이 문서 설계까지만 진행한다.
- FE 1차 구현은 실제 백엔드 연결 없이도 검토 가능한 범위를 우선한다.
- 결과 목록의 관로 정보는 1~3건 반복형 렌더링으로 구현하고, 고정 3세트 컬럼 가정은 두지 않는다.
- 설정 편집은 중점관리지역 1건 기준 staged 유출관로 1~3건을 FE 로컬 상태에 유지한다.
- 저장 실패 시 staged 목록과 지도 선택 상태는 유지한다.
## 4. 구현 라운드 요약
### 4.1 2026-05-18 설계/초안 라운드
- 수행 내용
- 작업지시 DOCX, HTML, PNG, 시나리오를 기준으로 기능 범위를 재정리했다.
- `SFR-012-003` 문서 구조를 기준으로 공통 설계서, 공통 공유기록, FE 작업카드, FE 구현기록, QA 계획/결과 문서 세트를 정의했다.
- 결과 조회, 지도보기, 설정 현황, 설정 편집/저장 흐름을 FE 단독 범위와 BE 필요 범위로 분리했다.
- 예상 수정 파일과 승인 필요 항목을 정리했다.
- 아직 하지 않은 내용
- FE 코드 수정
- popup 등록
- mock 데이터 연결
- 지도 overlay 구현
- staged 설정 상태 구현
### 4.2 2026-05-18 FE-only 1차 구현
- 반영 파일
- `FE_APP_ROOT/app/(map-layout)/map/page.tsx`
- `FE_APP_ROOT/app/(map-layout)/map/components/waterRisk/waterRiskTypes.ts`
- `FE_APP_ROOT/app/(map-layout)/map/components/waterRisk/WaterRiskPopupPage.tsx`
- `FE_APP_ROOT/src/features/windowPopup/model/types.ts`
- `FE_APP_ROOT/src/features/windowPopup/registry.tsx`
- `FE_APP_ROOT/src/features/windowPopup/ui/WaterRiskPopupContent.tsx`
- 구현 내용
- `통수위험` popup registry 연결
- 결과 조회/설정 현황 2탭 popup UI
- 관로 1~3건 동적 컬럼 렌더링
- 결과 행 선택 시 main map 강조와 sample rain grid overlay 동기화
- 설정 편집 모드 시작/종료, 지도 하수관로 클릭 기반 staged 목록 추가
- staged 목록 순번 조정/삭제/초기화
- 결과 다운로드 preview, 설정 다운로드 preview, 설정 저장 payload preview
- 아직 mock 기준인 항목
- 실제 통수위험 결과 API
- 실제 중점관리지역 geometry/예측강우 grid 연계
- 실제 설정 저장/재조회
- 실제 파일 다운로드
### 4.3 2026-05-19 FE 프로토타입 마감 정리
- 반영 파일
- `FE_APP_ROOT/app/(map-layout)/map/page.tsx`
- `FE_APP_ROOT/app/(map-layout)/map/components/waterRisk/WaterRiskPopupPage.tsx`
- `FE_APP_ROOT/app/(map-layout)/map/components/waterRisk/waterRiskTypes.ts`
- 구현 내용
- 결과 조회/설정 현황 더미데이터를 확대해 페이지네이션이 실제로 보이도록 정리했다.
- 결과 조회와 설정 현황 toolbar 버튼 정렬, 본문 배경, 헤더 컬러를 기존 지도형 기능과 유사한 톤으로 맞췄다.
- 지도 상세정보 카드를 compact 표 구조로 재구성하고, 유출유량이 통수량을 초과하는 경우 강조 표시가 가능하게 정리했다.
- 지도 상세정보 카드 위치는 여러 차례 사용자 피드백을 반영해 프로토타입 기준 위치 조정이 가능한 상태까지 정리했다.
- 아직 mock 또는 후속 검증이 필요한 항목
- 상세정보 카드의 최종 고정/앵커 규칙 확정
- 실제 API 응답 구조에 맞춘 결과/상세/설정 데이터 치환
- 실제 다운로드 및 저장 성공/실패 후처리
### 4.4 2026-05-19 FE 추가 보정
- 반영 파일
- `FE_APP_ROOT/app/(map-layout)/map/page.tsx`
- 구현 내용
- 상세정보 카드 위치 규칙은 사용자 피드백 기준으로 반복 보정되었고, 현재는 직접 추가 조정이 가능한 상태로 유지한다.
- 상세정보 카드 표 구조, 헤더/본문 spacing, 유출유량 초과 강조, 페이지네이션 노출 상태를 사용자 피드백에 맞춰 세부 조정했다.
- 확인 메모
- UI 세부 보정 과정에서 타입 오류 1건(`buildWaterRiskInfoAnchor`)이 발생했으나 바로 수정했다.
### 4.5 2026-05-19 상세정보 카드 위치 규칙 보정
- 반영 파일
- `FE_APP_ROOT/app/(map-layout)/map/page.tsx`
- 구현 내용
- 상세정보 카드는 선택된 중점관리지역의 오른쪽에 붙어 보이는 프로토타입 기준으로 재조정했다.
- 카드 anchor 좌표는 선택 대상 중점관리지역 geometry 기준으로 유지하고, 지도 렌더링 중에는 같은 anchor 기준으로 픽셀 위치를 다시 계산하도록 보정했다.
- 화면 고정형 팝업이 아니라 지도 대상 옆에서 같이 움직이는 정보 카드 방향으로 정리했다.
- 남은 메모
- 실제 운영에서 요구되는 카드 고정 규칙과 사용성은 브라우저 수동 검증에서 한 번 더 확정할 필요가 있다.
## 5. 기능별 현재 상태
### 5.1 결과 조회
- 설계 완료
- FE-only 프로토타입 구현 완료
- 핵심 구현 메모
- 날짜/시간/지역/위험상태 필터
- 결과 목록
- 관로 1~3건 동적 컬럼
- 페이지네이션 및 mock 행 렌더링
### 5.2 지도보기
- 설계 완료
- FE-only 프로토타입 구현 완료
- 핵심 구현 메모
- 결과 행 선택 기반 지도 이동
- 위험/정상 polygon 스타일
- 예측강우 sample grid overlay
- 상세정보 카드
### 5.3 설정 현황
- 설계 완료
- FE-only 프로토타입 구현 완료
- 핵심 구현 메모
- 결과 popup에서 같은 흐름으로 전환
- 설정 목록 조회
- 설정 목록 다운로드 조건 유지
- 페이지네이션 및 mock 설정 행 렌더링
### 5.4 설정 편집/저장
- 설계 완료
- FE-only 프로토타입 구현 완료
- 핵심 구현 메모
- 지도 유출관로 선택
- staged 목록 1~3건
- 순번 조정
- 저장 payload preview
## 6. 예상 구현 순서
1. `통수위험` 아이콘과 popup 진입점 연결
2. 결과 조회/설정 현황 화면 구조 구현
3. mock 결과 데이터와 동적 관로 컬럼 렌더링
4. 결과 행 선택 기반 지도 강조와 sample grid overlay
5. staged 유출관로 편집 상태와 저장 payload preview
6. BE 계약 확정 후 실제 API 연결
## 7. 남은 리스크
- popup 1개 탭 구조와 popup 2개 분리 구조 중 하나를 먼저 확정해야 구현 방향이 흔들리지 않는다.
- 격자 overlay는 mock 단계와 실제 데이터 단계의 렌더 방식 차이가 클 수 있다.
- 설정 편집 모드에서 기존 지도 클릭 기능과 충돌 가능성이 있다.
- 상세정보 카드 위치 규칙은 FE 프로토타입 단계에서 반복 조정된 항목이라 운영 규칙 확정 전 재검토가 필요하다.
- 지도 drag/zoom 중 상세정보 카드의 체감 동작은 실제 사용자 손 기준으로 재확인이 필요하다.
## 8. 다음 라운드 착수 조건
- 실제 API 응답 구조 확정
- BE 저장/다운로드 계약 확정
- 인증 가능한 브라우저 환경에서 수동 검증 가능 상태 확보
@@ -118,7 +118,7 @@ export const windowPopupDefinitions = {
flowRiskPopup: {
key: "flowRiskPopup",
title: "통수 위험",
width: 1080,
width: 920,
height: 760,
},
} as const satisfies Record<string, WindowPopupDefinition>;
@@ -36,6 +36,14 @@ export const WINDOW_POPUP_MESSAGE_TYPE = {
GIS_EDIT_SESSION_FOCUS_CHANGE: "sn:popup:gisEditSessionFocusChange",
GIS_EDIT_SESSION_REMOVE_LAST_CHANGE: "sn:popup:gisEditSessionRemoveLastChange",
GIS_EDIT_SESSION_CLEAR_CHANGES: "sn:popup:gisEditSessionClearChanges",
WATER_RISK_READY: "sn:popup:waterRiskReady",
WATER_RISK_SYNC: "sn:popup:waterRiskSync",
WATER_RISK_SELECT_RESULT: "sn:popup:waterRiskSelectResult",
WATER_RISK_START_SETTING_EDIT: "sn:popup:waterRiskStartSettingEdit",
WATER_RISK_STOP_SETTING_EDIT: "sn:popup:waterRiskStopSettingEdit",
WATER_RISK_REMOVE_STAGED_PIPE: "sn:popup:waterRiskRemoveStagedPipe",
WATER_RISK_REORDER_STAGED_PIPE: "sn:popup:waterRiskReorderStagedPipe",
WATER_RISK_CLEAR_STAGED_PIPES: "sn:popup:waterRiskClearStagedPipes",
} as const;
export type WindowPopupMessageType =
@@ -17,6 +17,7 @@ import GisEditSessionPopupContent from "./ui/GisEditSessionPopupContent";
import GisManagementPopupContent from "./ui/GisManagementPopupContent";
import PipeAnalysisPopupContent from "./ui/PipeAnalysisPopupContent";
import PipeAnalysisDetailPopupContent from "./ui/PipeAnalysisDetailPopupContent";
import WaterRiskPopupContent from "./ui/WaterRiskPopupContent";
const FloodPredictionMapPopupContent = (_props: WindowPopupContentProps) => (
<FeaturePlaceholderPopupContent
@@ -34,10 +35,6 @@ const GisEditPopupContent = (_props: WindowPopupContentProps) => (
<FeaturePlaceholderPopupContent title={windowPopupDefinitions.gisEditPopup.title} />
);
const FlowRiskPopupContent = (_props: WindowPopupContentProps) => (
<FeaturePlaceholderPopupContent title={windowPopupDefinitions.flowRiskPopup.title} />
);
export const windowPopupRegistry = {
oldPpUpload: {
...windowPopupDefinitions.oldPpUpload,
@@ -113,6 +110,6 @@ export const windowPopupRegistry = {
},
flowRiskPopup: {
...windowPopupDefinitions.flowRiskPopup,
component: FlowRiskPopupContent,
component: WaterRiskPopupContent,
},
} as const satisfies Record<WindowPopupKey, WindowPopupRegistryItem>;
@@ -0,0 +1,12 @@
import { Suspense } from "react";
import WaterRiskPopupPage from "@/app/(map-layout)/map/components/waterRisk/WaterRiskPopupPage";
import type { WindowPopupContentProps } from "../model/types";
export default function WaterRiskPopupContent(props: WindowPopupContentProps) {
return (
<Suspense fallback={null}>
<WaterRiskPopupPage {...props} />
</Suspense>
);
}