import { useEffect, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; import { toast } from "sonner"; import { BoardSettingsNav } from "../components/BoardSettingsNav"; import { Button } from "../components/ui/button"; import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "../components/ui/dialog"; import { Input } from "../components/ui/input"; import { Label } from "../components/ui/label"; import { Skeleton } from "../components/ui/skeleton"; import { Switch } from "../components/ui/switch"; import { Textarea } from "../components/ui/textarea"; import { useBoard, useDeleteBoard, useUpdateBoard } from "../hooks/useBoard"; interface BoardSettingsBoard { id: string; name: string; description?: string | null; visibility: "private" | "public"; share_slug: string | null; } const BADGE_TYPES = [ { type: "agents", label: "Agents", alt: "AK agents badge" }, { type: "tasks", label: "Tasks", alt: "AK tasks badge" }, { type: "tokens", label: "Tokens", alt: "AK tokens badge" }, ] as const; type BadgeType = (typeof BADGE_TYPES)[number]["type"]; export function BoardSettingsPage() { const { boardId } = useParams<{ boardId: string }>(); const { board, loading } = useBoard(boardId); if (loading) return ; if (!board || !boardId) return ; return ; } function BoardSettingsContent({ board, boardId }: { board: BoardSettingsBoard; boardId: string }) { return (

{board.name}

Board settings

); } function BoardDetailsSection({ board, boardId }: { board: BoardSettingsBoard; boardId: string }) { const [name, setName] = useState(""); const [description, setDescription] = useState(""); const updateBoard = useUpdateBoard(); useEffect(() => { setName(board.name); setDescription(board.description || ""); }, [board.id]); const hasChanges = name.trim() !== board.name || description.trim() !== (board.description || ""); async function save() { try { await updateBoard.mutateAsync({ id: boardId, name: name.trim(), description: description.trim() }); toast.success("Board settings saved"); } catch { toast.error("Failed to save board settings"); } } return (
setName(event.target.value)} />