bug: use page width for banner

This commit is contained in:
Kieran 2023-01-31 16:07:46 +00:00
parent 08acab4831
commit 14769f8f33
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 132 additions and 131 deletions

View File

@ -2,13 +2,13 @@ import useImgProxy from "Feed/ImgProxy";
import { useEffect, useState } from "react";
export const ProxyImg = (props: any) => {
const { src, ...rest } = props;
const { src, size, ...rest } = props;
const [url, setUrl] = useState<string>();
const { proxy } = useImgProxy();
useEffect(() => {
if (src) {
proxy(src)
proxy(src, size)
.then(a => setUrl(a))
.catch(console.warn);
}

View File

@ -146,7 +146,7 @@ export default function ProfilePage() {
</IconButton>
{showProfileQr && (
<Modal className="qr-modal" onClose={() => setShowProfileQr(false)}>
<QrCode data={`nostr:${hexToBech32("npub", id)}`} link={undefined} className="m10"/>
<QrCode data={`nostr:${hexToBech32("npub", id)}`} link={undefined} className="m10" />
</Modal>
)}
{isMe ? (
@ -191,10 +191,11 @@ export default function ProfilePage() {
return <div className={`tab f-1${tab === v ? " active" : ""}`} key={v} onClick={() => setTab(v)}>{v}</div>
}
const w = window.document.querySelector(".page")?.clientWidth;
return (
<>
<div className="profile flex">
{user?.banner && <ProxyImg alt="banner" className="banner" src={user.banner} />}
{user?.banner && <ProxyImg alt="banner" className="banner" src={user.banner} size={w}/>}
<div className="profile-wrapper flex">
{avatar()}
{userDetails()}