From b8e1cc83b9fbdce815a4386e9c0db681e29fa693 Mon Sep 17 00:00:00 2001 From: Bishwajeet Parhi Date: Tue, 27 Aug 2024 19:25:15 +0530 Subject: [PATCH] clicking on image in reaction modal opens up their profile --- .../Chat/Reactions/Modal/ReactionsModal.tsx | 2 + .../src/components/ui/Avatars/Avatar.tsx | 54 ++++++++++++------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/packages/mobile/src/components/Chat/Reactions/Modal/ReactionsModal.tsx b/packages/mobile/src/components/Chat/Reactions/Modal/ReactionsModal.tsx index e7464b14..60f08529 100644 --- a/packages/mobile/src/components/Chat/Reactions/Modal/ReactionsModal.tsx +++ b/packages/mobile/src/components/Chat/Reactions/Modal/ReactionsModal.tsx @@ -11,6 +11,7 @@ import { Avatar, OwnerAvatar } from '../../../ui/Avatars/Avatar'; import { AuthorName } from '../../../ui/Name'; import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types'; import { Backdrop } from '../../../ui/Modal/Backdrop'; +import { openURL } from '../../../../utils/utils'; export const ReactionsModal = memo( forwardRef( @@ -109,6 +110,7 @@ export const ReactionTile = ({ width: 42, height: 42, }} + onPress={() => openURL(`https://${authorOdinId}/`)} /> ) : ( void; imageSize?: { width: number; height: number }; }) => { const { data: contact } = useContact(props.odinId).fetch; @@ -29,11 +39,12 @@ export const Avatar = memo( imageSize={props.imageSize || { width: 48, height: 48 }} fit="contain" lastModified={contact?.fileMetadata.updated} + onClick={props.onPress} /> ); } else { - return ; + return ; } } ); @@ -41,22 +52,25 @@ export const Avatar = memo( export const PublicAvatar = (props: { odinId: string; style?: ImageStyle; + onPress?: () => void; imageSize?: { width: number; height: number }; }) => { const [isSvg, setIsSvg] = useState(false); if (!isSvg) { return ( - { - // console.error('Error loading image', e.nativeEvent.error); - setIsSvg(true); - }} - source={{ uri: `https://${props.odinId}/pub/image` }} - /> + + { + // console.error('Error loading image', e.nativeEvent.error); + setIsSvg(true); + }} + source={{ uri: `https://${props.odinId}/pub/image` }} + /> + ); } else { return ( @@ -71,12 +85,14 @@ export const PublicAvatar = (props: { Platform.OS === 'android' ? props.style : undefined, ]} > - + + + ); }