diff --git a/pkg/interface/src/views/components/ProfileOverlay.tsx b/pkg/interface/src/views/components/ProfileOverlay.tsx index 6ff25d4ef4..9130affa85 100644 --- a/pkg/interface/src/views/components/ProfileOverlay.tsx +++ b/pkg/interface/src/views/components/ProfileOverlay.tsx @@ -11,7 +11,8 @@ import { Text, BaseImage, ColProps, - Icon + Icon, + Center } from '@tlon/indigo-react'; import RichText from './RichText'; import { ProfileStatus } from './ProfileStatus'; @@ -44,16 +45,19 @@ const ProfileOverlay = (props: ProfileOverlayProps) => { onDismiss, ...rest } = props; - const hideAvatars = useSettingsState(state => state.calm.hideAvatars); - const hideNicknames = useSettingsState(state => state.calm.hideNicknames); + const hideAvatars = useSettingsState((state) => state.calm.hideAvatars); + const hideNicknames = useSettingsState((state) => state.calm.hideNicknames); const popoverRef = useRef(null); - const onDocumentClick = useCallback((event) => { - if (!popoverRef.current || popoverRef?.current?.contains(event.target)) { - return; - } - onDismiss(); - }, [onDismiss, popoverRef]); + const onDocumentClick = useCallback( + (event) => { + if (!popoverRef.current || popoverRef?.current?.contains(event.target)) { + return; + } + onDismiss(); + }, + [onDismiss, popoverRef] + ); useEffect(() => { document.addEventListener('mousedown', onDocumentClick); @@ -62,123 +66,123 @@ const ProfileOverlay = (props: ProfileOverlayProps) => { return () => { document.removeEventListener('mousedown', onDocumentClick); document.removeEventListener('touchstart', onDocumentClick); - } + }; }, [onDocumentClick]); let top, bottom; - if (topSpace < OVERLAY_HEIGHT / 2) { - top = '0px'; - } - if (bottomSpace < OVERLAY_HEIGHT / 2) { - bottom = '0px'; - } - if (!(top || bottom)) { - bottom = `-${Math.round(OVERLAY_HEIGHT / 2)}px`; - } - const containerStyle = { top, bottom, left: '100%' }; + if (topSpace < OVERLAY_HEIGHT / 2) { + top = '0px'; + } + if (bottomSpace < OVERLAY_HEIGHT / 2) { + bottom = '0px'; + } + if (!(top || bottom)) { + bottom = `-${Math.round(OVERLAY_HEIGHT / 2)}px`; + } + const containerStyle = { top, bottom, left: '100%' }; - const isOwn = window.ship === ship; + const isOwn = window.ship === ship; - const img = - contact?.avatar && !hideAvatars ? ( - - ) : ( - - ); - const showNickname = useShowNickname(contact, hideNicknames); - - return ( - - - {!isOwn && ( - history.push(`/~landscape/dm/${ship}`)} - /> - )} - - history.push(`/~profile/~${ship}`)} - overflow='hidden' - borderRadius={2} - > - {img} - - - - - {showNickname ? contact?.nickname : cite(ship)} - - - {isOwn ? ( - - ) : ( - - {contact?.status ? contact.status : ''} - - )} - - + /> + ) : ( + +
+ +
+
); + const showNickname = useShowNickname(contact, hideNicknames); + + return ( + + + {!isOwn && ( + history.push(`/~landscape/dm/${ship}`)} + /> + )} + + history.push(`/~profile/~${ship}`)} + overflow='hidden' + borderRadius={2} + > + {img} + + + + + {showNickname ? contact?.nickname : cite(ship)} + + + {isOwn ? ( + + ) : ( + + {contact?.status ? contact.status : ''} + + )} + + + ); }; -export default ProfileOverlay; \ No newline at end of file +export default ProfileOverlay;