this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

avatar: accept directly profile url

Clément 73feb696 b3b80623

+4 -6
+3 -5
app/src/lib/components/Avatar.tsx
··· 3 3 import type { Did } from '@atcute/lexicons'; 4 4 import { createSignal, onMount } from 'solid-js'; 5 5 6 - import type { User } from '~/generated/prisma/browser'; 7 - 8 6 async function getAvatar(did: Did): Promise<string | undefined> { 9 7 const rpc = new Client({ 10 8 handler: simpleFetchHandler({ service: 'https://public.api.bsky.app' }), ··· 18 16 return undefined; 19 17 } 20 18 21 - export function Avatar(props: { size?: number; user: Pick<User, 'did'> }) { 19 + export function Avatar(props: { size?: number; did: Did; avatar?: string }) { 22 20 const [avatar, setAvatar] = createSignal<string | undefined>(); 23 21 24 22 onMount(async () => { 25 - const url = await getAvatar(props.user.did as Did); 23 + const url = props.avatar ?? (await getAvatar(props.did)); 26 24 setAvatar(url); 27 25 }); 28 26 ··· 35 33 }} 36 34 > 37 35 <ArkAvatar.Fallback class="select-none"> 38 - {props.user.did.split(':').at(2)?.at(0)?.toLocaleUpperCase() || 'P'} 36 + {props.did.split(':').at(2)?.at(0)?.toLocaleUpperCase() || 'P'} 39 37 </ArkAvatar.Fallback> 40 38 <ArkAvatar.Image class="rounded-full" src={avatar()} alt="User Avatar" /> 41 39 </ArkAvatar.Root>
+1 -1
app/src/lib/header/Header.tsx
··· 37 37 <p> 38 38 logged in as <span>@{props.profile.handle}</span> 39 39 </p> 40 - <Avatar user={{ did: props.profile.did }} /> 40 + <Avatar did={props.profile.did} avatar={props.profile.avatar} /> 41 41 </div> 42 42 ); 43 43 }