about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/MediaPreview.tsx8
-rw-r--r--src/types/bsky/post.ts23
2 files changed, 20 insertions, 11 deletions
diff --git a/src/components/MediaPreview.tsx b/src/components/MediaPreview.tsx
index 6e368e7dc..208973cc9 100644
--- a/src/components/MediaPreview.tsx
+++ b/src/components/MediaPreview.tsx
@@ -54,6 +54,14 @@ export function Embed({
         <VideoItem thumbnail={e.view.thumbnail} alt={e.view.alt} />
       </Outer>
     )
+  } else if (
+    e.type === 'post_with_media' &&
+    // ignore further "nested" RecordWithMedia
+    e.media.type !== 'post_with_media' &&
+    // ignore any unknowns
+    e.media.view !== null
+  ) {
+    return <Embed embed={e.media.view} style={style} />
   }
 
   return null
diff --git a/src/types/bsky/post.ts b/src/types/bsky/post.ts
index 225726f41..61b63dce7 100644
--- a/src/types/bsky/post.ts
+++ b/src/types/bsky/post.ts
@@ -1,4 +1,5 @@
 import {
+  $Typed,
   AppBskyEmbedExternal,
   AppBskyEmbedImages,
   AppBskyEmbedRecord,
@@ -12,47 +13,47 @@ import {
 export type Embed =
   | {
       type: 'post'
-      view: AppBskyEmbedRecord.ViewRecord
+      view: $Typed<AppBskyEmbedRecord.ViewRecord>
     }
   | {
       type: 'post_not_found'
-      view: AppBskyEmbedRecord.ViewNotFound
+      view: $Typed<AppBskyEmbedRecord.ViewNotFound>
     }
   | {
       type: 'post_blocked'
-      view: AppBskyEmbedRecord.ViewBlocked
+      view: $Typed<AppBskyEmbedRecord.ViewBlocked>
     }
   | {
       type: 'post_detached'
-      view: AppBskyEmbedRecord.ViewDetached
+      view: $Typed<AppBskyEmbedRecord.ViewDetached>
     }
   | {
       type: 'feed'
-      view: AppBskyFeedDefs.GeneratorView
+      view: $Typed<AppBskyFeedDefs.GeneratorView>
     }
   | {
       type: 'list'
-      view: AppBskyGraphDefs.ListView
+      view: $Typed<AppBskyGraphDefs.ListView>
     }
   | {
       type: 'labeler'
-      view: AppBskyLabelerDefs.LabelerView
+      view: $Typed<AppBskyLabelerDefs.LabelerView>
     }
   | {
       type: 'starter_pack'
-      view: AppBskyGraphDefs.StarterPackViewBasic
+      view: $Typed<AppBskyGraphDefs.StarterPackViewBasic>
     }
   | {
       type: 'images'
-      view: AppBskyEmbedImages.View
+      view: $Typed<AppBskyEmbedImages.View>
     }
   | {
       type: 'link'
-      view: AppBskyEmbedExternal.View
+      view: $Typed<AppBskyEmbedExternal.View>
     }
   | {
       type: 'video'
-      view: AppBskyEmbedVideo.View
+      view: $Typed<AppBskyEmbedVideo.View>
     }
   | {
       type: 'post_with_media'