Show follow counts on profile tabs
This commit is contained in:
parent
07fc595f46
commit
6f3107659e
@ -1,7 +1,7 @@
|
|||||||
import useEventPublisher from "../feed/EventPublisher";
|
import useEventPublisher from "../feed/EventPublisher";
|
||||||
import ProfilePreview from "./ProfilePreview";
|
import ProfilePreview from "./ProfilePreview";
|
||||||
|
|
||||||
export default function FollowListBase({ pubkeys }) {
|
export default function FollowListBase({ pubkeys, title}) {
|
||||||
const publisher = useEventPublisher();
|
const publisher = useEventPublisher();
|
||||||
|
|
||||||
async function followAll() {
|
async function followAll() {
|
||||||
@ -12,7 +12,7 @@ export default function FollowListBase({ pubkeys }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<div className="f-grow"></div>
|
<div className="f-grow">{title}</div>
|
||||||
<div className="btn" onClick={() => followAll()}>Follow All</div>
|
<div className="btn" onClick={() => followAll()}>Follow All</div>
|
||||||
</div>
|
</div>
|
||||||
{pubkeys?.map(a => <ProfilePreview pubkey={a} key={a} options={{ about: false }} />)}
|
{pubkeys?.map(a => <ProfilePreview pubkey={a} key={a} options={{ about: false }} />)}
|
||||||
|
@ -11,5 +11,5 @@ export default function FollowersList({ pubkey }) {
|
|||||||
return [...new Set(contactLists?.map(a => a.pubkey))];
|
return [...new Set(contactLists?.map(a => a.pubkey))];
|
||||||
}, [feed]);
|
}, [feed]);
|
||||||
|
|
||||||
return <FollowListBase pubkeys={pubkeys} />
|
return <FollowListBase pubkeys={pubkeys} title={`${pubkeys?.length} followers`}/>
|
||||||
}
|
}
|
@ -12,5 +12,5 @@ export default function FollowsList({ pubkey }) {
|
|||||||
return [...new Set(pTags?.flat())];
|
return [...new Set(pTags?.flat())];
|
||||||
}, [feed]);
|
}, [feed]);
|
||||||
|
|
||||||
return <FollowListBase pubkeys={pubkeys} />
|
return <FollowListBase pubkeys={pubkeys} title={`Following ${pubkeys?.length}`}/>
|
||||||
}
|
}
|
@ -54,24 +54,24 @@ export default function ProfilePage() {
|
|||||||
<div>
|
<div>
|
||||||
{isMe ? (
|
{isMe ? (
|
||||||
<div className="btn btn-icon" onClick={() => navigate("/settings")}>
|
<div className="btn btn-icon" onClick={() => navigate("/settings")}>
|
||||||
<FontAwesomeIcon icon={faGear} size="lg" />
|
<FontAwesomeIcon icon={faGear} size="lg" />
|
||||||
</div>
|
</div>
|
||||||
) : <FollowButton pubkey={id} />
|
) : <FollowButton pubkey={id} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>{extractLinks([user?.about])}</p>
|
<p>{extractLinks([user?.about])}</p>
|
||||||
|
|
||||||
{user?.website && (
|
{user?.website && (
|
||||||
<div className="website f-ellipsis">
|
<div className="website f-ellipsis">
|
||||||
<a href={user.website} target="_blank" rel="noreferrer">{user.website}</a>
|
<a href={user.website} target="_blank" rel="noreferrer">{user.website}</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{lnurl ? <div className="lnurl f-ellipsis">
|
{lnurl ? <div className="lnurl f-ellipsis">
|
||||||
{lnurl}
|
{lnurl}
|
||||||
<div className="btn btn-icon" onClick={(e) => setShowLnQr(true)}>
|
<div className="btn btn-icon" onClick={(e) => setShowLnQr(true)}>
|
||||||
<FontAwesomeIcon icon={faQrcode} size="lg" />
|
<FontAwesomeIcon icon={faQrcode} size="lg" />
|
||||||
</div>
|
</div>
|
||||||
</div> : null}
|
</div> : null}
|
||||||
<LNURLTip svc={lnurl} show={showLnQr} onClose={() => setShowLnQr(false)} />
|
<LNURLTip svc={lnurl} show={showLnQr} onClose={() => setShowLnQr(false)} />
|
||||||
@ -84,7 +84,12 @@ export default function ProfilePage() {
|
|||||||
case ProfileTab.Notes: return <Timeline pubkeys={id} />;
|
case ProfileTab.Notes: return <Timeline pubkeys={id} />;
|
||||||
case ProfileTab.Follows: {
|
case ProfileTab.Follows: {
|
||||||
if (isMe) {
|
if (isMe) {
|
||||||
return follows.map(a => <ProfilePreview key={a} pubkey={a.toLowerCase()} options={{ about: false }} />)
|
return (
|
||||||
|
<>
|
||||||
|
<h4>Following {follows.length}</h4>
|
||||||
|
{follows.map(a => <ProfilePreview key={a} pubkey={a.toLowerCase()} options={{ about: false }} />)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return <FollowsList pubkey={id} />;
|
return <FollowsList pubkey={id} />;
|
||||||
}
|
}
|
||||||
@ -104,7 +109,7 @@ export default function ProfilePage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="f-grow details">
|
<div className="f-grow details">
|
||||||
{details()}
|
{details()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="tabs">
|
<div className="tabs">
|
||||||
|
Loading…
Reference in New Issue
Block a user