diff --git a/app/components/desktop/DesktopHeader.tsx b/app/components/desktop/DesktopHeader.tsx index d516b5d..b2b0cc7 100644 --- a/app/components/desktop/DesktopHeader.tsx +++ b/app/components/desktop/DesktopHeader.tsx @@ -3,6 +3,7 @@ import { useState, useRef, useEffect, type FormEvent } from "react"; import { Search, Heart, ShoppingBag, User, Store } from "lucide-react"; import { useRootData } from "~/hooks/use-root-data"; import { useCartCount } from "~/requestHandler/use-cart-hooks"; +import { useMyStores } from "~/requestHandler/use-seller-hooks"; import { useSearchAutocomplete } from "~/requestHandler/use-search-hooks"; import { useDebounce } from "~/hooks/useDebounce"; import { SunMoonToggle } from "~/components/SunMoonToggle"; @@ -25,6 +26,12 @@ const DesktopHeader = () => { const navigate = useNavigate(); const { user, theme } = useRootData(); const cartCount = useCartCount(); + const { data: myStores } = useMyStores(); + // Mirror the mobile "ورود به فروشگاه من" flow: prefer a store the user owns, + // fall back to the first store they staff. If they don't manage any store, + // the CTA is hidden. + const targetStore = + myStores?.find((s) => s.role === "owner") ?? myStores?.[0]; const [q, setQ] = useState(""); const [open, setOpen] = useState(false); const searchRef = useRef(null); @@ -181,6 +188,17 @@ const DesktopHeader = () => { {isLoggedIn ? ( <> + {targetStore ? ( + + + فروشگاه من + + ) : null}