prettier: format project

This commit is contained in:
James Xylight committed 2025-09-06 22:25:07 -07:00
1 parent e7dd3e8dac
commit cbd27a38a0
94 files changed
+261 -252

No files matched your search

@@ -34,7 +34,7 @@
{#if type == 'community'}
<Search
search={async q => {
search={async (q) => {
const results = await getClient(instance).search({
q: q || ' ',
type_: 'Communities',
@@ -43,9 +43,9 @@
sort: 'TopAll',
})
return results.communities.map(c => c.community)
return results.communities.map((c) => c.community)
}}
extractName={c => `${c.title}@${new URL(c.actor_id).hostname}`}
extractName={(c) => `${c.title}@${new URL(c.actor_id).hostname}`}
bind:query={q}
{...rest}
>
@@ -79,16 +79,16 @@
</Search>
{:else if type == 'instance'}
<Search
search={async q => {
search={async (q) => {
const results = (await instances) || {}
return q
? (results.federated_instances?.linked || []).filter(
i => i.software === 'lemmy' && i.domain.includes(q),
(i) => i.software === 'lemmy' && i.domain.includes(q),
)
: []
}}
extractName={i => `${i.domain}`}
extractName={(i) => `${i.domain}`}
bind:query={q}
{...rest}
>
+1 -1
View File
@@ -147,7 +147,7 @@
</span>
{/snippet}
<ItemList
items={admins.map(i => ({
items={admins.map((i) => ({
id: i.person.id,
name: i.person.display_name || i.person.name,
url: userLink(i.person),
@@ -94,7 +94,7 @@
<div>{$t('form.edit')}</div>
{/snippet}
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
save(replying ? 'reply' : 'edit')
}}
@@ -262,7 +262,7 @@
label={$t('comment.reply')}
{postId}
parentId={node.comment_view.comment.id}
oncomment={e => {
oncomment={(e) => {
node.children = [
{
children: [],
@@ -19,8 +19,8 @@
}, 100)
}
const observer = new ResizeObserver(entries => {
entries.forEach(entry => {
const observer = new ResizeObserver((entries) => {
entries.forEach((entry) => {
if (offsetEl) {
initialOffset =
entry.target.getBoundingClientRect().top + window.scrollY
@@ -50,7 +50,7 @@
{#snippet item(index)}
<div class={['px-3 sm:px-6', index % 2 == 1 && '']}>
<Comments
bind:nodes={() => [nodes[index]], v => (nodes[index] = v[0])}
bind:nodes={() => [nodes[index]], (v) => (nodes[index] = v[0])}
{post}
/>
</div>
@@ -54,7 +54,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) {
@@ -33,7 +33,7 @@
</script>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
submit()
}}
@@ -29,7 +29,7 @@
if (isPostView(item))
return await client()
.listPostLikes({ post_id: item.post.id, limit: 50, page: page })
.then(i => i.post_likes)
.then((i) => i.post_likes)
if (isCommentView(item))
return await client()
.listCommentLikes({
@@ -37,7 +37,7 @@
limit: 50,
page: page,
})
.then(i => i.comment_likes)
.then((i) => i.comment_likes)
return []
}
@@ -55,7 +55,7 @@ export const modals = writable<Modals>({
})
export function report(item: PostView | CommentView | PrivateMessageView) {
modals.update(m => ({
modals.update((m) => ({
...m,
reporting: {
open: true,
@@ -65,7 +65,7 @@ export function report(item: PostView | CommentView | PrivateMessageView) {
}
export function remove(item: SubmissionView, purge: boolean = false) {
modals.update(m => ({
modals.update((m) => ({
...m,
removing: {
open: true,
@@ -76,7 +76,7 @@ export function remove(item: SubmissionView, purge: boolean = false) {
}
export function ban(banned: boolean, item: Person, community?: Community) {
modals.update(m => ({
modals.update((m) => ({
...m,
banning: {
open: true,
@@ -95,7 +95,7 @@ export async function feature(featured: boolean, item: Comment, jwt: string) {
}
export async function viewVotes(item: PostView | CommentView) {
modals.update(m => ({
modals.update((m) => ({
...m,
votes: {
open: true,
@@ -105,7 +105,7 @@ export async function viewVotes(item: PostView | CommentView) {
}
export const amMod = (me: MyUserInfo, community: Community) =>
me.moderates.map(c => c.community.id).includes(community.id) ||
me.moderates.map((c) => c.community.id).includes(community.id) ||
(community.local && isAdmin(me))
export const amModOfAny = (me?: MyUserInfo) =>
+2 -2
View File
@@ -15,7 +15,7 @@
import PostBody from './PostBody.svelte'
function getTagRule(tags: Tag[]): 'blur-sm' | 'hide' | undefined {
const tagContent = tags.map(t => t.content.toLowerCase())
const tagContent = tags.map((t) => t.content.toLowerCase())
let rule: 'blur-sm' | 'hide' | undefined
if (settings.nsfwBlur && (post.post.nsfw || post.community.nsfw))
@@ -94,7 +94,7 @@
published={publishedToDate(post.post.published)}
{badges}
subscribed={profile.current?.user?.follows
.map(c => c.community.id)
.map((c) => c.community.id)
.includes(post.community.id)
? 'Subscribed'
: 'NotSubscribed'}
@@ -76,8 +76,8 @@
vote = newVote
voteItem(post, newVote)
.then(res => ({ upvotes, downvotes, score } = res))
.catch(e => {
.then((res) => ({ upvotes, downvotes, score } = res))
.catch((e) => {
toast({ content: errorMessage(e), type: 'error' })
})
}
@@ -54,7 +54,7 @@
const abortLoad = new AbortController()
let seenIds = new SvelteSet<number>(
feedData.posts.posts.map(post => post.post.id),
feedData.posts.posts.map((post) => post.post.id),
)
async function loadMore() {
@@ -80,7 +80,7 @@
sort: feedData.sort,
type_: feedData.type_,
})
.catch(e => {
.catch((e) => {
throw new Error(e)
})
@@ -90,7 +90,7 @@
feedData.cursor.next = newPosts.next_page
feedData.posts.posts.push(
...newPosts.posts.filter(post => {
...newPosts.posts.filter((post) => {
if (seenIds.has(post.post.id)) return false
seenIds.add(post.post.id)
return true
@@ -107,7 +107,7 @@
}
const callback: IntersectionObserverCallback = (entries, observer) => {
entries.forEach(entry => {
entries.forEach((entry) => {
if (!entry.isIntersecting) return
const element = entry.target as HTMLElement
@@ -147,7 +147,7 @@
const feed = document.getElementById('feed')
if (!feed) return
new MutationObserver(mutations => {
new MutationObserver((mutations) => {
mutations.forEach(({ addedNodes, removedNodes }) => {
addedNodes.forEach(observePost)
removedNodes.forEach(unobservePost)
@@ -18,7 +18,7 @@ export const combineCrossposts = (
const results: (PostViewWithCrossposts | PostViewWithoutCrossposts)[] = []
const seenUrls = new SvelteSet<string>()
posts?.forEach(post => {
posts?.forEach((post) => {
if (
!post ||
(settings.hidePosts.deleted && post.post.deleted) ||
@@ -116,7 +116,7 @@
limit: 40,
})
communities = list.communities.map(c => c.community)
communities = list.communities.map((c) => c.community)
}
})
@@ -209,7 +209,7 @@
if (res.metadata.description)
data.body = res.metadata.description
.split('\n')
.map(l => `> ${l}`)
.map((l) => `> ${l}`)
.join('\n')
toast({
@@ -254,7 +254,7 @@
{#await import('$lib/components/form/ImageInputModal.svelte') then { default: UploadModal }}
<UploadModal
bind:open={uploadingImage}
bind:imageUrl={() => '', v => (data.url = v)}
bind:imageUrl={() => '', (v) => (data.url = v)}
/>
{/await}
{/if}
@@ -262,7 +262,7 @@
{#if addAltText}
<Modal title={$t('form.post.altText')} bind:open={addAltText}>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
addAltText = !addAltText
}}
@@ -277,7 +277,7 @@
{/if}
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
submit()
}}
@@ -298,7 +298,7 @@
listing_type="All"
label={$t('form.post.community')}
required
onselect={e => {
onselect={(e) => {
const c = e
if (!c) {
data.community = null
@@ -88,11 +88,11 @@
class="absolute bottom-0 left-0 right-0 flex justify-between items-center
rounded-full ml-auto w-max m-2 p-0 gap-1
*:bg-white *:border *:border-slate-200 dark:*:border-zinc-800 dark:*:bg-zinc-900"
onclick={e => e.stopPropagation()}
onclick={(e) => e.stopPropagation()}
>
{#if post.alt_text}
<Button
onclick={e => {
onclick={(e) => {
e.stopPropagation()
modal({
title: 'Alt',
@@ -30,7 +30,7 @@
</script>
<Search
search={async q => {
search={async (q) => {
const users = (
await getClient(instance).search({
q: q || ' ',
@@ -39,15 +39,15 @@
listing_type: listing_type,
sort: 'TopAll',
})
).users.map(c => c.person)
).users.map((c) => c.person)
if (hideOwnUser) {
const myself = profile.current.user?.local_user_view.person.id
return users.filter(c => c.id != myself)
return users.filter((c) => c.id != myself)
}
return users
}}
extractName={c => `${c.name}@${new URL(c.actor_id).hostname}`}
extractName={(c) => `${c.name}@${new URL(c.actor_id).hostname}`}
bind:query={q}
{...rest}
>