diff --git a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx index af87e7e..2234674 100644 --- a/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx +++ b/apps/infoalloggi/src/components/area-riservata/userViewHeader.tsx @@ -1,7 +1,9 @@ import { format } from "date-fns"; import { + ChevronDown, CloudSync, ExternalLink, + type LucideIcon, Mail, MessagesSquare, NotebookPen, @@ -26,7 +28,10 @@ import { DialogTrigger, } from "~/components/ui/dialog"; import { Textarea } from "~/components/ui/textarea"; +import { useMediaQuery } from "~/hooks/use-media-query"; import { useUserViewContext } from "~/lib/userViewContext"; +import { cn } from "~/lib/utils"; + import { api } from "~/utils/api"; import { Confirm } from "../confirm"; import { WhatsAppIcon2 } from "../svgs"; @@ -55,121 +60,161 @@ export const UserViewHeader = () => { }); }, }); + const isDesktop = useMediaQuery("(min-width: 640px)"); + + const links: { label: string; slug: string; icon: LucideIcon }[] = [ + { + label: "Profilo", + slug: "edit-user", + icon: UserCog, + }, + { + label: "Ricerca", + slug: "ricerca", + icon: Search, + }, + { + label: "Comunicazioni", + slug: "comunicazioni", + icon: Mail, + }, + { + label: "Ordini", + slug: "ordini", + icon: ShoppingBag, + }, + { + label: "Allegati", + slug: "allegati", + icon: Paperclip, + }, + ]; + useEffect(() => { + setUtilOpen(isDesktop); + setNavOpen(isDesktop); + }, [isDesktop]); + const [utilOpen, setUtilOpen] = useState(isDesktop); + const [navOpen, setNavOpen] = useState(isDesktop); + if (!data) return
Errore
; return ( -
-
-
{data.username}
- - - - - {data.codice_fiscale ? ( - - ) : ( - - )} - { - await sendInvite({ id: data.id }); - }} - title="Vuoi mandare l'email di invito al sito?" - > - - - - -
-
- - - - - - - - - - - - - - - - - - - - +
+
{data.username}
+
+
+ + {utilOpen && ( +
+ + + + {data.codice_fiscale ? ( + + ) : ( + + )} + { + await sendInvite({ id: data.id }); + }} + title="Vuoi mandare l'email di invito al sito?" + > + + + + +
+ )} + + {navOpen && ( +
+ {links.map((link) => ( + + + + ))} + + + + + + +
+ )} +
);