"use client"; import { deleteCommissionExtra } from "@/actions/commissions/types/extras"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Pencil, Plus, Trash2 } from "lucide-react"; import * as React from "react"; import { toast } from "sonner"; import { ExtraDialog } from "./ExtraDialog"; type Item = { id: string; name: string; description: string | null; }; export function ExtraListClient({ extras }: { extras: Item[] }) { const [busyId, setBusyId] = React.useState(null); async function onDelete(id: string) { try { setBusyId(id); await deleteCommissionExtra(id); toast.success("Extra deleted."); } catch (e) { console.error(e); toast.error("Failed to delete extra."); } finally { setBusyId(null); } } return (

Extras

New extra } />
All extras {extras.length === 0 ? (
No extras yet.
) : (
    {extras.map((o) => (
  • {o.name}
    {o.description ? (
    {o.description}
    ) : null}
    Edit } />
  • ))}
)}
); }