mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-04-30 18:59:37 +00:00
Initial Commit
This commit is contained in:
commit
f3e2f01bd7
150 changed files with 13612 additions and 0 deletions
|
@ -0,0 +1,61 @@
|
|||
"use client";
|
||||
|
||||
import { MoreHorizontal, X } from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { deleteBoard } from "@/actions/delete-board";
|
||||
import { useAction } from "@/hooks/use-action";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverClose,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
|
||||
interface BoardOptionsProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export const BoardOptions = ({ id }: BoardOptionsProps) => {
|
||||
const { execute, isLoading } = useAction(deleteBoard, {
|
||||
onError: (error) => {
|
||||
toast.error(error);
|
||||
},
|
||||
});
|
||||
|
||||
const onDelete = () => {
|
||||
execute({ id });
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button className="h-auto w-auto p-2" variant="transparent">
|
||||
<MoreHorizontal className="h-4 w-4" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="px-0 pt-3 pb-3" side="bottom" align="start">
|
||||
<div className="text-sm font-medium text-center text-neutral-600 pb-4">
|
||||
Board Actions
|
||||
</div>
|
||||
<PopoverClose asChild>
|
||||
<Button
|
||||
className="h-auto w-auto p-2 absolute top-2 right-2 text-neutral-600"
|
||||
variant="ghost"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</PopoverClose>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={onDelete}
|
||||
disabled={isLoading}
|
||||
className="rounded-none w-full h-auto p-2 px-5 justify-start font-normal text-sm text-destructive hover:text-destructive"
|
||||
>
|
||||
Delete this board
|
||||
</Button>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue