From 2f8f29bf72c78010c02df55aa7471d2aa3a69451 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sat, 2 May 2026 12:50:25 +0330 Subject: [PATCH] link to viewer --- src/langs/fa.json | 3 ++- src/pages/editor/Editor.tsx | 2 +- src/shared/Header.tsx | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/langs/fa.json b/src/langs/fa.json index a91d5cd..150116d 100644 --- a/src/langs/fa.json +++ b/src/langs/fa.json @@ -5,7 +5,8 @@ "catalog": "کاتالوگ" }, "header": { - "search": "جستجو" + "search": "جستجو", + "open_viewer": "مشاهده در حالت نمایش" }, "view": { "title": "نمایش کاتالوگ", diff --git a/src/pages/editor/Editor.tsx b/src/pages/editor/Editor.tsx index e2f9f00..839a881 100644 --- a/src/pages/editor/Editor.tsx +++ b/src/pages/editor/Editor.tsx @@ -47,7 +47,7 @@ const Editor: FC = () => { isLayersPanelOpen ? "xl:pl-[296px]" : "xl:pl-[80px]" )}> {isSaving ? ( -
+
{/* در حال ذخیره ... */} diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 6b7f03a..d1d4b4f 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -3,9 +3,10 @@ import Input from '@/components/Input' // import { ArrowDown2, CloseCircle, HambergerMenu, Logout, Wallet } from 'iconsax-react' // import AvatarImage from '../assets/images/avatar_image.png' import { useTranslation } from 'react-i18next' -import { useLocation } from 'react-router-dom' +import { Link, useLocation } from 'react-router-dom' +import { Paths } from '@/config/Paths' import { useSharedStore } from '@/shared/store/sharedStore' -import { HambergerMenu } from 'iconsax-react' +import { Eye, HambergerMenu } from 'iconsax-react' import { clx } from '@/helpers/utils' type SidebarSize = 'default' | 'wide' @@ -33,6 +34,13 @@ const Header: FC = ({ hasMainSidebar = true, sidebarSize = 'default const { t } = useTranslation('global') const { setOpenSidebar, openSidebar, hasSubMenu, setSearch } = useSharedStore() const location = useLocation() + const editorPathPrefix = `${Paths.editor}/` + const isEditorRoute = + location.pathname.startsWith(editorPathPrefix) && + location.pathname.length > editorPathPrefix.length + const editorDocumentId = isEditorRoute + ? (location.pathname.slice(editorPathPrefix.length).split('/')[0] ?? '') + : '' // useEffect(() => { // setPopoverKey((prevKey) => prevKey + 1); @@ -71,6 +79,17 @@ const Header: FC = ({ hasMainSidebar = true, sidebarSize = 'default
{/* */}
+ {isEditorRoute && editorDocumentId ? ( + + + + ) : null} + {/* */}