Add user stats to user recomendations in edit box

This commit is contained in:
Bojan Mojsilovic 2024-01-18 14:32:20 +01:00
parent 487fce7432
commit bcc1fc57a3
3 changed files with 15 additions and 13 deletions

View File

@ -38,6 +38,7 @@ import { useMediaContext } from "../../../contexts/MediaContext";
import { hookForDev } from "../../../lib/devTools"; import { hookForDev } from "../../../lib/devTools";
import ButtonPrimary from "../../Buttons/ButtonPrimary"; import ButtonPrimary from "../../Buttons/ButtonPrimary";
import ButtonSecondary from "../../Buttons/ButtonSecondary"; import ButtonSecondary from "../../Buttons/ButtonSecondary";
import { useProfileContext } from "../../../contexts/ProfileContext";
type AutoSizedTextArea = HTMLTextAreaElement & { _baseScrollHeight: number }; type AutoSizedTextArea = HTMLTextAreaElement & { _baseScrollHeight: number };
@ -58,6 +59,7 @@ const EditBox: Component<{
const search = useSearchContext(); const search = useSearchContext();
const account = useAccountContext(); const account = useAccountContext();
const toast = useToastContext(); const toast = useToastContext();
const profile = useProfileContext();
let textArea: HTMLTextAreaElement | undefined; let textArea: HTMLTextAreaElement | undefined;
let textPreview: HTMLDivElement | undefined; let textPreview: HTMLDivElement | undefined;
@ -1212,7 +1214,7 @@ const EditBox: Component<{
title={userName(user)} title={userName(user)}
description={nip05Verification(user)} description={nip05Verification(user)}
icon={<Avatar user={user} size="xs" />} icon={<Avatar user={user} size="xs" />}
statNumber={search?.scores[user.pubkey]} statNumber={profile?.profileHistory.stats[user.pubkey]?.followers_count || search?.scores[user.pubkey]}
statLabel={intl.formatMessage(tSearch.followers)} statLabel={intl.formatMessage(tSearch.followers)}
onClick={() => selectUser(user)} onClick={() => selectUser(user)}
highlighted={highlightedUser() === index()} highlighted={highlightedUser() === index()}

View File

@ -1,5 +1,5 @@
import { A } from "@solidjs/router"; import { A } from "@solidjs/router";
import { Component, createSignal, JSXElement, onMount, Show } from "solid-js"; import { Component, JSXElement } from "solid-js";
import { hookForDev } from "../../../lib/devTools"; import { hookForDev } from "../../../lib/devTools";
import { nip05Verification, userName } from "../../../stores/profile"; import { nip05Verification, userName } from "../../../stores/profile";
import { PrimalUser } from "../../../types/primal"; import { PrimalUser } from "../../../types/primal";
@ -35,18 +35,18 @@ const MentionedUserLink: Component<{
return ( return (
<LinkComponent> <LinkComponent>
@{userName(props.user)} @{userName(props.user)}
<div class={styles.userPreview}> <div class={styles.userPreview}>
<Avatar user={props.user} /> <Avatar user={props.user} />
<div> <div>
<div class={styles.userName}> <div class={styles.userName}>
{userName(props.user)} {userName(props.user)}
<VerificationCheck user={props.user} /> <VerificationCheck user={props.user} />
</div> </div>
<div class={styles.verification}> <div class={styles.verification}>
{nip05Verification(props.user)} {nip05Verification(props.user)}
</div>
</div> </div>
</div> </div>
</div>
</LinkComponent> </LinkComponent>
); );
} }

View File

@ -1014,7 +1014,7 @@ const Messages: Component = () => {
title={userName(user)} title={userName(user)}
description={user.nip05} description={user.nip05}
icon={<Avatar user={user} size="xs" />} icon={<Avatar user={user} size="xs" />}
statNumber={search?.scores[user.pubkey]} statNumber={profile?.profileHistory.stats[user.pubkey]?.followers_count || search?.scores[user.pubkey]}
statLabel={intl.formatMessage(tSearch.followers)} statLabel={intl.formatMessage(tSearch.followers)}
onClick={() => selectUser(user)} onClick={() => selectUser(user)}
highlighted={highlightedUser() === index()} highlighted={highlightedUser() === index()}