impr: use common components for admin pages

This commit is contained in:
Xylight committed 2025-11-20 19:17:08 -08:00
1 parent 385a7dbc40
commit eae57ee955
10 files changed
+54 -48

No files matched your search

+6 -3
View File
@@ -13,13 +13,16 @@ export function errorMessage(error: any, instance?: string): string {
if (error?.body?.message) {
error = JSON.parse(error?.body?.message)
if (error?.message) {
if (typeof error?.message == 'string') {
// probably piefed weird error format
error = error.message
}
} else if (error?.message) {
}
if (error?.message) {
error = error?.message
} else if (error?.error && typeof error?.error === 'string') {
}
if (error?.error && typeof error?.error === 'string') {
error = error.error
}
if (!error) throw error
+3 -2
View File
@@ -946,7 +946,7 @@
"downvotes_are_disabled": "Downvotes are disabled on this server.",
"email_already_exists": "An account already exists with that email.",
"slurs": "Your submission contains a term banned in this server.",
"captcha_failed": "Incorrect CAPTCHA answer.",
"captcha_incorrect": "Incorrect CAPTCHA answer.",
"cant_block_local_instance": "You cannot block the server you are actively using.",
"invalid_vote_value": "You cannot commit voter fraud on Lemmy posts, sorry.",
"language_not_allowed": "That language is not allowed in this community. Unset it to use the community's default.",
@@ -957,7 +957,8 @@
"unimplemented": "That function of your account's server software is not yet supported by Photon.",
"unsupported": "That function is not supported by your account's server software.",
"not_live_supported": "That server is not running supported software, or is offline.",
"token_not_found": "That email verification link expired, or never existed."
"token_not_found": "That email verification link expired, or never existed.",
"invalid_password": "Invalid password."
},
"aria": {
"pagination": {
+1 -1
View File
@@ -38,7 +38,7 @@
<EntityHeader
name={site.site.name}
avatar={site.site.icon}
banner={site.site.banner ?? null}
banner={site.site.banner || null}
compact="always"
avatarCircle={false}
/>
@@ -3,7 +3,6 @@
import { t } from '$lib/app/i18n'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
import { Button, Modal } from 'mono-svelte'
import { preventDefault } from 'svelte/legacy'
import UserLink from '../user/UserLink.svelte'
interface Props {
@@ -28,13 +27,14 @@
}
</script>
<Modal bind:open>
{#snippet customTitle()}
<h1 class="text-2xl font-bold">
{$t('routes.admin.applications.modalTitle')}
</h1>
{/snippet}
<form onsubmit={preventDefault(() => deny())} class="flex flex-col gap-4">
<Modal bind:open title={$t('routes.admin.applications.modalTitle')}>
<form
onsubmit={(e) => {
e.preventDefault()
deny()
}}
class="flex flex-col gap-4"
>
<UserLink avatar {user} />
<MarkdownEditor
bind:value={denyReason}
+8 -6
View File
@@ -64,7 +64,7 @@
</div>
{/if}
{#snippet icon(width: number)}
{#snippet pfp(width: number)}
<Avatar
{width}
url={avatar}
@@ -79,20 +79,22 @@
{/snippet}
<div class="contents @md:hidden">
{@render icon(48)}
{@render pfp(48)}
</div>
<div class="hidden @md:contents">
{@render icon(72)}
{@render pfp(72)}
</div>
<div class="space-y-1">
<svelte:element
this={url ? 'a' : 'h1'}
href={url}
class="text-xl @md:text-2xl font-medium tracking-tight {url
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
: ''}"
class={[
'text-xl @md:text-2xl font-medium tracking-tight',
url &&
'hover:underline hover:text-primary-900 dark:hover:text-primary-100',
]}
>
{name}
</svelte:element>
+13 -2
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import { Icon, type IconSource } from 'svelte-hero-icons/dist'
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
type Elevation = keyof typeof elevationClass
@@ -53,6 +54,7 @@
rounding?: Rounding
color?: Color
element?: string
icon?: IconSource
class?: ClassValue
children?: import('svelte').Snippet
[key: string]: any
@@ -64,6 +66,7 @@
rounding = 'xl',
color = 'uniform',
element = 'div',
icon,
class: clazz = '',
children,
...rest
@@ -82,6 +85,14 @@
clazz,
]}
>
{#if icon}
<Icon
src={icon}
size="20"
mini
class="inline-block rounded-lg clear-both float-left mr-2"
/>
{/if}
{@render children?.()}
</svelte:element>
@@ -159,7 +170,7 @@
.material-error {
background: linear-gradient(
to bottom,
--alpha(var(--color-red-300) / 10%),
--alpha(var(--color-red-300) / 5%),
--alpha(var(--color-red-500) / 15%)
);
@@ -189,7 +200,7 @@
.material-warning {
background: linear-gradient(
to bottom,
--alpha(var(--color-yellow-300) / 10%),
--alpha(var(--color-yellow-300) / 5%),
--alpha(var(--color-yellow-500) / 15%)
);