misc: tweak post page
This commit is contained in:
1 parent
72cfd7a894
commit
e209a22d2c
2 files changed
+28
-16
No files matched your search
@@ -4,7 +4,7 @@
|
||||
import { page } from '$app/stores'
|
||||
import { onMount, setContext } from 'svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||
import { ChevronDown, Icon, Plus, PlusCircle } from 'svelte-hero-icons'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, Post } from 'lemmy-js-client'
|
||||
import { fly } from 'svelte/transition'
|
||||
@@ -112,23 +112,29 @@
|
||||
<svelte:self {post} bind:nodes={node.children} isParent={false} />
|
||||
{/if}
|
||||
{#if node.comment_view.counts.child_count > 0 && node.children.length == 0}
|
||||
<div
|
||||
class="my-2 w-max h-8 border-l-2 border-slate-200 dark:border-zinc-900 pl-2"
|
||||
<button
|
||||
class="w-full my-2 h-8 border-l-2 border-slate-200 dark:border-zinc-800 pl-2 text-left"
|
||||
on:click={() => {
|
||||
node.loading = true
|
||||
fetchChildren(node).then(() => (node.loading = false))
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
loading={node.loading}
|
||||
disabled={node.loading}
|
||||
size="sm"
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
loaderWidth={18}
|
||||
on:click={() => {
|
||||
node.loading = true
|
||||
fetchChildren(node).then(() => (node.loading = false))
|
||||
}}
|
||||
>
|
||||
<Icon src={ChevronDown} width={16} mini slot="icon" />
|
||||
<Icon src={Plus} width={18} mini slot="icon" />
|
||||
{node.comment_view.counts.child_count} more
|
||||
</Button>
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
</Comment>
|
||||
{/each}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -94,7 +95,7 @@
|
||||
type_: 'All',
|
||||
post_id: post.post_view.post.id,
|
||||
sort: commentSort,
|
||||
max_depth: 3,
|
||||
max_depth: data.post.post_view.counts.comments > 100 ? 1 : 3,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -170,7 +171,9 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if post.post_view.post.body}
|
||||
<div class="text-base rounded-md leading-[22px]">
|
||||
<div
|
||||
class="text-sm text-slate-800 dark:text-zinc-300 rounded-md leading-[22px]"
|
||||
>
|
||||
<Markdown source={post.post_view.post.body} />
|
||||
</div>
|
||||
{/if}
|
||||
@@ -221,16 +224,19 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="mt-4 flex flex-col gap-2">
|
||||
<div class="font-bold text-lg">
|
||||
Comments <span class="text-sm font-normal ml-2 opacity-80">
|
||||
{post.post_view.counts.comments}
|
||||
</span>
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="font-bold opacity-80 text-base">
|
||||
Comments <span class="text-lg font-medium ml-2">
|
||||
<FormattedNumber number={post.post_view.counts.comments} />
|
||||
</span>
|
||||
</div>
|
||||
<MultiSelect
|
||||
options={['Hot', 'Top', 'New']}
|
||||
bind:selected={commentSort}
|
||||
on:select={reloadComments}
|
||||
headless
|
||||
/>
|
||||
</div>
|
||||
<MultiSelect
|
||||
options={['Hot', 'Top', 'New']}
|
||||
bind:selected={commentSort}
|
||||
on:select={reloadComments}
|
||||
/>
|
||||
{#if data.singleThread}
|
||||
<Card class="py-2 px-4 text-sm flex flex-row items-center flex-wrap gap-4">
|
||||
<p>You're viewing a single thread.</p>
|
||||
|
||||
Reference in new issue
Block a user