"use client"; import { useEffect, useRef, useState } from "react"; import { useRouter } from "next/navigation"; import Image from "@/components/ui/resilient-image"; import { UserRoundIcon, XIcon } from "lucide-react"; import { ArtifactSelect, CharacterSelect, WeaponSelect } from "@/components/catalog-select"; import { ConstellationSelect, RefinementSelect } from "@/components/admin/ui/option-select"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet } from "@/components/ui/field"; import { Textarea } from "@/components/ui/textarea"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { commissionPrice, hasCustomStats, type CommissionRequest } from "@/lib/commission/request"; import { commissionDraftKey, restoreCommissionDraft, serializeCommissionDraft } from "@/lib/commission/draft"; import { commissionRequestIssues } from "@/lib/commission/request-validation"; import { elementBackgroundColor } from "@/lib/catalog/element"; type Item = { key: string; name: string; aliases: string[]; imageUrl: string; rarity?: number | null; element?: string | null; weaponType?: string | null }; type Catalog = { characters: Item[]; weapons: Item[]; artifacts: Item[] }; const blankMember = (): CommissionRequest["teams"][number]["members"][number] => ({ characterKey: "", weaponKey: "", artifactKey: "", constellation: "0", refinement: "1", }); const blankTeam = () => ({ members: Array.from({ length: 4 }, blankMember) }); function CustomStatsFields({ id, characterName, value, disabled, invalid, onValueChange }: { id: string; characterName: string; value: string | undefined; disabled: boolean; invalid: boolean; onValueChange: (value: string | undefined) => void; }) { return onValueChange(checked ? "" : undefined)} /> Custom stats {value !== undefined && ค่าสเตตัสของ {characterName}