'use client' import { useState, useEffect } from 'react' import { Button, buttonVariants } from '@/components/ui/button' import { cn } from '@/lib/utils' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog' import { Checkbox } from '@/components/ui/checkbox' import { Label } from '@/components/ui/label' import { Input } from '@/components/ui/input' import { submitOrder, getUserSubmission, getSessionUser } from '@/app/actions' import { PlusCircle, MinusCircle, User, CheckCircle2, ShoppingBag, Sparkles, Users, Eye, } from 'lucide-react' import { OrderFormModal } from '@/components/OrderFormModal' import { ShareButton } from '@/components/ShareButton' import Link from 'next/link' import { format } from 'date-fns' import { id as idLocale } from 'date-fns/locale' export function OrderCard({ order }: { order: any }) { const [open, setOpen] = useState(false) const activeItems = order.available_items.filter((i: any) => !i.is_sold_out) return (
{/* Left: Info */}

{order.title}

{order.description && (

{order.description}

)}
{format(new Date(order.date), 'EEEE, dd MMM yyyy', { locale: idLocale })} ● OPEN
{order.creator.photo ? ( {order.creator.name} ) : (
{order.creator.name.charAt(0).toUpperCase()}
)} {order.creator.name}
{order.submissions.length} Orang Menitip
{/* Middle: Items List */}
Item Tersedia ({activeItems.length}) {order.allow_custom && (
Kustom
)}
    {activeItems.map((item: any) => (
  • {item.name}
  • ))} {activeItems.length === 0 && (
  • {order.allow_custom ? 'Hanya menerima kustom.' : 'Semua item habis.'}
  • )}
{/* Right: Actions */}
Titip Sekarang {open && setOpen(false)} />}
Detail
) }