impr: use common components for admin pages
This commit is contained in:
10 files changed
+54
-48
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "photon-lemmy",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@dicebear/core": "^8.0.2",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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%)
|
||||
);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { searchParam } from '$lib/app/util.svelte'
|
||||
import Placeholder from '$lib/ui/info/Placeholder.svelte'
|
||||
import { Header, Pageination } from '$lib/ui/layout'
|
||||
import { CommonList, Header, Pageination } from '$lib/ui/layout'
|
||||
import { Option, Select } from 'mono-svelte'
|
||||
import { ClipboardDocumentCheck, Funnel, Icon } from 'svelte-hero-icons/dist'
|
||||
import Application from './Application.svelte'
|
||||
@@ -32,11 +32,17 @@
|
||||
</Select>
|
||||
</form>
|
||||
{#if data.applications?.value && data.applications?.value.length > 0}
|
||||
<div class="flex flex-col gap-4">
|
||||
<CommonList>
|
||||
{#each data.applications?.value as application (application.registration_application.id)}
|
||||
<Application {application} />
|
||||
<li
|
||||
class={application.creator_local_user.accepted_application
|
||||
? 'material-success'
|
||||
: 'material-error'}
|
||||
>
|
||||
<Application {application} />
|
||||
</li>
|
||||
{/each}
|
||||
</div>
|
||||
</CommonList>
|
||||
{#if data.applications?.value.length >= 40}
|
||||
<div class="mt-auto">
|
||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
user={application.creator}
|
||||
/>
|
||||
{/if}
|
||||
<Material color="uniform" rounding="xl" class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-2">
|
||||
<span class="text-slate-600 dark:text-zinc-400 text-xs">
|
||||
<RelativeDate
|
||||
@@ -184,4 +184,4 @@
|
||||
></Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
</Material>
|
||||
</div>
|
||||
@@ -29,7 +29,6 @@
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowPath,
|
||||
ExclamationCircle,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
Plus,
|
||||
@@ -211,17 +210,7 @@
|
||||
/>
|
||||
</div>
|
||||
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
|
||||
<Material
|
||||
rounding="2xl"
|
||||
color="none"
|
||||
class="bg-yellow-200/10 border border-yellow-500/30 text-yellow-900 dark:text-yellow-50"
|
||||
>
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
size="32"
|
||||
mini
|
||||
class="inline-block rounded-lg bg-yellow-500 p-1 text-white clear-both float-left mr-2"
|
||||
/>
|
||||
<Material rounding="2xl" color="warning" icon={ExclamationTriangle}>
|
||||
{$t('form.signup.application.info')}
|
||||
</Material>
|
||||
{#if data.site_view.local_site.application_question}
|
||||
@@ -256,13 +245,7 @@
|
||||
</Material>
|
||||
{/if}
|
||||
{:catch err}
|
||||
<Material
|
||||
padding="sm"
|
||||
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
|
||||
>
|
||||
<Icon src={ExclamationCircle} mini size="24" />
|
||||
{err}
|
||||
</Material>
|
||||
<ErrorContainer message={errorMessage(err)} />
|
||||
{/await}
|
||||
<Button onclick={() => getCaptcha()} size="square-md">
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
|
||||
Reference in new issue
Block a user