From 23b45961aa078a152d27de8285149003c704d180 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Thu, 5 Oct 2023 15:08:25 +0300 Subject: [PATCH] click to open profile photo on profile page --- packages/app/src/Element/User/Avatar.tsx | 5 +++-- packages/app/src/Pages/ProfilePage.tsx | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/app/src/Element/User/Avatar.tsx b/packages/app/src/Element/User/Avatar.tsx index 49b91e3e1..2fd201fe4 100644 --- a/packages/app/src/Element/User/Avatar.tsx +++ b/packages/app/src/Element/User/Avatar.tsx @@ -15,9 +15,10 @@ interface AvatarProps { image?: string; imageOverlay?: ReactNode; icons?: ReactNode; + className?: string; } -const Avatar = ({ pubkey, user, size, onClick, image, imageOverlay, icons }: AvatarProps) => { +const Avatar = ({ pubkey, user, size, onClick, image, imageOverlay, icons, className }: AvatarProps) => { const [url, setUrl] = useState(""); const { proxy } = useImgProxy(); @@ -43,7 +44,7 @@ const Avatar = ({ pubkey, user, size, onClick, image, imageOverlay, icons }: Ava
{icons &&
{icons}
} diff --git a/packages/app/src/Pages/ProfilePage.tsx b/packages/app/src/Pages/ProfilePage.tsx index 9d4d44066..fbc4736b4 100644 --- a/packages/app/src/Pages/ProfilePage.tsx +++ b/packages/app/src/Pages/ProfilePage.tsx @@ -58,6 +58,7 @@ import { ZapTarget } from "Zapper"; import { useStatusFeed } from "Feed/StatusFeed"; import messages from "./messages"; +import { SpotlightMediaModal } from "../Element/Deck/SpotlightMedia"; const NOTES = 0; const REACTIONS = 1; @@ -120,6 +121,7 @@ export default function ProfilePage() { const isMe = loginPubKey === id; const [showLnQr, setShowLnQr] = useState(false); const [showProfileQr, setShowProfileQr] = useState(false); + const [showAvatarModal, setShowAvatarModal] = useState(false); const aboutText = user?.about || ""; const npub = !id?.startsWith(NostrPrefix.PublicKey) ? hexToBech32(NostrPrefix.PublicKey, id || undefined) : id; @@ -428,7 +430,12 @@ export default function ProfilePage() { function avatar() { return (
- + user?.picture && setShowAvatarModal(true)} + className="pointer" + />
{renderIcons()} {!isMe && id && } @@ -520,6 +527,9 @@ export default function ProfilePage() {
{tabContent()}
+ {user?.picture && showAvatarModal && ( + setShowAvatarModal(false)} images={[user.picture]} idx={0} /> + )} ); }