misc: misc optimizations
This commit is contained in:
1 parent
fe262c1cc1
commit
68bd45b034
10 files changed
+154
-96
No files matched your search
@@ -11,7 +11,6 @@
|
||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import { bestImageURL, postLink } from '$lib/components/lemmy/post/helpers.js'
|
||||
import Empty from '$lib/components/helper/Empty.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
|
||||
export let post: PostView
|
||||
export let actions: boolean = true
|
||||
@@ -19,16 +18,6 @@
|
||||
export let view: 'card' | 'list' | 'compact' = $userSettings.view
|
||||
|
||||
let loaded = false
|
||||
|
||||
// hack because you cant use typescript types in svelte markup
|
||||
const onclick = (
|
||||
e: MouseEvent & {
|
||||
currentTarget: EventTarget & HTMLDivElement
|
||||
target: any
|
||||
}
|
||||
) => {
|
||||
if (e.target.id == post.post.id.toString()) goto(postLink(post.post))
|
||||
}
|
||||
</script>
|
||||
|
||||
<Material
|
||||
@@ -41,17 +30,7 @@
|
||||
>
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
id={post.post.id.toString()}
|
||||
on:click={onclick}
|
||||
class="relative flex flex-col gap-2.5"
|
||||
>
|
||||
<!-- {#if view == 'list' || view == 'compact'}
|
||||
<div
|
||||
class="absolute -inset-0.5 group-hover:-inset-2 group-hover:-inset-y-3 group-hover:md:-inset-4
|
||||
transition-all rounded-xl group-hover:bg-slate-50 group-hover:dark:bg-zinc-900"
|
||||
/>
|
||||
{/if} -->
|
||||
<div id={post.post.id.toString()} class="relative flex flex-col gap-2.5">
|
||||
<div
|
||||
class="flex {$userSettings.leftAlign
|
||||
? 'flex-row-reverse'
|
||||
|
||||
@@ -89,13 +89,7 @@
|
||||
href="/post/{getInstance()}/{post.post.id}"
|
||||
class="!text-inherit h-8 px-3"
|
||||
>
|
||||
<Icon
|
||||
slot="prefix"
|
||||
src={ChatBubbleOvalLeftEllipsis}
|
||||
mini
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
<Icon slot="prefix" src={ChatBubbleOvalLeftEllipsis} mini size="16" />
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
<div class="ml-auto" />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import { Icon, Link as LinkIcon } from 'svelte-hero-icons'
|
||||
|
||||
export let url: string
|
||||
export let thumbnail_url: string | undefined = undefined
|
||||
@@ -10,14 +9,14 @@
|
||||
<Link href={url} highlight nowrap />
|
||||
|
||||
{#if thumbnail_url}
|
||||
<a href={url}>
|
||||
<img
|
||||
src={thumbnail_url}
|
||||
class="rounded-md max-w-[300px] w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
|
||||
width={600}
|
||||
height={400}
|
||||
alt=""
|
||||
class:blur-3xl={nsfw}
|
||||
/>
|
||||
</a>
|
||||
<a href={url}>
|
||||
<img
|
||||
src={thumbnail_url}
|
||||
class="rounded-md max-w-[300px] w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
|
||||
width={600}
|
||||
height={400}
|
||||
alt=""
|
||||
class:blur-3xl={nsfw}
|
||||
/>
|
||||
</a>
|
||||
{/if}
|
||||
@@ -6,16 +6,13 @@
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import type { Community, Person } from 'lemmy-js-client'
|
||||
import {
|
||||
ArrowTrendingDown,
|
||||
Bookmark,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
LockClosed,
|
||||
Megaphone,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { getInstance } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
|
||||
export let community: Community | undefined = undefined
|
||||
export let user: Person | undefined = undefined
|
||||
|
||||
Reference in new issue
Block a user