From 9806a21af2065779e8b49ada6a0d430ca26dd3bc Mon Sep 17 00:00:00 2001 From: Saimon8420 Date: Sat, 1 Mar 2025 14:43:59 +0600 Subject: [PATCH 1/2] project delete issue fixed --- src/components/Layouts/LeftSidebar.jsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/Layouts/LeftSidebar.jsx b/src/components/Layouts/LeftSidebar.jsx index 907eb61..ff1854d 100644 --- a/src/components/Layouts/LeftSidebar.jsx +++ b/src/components/Layouts/LeftSidebar.jsx @@ -10,6 +10,8 @@ import { } from "lucide-react"; import { useContext } from "react"; import CanvasContext from "../Context/canvasContext/CanvasContext"; +import { useParams } from "react-router-dom"; +import { useToast } from "@/hooks/use-toast"; const sidebarItems = [ { id: "design", icon: Text, label: "Design" }, @@ -23,6 +25,25 @@ const sidebarItems = [ export function Sidebar() { const { selectedPanel, setSelectedPanel } = useContext(CanvasContext); + + const params = useParams(); + const { id } = params; + + const { toast } = useToast(); + + const handleSelectedPanel = (panelId) => { + if (panelId === "project" && id) { + toast({ + title: "Unsaved Project", + description: "Please save the project first, or delete it. If you don't want to save it.", + variant: "destructive", + }) + } + else { + setSelectedPanel(panelId); + } + } + return (
{sidebarItems.map((item) => { @@ -31,7 +52,7 @@ export function Sidebar() {