Truncate about on MessagesPage

fixes #588
This commit is contained in:
Kieran 2023-06-26 12:36:54 +01:00
parent 3354529114
commit 1315455b94
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -107,13 +107,20 @@ function ProfileDmActions({ pubkey }: { pubkey: string }) {
const profile = useUserProfile(System, pubkey);
const { block, unblock, isBlocked } = useModeration();
function truncAbout(s?: string) {
if ((s?.length ?? 0) > 200) {
return `${s?.slice(0, 200)}...`;
}
return s;
}
const blocked = isBlocked(pubkey);
return (
<>
<Avatar user={profile} size={210} />
<h2>{getDisplayName(profile, pubkey)}</h2>
<p>
<Text content={profile?.about ?? ""} tags={[]} creator={pubkey} disableMedia={true} depth={0} />
<Text content={truncAbout(profile?.about) ?? ""} tags={[]} creator={pubkey} disableMedia={true} depth={0} />
</p>
<div className="settings-row" onClick={() => (blocked ? unblock(pubkey) : block(pubkey))}>