diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 0e78fcf97f..c9455c5cce 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -75,7 +75,7 @@ export function Outer({ try { cb() } catch (e: any) { - logger.error('Error running close callback', e) + logger.error(e || 'Error running close callback') } } diff --git a/src/components/TagMenu/index.tsx b/src/components/TagMenu/index.tsx index ae9fcdae21..310ecc4c20 100644 --- a/src/components/TagMenu/index.tsx +++ b/src/components/TagMenu/index.tsx @@ -40,9 +40,37 @@ export function TagMenu({ tag: string authorHandle?: string }>) { + const navigation = useNavigation() + return ( + <> + {children} + + + + + + ) +} + +function TagMenuInner({ + control, + tag, + authorHandle, + navigation, +}: { + control: Dialog.DialogOuterProps['control'] + tag: string + authorHandle?: string + // Passed down because on native, we don't use real portals (and context would be wrong). + navigation: NavigationProp +}) { const {_} = useLingui() const t = useTheme() - const navigation = useNavigation() const {isLoading: isPreferencesLoading, data: preferences} = usePreferencesQuery() const { @@ -79,32 +107,75 @@ export function TagMenu({ }, [tag, preferences?.moderationPrefs?.mutedWords]) return ( - <> - {children} - - - - - {isPreferencesLoading ? ( - - - - ) : ( - <> + + {isPreferencesLoading ? ( + + + + ) : ( + <> + + { + control.close(() => { + navigation.push('Hashtag', { + tag: encodeURIComponent(tag), + }) + }) + })}> + + + + See{' '} + + {displayTag} + {' '} + posts + + + + + + {authorHandle && !isInvalidHandle(authorHandle) && ( + <> + + { control.close(() => { navigation.push('Hashtag', { tag: encodeURIComponent(tag), + author: authorHandle, }) }) })}> @@ -118,7 +189,7 @@ export function TagMenu({ a.px_lg, a.py_md, ]}> - + {displayTag} {' '} - posts + posts by this user + + )} - {authorHandle && !isInvalidHandle(authorHandle) && ( - <> - + {preferences ? ( + <> + - { - control.close(() => { - navigation.push('Hashtag', { - tag: encodeURIComponent(tag), - author: authorHandle, - }) - }) - })}> - - - - - See{' '} - - {displayTag} - {' '} - posts by this user - - - - - - )} - - {preferences ? ( - <> - - - - - ) : null} - + }) + }}> + + + + {isMuted ? _(msg`Unmute`) : _(msg`Mute`)}{' '} + + {displayTag} + {' '} + posts + + + + + ) : null} + - - - )} - - - + + + )} + ) }