Add verification check to avatars

This commit is contained in:
Bojan Mojsilovic 2023-08-31 15:34:15 +02:00
parent 6f5ef9d3a7
commit 4aae5dd0c7
9 changed files with 23 additions and 22 deletions

View File

@ -31,7 +31,6 @@
bottom: 0px; bottom: 0px;
width: 15px; width: 15px;
height: 15px; height: 15px;
background-color: var(--background-site);
border-radius: 50%; border-radius: 50%;
} }
@ -98,8 +97,6 @@
.iconBackground { .iconBackground {
@include iconBackground; @include iconBackground;
bottom: 0px;
right: 0px;
} }
} }
@ -115,8 +112,6 @@
.iconBackground { .iconBackground {
@include iconBackground; @include iconBackground;
bottom: 0px;
right: 0px;
} }
} }
@ -132,8 +127,6 @@
.iconBackground { .iconBackground {
@include iconBackground; @include iconBackground;
bottom: 0px;
right: 0px;
} }
} }

View File

@ -2,14 +2,15 @@ import { Component, createMemo, createSignal, Show } from 'solid-js';
import defaultAvatar from '../../assets/icons/default_nostrich.svg'; import defaultAvatar from '../../assets/icons/default_nostrich.svg';
import { useMediaContext } from '../../contexts/MediaContext'; import { useMediaContext } from '../../contexts/MediaContext';
import { getMediaUrl } from '../../lib/media'; import { getMediaUrl } from '../../lib/media';
import { MediaSize } from '../../types/primal'; import { MediaSize, PrimalUser } from '../../types/primal';
import VerificationCheck from '../VerificationCheck/VerificationCheck';
import styles from './Avatar.module.scss'; import styles from './Avatar.module.scss';
const Avatar: Component<{ const Avatar: Component<{
src: string | undefined, src: string | undefined,
size?: "xxs" | "xss" | "xs" | "vs" | "sm" | "md" | "lg" | "xl" | "xxl", size?: "xxs" | "xss" | "xs" | "vs" | "sm" | "md" | "lg" | "xl" | "xxl",
verified?: string, user?: PrimalUser,
highlightBorder?: boolean, highlightBorder?: boolean,
}> = (props) => { }> = (props) => {
@ -109,9 +110,9 @@ const Avatar: Component<{
<img src={imageSrc()} alt="avatar" onerror={imgError}/> <img src={imageSrc()} alt="avatar" onerror={imgError}/>
</div> </div>
</Show> </Show>
<Show when={props.verified}> <Show when={props.user}>
<div class={styles.iconBackground}> <div class={styles.iconBackground}>
<div class={styles.verifiedIcon}></div> <VerificationCheck user={props.user} />
</div> </div>
</Show> </Show>
</div> </div>

View File

@ -20,7 +20,7 @@ const NewNote: Component<{ onSuccess: (note: SendNoteResult) => void}> = (props)
<Avatar <Avatar
src={activeUser()?.picture} src={activeUser()?.picture}
size="md" size="md"
verified={activeUser()?.nip05} user={activeUser()}
/> />
</div> </div>
<div class={styles.rightSide}> <div class={styles.rightSide}>

View File

@ -55,6 +55,7 @@
overflow: hidden; overflow: hidden;
max-width: 360px; max-width: 360px;
color: var(--text-primary); color: var(--text-primary);
margin-right: 2px;
} }
.time{ .time{
margin: 0px 2px; margin: 0px 2px;

View File

@ -23,7 +23,7 @@ const PeopleList: Component<{ people: PrimalUser[], label: string}> = (props) =>
<Avatar <Avatar
src={person?.picture} src={person?.picture}
size="md" size="md"
verified={person?.nip05} user={person}
/> />
</div> </div>
<div class={styles.content}> <div class={styles.content}>

View File

@ -21,7 +21,7 @@ const ProfileWidget: Component = () => {
<Avatar <Avatar
size="vs" size="vs"
src={activeUser()?.picture} src={activeUser()?.picture}
verified={activeUser()?.nip05} user={activeUser()}
/> />
</div> </div>
<div class={styles.userInfo}> <div class={styles.userInfo}>

View File

@ -89,7 +89,7 @@ const ReplyToNote: Component<{ note: PrimalNote, onNotePosted?: (note: SendNoteR
<Avatar <Avatar
src={activeUser()?.picture} src={activeUser()?.picture}
size="md" size="md"
verified={activeUser()?.nip05} user={activeUser()}
/> />
</div> </div>
<div class={styles.rightSideClosed}> <div class={styles.rightSideClosed}>
@ -117,7 +117,7 @@ const ReplyToNote: Component<{ note: PrimalNote, onNotePosted?: (note: SendNoteR
<Avatar <Avatar
src={activeUser()?.picture} src={activeUser()?.picture}
size="md" size="md"
verified={activeUser()?.nip05} user={activeUser()}
/> />
</div> </div>
<div class={styles.rightSide}> <div class={styles.rightSide}>

View File

@ -3,7 +3,6 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
display: inline-block; display: inline-block;
margin-inline: 2px;
background-color: var(--text-tertiary-2); background-color: var(--text-tertiary-2);
-webkit-mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%; -webkit-mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%;
mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%; mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%;
@ -12,15 +11,15 @@
.verificationIcon { .verificationIcon {
width: 15px; width: 15px;
height: 15px; height: 15px;
display: inline-block;
position: relative; position: relative;
display: flex;
justify-content: center;
align-items: center;
} }
.verifiedIconPrimal { .verifiedIconPrimal {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: inline-block;
margin-inline: 2px;
background: var(--brand-gradient); background: var(--brand-gradient);
-webkit-mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%; -webkit-mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%;
mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%; mask: url(../../assets/icons/verified.svg) no-repeat 0 / 100%;
@ -31,7 +30,8 @@
height: 11px; height: 11px;
position: absolute; position: absolute;
top: 2px; top: 2px;
left: 4px; left: 2px;
border-radius: 50%; border-radius: 50%;
background-color: white; background-color: white;
position: absolute;
} }

View File

@ -32,7 +32,13 @@ const VerificationCheck: Component<{ user: PrimalUser | undefined }> = (props) =
}) })
return ( return (
<Show when={isVerified()}> <Show
when={isVerified()}
fallback={
<div class={styles.verificationIcon}>
</div>
}
>
<Show <Show
when={isVerifiedByPrimal()} when={isVerifiedByPrimal()}
fallback={ fallback={