14 files changed
+182
-9
No files matched your search
@@ -30,5 +30,6 @@
|
|||||||
class="w-full px-3 text-sm py-2.5 bg-white dark:bg-black
|
class="w-full px-3 text-sm py-2.5 bg-white dark:bg-black
|
||||||
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
|
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
|
||||||
focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
|
focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
|
||||||
|
{...$$restProps}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
${value.length != 0 ? 'invalid:border-red-400' : ''}
|
${value.length != 0 ? 'invalid:border-red-400' : ''}
|
||||||
w-full px-3 text-sm py-2.5 bg-white dark:bg-zinc-950
|
w-full px-3 text-sm py-2.5 bg-white dark:bg-zinc-950
|
||||||
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
|
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
|
||||||
focus:outline-none focus:border-black transition-colors rounded-md
|
focus:outline-none focus:border-black transition-colors rounded-md disabled:bg-slate-200 disabled:bg-zinc-800 disabled:opacity-70
|
||||||
${$$props.class}
|
${$$props.class}
|
||||||
`
|
`
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
export let node: CommentNodeI
|
export let node: CommentNodeI
|
||||||
export let postId: number
|
export let postId: number
|
||||||
export let op: boolean = false
|
export let op: boolean = false
|
||||||
|
export let actions: boolean = true
|
||||||
|
|
||||||
export let open = true
|
export let open = true
|
||||||
export let replying = false
|
export let replying = false
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<li
|
<li
|
||||||
class="py-2 {node.depth == 0
|
class="py-2 pb-3 {node.depth == 0
|
||||||
? 'border-b border-slate-200 dark:border-zinc-800'
|
? 'border-b border-slate-200 dark:border-zinc-800'
|
||||||
: ''}"
|
: ''}"
|
||||||
id="#{node.comment_view.comment.id.toString()}"
|
id="#{node.comment_view.comment.id.toString()}"
|
||||||
@@ -140,6 +141,7 @@
|
|||||||
<div class="max-w-full mt-0.5 break-words text-sm leading-[22px]">
|
<div class="max-w-full mt-0.5 break-words text-sm leading-[22px]">
|
||||||
<Markdown source={node.comment_view.comment.content} />
|
<Markdown source={node.comment_view.comment.content} />
|
||||||
</div>
|
</div>
|
||||||
|
{#if actions}
|
||||||
<div class="flex flex-row gap-2 items-center h-[26px]">
|
<div class="flex flex-row gap-2 items-center h-[26px]">
|
||||||
<CommentActions
|
<CommentActions
|
||||||
comment={node.comment_view}
|
comment={node.comment_view}
|
||||||
@@ -147,6 +149,7 @@
|
|||||||
on:edit={() => (editing = true)}
|
on:edit={() => (editing = true)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if replying}
|
{#if replying}
|
||||||
<div class="max-w-sm my-2">
|
<div class="max-w-sm my-2">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
BookmarkSlash,
|
BookmarkSlash,
|
||||||
ChatBubbleOvalLeft,
|
ChatBubbleOvalLeft,
|
||||||
EllipsisHorizontal,
|
EllipsisHorizontal,
|
||||||
|
Flag,
|
||||||
Icon,
|
Icon,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
Trash,
|
Trash,
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { isCommentMutable } from '$lib/components/lemmy/post/helpers.js'
|
import { isCommentMutable } from '$lib/components/lemmy/post/helpers.js'
|
||||||
|
import { report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
|
|
||||||
export let comment: CommentView
|
export let comment: CommentView
|
||||||
export let replying: boolean = false
|
export let replying: boolean = false
|
||||||
@@ -114,6 +116,15 @@
|
|||||||
<span>Delete</span>
|
<span>Delete</span>
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if $authData && $user?.person.id != comment.creator.id}
|
||||||
|
<MenuButton
|
||||||
|
on:click={() => report(comment)}
|
||||||
|
color={Color.dangerSecondary}
|
||||||
|
>
|
||||||
|
<Icon src={Flag} mini size="16" />
|
||||||
|
<span>Report</span>
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { modals } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
|
import ReportModal from './ReportModal.svelte'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ReportModal bind:open={$modals.reporting.open} item={$modals.reporting.item} />
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
|
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||||
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||||
|
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||||
|
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||||
|
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
|
import { authData, getClient } from '$lib/lemmy.js'
|
||||||
|
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||||
|
|
||||||
|
export let open: boolean
|
||||||
|
export let item: PostView | CommentView | undefined = undefined
|
||||||
|
|
||||||
|
const isComment = (item: PostView | CommentView): item is CommentView =>
|
||||||
|
'comment' in item
|
||||||
|
|
||||||
|
const isPost = (item: PostView | CommentView): item is PostView =>
|
||||||
|
!isComment(item)
|
||||||
|
|
||||||
|
let loading = false
|
||||||
|
let reason = ''
|
||||||
|
|
||||||
|
async function report() {
|
||||||
|
if (!item || !$authData) return
|
||||||
|
loading = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isComment(item)) {
|
||||||
|
await getClient().createCommentReport({
|
||||||
|
auth: $authData.token,
|
||||||
|
comment_id: item.comment.id,
|
||||||
|
reason: reason,
|
||||||
|
})
|
||||||
|
} else if (isPost(item)) {
|
||||||
|
await getClient().createPostReport({
|
||||||
|
auth: $authData.token,
|
||||||
|
post_id: item.post.id,
|
||||||
|
reason: reason,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
toast({
|
||||||
|
content: 'That submission has been reported.',
|
||||||
|
type: ToastType.success,
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
toast({ content: err as any, type: ToastType.error })
|
||||||
|
}
|
||||||
|
|
||||||
|
loading = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetText = () => (reason = '')
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if (item) {
|
||||||
|
resetText()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal bind:open>
|
||||||
|
<h1 class="font-bold text-2xl" slot="title">Report</h1>
|
||||||
|
<form class="flex flex-col gap-4" on:submit|preventDefault={report}>
|
||||||
|
{#if item}
|
||||||
|
<span>Reporting this submission</span>
|
||||||
|
<div class="pointer-events-none list-none">
|
||||||
|
{#if isComment(item)}
|
||||||
|
<Comment
|
||||||
|
actions={false}
|
||||||
|
node={{
|
||||||
|
children: [],
|
||||||
|
comment_view: item,
|
||||||
|
depth: 1,
|
||||||
|
loading: false,
|
||||||
|
}}
|
||||||
|
postId={item.post.id}
|
||||||
|
/>
|
||||||
|
{:else if isPost(item)}
|
||||||
|
<Post actions={false} post={item} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<TextArea
|
||||||
|
required
|
||||||
|
rows={3}
|
||||||
|
label="Reason"
|
||||||
|
placeholder="he's being a meanie :("
|
||||||
|
bind:value={reason}
|
||||||
|
/>
|
||||||
|
<Button submit {loading} disabled={loading} color="primary" size="lg">
|
||||||
|
Submit
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</Modal>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||||
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
|
interface Modals {
|
||||||
|
reporting: {
|
||||||
|
open: boolean
|
||||||
|
item: PostView | CommentView | undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export let modals = writable<Modals>({
|
||||||
|
reporting: {
|
||||||
|
open: false,
|
||||||
|
item: undefined,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export function report(item: PostView | CommentView) {
|
||||||
|
modals.update((m) => ({
|
||||||
|
...m,
|
||||||
|
reporting: {
|
||||||
|
open: true,
|
||||||
|
item: item,
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
|
|
||||||
export let post: PostView
|
export let post: PostView
|
||||||
|
|
||||||
|
export let actions: boolean = true
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
|
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
|
||||||
@@ -111,6 +113,7 @@
|
|||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if actions}
|
||||||
<PostActions
|
<PostActions
|
||||||
{post}
|
{post}
|
||||||
on:edit={(e) => {
|
on:edit={(e) => {
|
||||||
@@ -123,4 +126,5 @@
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
</Card>
|
</Card>
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
BookmarkSlash,
|
BookmarkSlash,
|
||||||
ChatBubbleOvalLeft,
|
ChatBubbleOvalLeft,
|
||||||
EllipsisHorizontal,
|
EllipsisHorizontal,
|
||||||
|
Flag,
|
||||||
Icon,
|
Icon,
|
||||||
Newspaper,
|
Newspaper,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||||
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
||||||
|
import { report } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
|
|
||||||
export let post: PostView
|
export let post: PostView
|
||||||
|
|
||||||
@@ -142,12 +144,18 @@
|
|||||||
<Icon src={post.saved ? BookmarkSlash : Bookmark} width={16} mini />
|
<Icon src={post.saved ? BookmarkSlash : Bookmark} width={16} mini />
|
||||||
{post.saved ? 'Unsave' : 'Save'}
|
{post.saved ? 'Unsave' : 'Save'}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
|
||||||
{#if $user && isMutable(post, $user)}
|
{#if $user && isMutable(post, $user)}
|
||||||
<MenuButton on:click={deletePost} color={Color.dangerSecondary}>
|
<MenuButton on:click={deletePost} color={Color.dangerSecondary}>
|
||||||
<Icon src={Trash} width={16} mini />
|
<Icon src={Trash} width={16} mini />
|
||||||
Delete
|
Delete
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if $user?.person.id != post.creator.id}
|
||||||
|
<MenuButton on:click={() => report(post)} color={Color.dangerSecondary}>
|
||||||
|
<Icon src={Flag} width={16} mini />
|
||||||
|
Report
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,6 +64,14 @@
|
|||||||
@apply list-decimal pl-4 leading-3;
|
@apply list-decimal pl-4 leading-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown :global(ul > *) {
|
||||||
|
@apply leading-[22px];
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown :global(ol > *) {
|
||||||
|
@apply leading-[22px];
|
||||||
|
}
|
||||||
|
|
||||||
.markdown :global(li) {
|
.markdown :global(li) {
|
||||||
@apply m-0 leading-[22px] !important;
|
@apply m-0 leading-[22px] !important;
|
||||||
}
|
}
|
||||||
@@ -75,4 +83,8 @@
|
|||||||
.markdown :global(blockquote) {
|
.markdown :global(blockquote) {
|
||||||
@apply border-l-2 border-black/20 dark:border-white/20 pl-2 my-1 h-max;
|
@apply border-l-2 border-black/20 dark:border-white/20 pl-2 my-1 h-max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown :global(p) {
|
||||||
|
@apply leading-[22px];
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import Button from '$lib/components/input/Button.svelte'
|
import Button from '$lib/components/input/Button.svelte'
|
||||||
import Card from '$lib/components/ui/Card.svelte'
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
|
import { Icon, XMark } from 'svelte-hero-icons'
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
import { fade, scale } from 'svelte/transition'
|
import { fade, scale } from 'svelte/transition'
|
||||||
|
|
||||||
@@ -23,15 +24,18 @@ flex flex-col items-center justify-center bg-black/50 backdrop-blur-sm"
|
|||||||
<div
|
<div
|
||||||
on:click|stopPropagation={() => {}}
|
on:click|stopPropagation={() => {}}
|
||||||
transition:scale={{ start: 0.9, easing: expoOut }}
|
transition:scale={{ start: 0.9, easing: expoOut }}
|
||||||
class={$$props.class}
|
class="overflow-y-auto {$$props.class} my-4 rounded-xl"
|
||||||
>
|
>
|
||||||
<Card class="w-[calc(100vw-1rem)] dark:!bg-zinc-950 rounded-xl max-w-xl">
|
<Card class="w-[calc(100vw-1rem)] dark:!bg-zinc-950 rounded-xl max-w-xl">
|
||||||
<div class="p-6 flex flex-col gap-4">
|
<div class="p-6 flex flex-col gap-4">
|
||||||
{#if $$slots.title}
|
<div class="flex flex-row">
|
||||||
<h1 class="font-bold text-2xl">
|
<h1 class="font-bold text-2xl w-max">
|
||||||
<slot name="title" />
|
<slot name="title" />
|
||||||
</h1>
|
</h1>
|
||||||
{/if}
|
<Button class="!p-2 ml-auto" on:click={() => (open = false)}>
|
||||||
|
<Icon src={XMark} mini size="16" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
{#if action}
|
{#if action}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
|||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
|
|
||||||
|
export const LINKED_INSTANCE_URL = env.PUBLIC_INSTANCE_URL
|
||||||
export const DEFAULT_INSTANCE_URL = env.PUBLIC_INSTANCE_URL || 'lemm.ee'
|
export const DEFAULT_INSTANCE_URL = env.PUBLIC_INSTANCE_URL || 'lemm.ee'
|
||||||
export let instance = writable(DEFAULT_INSTANCE_URL)
|
export let instance = writable(DEFAULT_INSTANCE_URL)
|
||||||
export let corsSupported = writable(true)
|
export let corsSupported = writable(true)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import nProgress from 'nprogress'
|
import nProgress from 'nprogress'
|
||||||
import 'nprogress/nprogress.css'
|
import 'nprogress/nprogress.css'
|
||||||
import ToastContainer from '$lib/components/ui/toasts/ToastContainer.svelte'
|
import ToastContainer from '$lib/components/ui/toasts/ToastContainer.svelte'
|
||||||
|
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||||
|
|
||||||
nProgress.configure({
|
nProgress.configure({
|
||||||
minimum: 0.4,
|
minimum: 0.4,
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
|
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<ToastContainer />
|
<ToastContainer />
|
||||||
|
<Moderation />
|
||||||
<main class="mx-auto max-w-5xl p-4 flex-1 w-full">
|
<main class="mx-auto max-w-5xl p-4 flex-1 w-full">
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
@@ -10,15 +10,15 @@
|
|||||||
} from '$lib/components/ui/toasts/toasts.js'
|
} from '$lib/components/ui/toasts/toasts.js'
|
||||||
import {
|
import {
|
||||||
DEFAULT_INSTANCE_URL,
|
DEFAULT_INSTANCE_URL,
|
||||||
|
LINKED_INSTANCE_URL,
|
||||||
authData,
|
authData,
|
||||||
getClient,
|
getClient,
|
||||||
user,
|
user,
|
||||||
validateInstance,
|
validateInstance,
|
||||||
} from '$lib/lemmy.js'
|
} from '$lib/lemmy.js'
|
||||||
import { Color } from '$lib/ui/colors.js'
|
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
instance: '',
|
instance: DEFAULT_INSTANCE_URL,
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
totp: '',
|
totp: '',
|
||||||
@@ -89,6 +89,7 @@
|
|||||||
id="instance_url"
|
id="instance_url"
|
||||||
label="Instance URL"
|
label="Instance URL"
|
||||||
placeholder={DEFAULT_INSTANCE_URL}
|
placeholder={DEFAULT_INSTANCE_URL}
|
||||||
|
disabled={LINKED_INSTANCE_URL != undefined}
|
||||||
bind:value={data.instance}
|
bind:value={data.instance}
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
required
|
required
|
||||||
|
|||||||
Reference in new issue
Block a user