update sidebar

This commit is contained in:
hamid zarghami
2026-03-15 11:53:50 +03:30
parent b292370261
commit c6f5999a8f
+16 -16
View File
@@ -1,13 +1,13 @@
import Logo from "@/assets/images/logo.svg"; import Logo from "@/assets/images/logo.svg";
import { clx } from "@/helpers/utils"; import { clx } from "@/helpers/utils";
import { useSharedStore } from "@/shared/store/sharedStore"; import { useSharedStore } from "@/shared/store/sharedStore";
import { CloseSquare, DocumentUpload } from "iconsax-react"; import { CloseSquare } from "iconsax-react";
import { useEditorStore, type ToolType } from "../store/editorStore"; import { useEditorStore, type ToolType } from "../store/editorStore";
import { ToolsBar, ObjectSettings, ToolInstructions } from "./sidebar"; import { ToolsBar, ObjectSettings, ToolInstructions } from "./sidebar";
const EditorSidebar = () => { const EditorSidebar = () => {
const { openSidebar, setOpenSidebar } = useSharedStore(); const { openSidebar, setOpenSidebar } = useSharedStore();
const { tool, setTool, selectedObjectId, objects, updateObject, deleteObject, loadPages } = useEditorStore(); const { tool, setTool, selectedObjectId, objects, updateObject, deleteObject } = useEditorStore();
const selectedObject = objects.find((obj) => obj.id === selectedObjectId); const selectedObject = objects.find((obj) => obj.id === selectedObjectId);
@@ -15,18 +15,18 @@ const EditorSidebar = () => {
setTool(selectedTool); setTool(selectedTool);
}; };
const handleLoadJSON = async () => { // const handleLoadJSON = async () => {
try { // try {
const response = await fetch('/viewer-data.json'); // const response = await fetch('/viewer-data.json');
const data = await response.json(); // const data = await response.json();
if (data.pages && Array.isArray(data.pages)) { // if (data.pages && Array.isArray(data.pages)) {
loadPages(data.pages); // loadPages(data.pages);
} // }
} catch (error) { // } catch (error) {
console.error('خطا در لود JSON:', error); // console.error('خطا در لود JSON:', error);
alert('خطا در لود فایل JSON'); // alert('خطا در لود فایل JSON');
} // }
}; // };
return ( return (
@@ -43,13 +43,13 @@ const EditorSidebar = () => {
<div className="mb-10 flex items-center justify-between"> <div className="mb-10 flex items-center justify-between">
<img src={Logo} alt="لوگو دانک" className="h-9" /> <img src={Logo} alt="لوگو دانک" className="h-9" />
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<button {/* <button
onClick={handleLoadJSON} onClick={handleLoadJSON}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors" className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
title="لود JSON" title="لود JSON"
> >
<DocumentUpload color="black" size={24} /> <DocumentUpload color="black" size={24} />
</button> </button> */}
<button <button
onClick={() => setOpenSidebar(false)} onClick={() => setOpenSidebar(false)}
className="xl:hidden p-2 hover:bg-gray-100 rounded-lg transition-colors" className="xl:hidden p-2 hover:bg-gray-100 rounded-lg transition-colors"