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

Function useFeedContextMenu

packages/shared/src/hooks/feed/useFeedContextMenu.ts:31–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29};
30
31export default function useFeedContextMenu(): FeedContextMenu {
32 const [postMenuLocation, setPostMenuLocation] =
33 useState<PostLocation | null>();
34 const postMenuIndex = postMenuLocation?.index;
35
36 const onMenuClick = (
37 e: React.MouseEvent,
38 index: number,
39 row: number,
40 column: number,
41 ) => {
42 if (postMenuIndex === index) {
43 setPostMenuLocation(null);
44 return;
45 }
46 setPostMenuLocation({ index, row, column });
47 };
48
49 const onShareMenuClick = (
50 e: React.MouseEvent,
51 _post: Post,
52 index: number,
53 row: number,
54 column: number,
55 ) => {
56 if (postMenuIndex === index) {
57 setPostMenuLocation(null);
58 return;
59 }
60 setPostMenuLocation({ index, row, column });
61 };
62
63 return {
64 onMenuClick,
65 onShareMenuClick,
66 postMenuIndex,
67 postMenuLocation,
68 setPostMenuIndex: setPostMenuLocation,
69 };
70}

Callers 1

FeedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected