Files
the-pet-loft/apps/storefront/src/components/layout/header/mobile/MobileHeaderUserAction.tsx
ianshaloom 23efcab80c
Some checks failed
CI / Lint, Typecheck & Test (push) Failing after 2m11s
fix: resolve CI and workspace lint errors (admin + storefront)
- Allow require() in next.config.js (eslint-disable) for both apps
- Replace all catch (e: any) with catch (e: unknown) and proper error handling
- Remove no-explicit-any: add types (PreviewProduct, ProductImage, Id<addresses>,
  ProductDetailReview, error payloads) across admin and storefront
- Admin: use next/image in ImageUploadSection and ProductImageCarousel; remove
  unused layout fonts and sidebar imports; fix products page useMemo deps
- Storefront: use Link for /sign-in in header actions; fix useAddressMutations
  and product detail types; remove unused imports/vars and fix useMemo deps

Made-with: Cursor
2026-03-08 00:45:57 +03:00

72 lines
1.6 KiB
TypeScript

"use client";
import Link from "next/link";
import { useConvexAuth } from "convex/react";
import { UserButton } from "@clerk/nextjs";
function OrdersIcon() {
return (
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z" />
<line x1="3" y1="6" x2="21" y2="6" />
<path d="M16 10a4 4 0 0 1-8 0" />
</svg>
);
}
export function MobileHeaderUserAction() {
const { isLoading, isAuthenticated } = useConvexAuth();
if (isLoading || !isAuthenticated) {
return (
<Link
href="/sign-in"
className="flex h-8 w-8 items-center justify-center rounded-full border border-[#d9e8e7] bg-[#f9fcfb]"
>
<svg
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
className="text-[#3d5554]"
>
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx="12" cy="7" r="4" />
</svg>
</Link>
);
}
return (
<UserButton
afterSignOutUrl="/"
appearance={{
elements: {
avatarBox: "w-8 h-8",
},
}}
>
<UserButton.MenuItems>
<UserButton.Link
label="My Orders"
labelIcon={<OrdersIcon />}
href="/account/orders"
/>
</UserButton.MenuItems>
</UserButton>
);
}