the statusphere demo reworked into a vite/react app in a monorepo
0
fork

Configure Feed

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

at 8728f2dc2c7013b89884987dbbbceed64f545ab7 42 lines 1.1 kB view raw
1import { 2 AppBskyActorDefs, 3 AppBskyActorProfile, 4 XyzStatusphereDefs, 5} from '@statusphere/lexicon' 6 7import { AppContext } from '#/context' 8import { Status } from '#/db' 9 10export async function statusToStatusView( 11 status: Status, 12 ctx: AppContext, 13): Promise<XyzStatusphereDefs.StatusView> { 14 return { 15 uri: status.uri, 16 status: status.status, 17 createdAt: status.createdAt, 18 profile: { 19 did: status.authorDid, 20 handle: await ctx.resolver 21 .resolveDidToHandle(status.authorDid) 22 .catch(() => 'invalid.handle'), 23 }, 24 } 25} 26 27export async function bskyProfileToProfileView( 28 did: string, 29 profile: AppBskyActorProfile.Record, 30 ctx: AppContext, 31): Promise<AppBskyActorDefs.ProfileView> { 32 return { 33 $type: 'app.bsky.actor.defs#profileView', 34 did: did, 35 handle: await ctx.resolver.resolveDidToHandle(did), 36 avatar: profile.avatar 37 ? `https://atproto.pictures/img/${did}/${profile.avatar.ref}` 38 : undefined, 39 displayName: profile.displayName, 40 createdAt: profile.createdAt, 41 } 42}