cleanup: remove routes object
This commit is contained in:
1 parent
ddaa34dee3
commit
b883b5f6e0
9 files changed
+19
-48
No files matched your search
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"i18n-ally.localesPaths": ["src/lib/i18n"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"prettier.prettierPath": "prettier"
|
||||
"prettier.prettierPath": ""
|
||||
}
|
||||
@@ -3,8 +3,9 @@
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { dockProps } from '../layout/Shell.svelte'
|
||||
import type { ButtonProps } from 'mono-svelte/button/Button.svelte'
|
||||
|
||||
interface Props {
|
||||
interface Props extends ButtonProps {
|
||||
label: string
|
||||
icon?: IconSource | undefined
|
||||
href?: string | undefined
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { t } from '$lib/translations'
|
||||
import CommandsWrapper from './commands/CommandsWrapper.svelte'
|
||||
import { optimizeImageURL } from '$lib/components/lemmy/post/helpers'
|
||||
import { dockProps } from '../layout/Shell.svelte'
|
||||
|
||||
let promptOpen: boolean = $state(false)
|
||||
interface Props {
|
||||
|
||||
@@ -223,9 +223,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
afterNavigate(() => {
|
||||
// open = false
|
||||
})
|
||||
$effect(() => {
|
||||
if (open) search = ''
|
||||
})
|
||||
|
||||
@@ -62,13 +62,6 @@
|
||||
'square-xl': 'w-12 h-12',
|
||||
custom: '',
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
|
||||
import Spinner from '../loader/Spinner.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none'
|
||||
type ButtonRoundingSide = 'all' | 'left' | 'right' | 'top' | 'bottom'
|
||||
@@ -136,6 +129,15 @@
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
export type { Props as ButtonProps }
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
|
||||
import Spinner from '../loader/Spinner.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
let {
|
||||
loading = false,
|
||||
submit = false,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { browser } from '$app/environment'
|
||||
type AnyFunction = (...args: any[]) => any
|
||||
|
||||
export const awaitIfServer = async <T>(
|
||||
promise: Promise<T>
|
||||
promise: Promise<T>,
|
||||
): Promise<{
|
||||
data: Promise<T> | T
|
||||
}> => ({ data: browser ? promise : await promise })
|
||||
@@ -88,7 +88,7 @@ const config: Config = {
|
||||
loader: async () => (await import('./i18n/zh-Hant.json')).default,
|
||||
},
|
||||
],
|
||||
fallbackLocale: 'en',
|
||||
fallbackLocale: 'en'
|
||||
}
|
||||
|
||||
export const aliases = new Map([
|
||||
|
||||
+5
-29
@@ -12,7 +12,7 @@ import { site } from './lemmy'
|
||||
// Example: findClosestNumber([8, 16, 32, 64, 128], 76) will return 128
|
||||
export const findClosestNumber = (numbers: number[], target: number): number =>
|
||||
numbers.reduce((prev, curr) =>
|
||||
curr >= target && (prev < target || curr < prev) ? curr : prev
|
||||
curr >= target && (prev < target || curr < prev) ? curr : prev,
|
||||
)
|
||||
|
||||
export const searchParam = (
|
||||
@@ -64,7 +64,7 @@ export const placeholders = {
|
||||
export function moveItem<T>(
|
||||
array: T[],
|
||||
currentIndex: number,
|
||||
newIndex: number
|
||||
newIndex: number,
|
||||
): T[] {
|
||||
if (
|
||||
currentIndex < 0 ||
|
||||
@@ -110,34 +110,10 @@ export const DOMAIN_REGEX_FORMS =
|
||||
export const isSubscribed = (subscribed: SubscribedType) =>
|
||||
subscribed == 'Pending' || subscribed == 'Subscribed'
|
||||
|
||||
export const routes = {
|
||||
'/': 'Frontpage',
|
||||
get '/post/[instance]/[id=integer]'() {
|
||||
return get(page)?.data?.post?.post_view?.post?.name
|
||||
},
|
||||
'/settings': 'Settings',
|
||||
'/communities': 'Communities',
|
||||
'/search': 'Search',
|
||||
'/moderation': 'Moderation',
|
||||
'/create/post': 'Create post',
|
||||
'/create/community': 'Create community',
|
||||
get '/c/[name]'() {
|
||||
return get(page)?.data?.community?.community_view?.community?.title
|
||||
},
|
||||
'/accounts': 'Accounts',
|
||||
'/admin/config': 'Administration',
|
||||
'/inbox': 'Inbox',
|
||||
'/saved': 'Saved',
|
||||
'/about': 'About',
|
||||
'/profile/user': 'Profile',
|
||||
'/profile/settings': 'Profile Settings',
|
||||
'/profile/blocks': 'Blocks',
|
||||
}
|
||||
|
||||
export async function uploadImage(
|
||||
image: File | null | undefined,
|
||||
instance: string,
|
||||
jwt: string
|
||||
jwt: string,
|
||||
): Promise<string | undefined> {
|
||||
if (!image) return
|
||||
|
||||
@@ -161,7 +137,7 @@ export async function uploadImage(
|
||||
{
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
const json = await response.json()
|
||||
@@ -173,7 +149,7 @@ export async function uploadImage(
|
||||
`${
|
||||
(await response.text().catch((_) => undefined)) ??
|
||||
'Failed to upload image'
|
||||
}: ${response.status}: ${response.statusText}`
|
||||
}: ${response.status}: ${response.statusText}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import '../style/app.css'
|
||||
import { navigating, page } from '$app/state'
|
||||
@@ -26,7 +24,6 @@
|
||||
import { onMount } from 'svelte'
|
||||
import { browser } from '$app/environment'
|
||||
import { Forward, Icon } from 'svelte-hero-icons'
|
||||
import { routes } from '$lib/util.svelte.js'
|
||||
import Shell from '$lib/components/ui/layout/Shell.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
|
||||
Reference in new issue
Block a user