"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Plus, ArrowLeft, ArrowRight, Circle } from "lucide-react"; import ScreenList from "@/components/screen/ScreenList"; import ScreenDesigner from "@/components/screen/ScreenDesigner"; import TemplateManager from "@/components/screen/TemplateManager"; import { ScreenDefinition } from "@/types/screen"; // 단계별 진행을 위한 타입 정의 type Step = "list" | "design" | "template"; export default function ScreenManagementPage() { const [currentStep, setCurrentStep] = useState("list"); const [selectedScreen, setSelectedScreen] = useState(null); const [stepHistory, setStepHistory] = useState(["list"]); // 단계별 제목과 설명 const stepConfig = { list: { title: "화면 목록 관리", description: "생성된 화면들을 확인하고 관리하세요", icon: "📋", }, design: { title: "화면 설계", description: "드래그앤드롭으로 화면을 설계하세요", icon: "🎨", }, template: { title: "템플릿 관리", description: "화면 템플릿을 관리하고 재사용하세요", icon: "📝", }, }; // 다음 단계로 이동 const goToNextStep = (nextStep: Step) => { setStepHistory((prev) => [...prev, nextStep]); setCurrentStep(nextStep); }; // 이전 단계로 이동 const goToPreviousStep = () => { if (stepHistory.length > 1) { const newHistory = stepHistory.slice(0, -1); const previousStep = newHistory[newHistory.length - 1]; setStepHistory(newHistory); setCurrentStep(previousStep); } }; // 특정 단계로 이동 const goToStep = (step: Step) => { setCurrentStep(step); // 해당 단계까지의 히스토리만 유지 const stepIndex = stepHistory.findIndex((s) => s === step); if (stepIndex !== -1) { setStepHistory(stepHistory.slice(0, stepIndex + 1)); } }; // 현재 단계가 마지막 단계인지 확인 const isLastStep = currentStep === "template"; return (
{/* 페이지 제목 */}

화면 관리

화면을 설계하고 템플릿을 관리합니다

{/* 단계별 내용 */}
{/* 화면 목록 단계 */} {currentStep === "list" && (

{stepConfig.list.title}

{ setSelectedScreen(screen); goToNextStep("design"); }} />
)} {/* 화면 설계 단계 */} {currentStep === "design" && (

{stepConfig.design.title}

goToStep("list")} />
)} {/* 템플릿 관리 단계 */} {currentStep === "template" && (

{stepConfig.template.title}

goToStep("list")} />
)}
); }