misc: tweak comment actions
This commit is contained in:
1 parent
63c0adf2e3
commit
77248a0e4f
4 files changed
+28
-18
No files matched your search
@@ -30,7 +30,7 @@
|
||||
const dispatcher = createEventDispatcher<{ edit: CommentView }>()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-row gap-2 items-center mt-1 h-7 relative">
|
||||
<div class="flex flex-row items-center gap-0.5 mt-1 h-7 relative">
|
||||
<CommentVote
|
||||
bind:score={comment.counts.score}
|
||||
bind:vote={comment.my_vote}
|
||||
@@ -38,7 +38,8 @@
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
color="ghost"
|
||||
color="tertiary"
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
on:click={() => (replying = !replying)}
|
||||
disabled={comment.post.locked}
|
||||
>
|
||||
@@ -51,9 +52,9 @@
|
||||
<Menu placement="bottom">
|
||||
<Button
|
||||
slot="target"
|
||||
class="!p-1"
|
||||
class="!p-1 text-slate-600 dark:text-zinc-400"
|
||||
aria-label="Comment actions"
|
||||
color="ghost"
|
||||
color="tertiary"
|
||||
>
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { Color } from '$lib/ui/colors'
|
||||
import {
|
||||
ArrowDownCircle,
|
||||
ArrowUp,
|
||||
ArrowUpCircle,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
@@ -70,18 +71,20 @@
|
||||
|
||||
<div
|
||||
class="flex flex-row items-center rounded-md transition-all
|
||||
cursor-pointer h-[26px] border border-slate-200
|
||||
cursor-pointer h-full border-slate-200
|
||||
dark:border-zinc-800"
|
||||
>
|
||||
<button
|
||||
on:click={upvote}
|
||||
class="px-1.5 {vote == 1 ? 'dark:text-blue-500 text-blue-600' : ''}"
|
||||
class="pr-1 transition-colors {vote == 1
|
||||
? 'dark:text-blue-500 text-blue-600'
|
||||
: ''}"
|
||||
aria-label="Upvote"
|
||||
>
|
||||
<Icon src={ChevronUp} width={19} mini />
|
||||
<Icon src={ChevronUp} size="20" mini />
|
||||
</button>
|
||||
<span
|
||||
class="text-sm font-medium {voteColor(vote)}"
|
||||
class="text-sm font-medium transition-colors {voteColor(vote)}"
|
||||
class:hidden={$profile?.user?.local_user_view.local_user.show_scores ==
|
||||
false}
|
||||
>
|
||||
@@ -89,12 +92,12 @@ dark:border-zinc-800"
|
||||
</span>
|
||||
<button
|
||||
on:click={downvote}
|
||||
class="px-1.5 {vote == -1
|
||||
class="pl-1 {vote == -1
|
||||
? 'text-red-400'
|
||||
: ''} disabled:pointer-events-none disabled:opacity-50"
|
||||
: ''} transition-colors disabled:pointer-events-none disabled:opacity-50"
|
||||
aria-label="Downvote"
|
||||
disabled={$site?.site_view.local_site.enable_downvotes == false}
|
||||
>
|
||||
<Icon src={ChevronDown} width={19} mini />
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</button>
|
||||
</div>
|
||||
@@ -3,7 +3,13 @@
|
||||
import { buildCommentsTree, type CommentNodeI } from './comments'
|
||||
import { page } from '$app/stores'
|
||||
import { onMount, setContext } from 'svelte'
|
||||
import { ChevronDown, Icon, Plus, PlusCircle } from 'svelte-hero-icons'
|
||||
import {
|
||||
ChevronDoubleDown,
|
||||
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'
|
||||
@@ -15,10 +21,6 @@
|
||||
export let isParent: boolean
|
||||
export let post: Post
|
||||
|
||||
if (isParent) {
|
||||
setContext('comments:tree', nodes)
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (isParent && $page.url.hash) {
|
||||
document.getElementById($page.url.hash)?.scrollIntoView({
|
||||
@@ -29,6 +31,7 @@
|
||||
})
|
||||
|
||||
let loadingChildren = false
|
||||
let childrenPage = 0
|
||||
|
||||
async function fetchChildren(parent: CommentNodeI) {
|
||||
if (
|
||||
@@ -46,6 +49,7 @@
|
||||
max_depth: 5,
|
||||
parent_id: parent.comment_view.comment.id,
|
||||
type_: 'All',
|
||||
page: childrenPage,
|
||||
})
|
||||
|
||||
if (newComments.comments.length == 0) {
|
||||
@@ -84,6 +88,7 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
childrenPage++
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast({
|
||||
@@ -124,12 +129,13 @@
|
||||
size="sm"
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
class="font-normal"
|
||||
on:click={() => {
|
||||
node.loading = true
|
||||
fetchChildren(node).then(() => (node.loading = false))
|
||||
}}
|
||||
>
|
||||
<Icon src={ChevronDown} mini size="16" slot="prefix" />
|
||||
<Icon src={ChevronDoubleDown} mini size="16" slot="prefix" />
|
||||
{node.comment_view.counts.child_count} more
|
||||
</Button>
|
||||
</button>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class="w-[26px] h-[26px] hover:!text-green-500 dark:text-zinc-400 text-slate-600"
|
||||
size="square-md"
|
||||
slot="target"
|
||||
color="ghost"
|
||||
color="tertiary"
|
||||
{...$$restProps}
|
||||
>
|
||||
<ShieldIcon filled width={14} />
|
||||
|
||||
Reference in new issue
Block a user