"use client"; import React, { useState } from "react"; import clsx from "clsx"; import { ServiceTier, ComponentType, type BaseTemplate, type BaseComponent, } from "../../../types/template-system"; // ============================================================================= // Types // ============================================================================= interface ComponentConfig { [componentId: string]: { visible: boolean; settings: Record; }; } interface ThemeConfig { primaryColor: string; secondaryColor: string; accentColor: string; fontFamily: string; borderRadius: number; } interface LayoutConfig { containerWidth: "full" | "contained" | "narrow"; spacing: "compact" | "normal" | "spacious"; headerStyle: "simple" | "standard" | "advanced"; footerStyle: "minimal" | "standard" | "comprehensive"; } interface TemplateConfig { theme: ThemeConfig; layout: LayoutConfig; components: ComponentConfig; globalSettings: { animations: boolean; showBranding: boolean; mobileOptimized: boolean; seoOptimized: boolean; }; } interface TemplateCustomizerProps { template: BaseTemplate; onUpdate: (config: TemplateConfig) => void; tier: ServiceTier; } // ============================================================================= // Default Configuration // ============================================================================= const defaultTemplateConfig: TemplateConfig = { theme: { primaryColor: "#3b82f6", secondaryColor: "#64748b", accentColor: "#f59e0b", fontFamily: "Inter", borderRadius: 8, }, layout: { containerWidth: "contained", spacing: "normal", headerStyle: "standard", footerStyle: "standard", }, components: {}, globalSettings: { animations: true, showBranding: true, mobileOptimized: true, seoOptimized: true, }, }; // ============================================================================= // Color Presets // ============================================================================= const colorPresets = [ { name: "블루", primary: "#3b82f6", secondary: "#64748b", accent: "#f59e0b" }, { name: "그린", primary: "#10b981", secondary: "#6b7280", accent: "#f59e0b" }, { name: "퍼플", primary: "#8b5cf6", secondary: "#6b7280", accent: "#f59e0b" }, { name: "핑크", primary: "#ec4899", secondary: "#6b7280", accent: "#f59e0b" }, ]; // ============================================================================= // Font Options // ============================================================================= const fontOptions = [ { name: "Inter", value: "Inter" }, { name: "Pretendard", value: "Pretendard" }, { name: "Noto Sans KR", value: "Noto Sans KR" }, { name: "맑은 고딕", value: "Malgun Gothic" }, ]; // ============================================================================= // Main Component // ============================================================================= export function TemplateCustomizer({ template, onUpdate, tier, }: TemplateCustomizerProps) { const [templateConfig, setTemplateConfig] = useState( defaultTemplateConfig ); const [activeTab, setActiveTab] = useState("theme"); const updateComponentSettings = ( componentId: string, settings: Record ) => { const newConfig = { ...templateConfig, components: { ...templateConfig.components, [componentId]: { ...templateConfig.components[componentId], settings, }, }, }; setTemplateConfig(newConfig); onUpdate(newConfig); }; const updateTheme = (themeUpdates: Partial) => { const newConfig = { ...templateConfig, theme: { ...templateConfig.theme, ...themeUpdates, }, }; setTemplateConfig(newConfig); onUpdate(newConfig); }; const updateLayout = (layoutUpdates: Partial) => { const newConfig = { ...templateConfig, layout: { ...templateConfig.layout, ...layoutUpdates, }, }; setTemplateConfig(newConfig); onUpdate(newConfig); }; const updateGlobalSettings = ( globalUpdates: Partial ) => { const newConfig = { ...templateConfig, globalSettings: { ...templateConfig.globalSettings, ...globalUpdates, }, }; setTemplateConfig(newConfig); onUpdate(newConfig); }; const tabs = [ { id: "theme", label: "테마 설정", icon: "🎨" }, { id: "layout", label: "레이아웃", icon: "📐" }, { id: "components", label: "컴포넌트", icon: "🧩" }, { id: "global", label: "전역 설정", icon: "⚙️" }, ]; return (
{/* Header */}

템플릿 커스터마이징

{tier} 티어 - {template.name}

{/* Tabs */}
{/* Content */}
{/* Theme Settings */} {activeTab === "theme" && (

색상 설정

{/* Color Presets */}
{colorPresets.map((preset) => ( ))}
{/* Custom Colors */}
updateTheme({ primaryColor: e.target.value }) } className="w-full h-10 border border-gray-300 rounded-md" />
updateTheme({ secondaryColor: e.target.value }) } className="w-full h-10 border border-gray-300 rounded-md" />
updateTheme({ accentColor: e.target.value }) } className="w-full h-10 border border-gray-300 rounded-md" />
{/* Typography */}

타이포그래피

updateTheme({ borderRadius: parseInt(e.target.value) }) } className="w-full" />
{templateConfig.theme.borderRadius}px
)} {/* Layout Settings */} {activeTab === "layout" && (

레이아웃 설정

)} {/* Component Settings */} {activeTab === "components" && (

컴포넌트 관리

{template.components.map((component) => (
{component.title}

{component.description}

))}
)} {/* Global Settings */} {activeTab === "global" && (

전역 설정

애니메이션 효과

페이지 로딩과 스크롤 시 애니메이션 효과

updateGlobalSettings({ animations: e.target.checked }) } className="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500" />

AgentC 브랜딩 표시

사이트 하단에 “Powered by AgentC” 표시

updateGlobalSettings({ showBranding: e.target.checked }) } className="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500" disabled={tier === ServiceTier.STARTER} />

모바일 최적화

모바일 디바이스에 최적화된 레이아웃

updateGlobalSettings({ mobileOptimized: e.target.checked, }) } className="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500" />

SEO 최적화

검색엔진 최적화를 위한 메타 태그 및 구조화된 데이터

updateGlobalSettings({ seoOptimized: e.target.checked }) } className="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500" />
{tier === ServiceTier.PLUS && (

Plus 티어 전용 기능

• 화이트라벨링 (AgentC 브랜딩 제거)
• 고급 SEO 도구
• 무제한 커스터마이징
• 우선 고객 지원
)}
)}
{/* Footer */}
변경사항은 실시간으로 미리보기에 반영됩니다.
); }