"use client"; import { useRef } from "react"; import { Button, Input } from "@common/components"; import { UiTable } from "@common/business_components/ui"; import LoadingOverlay from "@/components/ui/LoadingBar"; import useStore from "@/store/useStore"; import { AGED_PIPE_LIST_HEADLIST, type AgedPipeFilters, type AgedPipeRow, } from "./agedPipeUtils"; type Props = { open: boolean; onOpenChange: (open: boolean) => void; filters: AgedPipeFilters; onFiltersChange: (filters: AgedPipeFilters) => void; rows: AgedPipeRow[]; total: number; currentPage: number; isLoading: boolean; onSearch: (page?: number) => void; onDownload: () => void; onRowDoubleClick: (row: AgedPipeRow) => void; }; export default function AgedPipeListModal({ open, onOpenChange, filters, onFiltersChange, rows, total, currentPage, isLoading, onSearch, onDownload, onRowDoubleClick, }: Props) { const { ctpv, sgg } = useStore(); const lastClickRef = useRef<{ index: number; clickedAt: number } | null>(null); const sggOptions = filters.ctpvCd === "0" ? sgg : sgg.filter((item) => String(item.val).startsWith(filters.ctpvCd.slice(0, 2))); const handleRowClick = (index?: number) => { if (typeof index !== "number") return; const row = rows[index]; if (!row) return; const now = Date.now(); const lastClick = lastClickRef.current; if (lastClick && lastClick.index === index && now - lastClick.clickedAt < 300) { lastClickRef.current = null; onRowDoubleClick(row); return; } lastClickRef.current = { index, clickedAt: now }; }; if (!open) return null; return (
노후관로 목록
headName={<>노후관로 조회 결과} tableData={rows} headlist={AGED_PIPE_LIST_HEADLIST} pageSize={10} total={total} cellClick={(index) => handleRowClick(index)} onPageChange={(page) => onSearch(page)} curPage={currentPage} widthFixed={true} />
목록 행을 더블클릭하면 지도 이동 후 상세 패널이 열립니다.
); }