From 703a556cbddd40709e045322f0e6325c44e0ce89 Mon Sep 17 00:00:00 2001 From: luna Date: Sun, 5 Jan 2025 09:08:33 +1030 Subject: [PATCH] fix: lists in posts --- .../PostEmbed/app-bsky-embed-record-view.tsx | 27 ++++++++++++++++++- src/components/ui/avatar.tsx | 4 ++- src/lib/bluesky/types/BSkyPostEmbed.ts | 16 +++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/components/PostEmbed/app-bsky-embed-record-view.tsx b/src/components/PostEmbed/app-bsky-embed-record-view.tsx index 0f0b7bf..2bd32b8 100644 --- a/src/components/PostEmbed/app-bsky-embed-record-view.tsx +++ b/src/components/PostEmbed/app-bsky-embed-record-view.tsx @@ -11,6 +11,7 @@ import { Link } from '@/components/ui/Link'; import { useTranslation } from 'react-i18next'; import { Avatar } from '../ui/avatar'; import { FormattedText } from '../ui/FormattedText'; +import { SatelliteDish } from 'lucide-react'; export const AppBskyEmbedRecordView = ({ embed }: { embed: BSkyPostEmbed }) => { const { t } = useTranslation('post'); @@ -82,8 +83,32 @@ export const AppBskyEmbedRecordView = ({ embed }: { embed: BSkyPostEmbed }) => { )} + {embed.record.$type === 'app.bsky.graph.defs#listView' && ( +
+
+ {embed.record.avatar ? ( + + ) : ( +
+ +
+ )} +
+
{embed.record.name}
+
+ {embed.record.purpose === 'app.bsky.graph.defs#modlist' && 'mod'} + {'list by'} +
+
+
+
+ +
+
+ )} {embed.record.$type !== 'app.bsky.graph.defs#starterPackViewBasic' && - embed.record.$type !== 'app.bsky.feed.defs#generatorView' && ( + embed.record.$type !== 'app.bsky.feed.defs#generatorView' && + embed.record.$type !== 'app.bsky.graph.defs#listView' && (

{embed.record.facets ? ( diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index dd4f9a9..eeece5d 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -39,15 +39,17 @@ export const Avatar = ({ handle, avatar, labeler, + list, className, }: { handle: string; avatar: string | undefined; labeler?: boolean; + list?: boolean; className?: string; }) => { return ( - + {handle} diff --git a/src/lib/bluesky/types/BSkyPostEmbed.ts b/src/lib/bluesky/types/BSkyPostEmbed.ts index d862076..7aaba2b 100644 --- a/src/lib/bluesky/types/BSkyPostEmbed.ts +++ b/src/lib/bluesky/types/BSkyPostEmbed.ts @@ -130,6 +130,22 @@ export const BSkyPostEmbed = Type.Recursive((Self) => { viewer: Type.Object({}), indexedAt: Type.String(), }), + Type.Object({ + $type: Type.Literal('app.bsky.graph.defs#listView'), + uri: Type.String(), + cid: Type.String(), + name: Type.String(), + purpose: Type.Union([Type.Literal('app.bsky.graph.defs#curatelist'), Type.Literal('app.bsky.graph.defs#modlist')]), + listItemCount: Type.Number(), + indexedAt: Type.String(), + labels: Type.Array(BSkyPostLabel), + viewer: Type.Object({ + muted: Type.Boolean(), + }), + creator: Author, + description: Type.String(), + avatar: Type.Optional(Type.String()), + }), ]), }), Type.Object({