design: improve post page
This commit is contained in:
1 parent
160622e760
commit
9bde0e5686
4 files changed
+63
-35
No files matched your search
@@ -17,7 +17,7 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { afterNavigate } from '$app/navigation'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
// 0.18.2 -> 0.18.3 broke this
|
||||
// so i'm adding this check
|
||||
const treeParent = tree.find(
|
||||
(c) => c.comment_view.comment.id == parent.comment_view.comment.id,
|
||||
(c) => c.comment_view.comment.id == parent.comment_view.comment.id
|
||||
)
|
||||
|
||||
if (treeParent) {
|
||||
@@ -107,7 +107,7 @@
|
||||
</script>
|
||||
|
||||
<ul
|
||||
in:fly={{ opacity: 0, y: -4, duration: 400, easing: backOut }}
|
||||
in:fly={{ duration: 500, easing: expoOut, y: -12 }}
|
||||
class={isParent
|
||||
? 'divide-y dark:divide-zinc-900 divide-slate-100'
|
||||
: 'pl-3.5 border-l border-slate-200 dark:border-zinc-800 my-1'}
|
||||
@@ -140,7 +140,7 @@
|
||||
fetchChildren(node).then(() => (node.loading = false))
|
||||
}}
|
||||
>
|
||||
<Icon src={ChevronDoubleDown} mini size="16" slot="prefix" />
|
||||
<Icon src={ChevronDoubleDown} micro size="16" slot="prefix" />
|
||||
{$t('comment.more', {
|
||||
// @ts-ignore
|
||||
comments: node.comment_view.counts.child_count,
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
</Label>
|
||||
{/if}
|
||||
<div
|
||||
class="flex flex-col border border-slate-200 border-b-slate-300 dark:border-t-zinc-700 dark:border-zinc-800
|
||||
class="flex flex-col border border-slate-200 border-b-slate-300 dark:border-t-zinc-700/70 dark:border-zinc-800
|
||||
focus-within:border-primary-900 focus-within:dark:border-primary-100 focus-within:ring ring-slate-300
|
||||
dark:ring-zinc-700 rounded-xl
|
||||
overflow-hidden transition-colors {$$props.class}"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
urlObj.searchParams.append('format', 'webp')
|
||||
urlObj.searchParams.append(
|
||||
'thumbnail',
|
||||
findClosestNumber(sizes, (res || width) * 1.5).toString(),
|
||||
findClosestNumber(sizes, (res || width) * 1.5).toString()
|
||||
)
|
||||
|
||||
return urlObj.toString()
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
{#if optimizedURL}
|
||||
<img
|
||||
loading="lazy"
|
||||
src={optimizedURL}
|
||||
{alt}
|
||||
{width}
|
||||
{title}
|
||||
loading="lazy"
|
||||
class="aspect-square object-cover overflow-hidden {$$props.class} flex-shrink-0"
|
||||
style="width: {width}px; height: {width}px;"
|
||||
class:rounded-full={circle}
|
||||
|
||||
@@ -22,7 +22,14 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import PostLink from '$lib/components/lemmy/post/link/PostLink.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Material, Select, Spinner, removeToast, toast } from 'mono-svelte'
|
||||
import {
|
||||
Material,
|
||||
Select,
|
||||
Spinner,
|
||||
buttonColor,
|
||||
removeToast,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import type { CommentSortType } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { instance } from '$lib/instance.js'
|
||||
@@ -315,30 +322,13 @@
|
||||
</div>
|
||||
{/if}
|
||||
<section class="mt-4 flex flex-col gap-2 w-full">
|
||||
<header class="flex flex-row justify-between flex-wrap gap-2">
|
||||
<header>
|
||||
<div class="text-base">
|
||||
<span class="font-bold">
|
||||
<FormattedNumber number={post.post_view.counts.comments} />
|
||||
</span>
|
||||
{$t('routes.post.commentCount')}
|
||||
</div>
|
||||
<div class="gap-2 flex items-center h-full">
|
||||
<Select
|
||||
size="md"
|
||||
class="h-full"
|
||||
bind:value={commentSort}
|
||||
on:change={reloadComments}
|
||||
>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">{$t('filter.sort.controversial')}</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
{#await data.comments}
|
||||
<div class="space-y-4">
|
||||
@@ -353,15 +343,36 @@
|
||||
{:then comments}
|
||||
{#if $profile?.jwt}
|
||||
{#if !commenting}
|
||||
<Button
|
||||
rounding="pill"
|
||||
class="mx-auto"
|
||||
size="lg"
|
||||
on:click={() => (commenting = true)}
|
||||
>
|
||||
<Icon src={PlusCircle} size="16" micro />
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
<EndPlaceholder>
|
||||
<Button
|
||||
rounding="pill"
|
||||
class="mx-auto"
|
||||
size="lg"
|
||||
on:click={() => (commenting = true)}
|
||||
>
|
||||
<Icon src={PlusCircle} size="16" micro />
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
|
||||
<div class="gap-2 flex items-center" slot="action">
|
||||
<Select
|
||||
size="md"
|
||||
bind:value={commentSort}
|
||||
on:change={reloadComments}
|
||||
>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
</EndPlaceholder>
|
||||
{:else}
|
||||
<CommentForm
|
||||
postId={post.post_view.post.id}
|
||||
@@ -387,6 +398,23 @@
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if commenting || !$profile.jwt}
|
||||
<div class="gap-2 flex items-center">
|
||||
<Select size="md" bind:value={commentSort} on:change={reloadComments}>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
<Comments
|
||||
post={post.post_view.post}
|
||||
nodes={buildCommentsTree(
|
||||
|
||||
Reference in new issue
Block a user