diff --git a/app/components/BlueskyComment.vue b/app/components/BlueskyComment.vue
index 45c10d46..85f1b271 100644
--- a/app/components/BlueskyComment.vue
+++ b/app/components/BlueskyComment.vue
@@ -1,4 +1,18 @@
@@ -92,9 +189,70 @@ const maxDepth = 4
- {{ comment.text }}
+
+ {{ segment.text }}
+
+ {{ segment.text }}
+
+
+
+
+
+
+
![]()
+
+
+ {{ comment.embed.external.title }}
+
+
+ {{ comment.embed.external.description }}
+
+
+
+
+
-import type { AppBskyFeedDefs } from '@atproto/api'
+import type { AppBskyFeedDefs, AppBskyRichtextFacet, AppBskyEmbedImages, AppBskyEmbedExternal } from '@atproto/api'
const props = defineProps<{
uri: string
}>()
+type Facet = AppBskyRichtextFacet.Main
type ThreadViewPost = AppBskyFeedDefs.ThreadViewPost
-function isThreadViewPost (v: unknown): v is ThreadViewPost {
- return (
- typeof v === 'object'
- && v !== null
- && '$type' in v
- && v.$type === 'app.bsky.feed.defs#threadViewPost'
- )
+interface CommentEmbed {
+ type: 'images' | 'external'
+ images?: AppBskyEmbedImages.ViewImage[]
+ external?: AppBskyEmbedExternal.ViewExternal
}
interface Comment {
@@ -26,6 +24,8 @@ interface Comment {
avatar?: string
}
text: string
+ facets?: Facet[]
+ embed?: CommentEmbed
createdAt: string
likeCount: number
replyCount: number
@@ -33,11 +33,42 @@ interface Comment {
replies: Comment[]
}
+function isThreadViewPost (v: unknown): v is ThreadViewPost {
+ return (
+ typeof v === 'object'
+ && v !== null
+ && '$type' in v
+ && v.$type === 'app.bsky.feed.defs#threadViewPost'
+ )
+}
+
+function parseEmbed (embed: unknown): CommentEmbed | undefined {
+ if (!embed || typeof embed !== 'object') return undefined
+
+ const e = embed as Record
+
+ if (e.$type === 'app.bsky.embed.images#view' && Array.isArray(e.images)) {
+ return {
+ type: 'images',
+ images: e.images as AppBskyEmbedImages.ViewImage[],
+ }
+ }
+
+ if (e.$type === 'app.bsky.embed.external#view' && e.external) {
+ return {
+ type: 'external',
+ external: e.external as AppBskyEmbedExternal.ViewExternal,
+ }
+ }
+
+ return undefined
+}
+
function parseThread (thread: ThreadViewPost): Comment | null {
if (!isThreadViewPost(thread)) return null
const post = thread.post
- const record = post.record
+ const record = post.record as { text: string, createdAt: string, facets?: Facet[] }
const replies: Comment[] = []
if (thread.replies) {
@@ -62,6 +93,8 @@ function parseThread (thread: ThreadViewPost): Comment | null {
},
text: record.text as string,
createdAt: record.createdAt as string,
+ facets: record.facets,
+ embed: parseEmbed(post.embed),
likeCount: post.likeCount ?? 0,
replyCount: post.replyCount ?? 0,
repostCount: post.repostCount ?? 0,
diff --git a/budget.json b/budget.json
index 50f7f56d..d43a0a3e 100644
--- a/budget.json
+++ b/budget.json
@@ -8,7 +8,7 @@
},
{
"resourceType": "script",
- "budget": 87
+ "budget": 88
},
{
"resourceType": "stylesheet",
diff --git a/test/unit/bundle.spec.ts b/test/unit/bundle.spec.ts
index feb14bc6..7a42e4ce 100644
--- a/test/unit/bundle.spec.ts
+++ b/test/unit/bundle.spec.ts
@@ -36,7 +36,7 @@ describe('project sizes', () => {
stats.client = await analyzeSizes('**/*.js', publicDir)
expect
.soft(roundToKilobytes(stats.client.totalBytes))
- .toMatchInlineSnapshot(`"512k"`)
+ .toMatchInlineSnapshot(`"515k"`)
expect.soft(stats.client.files.map(f => f.replace(/\..*\.js/, '.js').replace(/_scripts\/.*\.js/, '_scripts/script.js')).sort())
.toMatchInlineSnapshot(`
[