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