update link
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-06 16:03:46 +03:30
parent 251d18145a
commit 81a786d2a4
4 changed files with 32 additions and 18 deletions
+9 -18
View File
@@ -4,10 +4,6 @@ import { type FC, useEffect } from "react";
// import AvatarImage from '../assets/images/avatar_image.png'
import { Paths } from "@/config/Paths";
import { clx } from "@/helpers/utils";
import {
isCatalogMongoId,
useGetCatalogByIdOrSlug,
} from "@/pages/home/hooks/useHomeData";
import { useSharedStore } from "@/shared/store/sharedStore";
import { Eye, HambergerMenu } from "iconsax-react";
import { useTranslation } from "react-i18next";
@@ -41,24 +37,19 @@ const Header: FC<HeaderProps> = ({
// const location = useLocation();
// const [popoverKey, setPopoverKey] = useState(0);
const { t } = useTranslation("global");
const { setOpenSidebar, openSidebar, hasSubMenu, setSearch } =
useSharedStore();
const {
setOpenSidebar,
openSidebar,
hasSubMenu,
setSearch,
editorCatalogSlug,
} = useSharedStore();
const location = useLocation();
const editorPathPrefix = `${Paths.editor}/`;
const isEditorRoute =
location.pathname.startsWith(editorPathPrefix) &&
location.pathname.length > editorPathPrefix.length;
const editorRouteParam = isEditorRoute
? (location.pathname.slice(editorPathPrefix.length).split("/")[0] ?? "")
: "";
const { data: catalogData } = useGetCatalogByIdOrSlug(
isEditorRoute && editorRouteParam ? editorRouteParam : "",
);
const viewerSlug =
catalogData?.data?.slug ??
(editorRouteParam && !isCatalogMongoId(editorRouteParam)
? editorRouteParam
: "");
const viewerSlug = isEditorRoute ? (editorCatalogSlug ?? "") : "";
// useEffect(() => {
// setPopoverKey((prevKey) => prevKey + 1);
@@ -103,7 +94,7 @@ const Header: FC<HeaderProps> = ({
{isEditorRoute && viewerSlug ? (
<Link
target="_blank"
to={`${Paths.viewer}/${viewerSlug}`}
to={`${Paths.viewerBySlug}/${viewerSlug}`}
className="flex items-center"
aria-label={t("header.open_viewer")}
title={t("header.open_viewer")}