From 030a8833271d6944e198e4a380d5da7cd4448a41 Mon Sep 17 00:00:00 2001 From: Arda Samadi Date: Tue, 16 Jun 2026 13:59:34 +0330 Subject: [PATCH] Desktop header: login/profile state + theme toggle; hide about/faq header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - header shows "ورود / ثبت نام" when logged out (no profile/cart/bookmark icons, so the profile tab isn't reachable) and the avatar + cart + bookmarks when logged in - add the light/dark SunMoonToggle to the desktop header - about/faq: hide their mobile HeaderWithSupport at lg (content already width-constrained) --- app/components/desktop/DesktopHeader.tsx | 81 ++++++++++++++---------- app/routes/profile.about.tsx | 14 ++-- app/routes/profile.faq.tsx | 12 ++-- 3 files changed, 63 insertions(+), 44 deletions(-) diff --git a/app/components/desktop/DesktopHeader.tsx b/app/components/desktop/DesktopHeader.tsx index c59a48d..3045309 100644 --- a/app/components/desktop/DesktopHeader.tsx +++ b/app/components/desktop/DesktopHeader.tsx @@ -3,6 +3,7 @@ import { useState, type FormEvent } from "react"; import { Search, Heart, ShoppingBag, User } from "lucide-react"; import { useRootData } from "~/hooks/use-root-data"; import { useCartCount } from "~/requestHandler/use-cart-hooks"; +import { SunMoonToggle } from "~/components/SunMoonToggle"; import logo from "~/assets/logo/SVG-07.svg"; const NAV = [ @@ -19,9 +20,10 @@ const NAV = [ const DesktopHeader = () => { const location = useLocation(); const navigate = useNavigate(); - const { user } = useRootData(); + const { user, theme } = useRootData(); const cartCount = useCartCount(); const [q, setQ] = useState(""); + const isLoggedIn = !!user?.access_token; const isActive = (to: string) => to === "/" ? location.pathname === "/" : location.pathname.startsWith(to); @@ -74,38 +76,51 @@ const DesktopHeader = () => { /> -
- - - - - {cartCount > 0 && user?.access_token ? ( - - {cartCount} - - ) : null} - - - - - - - +
+ + {isLoggedIn ? ( + <> + + + + + {cartCount > 0 ? ( + + {cartCount} + + ) : null} + + + + + + + + + ) : ( + + ورود / ثبت نام + + )}
diff --git a/app/routes/profile.about.tsx b/app/routes/profile.about.tsx index 135dcd1..a00838b 100644 --- a/app/routes/profile.about.tsx +++ b/app/routes/profile.about.tsx @@ -47,12 +47,14 @@ export default function AboutPage() { return (
- {/* Header */} - safeGoBack(navigate)} - /> + {/* Header (mobile) */} +
+ safeGoBack(navigate)} + /> +
{/* Content */}
{/* Logo Section */} diff --git a/app/routes/profile.faq.tsx b/app/routes/profile.faq.tsx index d4fab93..8af14d1 100644 --- a/app/routes/profile.faq.tsx +++ b/app/routes/profile.faq.tsx @@ -135,11 +135,13 @@ export default function FAQ() { return (
- safeGoBack(navigate)} - /> +
+ safeGoBack(navigate)} + /> +

سوالات متداول