Merge branch 'main' into listview-selfpost-thumbnail

This commit is contained in:
Xylight authored and GitHub committed 2024-07-11 15:29:36 -07:00
commit 82a06974ef
53 files changed
+2061 -441

No files matched your search

@@ -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 -->
@@ -19,10 +19,17 @@
export let post: Post
export let type: MediaType = 'none'
export let opened: boolean | undefined = undefined
export let blur: boolean = post.nsfw && $userSettings.nsfwBlur
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 +46,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
@@ -68,7 +75,7 @@
transition-opacity duration-300 object-contain mx-auto"
width={512}
height={300}
class:blur-3xl={post.nsfw && $userSettings.nsfwBlur}
class:blur-3xl={blur}
alt={post.alt_text ?? ''}
/>
</picture>
@@ -16,14 +16,43 @@
export let type: MediaType = 'none'
</script>
<div
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
style={$$props.style ?? ''}
>
{#if post.alt_text}
<Popover
openOnHover
placement={$userSettings.leftAlign ? 'bottom-start' : 'bottom-end'}
<!--
@component
Thumbnails for compact and list view posts.
-->
<div
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
style={$$props.style ?? ''}
>
{#if post.alt_text}
<Popover
openOnHover
placement={$userSettings.leftAlign ? 'bottom-start' : 'bottom-end'}
>
<Material
slot="target"
padding="none"
rounding="full"
elevation="high"
class="w-max absolute bottom-0 left-0 py-0.5 px-1.5 m-1 font-bold"
>
ALT
</Material>
<div class="max-w-sm">
{post.alt_text}
</div>
</Popover>
{/if}
<svelte:element
this={!$userSettings.expandImages || type != 'image' ? 'a' : 'button'}
href={postLink(post)}
on:click={() => {
if (type == 'image') {
showImage(bestImageURL(post, false, 2048))
}
}}
role="button"
tabindex="0"
>
<Material
slot="target"