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

Function ProfileMenu

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

Source from the content-addressed store, hash-verified

48const panelBandDivider = '-mx-3';
49
50export default function ProfileMenu({
51 onClose,
52}: ProfileMenuProps): ReactElement | null {
53 const { events } = useRouter();
54 const { user, logout } = useAuthContext();
55 const { showIndicator: showProfileCompletion } =
56 useProfileCompletionIndicator();
57 const { isEligible: isReferralLadderEligible, isCompleted } =
58 useReferralLadder();
59
60 useEffect(() => {
61 events.on('routeChangeStart', onClose);
62
63 return () => {
64 events.off('routeChangeStart', onClose);
65 };
66 }, [events, onClose]);
67
68 if (!user) {
69 return null;
70 }
71
72 return (
73 <InteractivePopup
74 onClose={onClose}
75 closeOutsideClick
76 position={InteractivePopupPosition.ProfileMenu}
77 showCloseButton={!isReferralLadderEligible || isCompleted}
78 className={classNames(
79 'flex max-h-[calc(100vh-4rem)] w-full max-w-80 flex-col overflow-y-auto !rounded-10 border border-border-subtlest-tertiary !bg-accent-pepper-subtlest',
80 panelSpacing,
81 )}
82 >
83 {showProfileCompletion && <ProfileCompletion />}
84 <ProfileMenuHeader
85 showReferralLadderGift
86 shouldOpenProfile
87 showOpenLinkIcon={false}
88 compact
89 className={classNames(
90 panelBand,
91 showProfileCompletion ? panelBandBetween : panelBandOnTop,
92 )}
93 />
94
95 <PlusMenuEntry
96 target={TargetId.ProfileDropdown}
97 size={PlusEntryRowSize.Large}
98 className={classNames(panelBand, panelBandBetween)}
99 />
100
101 <HorizontalSeparator className={panelBandDivider} />
102
103 <nav className="flex flex-col gap-2">
104 <MainSection />
105
106 <HorizontalSeparator />
107

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected