misc: Switch to thumbnails for avatars
This commit is contained in:
1 parent
cf372442d8
commit
ce19dd3a17
9 files changed
+45
-29
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Community } from 'lemmy-js-client'
|
||||
|
||||
export let community: Community
|
||||
@@ -16,14 +17,11 @@
|
||||
href={linkFromCommunity(community)}
|
||||
>
|
||||
{#if avatar}
|
||||
<img
|
||||
src={community.icon ??
|
||||
<Avatar
|
||||
url={community.icon ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${community.name}`}
|
||||
alt=""
|
||||
alt={community.name}
|
||||
width={avatarSize}
|
||||
height={avatarSize}
|
||||
class="rounded-full aspect-square object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
{/if}
|
||||
{community.title}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
DEFAULT_INSTANCE_URL,
|
||||
authData,
|
||||
getClient,
|
||||
getInstance,
|
||||
user,
|
||||
} from '$lib/lemmy.js'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
@@ -75,7 +76,7 @@
|
||||
<span class="opacity-50 capitalize" />
|
||||
</span>
|
||||
<a
|
||||
href="/post/{postRes.post.id}"
|
||||
href="/post/{getInstance()}/{postRes.post.id}"
|
||||
class="font-bold {postRes.read ? 'opacity-50' : ''}"
|
||||
>
|
||||
{postRes.post.name}
|
||||
@@ -90,7 +91,10 @@
|
||||
</a>
|
||||
{/if}
|
||||
{#if isImage(postRes.post.url)}
|
||||
<a href="/post/{postRes.post.id}" class="inline self-start">
|
||||
<a
|
||||
href="/post/{getInstance()}/{postRes.post.id}"
|
||||
class="inline self-start"
|
||||
>
|
||||
<img
|
||||
src={postRes.post.url}
|
||||
alt={postRes.post.name}
|
||||
@@ -100,7 +104,10 @@
|
||||
</a>
|
||||
{:else if isVideo(postRes.post.url)}
|
||||
<!-- svelte-ignore a11y-media-has-caption -->
|
||||
<a href="/post/{postRes.post.id}" class="inline self-start">
|
||||
<a
|
||||
href="/post/{getInstance()}/{postRes.post.id}"
|
||||
class="inline self-start"
|
||||
>
|
||||
<video class="rounded-md max-h-64 max-w-full" preload="metadata">
|
||||
<source src={postRes.post.url} />
|
||||
</video>
|
||||
@@ -127,7 +134,7 @@
|
||||
bg-slate-100 dark:bg-zinc-800 hover:bg-slate-200
|
||||
dark:hover:bg-zinc-700 transition-colors border border-slate-200
|
||||
dark:border-zinc-700"
|
||||
href="/post/{postRes.post.id}"
|
||||
href="/post/{getInstance()}/{postRes.post.id}"
|
||||
>
|
||||
<Icon src={ChatBubbleOvalLeft} mini width={16} height={16} />
|
||||
<span class="text-sm">
|
||||
@@ -142,9 +149,7 @@
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
navigator.clipboard.writeText(
|
||||
`${$page.url.origin}/post/${
|
||||
$authData?.instance ?? DEFAULT_INSTANCE_URL
|
||||
}/${postRes.post.id}`
|
||||
`${$page.url.origin}/post/${getInstance()}/${postRes.post.id}`
|
||||
)
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
import MarkdownLink from '$lib/components/markdown/MarkdownLink.svelte'
|
||||
import MarkdownQuote from '$lib/components/markdown/MarkdownQuote.svelte'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
import MarkdownList from '$lib/components/markdown/MarkdownList.svelte'
|
||||
|
||||
export let source: string | undefined
|
||||
</script>
|
||||
|
||||
<div class="break-words">
|
||||
<div class="break-words flex flex-col gap-1">
|
||||
<SvelteMarkdown
|
||||
{source}
|
||||
renderers={{
|
||||
@@ -16,6 +17,7 @@
|
||||
heading: MarkdownHeader,
|
||||
hr: MarkdownHr,
|
||||
blockquote: MarkdownQuote,
|
||||
list: MarkdownList,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -3,17 +3,17 @@
|
||||
</script>
|
||||
|
||||
{#if depth == 1}
|
||||
<h1 class="font-bold text-3xl"><slot /></h1>
|
||||
<h1 class="font-bold text-3xl my-2"><slot /></h1>
|
||||
{:else if depth == 2}
|
||||
<h2 class="font-bold text-2xl"><slot /></h2>
|
||||
<h2 class="font-bold text-2xl my-2"><slot /></h2>
|
||||
{:else if depth == 3}
|
||||
<h3 class="font-bold text-xl"><slot /></h3>
|
||||
<h3 class="font-bold text-xl my-2"><slot /></h3>
|
||||
{:else if depth == 4}
|
||||
<h4 class="font-bold text-lg"><slot /></h4>
|
||||
<h4 class="font-bold text-lg my-2"><slot /></h4>
|
||||
{:else if depth == 5}
|
||||
<h5 class="font-bold text-base"><slot /></h5>
|
||||
<h5 class="font-bold text-base my-2"><slot /></h5>
|
||||
{:else if depth == 6}
|
||||
<h6 class="font-bold text-sm"><slot /></h6>
|
||||
<h6 class="font-bold text-sm my-2"><slot /></h6>
|
||||
{:else}
|
||||
<slot />
|
||||
{/if}
|
||||
@@ -1 +1 @@
|
||||
<hr class="w-[90%] mx-auto my-4 opacity-80" />
|
||||
<hr class="w-[90%] mx-auto my-4 opacity-50" />
|
||||
@@ -0,0 +1,10 @@
|
||||
<script lang="ts">
|
||||
export let ordered: boolean
|
||||
export let start: number
|
||||
</script>
|
||||
|
||||
{#if ordered}
|
||||
<ol {start} class="list-decimal pl-3"><slot /></ol>
|
||||
{:else}
|
||||
<ul class="list-disc pl-3"><slot /></ul>
|
||||
{/if}
|
||||
@@ -6,7 +6,8 @@
|
||||
</script>
|
||||
|
||||
<img
|
||||
src={url ?? `https://api.dicebear.com/6.x/initials/svg?seed=${alt}`}
|
||||
src={`${url}?format=webp&thumbnail=${width * 2}` ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${alt}`}
|
||||
{alt}
|
||||
{width}
|
||||
loading="lazy"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
|
||||
export let user: Person
|
||||
@@ -16,14 +17,11 @@
|
||||
href={linkFromCommunity(user)}
|
||||
>
|
||||
{#if avatar}
|
||||
<img
|
||||
src={user.avatar ??
|
||||
<Avatar
|
||||
url={user.avatar ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${user.name}`}
|
||||
alt=""
|
||||
alt={user.name}
|
||||
width={avatarSize}
|
||||
height={avatarSize}
|
||||
class="rounded-full aspect-square object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
{/if}
|
||||
{user.name}
|
||||
|
||||
Reference in new issue
Block a user