import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { useAuth } from "@/lib/hooks/useAuth"; import { useState } from "react"; import { Button } from "./ui/button"; import { LoaderCircle, TrashIcon } from "lucide-react"; import { Board, useBoardsStore } from "@/lib/stores/boards"; import { toast } from "sonner"; import { AtUri } from "@atproto/api"; import { LIST_COLLECTION, LIST_ITEM_COLLECTION } from "@/constants"; import { useBoardItemsStore } from "@/lib/stores/boardItems"; import clsx from "clsx"; import { Progress } from "./ui/progress"; import { redirect } from "next/navigation"; export function DeleteButton({ board, rkey }: { board: Board; rkey: string }) { const { agent } = useAuth(); const [isLoading, setLoading] = useState(false); const [isOpen, setOpen] = useState(false); const [name, setName] = useState(board.name); const [description, setDescription] = useState(board.description); const { setBoard, removeBoard } = useBoardsStore(); const { boardItems } = useBoardItemsStore(); const [progress, setProgress] = useState(0); const [totalItems, setTotalItems] = useState(0); if (agent == null) return
not logged in :(
; return ( { e.stopPropagation(); }} className={clsx("cursor-pointer")} > Delete board? Are you sure you want to delete the board and all items in it? Looked like it was a pretty good board you had going there. {isLoading && (
Deleting items... ({progress}/{totalItems})
)} {!isLoading && ( )} {!isLoading ? ( ) : ( )}
); }