update sidebar
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import Logo from "@/assets/images/logo.svg";
|
||||
import { clx } from "@/helpers/utils";
|
||||
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 { ToolsBar, ObjectSettings, ToolInstructions } from "./sidebar";
|
||||
|
||||
const EditorSidebar = () => {
|
||||
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);
|
||||
|
||||
@@ -15,18 +15,18 @@ const EditorSidebar = () => {
|
||||
setTool(selectedTool);
|
||||
};
|
||||
|
||||
const handleLoadJSON = async () => {
|
||||
try {
|
||||
const response = await fetch('/viewer-data.json');
|
||||
const data = await response.json();
|
||||
if (data.pages && Array.isArray(data.pages)) {
|
||||
loadPages(data.pages);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('خطا در لود JSON:', error);
|
||||
alert('خطا در لود فایل JSON');
|
||||
}
|
||||
};
|
||||
// const handleLoadJSON = async () => {
|
||||
// try {
|
||||
// const response = await fetch('/viewer-data.json');
|
||||
// const data = await response.json();
|
||||
// if (data.pages && Array.isArray(data.pages)) {
|
||||
// loadPages(data.pages);
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('خطا در لود JSON:', error);
|
||||
// alert('خطا در لود فایل JSON');
|
||||
// }
|
||||
// };
|
||||
|
||||
|
||||
return (
|
||||
@@ -43,13 +43,13 @@ const EditorSidebar = () => {
|
||||
<div className="mb-10 flex items-center justify-between">
|
||||
<img src={Logo} alt="لوگو دانک" className="h-9" />
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
{/* <button
|
||||
onClick={handleLoadJSON}
|
||||
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
||||
title="لود JSON"
|
||||
>
|
||||
<DocumentUpload color="black" size={24} />
|
||||
</button>
|
||||
</button> */}
|
||||
<button
|
||||
onClick={() => setOpenSidebar(false)}
|
||||
className="xl:hidden p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
||||
|
||||
Reference in New Issue
Block a user