misc: I haven't eaten in 16 hours brb gonna get some food
This commit is contained in:
1 parent
a363fe3baf
commit
eb006ed982
21 files changed
+157
-89
No files matched your search
@@ -8,6 +8,14 @@
|
||||
import { getInstance } from '$lib/lemmy.js'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import PostActions from '$lib/components/lemmy/PostActions.svelte'
|
||||
import Badge from '$lib/components/ui/Badge.svelte'
|
||||
import {
|
||||
Bookmark,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
Link,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let postRes: PostView
|
||||
export { postRes as post }
|
||||
@@ -37,9 +45,22 @@
|
||||
</span>
|
||||
</div>
|
||||
{#if postRes.post.nsfw}
|
||||
<span class="bg-red-600 px-1 py-0.5 rounded-md text-xs ml-auto font-bold">
|
||||
NSFW
|
||||
</span>
|
||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
||||
{/if}
|
||||
{#if postRes.saved}
|
||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
||||
<Icon src={Bookmark} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if postRes.post.deleted || postRes.post.removed}
|
||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if postRes.post.featured_community || postRes.post.featured_local}
|
||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
||||
<Icon src={InformationCircle} mini width={16} />
|
||||
</Badge>
|
||||
{/if}
|
||||
</span>
|
||||
<a
|
||||
@@ -48,32 +69,53 @@
|
||||
>
|
||||
{postRes.post.name}
|
||||
</a>
|
||||
{#if postRes.post.url}
|
||||
<a
|
||||
href={postRes.post.url}
|
||||
class="text-sky-400 max-w-[24ch] overflow-hidden
|
||||
whitespace-nowrap text-ellipsis text-xs hover:underline"
|
||||
>
|
||||
{postRes.post.url}
|
||||
</a>
|
||||
{/if}
|
||||
{#if isImage(postRes.post.url)}
|
||||
<div class="self-start" class:blur-3xl={postRes.post.nsfw}>
|
||||
<img
|
||||
src="{postRes.post.url}?thumbnail=1024&format=webp"
|
||||
alt={postRes.post.name}
|
||||
class="rounded-md max-h-[32rem] w-full max-w-full"
|
||||
loading="lazy"
|
||||
/>
|
||||
<picture
|
||||
class="rounded-md overflow-hidden max-h-[min(50vh,500px)] w-full max-w-full"
|
||||
>
|
||||
<source
|
||||
srcset="{postRes.post.url}?thumbnail=256&format=webp"
|
||||
media="(max-width: 256px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{postRes.post.url}?thumbnail=512&format=webp"
|
||||
media="(max-width: 512px)"
|
||||
/>
|
||||
<source
|
||||
srcset="{postRes.post.url}?thumbnail=720&format=webp"
|
||||
media="(max-width: 720px)"
|
||||
/>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<img
|
||||
src="{postRes.post.url}?thumbnail=1024&format=webp"
|
||||
loading="lazy"
|
||||
class="object-cover bg-slate-100 rounded-md max-h-[50vh] w-full"
|
||||
width={512}
|
||||
height={300}
|
||||
/>
|
||||
</picture>
|
||||
</div>
|
||||
{:else if postRes.post.thumbnail_url}
|
||||
<div class="self-start" class:blur-3xl={postRes.post.nsfw}>
|
||||
{:else if postRes.post.thumbnail_url && postRes.post.url}
|
||||
<a
|
||||
href={postRes.post.url}
|
||||
class="self-start relative group"
|
||||
class:blur-3xl={postRes.post.nsfw}
|
||||
>
|
||||
<img
|
||||
src={postRes.post.thumbnail_url}
|
||||
alt={postRes.post.name}
|
||||
class="rounded-md max-h-[16rem] w-full max-w-full"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
class="w-full px-4 py-2 overflow-hidden
|
||||
whitespace-nowrap text-ellipsis text-sm group-hover:underline bg-slate-100 border
|
||||
absolute bottom-0 rounded-b-md flex flex-row gap-1 items-center"
|
||||
>
|
||||
<Icon src={Link} width={16} mini />
|
||||
{new URL(postRes.post.url).hostname}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{#if postRes.post.body && !postRes.post.nsfw}
|
||||
<p
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} width={16} height={16} mini />
|
||||
</button>
|
||||
<span class="opacity-80 my-1 py-1 text-xs mx-4">Comment actions</span>
|
||||
{#if $authData?.token}
|
||||
<MenuButton on:click={save}>
|
||||
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
|
||||
|
||||
@@ -48,14 +48,16 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="max-w-lg flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-2 relative">
|
||||
<TextArea
|
||||
rows={3}
|
||||
rows={4}
|
||||
placeholder="What are you thinking?"
|
||||
class="bg-slate-100 dark:bg-zinc-900"
|
||||
bind:value={newComment}
|
||||
/>
|
||||
<div class="w-24 ml-auto flex flex-row gap-2">
|
||||
<div
|
||||
class="w-full ml-auto flex flex-row gap-2 md:w-24 md:absolute md:bottom-0 md:right-0 md:m-2"
|
||||
>
|
||||
<Button
|
||||
large
|
||||
on:click={submit}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||
import { authData, getClient } from '$lib/lemmy.js'
|
||||
import type { Post } from 'lemmy-js-client'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
const maxComments = 250
|
||||
|
||||
@@ -57,11 +59,12 @@
|
||||
</script>
|
||||
|
||||
<ul
|
||||
in:fly={{ opacity: 0, y: -4 }}
|
||||
class={isParent
|
||||
? ''
|
||||
: 'ml-2.5 mt-2 pl-2.5 border-l-2 border-black/10 dark:border-white/10'}
|
||||
>
|
||||
{#each nodes.slice(0, maxComments) as node}
|
||||
{#each nodes.slice(0, maxComments) as node (node.comment_view.comment.id)}
|
||||
<Comment
|
||||
postId={post.id}
|
||||
{node}
|
||||
@@ -72,10 +75,11 @@
|
||||
<svelte:self {post} nodes={node.children} isParent={false} />
|
||||
{/if}
|
||||
{#if node.comment_view.counts.child_count > 0 && node.children.length == 0}
|
||||
<div class="m-1">
|
||||
<div class="my-2 w-36 h-8">
|
||||
<Button
|
||||
loading={loadingChildren}
|
||||
disabled={loadingChildren}
|
||||
large
|
||||
on:click={() => fetchChildren(node)}
|
||||
>
|
||||
<Icon src={ChevronDown} width={16} mini />
|
||||
|
||||
Reference in new issue
Block a user