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

+2 -2
View File
@@ -89,7 +89,7 @@
{:then feed}
<FeedComponent
bind:posts={feed.posts.posts}
bind:feedData={() => feed, v => (postFeeds.value.main.data = v)}
bind:feedData={() => feed, (v) => (postFeeds.value.main.data = v)}
feedId="main"
/>
<svelte:element
@@ -107,7 +107,7 @@
{#snippet action()}
<Pageination
cursor={{ next: feed.cursor.next }}
href={page =>
href={(page) =>
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
back={false}
/>
+1 -1
View File
@@ -31,7 +31,7 @@
</div>
{#if data.applications?.value.length >= 40}
<div class="mt-auto">
<Pageination page={data.page} href={page => `?page=${page}`} />
<Pageination page={data.page} href={(page) => `?page=${page}`} />
</div>
{/if}
{:else}
@@ -45,7 +45,7 @@
} else {
reviewing = true
while (reviewing) {
await new Promise(res => setTimeout(res, 1000))
await new Promise((res) => setTimeout(res, 1000))
}
if (!denying) {
denyReason = ''
+2 -2
View File
@@ -20,7 +20,7 @@
ondelete={() => {
data.images.value = data.images.value.toSpliced(
data.images.value.findIndex(
i =>
(i) =>
i.local_image.pictrs_delete_token ==
image.local_image.pictrs_delete_token,
),
@@ -34,6 +34,6 @@
{#if data.images.value.length == 20}
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={page => `?page=${page}`}
href={(page) => `?page=${page}`}
/>
{/if}
+1 -1
View File
@@ -69,7 +69,7 @@
<Button
onclick={() => {
taglines.splice(
taglines.findIndex(i => i == tagline),
taglines.findIndex((i) => i == tagline),
1,
)
+4 -4
View File
@@ -84,9 +84,9 @@
</Header>
{#if profile.current.user}
{#if !data.community.value.discussion_languages.every( l => profile.current.user?.discussion_languages.includes(l), ) && profile.current.user.discussion_languages.length > 0}
{#if !data.community.value.discussion_languages.every( (l) => profile.current.user?.discussion_languages.includes(l), ) && profile.current.user.discussion_languages.length > 0}
{@const missing = data.community.value.discussion_languages.filter(
i => !profile.current.user?.discussion_languages.includes(i),
(i) => !profile.current.user?.discussion_languages.includes(i),
)}
<Note class="p-1! pl-3! flex-col md:flex-row">
<div>{$t('routes.community.languageWarning')}</div>
@@ -110,7 +110,7 @@
<a href="/profile/settings#languages" class="inline-block w-max">
<Badge color="blue-subtle">
<Icon src={Plus} size="16" micro />
{allLanguages.find(i => language == i.id)?.name}
{allLanguages.find((i) => language == i.id)?.name}
</Badge>
</a>
{/each}
@@ -149,7 +149,7 @@
<Pageination
page={data.page}
cursor={{ next: data.cursor.next }}
href={page =>
href={(page) =>
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
>
<span class="flex flex-row items-center gap-1">
@@ -128,7 +128,7 @@
{/snippet}
</CommonList>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
addModerator()
}}
@@ -137,7 +137,7 @@
<div class="w-full">
<UserAutocomplete
listing_type="All"
onselect={p => (formData.newModerator = p.id)}
onselect={(p) => (formData.newModerator = p.id)}
/>
</div>
<Button
@@ -76,7 +76,7 @@
</div>
{#if profile.meta.profiles}
{@const filtered = profile.meta.profiles.filter(
i => i.instance == page.params.instance,
(i) => i.instance == page.params.instance,
)}
<div class="space-y-1">
<div class="font-medium text-sm">
+3 -3
View File
@@ -33,7 +33,7 @@
</script>
<svelte:window
onkeydown={e => {
onkeydown={(e) => {
if (e.target == document.body) searchElement?.focus()
}}
/>
@@ -56,7 +56,7 @@
>
{#if !LINKED_INSTANCE_URL}
{@const instanceSet = new Set(
profile.meta.profiles.map(i => i.instance),
profile.meta.profiles.map((i) => i.instance),
)}
{#if instanceSet.size > 1}
<Option disabled data-label="true">—</Option>
@@ -161,7 +161,7 @@
<Fixate placement="bottom">
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={c => `?page=${c}`}
href={(c) => `?page=${c}`}
/>
</Fixate>
{/if}
+1 -1
View File
@@ -37,7 +37,7 @@
url: undefined,
}}
passedCommunity={community}
onsubmit={e => goto(`/post/${e.post.id}`)}
onsubmit={(e) => goto(`/post/${e.post.id}`)}
>
{#snippet formtitle()}{/snippet}
</PostForm>
+2 -2
View File
@@ -78,7 +78,7 @@
class="relative w-max"
bind:value={
() => data.unreadOnly.value.toString(),
v => (data.unreadOnly.value = v == 'true')
(v) => (data.unreadOnly.value = v == 'true')
}
onchange={() =>
searchParam(
@@ -121,7 +121,7 @@
!data.inbox || (data.inbox.value?.length ?? 0) < (data?.limit ?? 0)
)}
page={data.page}
href={page => `?page=${page}`}
href={(page) => `?page=${page}`}
/>
</Fixate>
{/if}
+2 -2
View File
@@ -61,10 +61,10 @@ export async function load({ url, fetch }) {
const totalNotifs =
type == 'all'
? data.filter(i => i.type != 'private_message' && !i.read).length
? data.filter((i) => i.type != 'private_message' && !i.read).length
: 0
notifications.update(i => ({
notifications.update((i) => ({
applications: i.applications,
reports: i.reports,
inbox: totalNotifs,
+2 -2
View File
@@ -98,7 +98,7 @@
color={item.read ? 'secondary' : 'primary'}
{loading}
disabled={loading}
onclick={e => {
onclick={(e) => {
e.stopPropagation()
markAsRead(!item.read)
}}
@@ -132,7 +132,7 @@
color={item.read ? 'secondary' : 'primary'}
{loading}
disabled={loading}
onclick={e => {
onclick={(e) => {
e.stopPropagation()
markAsRead(!item.read)
}}
+6 -6
View File
@@ -36,7 +36,7 @@
function filterDuplicates<T, K>(array: T[], predicate: (item: T) => K): T[] {
const seen = new SvelteSet()
return array.filter(element => {
return array.filter((element) => {
const value = predicate(element)
if (seen.has(value)) {
return false
@@ -50,13 +50,13 @@
function conversationPreviews(
conversations: PrivateMessageView[],
): ConversationPreview[] {
const deduplicated = filterDuplicates(conversations, i =>
const deduplicated = filterDuplicates(conversations, (i) =>
getOtherPartyId(i),
)
return deduplicated
.filter(c => c.creator.id != c.recipient.id) // you messaged yourself
.map(i => ({
.filter((c) => c.creator.id != c.recipient.id) // you messaged yourself
.map((i) => ({
user:
i.creator.id != profile.current.user?.local_user_view.person.id
? i.creator
@@ -81,7 +81,7 @@
<UserAutocomplete
listing_type="All"
hideOwnUser={true}
onselect={u =>
onselect={(u) =>
goto(
resolveRoute('/inbox/messages/[user_id]', { user_id: u.id.toString() }),
)}
@@ -164,7 +164,7 @@
<Pageination
page={data.page}
hasMore={res.private_messages.length == 50}
href={current => `/inbox/messages?page=${current}`}
href={(current) => `/inbox/messages?page=${current}`}
/>
</div>
{/if}
@@ -78,7 +78,7 @@
data.message.value = {
private_messages: data.message.value.private_messages.toSpliced(
data.message.value.private_messages.findLastIndex(
i => i.private_message.id == id,
(i) => i.private_message.id == id,
),
1,
),
@@ -182,7 +182,7 @@
? 'flex flex-col'
: 'flex-row h-14 items-center',
]}
onsubmit={async e => {
onsubmit={async (e) => {
e.preventDefault()
const res = await sendMessage(textbox.message)
+1 -1
View File
@@ -17,7 +17,7 @@
function triggerFilter(filter: string) {
if (!passedData.blocked) return
loading = true
data.blocked = passedData.blocked.filter(i => i.domain.includes(filter))
data.blocked = passedData.blocked.filter((i) => i.domain.includes(filter))
loading = false
}
</script>
+1 -1
View File
@@ -17,7 +17,7 @@
function triggerFilter(filter: string) {
if (!passedData.linked) return
loading = true
data.linked = passedData.linked.filter(i => i.domain.includes(filter))
data.linked = passedData.linked.filter((i) => i.domain.includes(filter))
loading = false
}
</script>
+2 -2
View File
@@ -108,7 +108,7 @@
<div class="max-w-xl w-full mx-auto h-max my-auto">
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
logIn()
}}
@@ -152,7 +152,7 @@
if (data.client.name == 'lemmy') return 'lemmyv3'
else return 'piefedvalpha'
},
v => {
(v) => {
if (v == 'lemmyv3')
data.client = { name: 'lemmy', baseUrl: '/api/v3' }
else data.client = { name: 'piefed', baseUrl: '/api/alpha' }
+3 -3
View File
@@ -27,7 +27,7 @@
client: ClientType
}>({
instance: '',
username: `${$t('account.guest')} ${profile.meta.profiles.filter(p => p.jwt == undefined).length + 1}`,
username: `${$t('account.guest')} ${profile.meta.profiles.filter((p) => p.jwt == undefined).length + 1}`,
loading: false,
client: DEFAULT_CLIENT_TYPE,
})
@@ -40,7 +40,7 @@
return
}
const id = Math.max(...profile.meta.profiles.map(i => i.id)) + 1
const id = Math.max(...profile.meta.profiles.map((i) => i.id)) + 1
profile.meta.profiles.push({
id: id,
instance: form.instance,
@@ -88,7 +88,7 @@
if (form.client.name == 'lemmy') return 'lemmyv3'
else return 'piefedvalpha'
},
v => {
(v) => {
if (v == 'lemmyv3')
form.client = { name: 'lemmy', baseUrl: '/api/v3' }
else form.client = { name: 'piefed', baseUrl: '/api/alpha' }
+3 -3
View File
@@ -27,8 +27,8 @@
batch.progress = 0
await Promise.all(
data.items?.value.map(report => {
report.map(r => {
data.items?.value.map((report) => {
report.map((r) => {
switch (r.type) {
case 'comment': {
const promise = client().resolveCommentReport({
@@ -157,7 +157,7 @@
<Fixate placement="bottom">
<Pageination
page={data.page}
href={current => `?page=${current}`}
href={(current) => `?page=${current}`}
hasMore={data.items.value.length >= 20}
/>
</Fixate>
+6 -6
View File
@@ -31,13 +31,13 @@
switch (item.type) {
case 'comment': {
await Promise.all(
items.map(async i =>
items.map(async (i) =>
getClient()
.resolveCommentReport({
report_id: i.id,
resolved: !i.resolved,
})
.then(res => {
.then((res) => {
i.resolved = res.comment_report_view.comment_report.resolved
i.resolver = res.comment_report_view.resolver
$notifications.reports += i.resolved ? -1 : 1
@@ -49,13 +49,13 @@
}
case 'post': {
await Promise.all(
items.map(async i =>
items.map(async (i) =>
getClient()
.resolvePostReport({
report_id: i.id,
resolved: !i.resolved,
})
.then(res => {
.then((res) => {
i.resolved = res.post_report_view.post_report.resolved
i.resolver = res.post_report_view.resolver
@@ -69,13 +69,13 @@
}
case 'message': {
await Promise.all(
items.map(async i =>
items.map(async (i) =>
getClient()
.resolvePrivateMessageReport({
report_id: i.id,
resolved: !i.resolved,
})
.then(res => {
.then((res) => {
i.resolved =
res.private_message_report_view.private_message_report.resolved
@@ -76,7 +76,7 @@
bind:selected={banFromCommunity}
/>
<UserAutocomplete
onselect={p =>
onselect={(p) =>
ban(banFromCommunity, p, data.community.community_view.community)}
listing_type="All"
/>
@@ -8,7 +8,7 @@ export async function load({ params, fetch }) {
limit: 5,
page: 1,
})
.then(i =>
.then((i) =>
[
...i.banned_from_community,
...i.removed_comments,
+5 -5
View File
@@ -182,7 +182,7 @@
label="Instance"
class="flex-1"
q={page.url.searchParams.get('instance') || ''}
onselect={e =>
onselect={(e) =>
searchParam(
page.url,
'instance',
@@ -200,7 +200,7 @@
label="Community"
class="flex-1"
q={page.url.searchParams.get('community') ? 'Selected' : ''}
onselect={e =>
onselect={(e) =>
searchParam(page.url, 'community', e?.id.toString() ?? '', 'page')}
/>
<UserAutocomplete
@@ -214,7 +214,7 @@
q={page.url.searchParams.get('user')
? (data.filters.user ?? 'Selected')
: ''}
onselect={e =>
onselect={(e) =>
searchParam(page.url, 'user', e?.id.toString() ?? '', 'page')}
/>
{#if profile.current?.user && isAdmin(profile.current?.user)}
@@ -228,7 +228,7 @@
q={page.url.searchParams.get('mod_id')
? (data.filters.moderator ?? 'Selected')
: ''}
onselect={e =>
onselect={(e) =>
searchParam(page.url, 'mod_id', e?.id.toString() ?? '', 'page')}
/>
{/if}
@@ -294,7 +294,7 @@
</table>
</div>
{/if}
<Pageination page={data.page} href={page => `?page=${page}`} />
<Pageination page={data.page} href={(page) => `?page=${page}`} />
{:else}
<Placeholder
title="No results"
@@ -58,7 +58,7 @@
$effect(() => {
data.post.value.meta.then(
res => (data.post.value.post_view = res.post_view),
(res) => (data.post.value.post_view = res.post_view),
)
})
@@ -136,7 +136,7 @@
community={data.post.value.post_view.community}
user={data.post.value.post_view.creator}
subscribed={profile.current.user?.follows.find(
i => i.community.id == data.post.value.post_view.community.id,
(i) => i.community.id == data.post.value.post_view.community.id,
)
? 'Subscribed'
: 'NotSubscribed'}
@@ -55,7 +55,7 @@ function findInFeed(
}
| undefined {
const index = postFeeds.value[feedId]?.data.posts.posts.findIndex(
i => i.post.id == postId,
(i) => i.post.id == postId,
)
if ((index ?? -1) == -1) return
@@ -105,7 +105,7 @@ export async function load({ params, url, fetch }) {
const partialPost: PartialPost = {
post_view: cachedPost ? cachedPost.post_view : (await post).post_view,
meta: post.then(i => ({
meta: post.then((i) => ({
...i,
})),
}
@@ -123,7 +123,7 @@ export async function load({ params, url, fetch }) {
sidebar: {
component: CommunityCard,
props: {
community_view: post.then(i => i.community_view),
community_view: post.then((i) => i.community_view),
},
},
},
@@ -72,7 +72,7 @@
!(
profile.current?.user?.local_user_view.local_user.admin ||
profile.current?.user?.moderates
.map(c => c.community.id)
.map((c) => c.community.id)
.includes(post.community.id)
)}
onclick={() => (commenting = true)}
@@ -116,7 +116,7 @@
{:else}
<CommentForm
postId={post.post.id}
oncomment={comment => {
oncomment={(comment) => {
comments.comments.unshift(comment.comment_view)
}}
onfocus={() => (commenting = true)}
@@ -76,7 +76,7 @@
</div>
{#if profile.meta.profiles}
{@const filtered = profile.meta.profiles.filter(
i => i.instance == page.params.instance,
(i) => i.instance == page.params.instance,
)}
<div class="space-y-1">
<div class="font-medium text-sm">
@@ -33,7 +33,7 @@
if (!profile.current?.jwt) return
data.person_blocks.splice(
data.person_blocks.findIndex(i => i.target.id == item.target.id),
data.person_blocks.findIndex((i) => i.target.id == item.target.id),
1,
)
// hack to get reactivity working
@@ -49,7 +49,9 @@
if (!profile.current?.jwt) return
data.community_blocks.splice(
data.community_blocks.findIndex(i => i.community.id == item.community.id),
data.community_blocks.findIndex(
(i) => i.community.id == item.community.id,
),
1,
)
@@ -68,7 +70,7 @@
data.my_user.instance_blocks.splice(
data.my_user.instance_blocks.findIndex(
i => i.instance.id == item.instance.id,
(i) => i.instance.id == item.instance.id,
),
1,
)
@@ -33,7 +33,7 @@
</script>
<Header pageHeader>
{routes.find(r => page.url.pathname == r.href)?.name ??
{routes.find((r) => page.url.pathname == r.href)?.name ??
$t('routes.profile.credentials')}
{#snippet extended()}
<Tabs style="subpage" margin={false} {routes}></Tabs>
@@ -88,7 +88,7 @@
{/if}
<form
class="flex flex-col gap-2 w-full"
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
twofa(!(totpEnabled == true), true)
}}
@@ -41,7 +41,7 @@
</script>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
changePassword()
}}
@@ -79,7 +79,7 @@
</script>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
deleteAccount(4)
}}
+2 -2
View File
@@ -19,7 +19,7 @@
ondelete={() => {
data.images.value = data.images.value.toSpliced(
data.images.value.findIndex(
i =>
(i) =>
i.local_image.pictrs_delete_token ==
image.local_image.pictrs_delete_token,
),
@@ -33,6 +33,6 @@
{#if data.images.value.length == 20}
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={page => `?page=${page}`}
href={(page) => `?page=${page}`}
/>
{/if}
+1 -1
View File
@@ -83,7 +83,7 @@
<Fixate placement="bottom">
<Pageination
hasMore={data.data.length == 40}
href={page => `?page=${page}`}
href={(page) => `?page=${page}`}
page={data.page}
/>
</Fixate>
+3 -3
View File
@@ -44,7 +44,7 @@
</script>
<svelte:window
onkeydown={e => {
onkeydown={(e) => {
if (e.target == document.body) searchElement?.focus()
}}
/>
@@ -111,7 +111,7 @@
jwt={profile.current?.jwt}
listing_type="All"
showWhenEmpty={true}
onselect={c =>
onselect={(c) =>
searchParam(page.url, 'community', c?.id || undefined, 'page')}
/>
</div>
@@ -191,7 +191,7 @@
{#if data.results.value.length > 0}
<Pageination
bind:page={data.filters.value.page}
href={page => `?page=${page}`}
href={(page) => `?page=${page}`}
/>
{/if}
{/if}
+1 -1
View File
@@ -48,7 +48,7 @@
mainClass,
]}
>
{#if Object.values(supportedPlatforms).some(v => v == false)}
{#if Object.values(supportedPlatforms).some((v) => v == false)}
<div class="flex items-center gap-2 flex-wrap">
{#if supportedPlatforms.desktop}
<Badge>
+2 -2
View File
@@ -39,12 +39,12 @@
<li
class="flex flex-col w-full justify-between gap-2 max-w-full setting @container/setting"
>
{#if Object.values(supportedPlatforms).some(v => v == false) || beta}
{#if Object.values(supportedPlatforms).some((v) => v == false) || beta}
<div class="flex items-center gap-2 flex-wrap">
{#if beta}
<Badge>Beta</Badge>
{/if}
{#if Object.values(supportedPlatforms).some(v => v == false)}
{#if Object.values(supportedPlatforms).some((v) => v == false)}
{#if supportedPlatforms.desktop}
<Badge>
{#snippet icon()}
+1 -1
View File
@@ -53,7 +53,7 @@
label="Content"
images={false}
previewButton
beforePreview={input =>
beforePreview={(input) =>
removalTemplate(input, {
postTitle: '<Example post>',
communityLink: '[!community@example.com]()',
+1 -1
View File
@@ -37,7 +37,7 @@
try {
const res: Instance[] = (
await fetch(`https://data.lemmyverse.net/data/instance.full.json`).then(
r => r.json(),
(r) => r.json(),
)
)
.filter((i: Instance) => i.fed)
+1 -1
View File
@@ -300,7 +300,7 @@
<ErrorContainer scope={page.url.pathname} />
<h2 class="font-medium text-3xl">{$t('toast.verifyEmail')}</h2>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
verifiedEmail()
}}
+7 -7
View File
@@ -73,7 +73,7 @@
<button
onclick={() => {
const newTheme = {
id: Math.max(...themeData.data.themes.map(t => t.id)) + 1,
id: Math.max(...themeData.data.themes.map((t) => t.id)) + 1,
colors: getDefaultColors(),
name: $t('routes.theme.preset.new'),
}
@@ -170,10 +170,10 @@
</Header>
<ColorSwatch
value={themeData.current.colors.primary?.[900]}
onchange={e => {
onchange={(e) => {
themeData.current.colors.primary[900] = e
}}
oncontextmenu={e => {
oncontextmenu={(e) => {
e.preventDefault()
themeData.current.colors.primary[900] = defaultColors.primary[900]
@@ -183,10 +183,10 @@
/>
<ColorSwatch
value={themeData.current.colors.primary?.[100]}
onchange={e => {
onchange={(e) => {
themeData.current.colors.primary[100] = e
}}
oncontextmenu={e => {
oncontextmenu={(e) => {
e.preventDefault()
themeData.current.colors.primary[100] = defaultColors.primary[100]
@@ -221,10 +221,10 @@
<!--@ts-ignore-->
<ColorSwatch
bind:value={themeData.current.colors[category][shade]}
onchange={e => {
onchange={(e) => {
themeData.current.colors[category][shade] = e
}}
oncontextmenu={e => {
oncontextmenu={(e) => {
e.preventDefault()
themeData.current.colors[category][shade] =
defaultColors[category][shade]
+2 -2
View File
@@ -48,7 +48,7 @@
<div class="px-4 py-2 flex items-center gap-1 justify-between">
{#if editingName}
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
editingName = false
}}
@@ -85,7 +85,7 @@
type: 'danger',
action: () => {
const index = themeData.data.themes
.map(t => t.id)
.map((t) => t.id)
.indexOf(theme.id)
themeData.data.themes = themeData.data.themes.toSpliced(