format: whole project

This commit is contained in:
James Xylight committed 2025-02-04 16:23:31 -08:00
1 parent b883b5f6e0
commit 80269cf275
79 files changed
+590 -612

No files matched your search

+1 -2
View File
@@ -8,8 +8,7 @@ export let ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
export const load = async ({}) => {
if (browser) {
const initLocale =
settings.language ?? navigator?.language ?? 'en'
const initLocale = settings.language ?? navigator?.language ?? 'en'
console.log(`Loading locale ${aliases.get(initLocale) ?? initLocale}`)
+7 -10
View File
@@ -1,14 +1,12 @@
<script lang="ts">
import { Badge } from 'mono-svelte'
interface Props {
name: string;
description: string;
badge?: string | undefined;
link?: string;
class?: string;
name: string
description: string
badge?: string | undefined
link?: string
class?: string
}
let {
@@ -16,9 +14,8 @@
description,
badge = undefined,
link = '#',
class: clazz = ''
}: Props = $props();
class: clazz = '',
}: Props = $props()
</script>
<div class="flex flex-col w-max {clazz}">
+1 -1
View File
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit'
export const load = () => {
redirect(302, '/admin/config');
redirect(302, '/admin/config')
}
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
let { data, children } = $props();
let { data, children } = $props()
</script>
<svelte:head>
+1 -2
View File
@@ -10,8 +10,7 @@ export async function load({ params, fetch, url }) {
const page = Number(url.searchParams.get('page')) || undefined
const sort: SortType =
(url.searchParams.get('sort') as SortType) ||
settings.defaultSort.sort
(url.searchParams.get('sort') as SortType) || settings.defaultSort.sort
return await postFeed({
id: 'community',
+5 -8
View File
@@ -3,18 +3,15 @@
import CommunityTitle from '$lib/components/lemmy/community/CommunityTitle.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
let { data } = $props();
let { data } = $props()
</script>
<div class="flex flex-col gap-4">
<Header pageHeader>
<span>Settings</span>
{#snippet extended()}
<CommunityTitle
community={data.community.community_view.community}
/>
{/snippet}
<CommunityTitle community={data.community.community_view.community} />
{/snippet}
</Header>
<CommunityForm
edit={data.community.community_view.community.id}
@@ -32,7 +29,7 @@
}}
>
{#snippet formtitle()}
{''}
{/snippet}
{''}
{/snippet}
</CommunityForm>
</div>
+1 -1
View File
@@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit'
export function load({ params }) {
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
redirect(302, `/comment/${getInstance()}/${params.instance}`);
redirect(302, `/comment/${getInstance()}/${params.instance}`)
}
+1 -1
View File
@@ -13,6 +13,6 @@ export async function load({ params, fetch }) {
redirect(
302,
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`,
)
}
+1 -1
View File
@@ -55,7 +55,7 @@ export async function load({ url, fetch }) {
].sort(
(a, b) =>
publishedToDate(b.published).getTime() -
publishedToDate(a.published).getTime()
publishedToDate(a.published).getTime(),
)
return {
@@ -1,5 +1,5 @@
<script lang="ts">
import { run, preventDefault } from 'svelte/legacy';
import { run, preventDefault } from 'svelte/legacy'
import { Button, Material, Spinner, TextInput, toast } from 'mono-svelte'
import Message from './Message.svelte'
@@ -17,7 +17,7 @@
import { report } from '$lib/components/lemmy/moderation/moderation'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
let { data = $bindable() } = $props();
let { data = $bindable() } = $props()
let textbox = $state({
message: '',
@@ -27,7 +27,7 @@
let chatWindow: HTMLDivElement = $state()
async function sendMessage(
message: string
message: string,
): Promise<PrivateMessageResponse | undefined> {
if (message == '') return
@@ -55,10 +55,13 @@
run(() => {
if (browser && data.message && chatWindow) {
tick().then(() =>
chatWindow.scrollTo({ top: chatWindow.scrollHeight, behavior: 'smooth' })
chatWindow.scrollTo({
top: chatWindow.scrollHeight,
behavior: 'smooth',
}),
)
}
});
})
async function deleteMessage(id: number) {
const res = await client().deletePrivateMessage({
@@ -69,9 +72,9 @@
data.message = {
private_messages: data.message.private_messages.toSpliced(
data.message.private_messages.findLastIndex(
(i) => i.private_message.id == id
(i) => i.private_message.id == id,
),
1
1,
),
}
}
@@ -151,8 +154,8 @@
disabled={textbox.loading}
>
{#snippet prefix()}
<Icon src={PaperAirplane} size="18" micro />
{/snippet}
<Icon src={PaperAirplane} size="18" micro />
{/snippet}
</Button>
</form>
</div>
+5 -5
View File
@@ -7,7 +7,7 @@
import { Material, Popover } from 'mono-svelte'
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
let { data } = $props();
let { data } = $props()
</script>
<Header pageHeader>Linked Instances</Header>
@@ -18,8 +18,8 @@
Linked
<Popover openOnHover>
{#snippet target()}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<p class="font-normal">
These are the instances your instance can see and interact with
content from.
@@ -60,8 +60,8 @@
<Popover openOnHover placement="bottom">
{#snippet target()}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<p class="font-normal">
These are the instances your instance is explicitly blocking content
from.
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { preventDefault } from 'svelte/legacy'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import {
+1 -1
View File
@@ -53,7 +53,7 @@ export async function load({ url, fetch }) {
...posts.post_reports.map(generalizePostReport),
...comments.comment_reports.map(generalizeCommentReport),
...(messages?.private_message_reports ?? []).map(
generalizePrivateMessageReport
generalizePrivateMessageReport,
),
].sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
+2 -2
View File
@@ -252,7 +252,7 @@ export async function load({ url }) {
filters: {
user: user ? moderationActions[0]?.moderatee?.name : undefined,
community: community ? moderationActions[0]?.community?.title : undefined,
moderator: modId ? moderationActions[0]?.moderator?.name : undefined
}
moderator: modId ? moderationActions[0]?.moderator?.name : undefined,
},
}
}
+3 -4
View File
@@ -17,14 +17,13 @@
import type { ActionName } from './+page.js'
interface Props {
action: ActionName;
action: ActionName
}
let { action }: Props = $props();
let { action }: Props = $props()
const getAction = (
action: ActionName
action: ActionName,
): { icon: IconSource; text: string; class: string } => {
switch (action) {
case 'ban': {
+2 -2
View File
@@ -10,10 +10,10 @@
import ModlogAction from '../ModlogAction.svelte'
interface Props {
item: ModLog;
item: ModLog
}
let { item }: Props = $props();
let { item }: Props = $props()
</script>
<Material padding="lg" class="flex flex-col gap-2">
@@ -7,10 +7,10 @@
import ModlogAction from '../ModlogAction.svelte'
interface Props {
item: ModLog;
item: ModLog
}
let { item }: Props = $props();
let { item }: Props = $props()
</script>
<tr class="">
@@ -28,7 +28,8 @@
user={item.moderator}
/>
{:else}
<p class="text-slate-500 dark:text-zinc-500">Hidden<p></p>
<p class="text-slate-500 dark:text-zinc-500">Hidden</p>
<p></p>
{/if}
</td>
<td>
@@ -1,5 +1,5 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { preventDefault } from 'svelte/legacy'
import { goto } from '$app/navigation'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
@@ -14,11 +14,11 @@
interface Props {
data: {
token: string
};
token: string
}
}
let { data }: Props = $props();
let { data }: Props = $props()
let instance = $state(LINKED_INSTANCE_URL || $currentInstance || '')
let password = $state(''),
+2 -2
View File
@@ -12,8 +12,8 @@ export function load({ params, url }) {
const newUrl = new URL(url)
newUrl.pathname = split.join('/')
redirect(302, newUrl.toString());
redirect(302, newUrl.toString())
}
error(404, 'Not found');
error(404, 'Not found')
}
@@ -1,11 +1,11 @@
<script>
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props} */
let { children } = $props();
/** @type {Props} */
let { children } = $props()
</script>
{@render children?.()}
@@ -5,7 +5,7 @@
*/
/** @type {Props} */
let { children } = $props();
let { children } = $props()
</script>
<div
@@ -10,7 +10,7 @@
UserGroup,
} from 'svelte-hero-icons'
let { data } = $props();
let { data } = $props()
</script>
<div
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import UserPage from '../../u/[name]/+page.svelte'
let { data } = $props();
let { data } = $props()
</script>
{#if data.user && data.sort && data.type && data.page}
+2 -2
View File
@@ -26,12 +26,12 @@ export async function load({ url, fetch, parent }) {
(a, b) =>
b.counts.upvotes -
b.counts.downvotes -
(a.counts.upvotes - a.counts.downvotes)
(a.counts.upvotes - a.counts.downvotes),
)
} else if (sort == 'New') {
items.sort(
(a, b) =>
Date.parse(getItemPublished(b)) - Date.parse(getItemPublished(a))
Date.parse(getItemPublished(b)) - Date.parse(getItemPublished(a)),
)
}
+2 -2
View File
@@ -5,9 +5,9 @@
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/translations'
let { data = $bindable() } = $props();
let { data = $bindable() } = $props()
const SvelteComponent = $derived(browser ? VirtualFeed : PostFeed);
const SvelteComponent = $derived(browser ? VirtualFeed : PostFeed)
</script>
<Header>
+1 -1
View File
@@ -44,7 +44,7 @@ export async function load({ url, fetch }) {
const everything = [...posts.posts, ...comments.comments].sort(
(a, b) =>
Date.parse(getSavedItemPublished(b)) -
Date.parse(getSavedItemPublished(a))
Date.parse(getSavedItemPublished(a)),
)
return { page: page, data: everything, type: type }
+1 -1
View File
@@ -46,7 +46,7 @@ export async function load({ url, fetch }) {
everything.sort(
(a, b) =>
new Date(getItemPublished(b)).getTime() -
new Date(getItemPublished(a)).getTime()
new Date(getItemPublished(a)).getTime(),
)
}
+5 -11
View File
@@ -4,20 +4,14 @@
import { backOut, expoOut } from 'svelte/easing'
import { slide } from 'svelte/transition'
interface Props {
title: string;
id: string;
open?: boolean;
children?: import('svelte').Snippet;
title: string
id: string
open?: boolean
children?: import('svelte').Snippet
}
let {
title,
id,
open = $bindable(true),
children
}: Props = $props();
let { title, id, open = $bindable(true), children }: Props = $props()
</script>
<div class="flex flex-col max-w-full w-full">
+20 -22
View File
@@ -8,33 +8,31 @@
Icon,
} from 'svelte-hero-icons'
interface Props {
supportedPlatforms?: any;
mainClass?: string;
itemsClass?: string;
optionClass?: string;
class?: string;
title?: import('svelte').Snippet;
description?: import('svelte').Snippet;
children?: import('svelte').Snippet;
supportedPlatforms?: any
mainClass?: string
itemsClass?: string
optionClass?: string
class?: string
title?: import('svelte').Snippet
description?: import('svelte').Snippet
children?: import('svelte').Snippet
}
let {
supportedPlatforms = {
desktop: true,
tablet: true,
mobile: true,
},
desktop: true,
tablet: true,
mobile: true,
},
mainClass = '',
itemsClass = '',
optionClass = '',
class: clazz = '',
title,
description,
children
}: Props = $props();
children,
}: Props = $props()
</script>
<div
@@ -45,24 +43,24 @@
{#if supportedPlatforms.desktop}
<Badge>
{#snippet icon()}
<Icon src={ComputerDesktop} micro size="14" />
{/snippet}
<Icon src={ComputerDesktop} micro size="14" />
{/snippet}
{$t('settings.desktop')}
</Badge>
{/if}
{#if supportedPlatforms.tablet}
<Badge>
{#snippet icon()}
<Icon src={DeviceTablet} micro size="14" />
{/snippet}
<Icon src={DeviceTablet} micro size="14" />
{/snippet}
{$t('settings.tablet')}
</Badge>
{/if}
{#if supportedPlatforms.mobile}
<Badge>
{#snippet icon()}
<Icon src={DevicePhoneMobile} micro size="14" />
{/snippet}
<Icon src={DevicePhoneMobile} micro size="14" />
{/snippet}
{$t('settings.mobile')}
</Badge>
{/if}
+16 -17
View File
@@ -9,13 +9,12 @@
Icon,
} from 'svelte-hero-icons'
interface Props {
title: string;
description?: string | undefined;
checked?: boolean;
beta?: boolean;
supportedPlatforms?: any;
title: string
description?: string | undefined
checked?: boolean
beta?: boolean
supportedPlatforms?: any
}
let {
@@ -24,11 +23,11 @@
checked = $bindable(false),
beta = false,
supportedPlatforms = {
desktop: true,
tablet: true,
mobile: true,
}
}: Props = $props();
desktop: true,
tablet: true,
mobile: true,
},
}: Props = $props()
</script>
<div class="flex flex-col w-full justify-between gap-2 max-w-full">
@@ -41,24 +40,24 @@
{#if supportedPlatforms.desktop}
<Badge>
{#snippet icon()}
<Icon src={ComputerDesktop} micro size="14" />
{/snippet}
<Icon src={ComputerDesktop} micro size="14" />
{/snippet}
{$t('settings.desktop')}
</Badge>
{/if}
{#if supportedPlatforms.tablet}
<Badge>
{#snippet icon()}
<Icon src={DeviceTablet} micro size="14" />
{/snippet}
<Icon src={DeviceTablet} micro size="14" />
{/snippet}
{$t('settings.tablet')}
</Badge>
{/if}
{#if supportedPlatforms.mobile}
<Badge>
{#snippet icon()}
<Icon src={DevicePhoneMobile} micro size="14" />
{/snippet}
<Icon src={DevicePhoneMobile} micro size="14" />
{/snippet}
{$t('settings.mobile')}
</Badge>
{/if}
+6 -12
View File
@@ -2,18 +2,13 @@
import { Material, Popover } from 'mono-svelte'
interface Props {
href: string;
size?: keyof typeof sizes;
title?: string;
children?: import('svelte').Snippet;
href: string
size?: keyof typeof sizes
title?: string
children?: import('svelte').Snippet
}
let {
href,
size = 'medium',
title = '',
children
}: Props = $props();
let { href, size = 'medium', title = '', children }: Props = $props()
const sizes = {
large: 'h-24',
@@ -24,13 +19,12 @@
<Popover openOnHover placement="right">
{#snippet target()}
<a {href} >
<a {href}>
{@render children?.()}
</a>
{/snippet}
{#snippet popover()}
<Material
padding="none"
rounding="xl"
elevation="medium"
+2 -2
View File
@@ -14,7 +14,7 @@
</script>
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import { preventDefault } from 'svelte/legacy'
import { goto } from '$app/navigation'
import { Badge, Material, Spinner, toast } from 'mono-svelte'
@@ -36,7 +36,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)
+4 -4
View File
@@ -1,8 +1,8 @@
import { LINKED_INSTANCE_URL } from "$lib/instance.js";
import { redirect } from "@sveltejs/kit";
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
import { redirect } from '@sveltejs/kit'
export const load = () => {
if (LINKED_INSTANCE_URL) {
redirect(302, `/signup/${LINKED_INSTANCE_URL}`);
redirect(302, `/signup/${LINKED_INSTANCE_URL}`)
}
}
}
+2 -2
View File
@@ -24,12 +24,12 @@ export async function load({ params, url, fetch }) {
(a, b) =>
b.counts.upvotes -
b.counts.downvotes -
(a.counts.upvotes - a.counts.downvotes)
(a.counts.upvotes - a.counts.downvotes),
)
} else if (sort == 'New') {
items.sort(
(a, b) =>
Date.parse(getItemPublished(b)) - Date.parse(getItemPublished(a))
Date.parse(getItemPublished(b)) - Date.parse(getItemPublished(a)),
)
}
+3 -3
View File
@@ -1,15 +1,15 @@
<script lang="ts">
import { run } from 'svelte/legacy';
import { run } from 'svelte/legacy'
import { photonify } from '$lib/components/markdown/renderers/plugins'
import { TextInput } from 'mono-svelte'
let link = $state('')
let photonified;
let photonified
run(() => {
photonified = photonify(link)
});
})
</script>
<h1 class="font-bold text-2xl">Photonify links</h1>