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

Function ForYouSheet

packages/shared/src/components/feeds/ForYouSort.tsx:153–218  ·  view source on GitHub ↗
({
  title,
  sort,
  isOpen,
  onClose,
}: {
  title: ReactNode;
  sort: ForYouSort;
  isOpen: boolean;
  onClose: () => void;
})

Source from the content-addressed store, hash-verified

151 * tab bar.
152 */
153export const ForYouSheet = ({
154 title,
155 sort,
156 isOpen,
157 onClose,
158}: {
159 title: ReactNode;
160 sort: ForYouSort;
161 isOpen: boolean;
162 onClose: () => void;
163}): ReactElement => {
164 const { onClick: openFeedSettings } = useFeedSettingsAction(onClose);
165
166 return (
167 <RootPortal>
168 <Drawer
169 isOpen={isOpen}
170 onClose={onClose}
171 title={title}
172 className={{ drawer: 'py-1' }}
173 >
174 {sort.canSort && (
175 <>
176 <h3 className="px-4 pb-1 pt-3 text-text-tertiary typo-footnote">
177 Sort
178 </h3>
179 <SheetChoice
180 items={algorithms.map(({ text }, index) => ({
181 key: text,
182 label: text,
183 active: sort.selected === index,
184 onClick: () => {
185 sort.onSelect(index);
186 onClose();
187 },
188 }))}
189 />
190 </>
191 )}
192 <div
193 className={classNames(
194 'py-1',
195 sort.canSort && 'border-t border-border-subtlest-tertiary',
196 )}
197 >
198 <FeedExplainSwitch
199 isRow
200 isRecommended={sort.selected === DEFAULT_ALGORITHM_INDEX}
201 />
202 <button
203 type="button"
204 onClick={openFeedSettings}
205 className="flex h-12 w-full items-center gap-3 px-4 text-left text-text-primary transition-colors typo-callout hover:bg-surface-hover"
206 >
207 <FilterIcon size={IconSize.Small} className="text-text-tertiary" />
208 <span className="flex-1">Feed settings</span>
209 <ArrowIcon
210 size={IconSize.Size16}

Callers

nothing calls this directly

Calls 2

useFeedSettingsActionFunction · 0.90
onCloseFunction · 0.50

Tested by

no test coverage detected