import { CheckCircle, XCircle, Users } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import ExternalLayout from "./ExternalLayout"; import {RedirectSlug} from "@/types/common"; interface StatusConfig { label: string; sublabel: string; title: string; description: string; Icon: React.ElementType; badgeVariant: "default" | "secondary" | "destructive" | "outline"; iconClassName: string; savedVisible: boolean; } // ─── Status Configs ─────────────────────────────────────────────────────────── const STATUS_MAP: Record = { complete: { label: "설문 완료", sublabel: "Survey Complete", title: "설문에 참여해 주셔서\n감사합니다", description: "귀하의 소중한 의견이 성공적으로 접수되었습니다. 응답 결과는 연구 목적으로만 활용되며, 개인 정보는 철저히 보호됩니다.", Icon: CheckCircle, badgeVariant: "default", iconClassName: "text-primary", savedVisible: true, }, screen: { label: "참여 불가", sublabel: "Screen Out", title: "이번 설문에는\n참여하실 수 없습니다", description: "현재 진행 중인 설문은 특정 조건에 맞는 응답자를 대상으로 합니다. 귀하의 프로필이 이번 조사의 대상과 맞지 않아 참여가 제한되었습니다.", Icon: XCircle, badgeVariant: "outline", iconClassName: "text-muted-foreground", savedVisible: false, }, quota: { label: "할당 초과", sublabel: "Quota Full", title: "모집 인원이\n마감되었습니다", description: "해당 설문의 목표 응답 수가 충족되어 더 이상 참여가 불가합니다. 참여 의사를 가져주신 데 감사드리며, 다른 설문 기회를 기대해 주세요.", Icon: Users, badgeVariant: "outline", iconClassName: "text-muted-foreground", savedVisible: false, }, }; const InfoRow = ({ label, value, mono = false, }: { label: string; value: React.ReactNode; mono?: boolean; }) => { return (
{label} {value}
); } interface RedirectLandingProps { redirectSlug: RedirectSlug; timestamp?: string; } const RedirectLanding = ({ redirectSlug, timestamp, }: RedirectLandingProps) => { const { label, sublabel, title, description, Icon, badgeVariant, iconClassName, savedVisible, } = STATUS_MAP[redirectSlug]; const displayTime = timestamp ?? new Date().toLocaleString("ko-KR", { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", }); return (
{/* 왼쪽: 메시지 */}
{sublabel}

{title}

{description}

{/* 오른쪽: 카드 */}
{/* 상태 카드 */}

최종 상태

{label}

{/* 상세 정보 */} {savedVisible && ( ✓ 저장 완료} /> )}
); } export default RedirectLanding;