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

Function useTopReaderModal

packages/shared/src/hooks/modals/useTopReaderModal.ts:7–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { Origin } from '../../lib/log';
6
7export const useTopReaderModal = (): void => {
8 const { query, replace } = useRouter();
9 const { openModal } = useLazyModal();
10
11 useEffect(() => {
12 if (!query || !query.topreader || !query.badgeId) {
13 return;
14 }
15
16 openModal({
17 type: LazyModal.TopReaderBadge,
18 props: {
19 badgeId: query.badgeId as string,
20 origin: Origin.NotificationsPage,
21 onAfterClose: () => {
22 const { origin, pathname } = window.location;
23 replace(origin + pathname);
24 },
25 },
26 });
27 }, [openModal, query, replace]);
28};

Callers 2

NotificationsFeedFunction · 0.90
NotificationsLegacyFunction · 0.90

Calls 3

useLazyModalFunction · 0.90
replaceFunction · 0.85
useRouterFunction · 0.50

Tested by

no test coverage detected