diff --git a/frontend/components/admin/dashboard/DashboardDesigner.tsx b/frontend/components/admin/dashboard/DashboardDesigner.tsx index 67dd335b..1a67f76c 100644 --- a/frontend/components/admin/dashboard/DashboardDesigner.tsx +++ b/frontend/components/admin/dashboard/DashboardDesigner.tsx @@ -5,8 +5,6 @@ import { useRouter } from "next/navigation"; import { DashboardCanvas } from "./DashboardCanvas"; import { DashboardTopMenu } from "./DashboardTopMenu"; import { ElementConfigSidebar } from "./ElementConfigSidebar"; -import { ListWidgetConfigModal } from "./widgets/ListWidgetConfigModal"; -import { YardWidgetConfigModal } from "./widgets/YardWidgetConfigModal"; import { DashboardSaveModal } from "./DashboardSaveModal"; import { DashboardElement, ElementType, ElementSubtype } from "./types"; import { GRID_CONFIG, snapToGrid, snapSizeToGrid, calculateCellSize } from "./gridUtils"; @@ -293,8 +291,13 @@ export default function DashboardDesigner({ dashboardId: initialDashboardId }: D if (selectedElement === id) { setSelectedElement(null); } + // 삭제된 요소의 사이드바가 열려있으면 닫기 + if (sidebarElement?.id === id) { + setSidebarOpen(false); + setSidebarElement(null); + } }, - [selectedElement], + [selectedElement, sidebarElement], ); // 키보드 단축키 핸들러들 @@ -568,14 +571,8 @@ export default function DashboardDesigner({ dashboardId: initialDashboardId }: D // 선택된 요소 찾아서 사이드바 열기 const element = elements.find((el) => el.id === id); if (element) { - // 리스트/야드 위젯은 별도 모달 사용 - if (element.subtype === "list" || element.subtype === "yard-management-3d") { - setSidebarElement(element); - setSidebarOpen(false); - } else { - setSidebarElement(element); - setSidebarOpen(true); - } + setSidebarElement(element); + setSidebarOpen(true); } }} onSelectMultiple={(ids) => { @@ -592,7 +589,7 @@ export default function DashboardDesigner({ dashboardId: initialDashboardId }: D - {/* 요소 설정 사이드바 */} + {/* 요소 설정 사이드바 (리스트/야드 위젯 포함) */} - {/* 리스트 위젯 전용 모달 */} - {sidebarElement && sidebarElement.subtype === "list" && ( - { - setSidebarElement(null); - setSelectedElement(null); - }} - onSave={saveWidgetConfig} - /> - )} - - {/* 야드 위젯 전용 모달 */} - {sidebarElement && sidebarElement.subtype === "yard-management-3d" && ( - { - setSidebarElement(null); - setSelectedElement(null); - }} - onSave={saveWidgetConfig} - /> - )} - {/* 저장 모달 */} { + onApply(updatedElement); + }} + /> + ); + } + + // 야드 위젯은 별도 모달로 처리 + if (element.subtype === "yard-management-3d") { + return ( + { + onApply({ ...element, ...updatedElement }); + }} + /> + ); + } + // 차트 설정이 필요 없는 위젯 (쿼리/API만 필요) const isSimpleWidget = element.subtype === "todo" || diff --git a/frontend/components/admin/dashboard/VehicleMapConfigPanel.tsx b/frontend/components/admin/dashboard/VehicleMapConfigPanel.tsx index 9bf381c9..3800105b 100644 --- a/frontend/components/admin/dashboard/VehicleMapConfigPanel.tsx +++ b/frontend/components/admin/dashboard/VehicleMapConfigPanel.tsx @@ -29,13 +29,13 @@ export function VehicleMapConfigPanel({ config, queryResult, onConfigChange }: V const sampleData = queryResult?.rows?.[0] || {}; return ( -
-

🗺️ 지도 설정

+
+

🗺️ 지도 설정

{/* 쿼리 결과가 없을 때 */} {!queryResult && ( -
-
+
+
💡 먼저 SQL 쿼리를 실행하여 데이터를 가져온 후 지도를 설정할 수 있습니다.
@@ -45,27 +45,27 @@ export function VehicleMapConfigPanel({ config, queryResult, onConfigChange }: V {queryResult && ( <> {/* 지도 제목 */} -
- +
+ updateConfig({ title: e.target.value })} placeholder="차량 위치 지도" - className="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" + className="w-full px-2 py-1.5 border border-gray-300 rounded-lg text-xs" />
{/* 위도 컬럼 설정 */} -
-