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

Function FeedSheet

packages/shared/src/components/shell/HomeSegments.tsx:48–122  ·  view source on GitHub ↗
({
  feed,
  onClose,
}: {
  feed: OpenFeed | null;
  onClose: () => void;
})

Source from the content-addressed store, hash-verified

46}
47
48const FeedSheet = ({
49 feed,
50 onClose,
51}: {
52 feed: OpenFeed | null;
53 onClose: () => void;
54}): ReactElement => {
55 const { feedName } = useActiveFeedNameContext();
56 const { isSortableFeed } = useFeedName({
57 feedName: feedName as AllFeedPages,
58 });
59 const { sortingEnabled } = useSettingsContext();
60 const [selectedAlgo, setSelectedAlgo] = usePersistentContext(
61 DEFAULT_ALGORITHM_KEY,
62 DEFAULT_ALGORITHM_INDEX,
63 [0, 1],
64 DEFAULT_ALGORITHM_INDEX,
65 );
66 const canSort = sortingEnabled && isSortableFeed;
67
68 return (
69 <RootPortal>
70 <Drawer
71 isOpen={!!feed}
72 onClose={onClose}
73 title={feed?.title}
74 className={{ drawer: 'py-1' }}
75 >
76 {canSort && (
77 <>
78 <h3 className="px-4 pb-1 pt-2 text-text-tertiary typo-footnote">
79 Order
80 </h3>
81 <SheetChoice
82 items={algorithmsList.map((label, index) => ({
83 key: label,
84 label,
85 active: index === selectedAlgo,
86 onClick: () => {
87 setSelectedAlgo(index);
88 onClose();
89 },
90 }))}
91 />
92 </>
93 )}
94 {feed && (
95 <div
96 className={
97 canSort ? 'border-t border-border-subtlest-tertiary' : undefined
98 }
99 >
100 <SheetChoice
101 items={[
102 {
103 key: 'settings',
104 label: (
105 <span className="flex items-center gap-3">

Callers

nothing calls this directly

Calls 5

useActiveFeedNameContextFunction · 0.90
useFeedNameFunction · 0.90
useSettingsContextFunction · 0.90
usePersistentContextFunction · 0.85
onCloseFunction · 0.70

Tested by

no test coverage detected