From d60f6842a113873e7bbb7295cd9e3056cfa4e73c Mon Sep 17 00:00:00 2001 From: Guilherme Baufaker Date: Wed, 24 Apr 2024 11:11:46 -0300 Subject: [PATCH] fixed fresh component --- components/header/Drawers.tsx | 21 ++++++++++++--------- sections/Layout/Flex.tsx | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/components/header/Drawers.tsx b/components/header/Drawers.tsx index fae3021..0f699ab 100644 --- a/components/header/Drawers.tsx +++ b/components/header/Drawers.tsx @@ -10,6 +10,7 @@ import type { ComponentChildren } from "preact"; import { lazy, Suspense } from "preact/compat"; import type { Logo } from "./Header.tsx"; import Image from "apps/website/components/Image.tsx"; +import { IS_BROWSER } from "$fresh/runtime.ts"; const Menu = lazy(() => import("../../components/header/Menu.tsx")); const Searchbar = lazy(() => import("../../components/search/Searchbar.tsx")); @@ -68,15 +69,17 @@ function Drawers({ menu, searchbar, children, platform }: Props) { const { displayCart, displayMenu, displaySearchDrawer, user } = useUI(); //if user is not loggedin, use the public navitems in the menu - if (localStorage.getItem("AccessToken") == "") { - menu.items = menu.publicItems || []; - } else if (localStorage.getItem("AssociationAdmin")) { - if (!menu.items.find((i) => i.name === "Admin Associação")) { - menu.items[menu.items.length] = { - "@type": "SiteNavigationElement", - name: "Admin Associação", - url: "/admin/associacao", - }; + if (IS_BROWSER) { + if (localStorage.getItem("AccessToken") == "") { + menu.items = menu.publicItems || []; + } else if (localStorage.getItem("AssociationAdmin")) { + if (!menu.items.find((i) => i.name === "Admin Associação")) { + menu.items[menu.items.length] = { + "@type": "SiteNavigationElement", + name: "Admin Associação", + url: "/admin/associacao", + }; + } } } diff --git a/sections/Layout/Flex.tsx b/sections/Layout/Flex.tsx index cbe284d..ce78fab 100644 --- a/sections/Layout/Flex.tsx +++ b/sections/Layout/Flex.tsx @@ -1,5 +1,5 @@ import { clx } from "../../sdk/clx.ts"; -import { Section } from "deco/blocks/section.ts"; +import type { Section } from "deco/blocks/section.ts"; import type { ComponentChildren } from "preact"; import { flex } from "../../constants.tsx";