필요없는 종류 정리 및 대시보드 이젠 렌더링 되고 모든 위젯들 이름 수정 가능하게 해달라고 했는데 지금은 데이터베이스 연결하는 것만 이름 변경이 됩니다.

This commit is contained in:
leeheejin
2025-10-15 18:25:16 +09:00
parent 4addf8dccf
commit 7e38f82d0c
15 changed files with 229 additions and 168 deletions

View File

@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { RefreshCw, AlertTriangle, Cloud, Construction } from "lucide-react";
import { apiClient } from "@/lib/api/client";
import { DashboardElement } from "@/components/admin/dashboard/types";
// 알림 타입
type AlertType = "accident" | "weather" | "construction";
@@ -21,7 +22,11 @@ interface Alert {
timestamp: string;
}
export default function RiskAlertWidget() {
interface RiskAlertWidgetProps {
element?: DashboardElement;
}
export default function RiskAlertWidget({ element }: RiskAlertWidgetProps) {
const [alerts, setAlerts] = useState<Alert[]>([]);
const [isRefreshing, setIsRefreshing] = useState(false);
const [filter, setFilter] = useState<AlertType | "all">("all");
@@ -163,7 +168,7 @@ export default function RiskAlertWidget() {
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<AlertTriangle className="h-5 w-5 text-red-600" />
<h3 className="text-base font-semibold text-gray-900"> / </h3>
<h3 className="text-base font-semibold text-gray-900">{element?.customTitle || "리스크 / 알림"}</h3>
{stats.high > 0 && (
<Badge className="bg-red-100 text-red-700 hover:bg-red-100"> {stats.high}</Badge>
)}