···
import { type AtpClient } from '$lib/at/client';
3
-
import { AppBskyFeedPost } from '@atcute/bluesky';
4
+
AppBskyEmbedExternal,
8
+
} from '@atcute/bluesky';
parseCanonicalResourceUri,
···
{#if !isOnPostComposer && record.embed}
{@const embed = record.embed}
307
+
{#snippet embedMedia(
308
+
embed: AppBskyEmbedImages.Main | AppBskyEmbedVideo.Main | AppBskyEmbedExternal.Main
310
+
{#if embed.$type === 'app.bsky.embed.images'}
311
+
<!-- todo: improve how images are displayed, and pop out on click -->
312
+
{#each embed.images as image (image.image)}
313
+
{#if isBlob(image.image)}
316
+
src={img('feed_thumbnail', did, image.image.ref.$link)}
321
+
{:else if embed.$type === 'app.bsky.embed.video'}
322
+
{#if isBlob(embed.video)}
323
+
{#await didDoc then didDoc}
325
+
<!-- svelte-ignore a11y_media_has_caption -->
328
+
src={blob(didDoc.value.pds, did, embed.video.ref.$link)}
{#snippet embedPost(uri: ResourceUri)}
{@const parsedUri = expect(parseCanonicalResourceUri(uri))}
···
{@render embedBadge(record)}
323
-
{#if embed.$type === 'app.bsky.embed.images'}
324
-
<!-- todo: improve how images are displayed, and pop out on click -->
325
-
{#each embed.images as image (image.image)}
326
-
{#if isBlob(image.image)}
329
-
src={img('feed_thumbnail', did, image.image.ref.$link)}
334
-
{:else if embed.$type === 'app.bsky.embed.video'}
335
-
{#if isBlob(embed.video)}
336
-
{#await didDoc then didDoc}
338
-
<!-- svelte-ignore a11y_media_has_caption -->
341
-
src={blob(didDoc.value.pds, did, embed.video.ref.$link)}
357
+
{#if embed.$type === 'app.bsky.embed.images' || embed.$type === 'app.bsky.embed.video'}
358
+
{@render embedMedia(embed)}
{:else if embed.$type === 'app.bsky.embed.record'}
{@render embedPost(embed.record.uri)}
{:else if embed.$type === 'app.bsky.embed.recordWithMedia'}
350
-
{@render embedPost(embed.record.record.uri)}
362
+
<div class="space-y-1.5">
363
+
{@render embedPost(embed.record.record.uri)}
364
+
{@render embedMedia(embed.media)}
<!-- todo: implement external link embeds -->