From 93140b3cb6140bf3ce036cf8a789a2f19e7eb1aa Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Sat, 11 Apr 2026 12:18:55 +0330 Subject: [PATCH] refactor(Layouts): optimize imports and enhance UserInfo component - Moved the useIsMobile hook import to the correct position in conditional-layout.tsx. - Added type="button" to the ThemeToggleSwitch button for better accessibility. - Introduced truncateString utility in UserInfo component to limit email display length. - Set Image component in UserInfo to unoptimized for performance improvement. --- src/components/Layouts/conditional-layout.tsx | 2 +- src/components/Layouts/header/theme-toggle/index.tsx | 1 + src/components/Layouts/header/user-info/index.tsx | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Layouts/conditional-layout.tsx b/src/components/Layouts/conditional-layout.tsx index 1c0732d..eebb829 100644 --- a/src/components/Layouts/conditional-layout.tsx +++ b/src/components/Layouts/conditional-layout.tsx @@ -1,12 +1,12 @@ "use client"; import { AuthGuard, LoginGuard } from "@/contexts"; +import { useIsMobile } from "@/hooks/use-mobile"; import { usePathname } from "next/navigation"; import type { PropsWithChildren } from "react"; import { Header } from "./header"; import Notification from "./notification"; import { Sidebar } from "./sidebar"; -import { useIsMobile } from "@/hooks/use-mobile"; function MainLayout({ children }: PropsWithChildren) { const isMobile = useIsMobile(); diff --git a/src/components/Layouts/header/theme-toggle/index.tsx b/src/components/Layouts/header/theme-toggle/index.tsx index 84cce11..287bbd2 100644 --- a/src/components/Layouts/header/theme-toggle/index.tsx +++ b/src/components/Layouts/header/theme-toggle/index.tsx @@ -30,6 +30,7 @@ export function ThemeToggleSwitch() {