"use client"; import { useState, useEffect } from "react"; import { useSearchParams, useRouter } from "next/navigation"; import { ArrowLeft, Star, CheckCircle, AlertCircle } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Textarea } from "@/components/ui/textarea"; import { fetchAppraisal, submitAppraisal } from "@/lib/supabase/appraisal-actions"; import PageSkeleton from "./PageSkeleton"; // ── Star Rating Component ────────────────────────────────────── function StarRating({ value, onChange, readonly = false, size = "md", }: { value: number; onChange?: (v: number) => void; readonly?: boolean; size?: "sm" | "md" | "lg"; }) { const [hover, setHover] = useState(0); const sizeClass = size === "lg" ? "w-7 h-7" : size === "md" ? "w-5 h-5" : "w-4 h-4"; return (
{[1, 2, 3, 4, 5].map((s) => ( ))}
); } // ── Question Renderer ────────────────────────────────────────── function RatingQuestion({ question, value, onChange, readonly, }: { question: string; value: number; onChange: (v: number) => void; readonly: boolean; }) { return (

{question}

); } function TextQuestion({ question, value, onChange, readonly, }: { question: string; value: string; onChange: (v: string) => void; readonly: boolean; }) { return (

{question}