ERP-node/frontend/components/admin/dashboard/widget-sections/MapConfigSection.tsx

108 lines
3.8 KiB
TypeScript
Raw Normal View History

2025-10-31 11:02:06 +09:00
"use client";
import React from "react";
import { QueryResult } from "../types";
import { Label } from "@/components/ui/label";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
2025-10-31 11:02:06 +09:00
import { Alert, AlertDescription } from "@/components/ui/alert";
import { AlertCircle } from "lucide-react";
interface MapConfigSectionProps {
queryResult: QueryResult | null;
refreshInterval?: number;
markerType?: string;
onRefreshIntervalChange?: (interval: number) => void;
onMarkerTypeChange?: (type: string) => void;
2025-10-31 11:02:06 +09:00
}
/**
*
* -
* -
2025-10-31 11:02:06 +09:00
*/
export function MapConfigSection({
queryResult,
refreshInterval = 5,
markerType = "circle",
onRefreshIntervalChange,
onMarkerTypeChange,
}: MapConfigSectionProps) {
2025-10-31 11:02:06 +09:00
// 쿼리 결과가 없으면 안내 메시지 표시
if (!queryResult || !queryResult.columns || queryResult.columns.length === 0) {
return (
<div className="bg-background rounded-lg p-3 shadow-sm">
2025-10-31 11:02:06 +09:00
<Label className="mb-2 block text-xs font-semibold"> </Label>
<Alert>
<AlertCircle className="h-4 w-4" />
<AlertDescription className="text-xs"> .</AlertDescription>
2025-10-31 11:02:06 +09:00
</Alert>
</div>
);
}
return (
<div className="bg-background rounded-lg p-3 shadow-sm">
<Label className="mb-3 block text-xs font-semibold"> </Label>
<div className="space-y-3">
{/* 자동 새로고침 간격 */}
<div className="space-y-1.5">
<Label htmlFor="refresh-interval" className="text-xs">
</Label>
<Select
value={refreshInterval.toString()}
onValueChange={(value) => onRefreshIntervalChange?.(parseInt(value))}
>
<SelectTrigger id="refresh-interval" className="h-9 text-xs">
<SelectValue placeholder="새로고침 간격 선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="0" className="text-xs">
</SelectItem>
<SelectItem value="5" className="text-xs">
5
</SelectItem>
<SelectItem value="10" className="text-xs">
10
</SelectItem>
<SelectItem value="30" className="text-xs">
30
</SelectItem>
<SelectItem value="60" className="text-xs">
1
</SelectItem>
</SelectContent>
</Select>
<p className="text-muted-foreground text-[10px]"> </p>
</div>
{/* 마커 종류 선택 */}
<div className="space-y-1.5">
<Label htmlFor="marker-type" className="text-xs">
</Label>
<Select value={markerType} onValueChange={(value) => onMarkerTypeChange?.(value)}>
<SelectTrigger id="marker-type" className="h-9 text-xs">
<SelectValue placeholder="마커 종류 선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="circle" className="text-xs">
</SelectItem>
<SelectItem value="arrow" className="text-xs">
</SelectItem>
<SelectItem value="truck" className="text-xs">
</SelectItem>
</SelectContent>
</Select>
<p className="text-muted-foreground text-[10px]"> </p>
</div>
</div>
2025-10-31 11:02:06 +09:00
</div>
);
}