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

Function useUpvoteQuery

packages/shared/src/hooks/useUpvoteQuery.ts:27–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25};
26
27export const useUpvoteQuery = (): UseUpvoteQuery => {
28 const { modal, openModal } = useLazyModal<LazyModal.UpvotedPopup>();
29 const onShowUpvoted = (
30 id: string,
31 upvotes: number,
32 type: UpvoteType = 'post',
33 ) => {
34 openModal({
35 type: LazyModal.UpvotedPopup,
36 props: {
37 placeholderAmount: upvotes,
38 requestQuery: {
39 queryKey: [KEY_MAP[type], id],
40 query: QUERY_MAP[type],
41 params: { id, first: DEFAULT_UPVOTES_PER_PAGE },
42 },
43 },
44 });
45 };
46
47 return useMemo(
48 () => ({ onShowUpvoted, queryKey: modal?.props?.requestQuery?.queryKey }),
49 // @NOTE see https://dailydotdev.atlassian.net/l/cp/dK9h1zoM
50 // eslint-disable-next-line react-hooks/exhaustive-deps
51 [modal],
52 );
53};

Callers 8

CommentFeedFunction · 0.90
PostEngagementsFunction · 0.90
EngagementRailFunction · 0.90
PostFocusCardFunction · 0.90
DiscussionMetaBarFunction · 0.90
PostDiscussionPanelFunction · 0.90
ActivityRepliesTabFunction · 0.90
CompanionContentFunction · 0.90

Calls 1

useLazyModalFunction · 0.90

Tested by

no test coverage detected