Merge branch 'main' into infinite-scroll

This commit is contained in:
Xylight committed 2024-07-07 18:20:19 -07:00
commit 0da8d729f6
30 files changed
+431 -224

No files matched your search

@@ -55,6 +55,11 @@
}
</script>
<!--
@component
This is the sole component for displaying posts.
It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
-->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<Material
@@ -14,6 +14,10 @@
$: richURL = parseURL(url)
</script>
<!--
@component
For embed-type posts. Displays embed card or a compact link.
-->
{#if embed_title && !compact}
<Material color="distinct" class="flex flex-row gap-4">
<div class="flex flex-col gap-2">
@@ -45,6 +45,10 @@
}
</script>
<!--
@component
This component will build two different things: a post's meta block and the title.
-->
<div
class="grid w-full meta {community
? 'grid-rows-2'
@@ -184,6 +188,8 @@
>
<Markdown source={title} inline noStyle class="leading-[1.3]"></Markdown>
</a>
{:else}
<div style="grid-area: title; margin: 0;"></div>
{/if}
<style>
+3 -3
View File
@@ -18,8 +18,8 @@ export const bestImageURL = (
}
if (compact && post.thumbnail_url)
return `${post.thumbnail_url}?thumbnail=256&format=webp`
else if (compact && post.url) return `${post.url}?thumbnail=256&format=webp`
return `${post.thumbnail_url}?thumbnail=512&format=webp`
else if (compact && post.url) return `${post.url}?thumbnail=512&format=webp`
if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
else if (post.thumbnail_url)
@@ -37,7 +37,7 @@ export const optimizeImageURL = (
url.searchParams.append('format', 'webp')
url.searchParams.append(
'thumbnail',
findClosestNumber([128, 256, 512, 1024], width).toString()
findClosestNumber([128, 256, 512, 728, 1024, 1536], width).toString()
)
return url.toString()
} catch (e) {
@@ -92,6 +92,10 @@
$: embedUrl = urlToEmbed(url)
</script>
<!--
@component
Displays a video file or embedded video iframe.
-->
{#if opened}
{#if type == 'video'}
<!-- svelte-ignore a11y-media-has-caption -->
@@ -23,6 +23,12 @@
let showAltText = false
</script>
<!--
@component
This component will show either
- A media item (pictures, videos) (large form factor posts only)
- Embed link/card.
-->
{#if type == 'image'}
{#if view == 'card' || view == 'cozy'}
<!--disabled preloads here since most people will hover over every image while scrolling-->
@@ -39,9 +45,9 @@
>
<!-- svelte-ignore a11y-missing-attribute -->
<img
src={bestImageURL(post, false, 256)}
src={bestImageURL(post, false, 64)}
loading="lazy"
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-50"
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-40"
/>
<picture class="max-h-[inherit]">
<source
@@ -17,6 +17,10 @@
export let type: MediaType = 'none'
</script>
<!--
@component
Thumbnails for compact and list view posts.
-->
{#if view == 'compact' || (view == 'list' && type != 'none')}
<div
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"