Compare commits
No commits in common. "a4846621fbf4f260109bc3fbd2866ee27c143277" and "6d05517c2576af0e0294f8b17a4cafe41b203eb5" have entirely different histories.
a4846621fb
...
6d05517c25
1 changed files with 1 additions and 22 deletions
|
|
@ -10,8 +10,6 @@ import {
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import CanvasContext from "../Context/canvasContext/CanvasContext";
|
import CanvasContext from "../Context/canvasContext/CanvasContext";
|
||||||
import { useParams } from "react-router-dom";
|
|
||||||
import { useToast } from "@/hooks/use-toast";
|
|
||||||
|
|
||||||
const sidebarItems = [
|
const sidebarItems = [
|
||||||
{ id: "design", icon: Text, label: "Design" },
|
{ id: "design", icon: Text, label: "Design" },
|
||||||
|
|
@ -25,25 +23,6 @@ const sidebarItems = [
|
||||||
|
|
||||||
export function Sidebar() {
|
export function Sidebar() {
|
||||||
const { selectedPanel, setSelectedPanel } = useContext(CanvasContext);
|
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 (
|
return (
|
||||||
<div className="w-full xl:w-20 lg:w-20 md:w-20 sm:w-20 border-r bg-background flex xl:flex-col lg:flex-col md:flex-col sm:flex-col items-center justify-center py-4 gap-6 md:pt-16 xl:pt-0 h-full overflow-x-scroll">
|
<div className="w-full xl:w-20 lg:w-20 md:w-20 sm:w-20 border-r bg-background flex xl:flex-col lg:flex-col md:flex-col sm:flex-col items-center justify-center py-4 gap-6 md:pt-16 xl:pt-0 h-full overflow-x-scroll">
|
||||||
{sidebarItems.map((item) => {
|
{sidebarItems.map((item) => {
|
||||||
|
|
@ -52,7 +31,7 @@ export function Sidebar() {
|
||||||
<button
|
<button
|
||||||
key={item.id}
|
key={item.id}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSelectedPanel(item.id);
|
setSelectedPanel(item.id);
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-col items-center gap-1 p-2 rounded-lg w-16 hover:bg-accent",
|
"flex flex-col items-center gap-1 p-2 rounded-lg w-16 hover:bg-accent",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue