refactor: switch headers to barrel
This commit is contained in:
56 files changed
+96
-83
No files matched your search
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
@@ -20,14 +19,14 @@
|
||||
Minus,
|
||||
Pencil,
|
||||
Plus,
|
||||
ShieldCheck,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { slide } from 'svelte/transition'
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import CommentForm from './CommentForm.svelte'
|
||||
import type { CommentNodeI } from './comments.svelte'
|
||||
import { CommentActions, CommentForm } from '.'
|
||||
|
||||
interface Props {
|
||||
node: CommentNodeI
|
||||
@@ -154,10 +153,22 @@
|
||||
>
|
||||
{#snippet extraBadges()}
|
||||
{#if node.comment_view.creator_is_moderator}
|
||||
<ShieldIcon filled width={14} class="text-green-500" />
|
||||
<Icon
|
||||
src={ShieldCheck}
|
||||
size="14"
|
||||
micro
|
||||
class="text-green-500"
|
||||
aria-label={$t('class.moderator')}
|
||||
/>
|
||||
{/if}
|
||||
{#if node.comment_view.creator_is_admin}
|
||||
<ShieldIcon filled width={14} class="text-red-500" />
|
||||
<Icon
|
||||
src={ShieldCheck}
|
||||
size="16"
|
||||
micro
|
||||
class="text-red-500"
|
||||
aria-label={$t('class.admin')}
|
||||
/>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</UserLink>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentVote from '$lib/components/lemmy/comment/CommentVote.svelte'
|
||||
import type { CommentView } from '$lib/client/types'
|
||||
import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte'
|
||||
import {
|
||||
amMod,
|
||||
@@ -10,7 +10,6 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { deleteItem, save } from '$lib/lemmy/contentview.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { CommentView } from '$lib/client/types'
|
||||
import { Button, Menu, MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
Bookmark,
|
||||
@@ -23,6 +22,7 @@
|
||||
Share,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { CommentVote } from '.'
|
||||
|
||||
interface Props {
|
||||
comment: CommentView
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient, site } from '$lib/client/lemmy.svelte'
|
||||
import { client, site } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { placeholders } from '$lib/util.svelte.js'
|
||||
import type { CommentResponse } from '$lib/client/types'
|
||||
@@ -56,7 +56,7 @@
|
||||
loading = true
|
||||
|
||||
try {
|
||||
const response = await getClient().createComment({
|
||||
const response = await client().createComment({
|
||||
content: value,
|
||||
post_id: postId,
|
||||
parent_id: parentId,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import type { CommentView } from '$lib/client/types'
|
||||
@@ -7,6 +6,7 @@
|
||||
import { ArrowUturnUp, Icon } from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { PostMeta } from '../post'
|
||||
import { Comment } from '.'
|
||||
|
||||
interface Props {
|
||||
comment: CommentView
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { Post } from '$lib/client/types'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
@@ -34,7 +33,7 @@
|
||||
try {
|
||||
parent.loading = true
|
||||
|
||||
const newComments = await getClient(page.params.instance).getComments({
|
||||
const newComments = await client().getComments({
|
||||
max_depth: 5,
|
||||
parent_id: parent.comment_view.comment.id,
|
||||
type_: 'All',
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
export { default as Comment } from './Comment.svelte'
|
||||
export { default as CommentActions } from './CommentActions.svelte'
|
||||
export { default as CommentForm } from './CommentForm.svelte'
|
||||
export { default as CommentItem } from './CommentItem.svelte'
|
||||
export { default as CommentListVirtualizer } from './CommentListVirtualizer.svelte'
|
||||
export { default as CommentTree } from './CommentTree.svelte'
|
||||
export { default as CommentVote } from './CommentVote.svelte'
|
||||
|
||||
export * from './comments.svelte'
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
@@ -18,6 +17,7 @@
|
||||
import { amMod, isAdmin } from './moderation'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Post } from '../post'
|
||||
import { Comment } from '../comment'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { preventDefault, run } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
@@ -15,6 +14,7 @@
|
||||
import PrivateMessage from '../inbox/PrivateMessage.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Post } from '../post'
|
||||
import { Comment } from '../comment'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { Header } from '$lib/components/ui/layout'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client, site } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
@@ -24,8 +24,8 @@
|
||||
TextArea,
|
||||
TextInput,
|
||||
toast,
|
||||
Option,
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import {
|
||||
ArrowPath,
|
||||
@@ -96,15 +96,7 @@
|
||||
let communities: Community[] = $state([])
|
||||
|
||||
onMount(async () => {
|
||||
if (editingPost) {
|
||||
data.url = editingPost.url ?? ''
|
||||
data.body = editingPost.body ?? ''
|
||||
data.title = editingPost.name
|
||||
data.nsfw = editingPost.nsfw
|
||||
data.alt_text = editingPost.alt_text
|
||||
data.thumbnail = editingPost.thumbnail_url
|
||||
data.language_id = editingPost.language_id.toString()
|
||||
}
|
||||
if (editingPost) Object.assign(data, editingPost)
|
||||
|
||||
if (passedCommunity) {
|
||||
data.community = passedCommunity
|
||||
@@ -121,7 +113,6 @@
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
// @ts-expect-error TODO get rid of sessionStorage stuff
|
||||
if (saveDraft) setSessionStorage('postDraft', data)
|
||||
})
|
||||
|
||||
@@ -134,7 +125,6 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!data.title || !profile.current?.jwt) return
|
||||
if (data.url && data.url != '') {
|
||||
try {
|
||||
new URL(data.url)
|
||||
|
||||
@@ -947,5 +947,9 @@
|
||||
"title": "Add a post title",
|
||||
"body": "What do you have to say?",
|
||||
"comments": "Join the conversation"
|
||||
},
|
||||
"class": {
|
||||
"moderator": "Moderator",
|
||||
"admin": "Administrator"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user