fix: respect nsfw rules in compact mode
This commit is contained in:
1 parent
1401e30a09
commit
6291e7e3d3
5 files changed
+64
-15
No files matched your search
@@ -10,11 +10,18 @@
|
||||
import { isImage } from '$lib/ui/image'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
import { DocumentText, Icon, Link, VideoCamera } from 'svelte-hero-icons'
|
||||
import {
|
||||
DocumentText,
|
||||
Icon,
|
||||
Link,
|
||||
VideoCamera,
|
||||
ExclamationTriangle,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let post: Post
|
||||
export let type: MediaType = 'none'
|
||||
export let view: View = 'cozy'
|
||||
export let blur: boolean = post.nsfw && $userSettings.nsfwBlur
|
||||
|
||||
const thumbnailSize = (view: View) =>
|
||||
view == 'compact' ? 'w-22 h-22 sm:w-28' : 'w-24 h-24 sm:w-32'
|
||||
@@ -61,20 +68,41 @@
|
||||
tabindex="0"
|
||||
>
|
||||
{#if post.thumbnail_url || isImage(post.url)}
|
||||
<img
|
||||
src={optimizeImageURL(post.thumbnail_url || post.url || '', 196)}
|
||||
loading="lazy"
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl
|
||||
<div class="relative overflow-hidden rounded-xl">
|
||||
<picture class="relative">
|
||||
<img
|
||||
src={optimizeImageURL(post.thumbnail_url || post.url || '', 256)}
|
||||
loading="lazy"
|
||||
class="object-cover overflow-hidden bg-slate-100 dark:bg-zinc-800 rounded-xl
|
||||
transition-colors {size}"
|
||||
alt={post.name}
|
||||
/>
|
||||
{#if type != 'image'}
|
||||
alt={post.name}
|
||||
class:blur-xl={blur}
|
||||
/>
|
||||
{#if type != 'image'}
|
||||
<div
|
||||
class="absolute w-8 h-8 bottom-0 left-0 m-1 rounded-xl text-slate-800 dark:text-zinc-200
|
||||
backdrop-blur-sm bg-slate-25/75 dark:bg-zinc-900/75 border border-slate-200/75 dark:border-zinc-700/75
|
||||
grid place-items-center"
|
||||
>
|
||||
<Icon
|
||||
src={type == 'iframe' ? VideoCamera : Link}
|
||||
micro
|
||||
size="16"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</picture>
|
||||
</div>
|
||||
{#if blur}
|
||||
<div
|
||||
class="absolute w-8 h-8 bottom-0 left-0 m-1 rounded-xl text-slate-800 dark:text-zinc-200
|
||||
backdrop-blur-sm bg-slate-25/75 dark:bg-zinc-900/75 border border-slate-200/75 dark:border-zinc-700/75
|
||||
grid place-items-center"
|
||||
class="absolute w-full h-full grid place-items-center inset-0 z-30"
|
||||
>
|
||||
<Icon src={type == 'iframe' ? VideoCamera : Link} micro size="16" />
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
solid
|
||||
size="32"
|
||||
class="z-50 opacity-30"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
Reference in new issue
Block a user