From e7208dd7d2c8722adbd28b260925ea27f38b9856 Mon Sep 17 00:00:00 2001 From: coolcoala Date: Mon, 21 Jul 2025 01:55:33 +0300 Subject: [PATCH] fixed problem with menu reopening when opening a page in a compressed window --- src/components/layout/sidebar.tsx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/layout/sidebar.tsx b/src/components/layout/sidebar.tsx index af31e79a..cdcd0786 100644 --- a/src/components/layout/sidebar.tsx +++ b/src/components/layout/sidebar.tsx @@ -7,7 +7,7 @@ import { SidebarHeader, SidebarMenu, SidebarMenuButton, - SidebarMenuItem, + SidebarMenuItem, useSidebar, } from "@/components/ui/sidebar" import { t } from 'i18next'; import { cn } from '@root/lib/utils'; @@ -23,6 +23,7 @@ import { } from 'lucide-react'; import { UpdateButton } from "@/components/layout/update-button"; import React from "react"; +import { SheetClose } from '@/components/ui/sheet'; const menuItems = [ { title: 'Home', url: '/home', icon: Home }, @@ -35,6 +36,7 @@ const menuItems = [ ]; export function AppSidebar() { + const { isMobile } = useSidebar(); return ( @@ -51,13 +53,8 @@ export function AppSidebar() { {menuItems.map((item) => { const isActive = location.pathname === item.url; - return ( - - - {t(item.title)} + ) + return ( + + + {isMobile ? ( + + {linkElement} + + ) : ( + linkElement + )} )