Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shared/chat/conversation/bot/install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const blankCommands: Array<T.RPCChat.ConversationCommand> = []

const InstallBotPopup = (props: Props) => {
const {botUsername, conversationIDKey} = props

// state
const [installScreen, setInstallScreen] = React.useState(false)
const [channelPickerScreen, setChannelPickerScreen] = React.useState(false)
Expand Down Expand Up @@ -201,6 +200,7 @@ const InstallBotPopup = (props: Props) => {
botAlias={featured.botAlias}
horizontal={true}
metaOne={featured.description}
onClick="profile"
username={botUsername}
size="big"
/>
Expand Down Expand Up @@ -228,7 +228,7 @@ const InstallBotPopup = (props: Props) => {
)
const usernameContent = !featured && (
<Kb.Box2 direction="vertical" gap="small" style={styles.container} fullWidth={true}>
<Kb.NameWithIcon horizontal={true} username={botUsername} size="big" />
<Kb.NameWithIcon horizontal={true} onClick="profile" username={botUsername} size="big" />
{inTeam && isBot && !inTeamUnrestricted && (
<PermsList
channelMetas={channelMetas}
Expand Down
38 changes: 25 additions & 13 deletions shared/chat/conversation/messages/reaction-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ReactButton from './react-button'
import type * as T from '@/constants/types'
import {MessageContext} from './ids-context'
import {useUsersState} from '@/constants/users'
import {useProfileState} from '@/constants/profile'

const positionFallbacks = ['bottom center', 'left center'] as const

Expand Down Expand Up @@ -73,6 +74,30 @@ const ReactionTooltip = (p: OwnProps) => {
() => ({canFixOverdraw: false, isHighlighted: false, ordinal}),
[ordinal]
)
const showUserProfile = useProfileState(s => s.dispatch.showUserProfile)
const onClickUser = React.useCallback(
(username: string) => {
onHidden()
showUserProfile(username)
},
[onHidden, showUserProfile]
)
const renderItem = React.useCallback(
({item}: {item: ListItem}) => (
<Kb.NameWithIcon
colorFollowing={true}
containerStyle={styles.userContainer}
horizontal={true}
metaOne={item.fullName}
onClick={onClickUser}
clickType="onClick"
withProfileCardPopup={false}
username={item.username}
/>
),
[onClickUser]
)

if (!visible) {
return null
}
Expand Down Expand Up @@ -144,19 +169,6 @@ type ListItem = {
username: string
}

const renderItem = ({item}: {item: ListItem}) => {
return (
<Kb.NameWithIcon
key={item.key}
colorFollowing={true}
containerStyle={styles.userContainer}
horizontal={true}
metaOne={item.fullName}
username={item.username}
/>
)
}

const renderSectionHeader = ({
section,
}: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const CoinFlipParticipants = (props: Props) => {
colorFollowing={true}
key={`${p.username}${p.deviceName}`}
horizontal={true}
onClick="profile"
withProfileCardPopup={false}
username={p.username}
metaOne={p.deviceName}
containerStyle={styles.participants}
Expand Down
11 changes: 6 additions & 5 deletions shared/common-adapters/floating-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import {useSafeAreaInsets} from '@/common-adapters/safe-area-view'
import {FloatingModalContext} from './context'
import {FullWindowOverlay} from 'react-native-screens'
import {useNavigation, type NavigationProp, type ParamListBase} from '@react-navigation/native'
import {NavigationContext} from '@react-navigation/core'

const Kb = {
Box2,
Expand Down Expand Up @@ -61,10 +61,11 @@ const FullWindow = ({children}: {children?: React.ReactNode}): React.ReactNode =

const defaultSnapPoints = ['75%']

type SafeNavigationHook = <T extends NavigationProp<ParamListBase>>() => T | null

const useSafeNavigation: SafeNavigationHook = Styles.isMobile
? (useNavigation as SafeNavigationHook)
// useNavigation() throws when called outside a navigator (e.g. inside a gorhom
// portal rendered at popup-root, which is a sibling to the router). Using the
// context directly returns undefined instead of throwing.
const useSafeNavigation = Styles.isMobile
? () => React.useContext(NavigationContext) ?? null
: () => null

const FloatingMenu = React.memo(function FloatingMenu(props: Props) {
Expand Down