test(front end): added in card test but removing

This commit is contained in:
2025-04-13 08:26:03 -05:00
parent b5b57fe3bf
commit 3241cf810a
5 changed files with 192 additions and 13 deletions

View File

@@ -0,0 +1,58 @@
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { useCardStore } from "@/lib/store/useCardStore";
import { toast } from "sonner";
export function AddCards() {
const { cards, addCard } = useCardStore();
const handleAddPPOO = () => {
const existingCard = cards.filter((c) => c.i === "PPOO");
//console.log(existingCard.length);
//console.log(data);
if (existingCard.length != 0) {
toast.error(`PPOO already exists no card will be added`);
return;
}
addCard({
i: "PPOO",
x: 0,
y: 0,
w: 5,
h: 3,
isResizable: true,
isDraggable: true,
});
};
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Add Cards</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Cards</DialogTitle>
<DialogDescription>
Please add a card below.
</DialogDescription>
</DialogHeader>
<Button onClick={handleAddPPOO} className="w-48">
PPOO
</Button>
<DialogFooter>
<Button type="submit">Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}