mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-04-30 18:59:37 +00:00
Added Copy Board Feature
This commit is contained in:
parent
b15a0fbac5
commit
993552226b
8 changed files with 125 additions and 17 deletions
|
@ -12,20 +12,37 @@ import {
|
|||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from '@/components/ui/popover';
|
||||
import { copyBoard } from '@/actions/copy-board';
|
||||
|
||||
interface BoardOptionsProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export const BoardOptions = ({ id }: BoardOptionsProps) => {
|
||||
const { execute, isLoading } = useAction(deleteBoard, {
|
||||
onError: (error) => {
|
||||
toast.error(error);
|
||||
},
|
||||
});
|
||||
const { execute: executeDelete, isLoading: isLoadingDelete } = useAction(
|
||||
deleteBoard,
|
||||
{
|
||||
onError: (error) => {
|
||||
toast.error(error);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const { execute: executeCopy, isLoading: isLoadingCopy } = useAction(
|
||||
copyBoard,
|
||||
{
|
||||
onError: (error) => {
|
||||
toast.error(error);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const onDelete = () => {
|
||||
execute({ id });
|
||||
executeDelete({ id });
|
||||
};
|
||||
|
||||
const onCopy = () => {
|
||||
executeCopy({ id });
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -47,10 +64,18 @@ export const BoardOptions = ({ id }: BoardOptionsProps) => {
|
|||
<X className='h-4 w-4' />
|
||||
</Button>
|
||||
</PopoverClose>
|
||||
<Button
|
||||
variant='ghost'
|
||||
onClick={onCopy}
|
||||
disabled={isLoadingCopy}
|
||||
className='h-auto w-full justify-start rounded-none p-2 px-5 text-sm font-normal text-neutral-600'
|
||||
>
|
||||
Copy this board
|
||||
</Button>
|
||||
<Button
|
||||
variant='ghost'
|
||||
onClick={onDelete}
|
||||
disabled={isLoading}
|
||||
disabled={isLoadingDelete}
|
||||
className='h-auto w-full justify-start rounded-none p-2 px-5 text-sm font-normal text-destructive hover:text-destructive'
|
||||
>
|
||||
Delete this board
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue