MCPcopy Create free account
hub / github.com/dailydotdev/apps / ProfileMenu

Function ProfileMenu

packages/shared/src/components/ProfileMenu/ProfileMenu.tsx:39–111  ·  view source on GitHub ↗
({
  onClose,
}: ProfileMenuProps)

Source from the content-addressed store, hash-verified

37}
38
39export default function ProfileMenu({
40 onClose,
41}: ProfileMenuProps): ReactElement | null {
42 const { events } = useRouter();
43 const { user, logout } = useAuthContext();
44 const { showIndicator: showProfileCompletion } =
45 useProfileCompletionIndicator();
46
47 useEffect(() => {
48 events.on('routeChangeStart', onClose);
49
50 return () => {
51 events.off('routeChangeStart', onClose);
52 };
53 }, [events, onClose]);
54
55 if (!user) {
56 return null;
57 }
58
59 return (
60 <InteractivePopup
61 onClose={onClose}
62 closeOutsideClick
63 position={InteractivePopupPosition.ProfileMenu}
64 className="flex max-h-[calc(100vh-4rem)] w-full max-w-80 flex-col gap-3 overflow-y-auto !rounded-10 border border-border-subtlest-tertiary !bg-accent-pepper-subtlest p-3"
65 >
66 {showProfileCompletion && <ProfileCompletion />}
67 <ProfileMenuHeader />
68
69 <UpgradeToPlus
70 target={TargetId.ProfileDropdown}
71 size={ButtonSize.Small}
72 className="flex-initial"
73 />
74
75 <HorizontalSeparator />
76
77 <nav className="flex flex-col gap-2">
78 <MainSection />
79
80 <HorizontalSeparator />
81
82 <ThemeSection className="px-1" />
83
84 <HorizontalSeparator />
85
86 <AccountSection />
87
88 {checkIsExtension() && <ExtensionSection />}
89
90 <HorizontalSeparator />
91
92 <ResourceSection />
93 <FeedbackButtonSection className="px-1" />
94
95 <HorizontalSeparator />
96

Callers

nothing calls this directly

Calls 5

useAuthContextFunction · 0.90
checkIsExtensionFunction · 0.90
useRouterFunction · 0.50
logoutFunction · 0.50

Tested by

no test coverage detected