From 877b01f483079cf2af508c784363fcc56d6cce0b Mon Sep 17 00:00:00 2001 From: fazli Date: Tue, 7 Jul 2026 10:57:14 +0000 Subject: [PATCH] =?UTF-8?q?feat(desktop-header):=20surface=20"=D9=88=D8=B1?= =?UTF-8?q?=D9=88=D8=AF=20=D8=A8=D9=87=20=D9=81=D8=B1=D9=88=D8=B4=DA=AF?= =?UTF-8?q?=D8=A7=D9=87=20=D9=85=D9=86"=20CTA=20for=20sellers=20and=20staf?= =?UTF-8?q?f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mobile profile page already has this action, but the desktop chrome had no way for a seller or staff member to jump into a store they manage — they'd have to type the URL. Add a compact "فروشگاه من" pill in the header action row, gated on useMyStores() so it only renders for users who actually manage a store. Selection mirrors the mobile flow: owned first, then the first store they staff. --- app/components/desktop/DesktopHeader.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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}