GIF support (#5)
All checks were successful
Deploy / Deploy (push) Successful in 28s

Reviewed-on: #5
This commit is contained in:
Astra 2025-05-10 15:52:44 +00:00
parent 79d5694dd1
commit c3dfb2e48d
3 changed files with 15 additions and 9 deletions

View file

@ -57,12 +57,7 @@
{#each posts as postObject} {#each posts as postObject}
<PostComponent post={postObject as Post} /> <PostComponent post={postObject as Post} />
{/each} {/each}
{#if screen.availWidth > 600} <InfiniteLoading on:infinite={onInfinite} distance={3000} />
<InfiniteLoading on:infinite={onInfinite} distance={3000} forceUseInfiniteWrapper="#Feed" />
{/if}
{#if screen.availWidth <= 600}
<InfiniteLoading on:infinite={onInfinite} distance={3000} forceUseInfiniteWrapper=false />
{/if}
<div id="spacer"></div> <div id="spacer"></div>
</div> </div>
</div> </div>
@ -83,9 +78,9 @@
color: var(--text-color); color: var(--text-color);
} }
#Feed { #Feed {
overflow-y: scroll;
width: 65%; width: 65%;
height: 100vh; height: 100vh;
overflow-y: scroll;
padding: 20px; padding: 20px;
padding-bottom: 0; padding-bottom: 0;
padding-top: 0; padding-top: 0;
@ -143,13 +138,12 @@
height: auto; height: auto;
} }
#Feed { #Feed {
overflow-y: scroll;
width: 95%; width: 95%;
margin: 0px; margin: 0px;
margin-left: 10%; margin-left: 10%;
margin-right: 10%; margin-right: 10%;
padding: 0px; padding: 0px;
height: auto; overflow-y: visible;
} }
#spacer { #spacer {

View file

@ -141,6 +141,13 @@
controls controls
></video> ></video>
{/if} {/if}
{#if post.gifLink}
<img
id="embedVideo"
src="{post.gifLink}"
alt="Post GIF"
/>
{/if}
</div> </div>
</div> </div>

View file

@ -46,6 +46,7 @@ class Post {
replyingUri: atUriObject | null; replyingUri: atUriObject | null;
imagesCid: string[] | null; imagesCid: string[] | null;
videosLinkCid: string | null; videosLinkCid: string | null;
gifLink: string | null;
constructor( constructor(
record: ComAtprotoRepoListRecords.Record, record: ComAtprotoRepoListRecords.Record,
@ -69,6 +70,7 @@ class Post {
this.quotingUri = null; this.quotingUri = null;
this.imagesCid = null; this.imagesCid = null;
this.videosLinkCid = null; this.videosLinkCid = null;
this.gifLink = null;
switch (post.embed?.$type) { switch (post.embed?.$type) {
case "app.bsky.embed.images": case "app.bsky.embed.images":
this.imagesCid = post.embed.images.map( this.imagesCid = post.embed.images.map(
@ -96,6 +98,9 @@ class Post {
break; break;
} }
break; break;
case "app.bsky.embed.external": // assuming that external embeds are gifs for now
this.gifLink = post.embed.external.uri;
break;
} }
} }
} }