From 49f7bb9937cacf157ac2b64414cc9e0a7ef12056 Mon Sep 17 00:00:00 2001 From: DDD1542 Date: Wed, 11 Mar 2026 21:25:37 +0900 Subject: [PATCH] [agent-pipeline] pipe-20260311122226-4dkx round-1 --- .../v2/config-panels/V2DateConfigPanel.tsx | 314 ++++++++++++------ 1 file changed, 207 insertions(+), 107 deletions(-) diff --git a/frontend/components/v2/config-panels/V2DateConfigPanel.tsx b/frontend/components/v2/config-panels/V2DateConfigPanel.tsx index 8e3e2494..fe785bc2 100644 --- a/frontend/components/v2/config-panels/V2DateConfigPanel.tsx +++ b/frontend/components/v2/config-panels/V2DateConfigPanel.tsx @@ -2,14 +2,70 @@ /** * V2Date 설정 패널 - * 통합 날짜 컴포넌트의 세부 설정을 관리합니다. + * 토스식 단계별 UX: 날짜 타입 카드 선택 -> 표시 설정 -> 고급 설정(접힘) */ -import React from "react"; +import React, { useState, useMemo } from "react"; import { Label } from "@/components/ui/label"; import { Input } from "@/components/ui/input"; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; -import { Checkbox } from "@/components/ui/checkbox"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Switch } from "@/components/ui/switch"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@/components/ui/collapsible"; +import { Calendar, Clock, CalendarClock, Settings, ChevronDown } from "lucide-react"; +import { cn } from "@/lib/utils"; + +// ─── 날짜 타입 카드 정의 ─── +const DATE_TYPE_CARDS = [ + { + value: "date", + icon: Calendar, + title: "날짜", + description: "연/월/일을 선택해요", + }, + { + value: "time", + icon: Clock, + title: "시간", + description: "시/분을 선택해요", + }, + { + value: "datetime", + icon: CalendarClock, + title: "날짜+시간", + description: "날짜와 시간을 함께 선택해요", + }, +] as const; + +// ─── 날짜 타입별 표시 형식 옵션 ─── +const FORMAT_OPTIONS: Record = { + date: [ + { value: "YYYY-MM-DD", label: "YYYY-MM-DD" }, + { value: "YYYY/MM/DD", label: "YYYY/MM/DD" }, + { value: "DD/MM/YYYY", label: "DD/MM/YYYY" }, + { value: "MM/DD/YYYY", label: "MM/DD/YYYY" }, + { value: "YYYY년 MM월 DD일", label: "YYYY년 MM월 DD일" }, + ], + time: [ + { value: "HH:mm", label: "HH:mm" }, + { value: "HH:mm:ss", label: "HH:mm:ss" }, + ], + datetime: [ + { value: "YYYY-MM-DD HH:mm", label: "YYYY-MM-DD HH:mm" }, + { value: "YYYY-MM-DD HH:mm:ss", label: "YYYY-MM-DD HH:mm:ss" }, + { value: "YYYY/MM/DD HH:mm", label: "YYYY/MM/DD HH:mm" }, + { value: "YYYY년 MM월 DD일", label: "YYYY년 MM월 DD일" }, + ], +}; interface V2DateConfigPanelProps { config: Record; @@ -20,139 +76,183 @@ export const V2DateConfigPanel: React.FC = ({ config, onChange, }) => { + const [advancedOpen, setAdvancedOpen] = useState(false); + const updateConfig = (field: string, value: any) => { onChange({ ...config, [field]: value }); }; + const currentDateType = config.dateType || config.type || "date"; + const showTimeOptions = currentDateType === "datetime" || currentDateType === "time"; + + const formatOptions = useMemo(() => { + return FORMAT_OPTIONS[currentDateType] || FORMAT_OPTIONS.date; + }, [currentDateType]); + return ( -
- {/* DATE TYPE 섹션 */} -
-

DATE TYPE

-
- 날짜 타입 -
- -
+
+ {/* ─── 1단계: 날짜 타입 선택 (카드) ─── */} +
+

어떤 날짜 정보를 입력받나요?

+
+ {DATE_TYPE_CARDS.map((card) => { + const Icon = card.icon; + const isSelected = currentDateType === card.value; + return ( + + ); + })}
- {/* PLACEHOLDER 섹션 */} -
-

PLACEHOLDER

-
- 안내 텍스트 -
- updateConfig("placeholder", e.target.value)} - placeholder="날짜 선택" - className="h-7 text-xs" - /> -
-
-
+ {/* ─── 2단계: 표시 설정 ─── */} +
+ 표시 설정 - {/* FORMAT 섹션 */} -
-

FORMAT

표시 형식 -
- -
+
-
- - {/* DATE RANGE 섹션 */} -
-

DATE RANGE

-
-
- - updateConfig("minDate", e.target.value)} - className="h-7 text-xs" - /> -
-
- - updateConfig("maxDate", e.target.value)} - className="h-7 text-xs" - /> -
-
-
- - {/* OPTIONS 섹션 */} -
-

OPTIONS

- 기간 선택 (시작~종료) - 안내 텍스트 + updateConfig("placeholder", e.target.value)} + placeholder="날짜 선택" + className="h-8 w-[180px] text-sm" + /> +
+
+ + {/* ─── 3단계: 옵션 (Switch + 설명) ─── */} +
+
+
+

기간 선택

+

+ 시작일~종료일을 함께 선택할 수 있어요 +

+
+ updateConfig("range", checked)} />
-
- 오늘 버튼 표시 - +
+

오늘 버튼

+

+ 오늘 날짜로 빠르게 이동할 수 있어요 +

+
+ updateConfig("showToday", checked)} />
- {(config.dateType === "datetime" || config.dateType === "time") && ( -
- 초 단위 표시 - +
+

초 단위 표시

+

+ 시:분 외에 초까지 입력할 수 있어요 +

+
+ updateConfig("showSeconds", checked)} />
)}
+ + {/* ─── 4단계: 고급 설정 (기본 접혀있음) ─── */} + + + + + +
+

+ 선택 가능한 날짜 범위를 제한할 수 있어요 +

+ +
+
+ + updateConfig("minDate", e.target.value)} + className="h-8 w-full text-sm" + /> +
+
+ + updateConfig("maxDate", e.target.value)} + className="h-8 w-full text-sm" + /> +
+
+ +

+ 비워두면 제한 없이 모든 날짜를 선택할 수 있어요 +

+
+
+
); };