diff --git a/src/components/TagMenu/index.tsx b/src/components/TagMenu/index.tsx index c9ced9a54c..6af3370186 100644 --- a/src/components/TagMenu/index.tsx +++ b/src/components/TagMenu/index.tsx @@ -23,6 +23,16 @@ import { import {Loader} from '#/components/Loader' import {isInvalidHandle} from '#/lib/strings/handles' +type TagMenuProps = { + control: Dialog.DialogOuterProps['control'] + /** + * This should be the sanitized tag value from the facet itself, not the + * "display" value with a leading `#`. + */ + tag: string + authorHandle?: string +} + export function useTagMenuControl() { return Dialog.useDialogControl() } @@ -32,15 +42,20 @@ export function TagMenu({ control, tag, authorHandle, -}: React.PropsWithChildren<{ - control: Dialog.DialogOuterProps['control'] - /** - * This should be the sanitized tag value from the facet itself, not the - * "display" value with a leading `#`. - */ - tag: string - authorHandle?: string -}>) { +}: React.PropsWithChildren) { + return ( + <> + {children} + + + + + + + ) +} + +function TagMenuInner({control, tag, authorHandle}: TagMenuProps) { const {_} = useLingui() const t = useTheme() const navigation = useNavigation() @@ -69,36 +84,86 @@ export function TagMenu({ ) return ( - <> - {children} + + {isPreferencesLoading ? ( + + + + ) : ( + <> + + { + e.preventDefault() - - + control.close(() => { + navigation.push('Hashtag', { + tag: tag.replaceAll('#', '%23'), + }) + }) - - {isPreferencesLoading ? ( - - - - ) : ( - <> + return false + }}> + + + + See{' '} + + {displayTag} + {' '} + posts + + + + + + {authorHandle && !isInvalidHandle(authorHandle) && ( + <> + + { e.preventDefault() control.close(() => { navigation.push('Hashtag', { tag: tag.replaceAll('#', '%23'), + author: authorHandle, }) }) @@ -114,7 +179,7 @@ export function TagMenu({ a.px_lg, a.py_md, ]}> - + {displayTag} {' '} - posts + posts by this user + + )} - {authorHandle && !isInvalidHandle(authorHandle) && ( - <> - + {preferences ? ( + <> + - { - e.preventDefault() - - control.close(() => { - navigation.push('Hashtag', { - tag: tag.replaceAll('#', '%23'), - author: authorHandle, - }) + - - ) : null} - + }) + }}> + + + + {isMuted ? _(msg`Unmute`) : _(msg`Mute`)}{' '} + + {displayTag} + {' '} + posts + + + + + ) : null} + - - - )} - - - + + + )} + ) }