impr: use common components for admin pages
This commit is contained in:
10 files changed
+53
-47
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "2.2.0",
|
"version": "2.2.2",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dicebear/core": "^8.0.2",
|
"@dicebear/core": "^8.0.2",
|
||||||
|
|||||||
@@ -13,13 +13,16 @@ export function errorMessage(error: any, instance?: string): string {
|
|||||||
|
|
||||||
if (error?.body?.message) {
|
if (error?.body?.message) {
|
||||||
error = JSON.parse(error?.body?.message)
|
error = JSON.parse(error?.body?.message)
|
||||||
if (error?.message) {
|
|
||||||
|
if (typeof error?.message == 'string') {
|
||||||
// probably piefed weird error format
|
// probably piefed weird error format
|
||||||
error = error.message
|
error = error.message
|
||||||
}
|
}
|
||||||
} else if (error?.message) {
|
}
|
||||||
|
if (error?.message) {
|
||||||
error = error?.message
|
error = error?.message
|
||||||
} else if (error?.error && typeof error?.error === 'string') {
|
}
|
||||||
|
if (error?.error && typeof error?.error === 'string') {
|
||||||
error = error.error
|
error = error.error
|
||||||
}
|
}
|
||||||
if (!error) throw error
|
if (!error) throw error
|
||||||
|
|||||||
@@ -946,7 +946,7 @@
|
|||||||
"downvotes_are_disabled": "Downvotes are disabled on this server.",
|
"downvotes_are_disabled": "Downvotes are disabled on this server.",
|
||||||
"email_already_exists": "An account already exists with that email.",
|
"email_already_exists": "An account already exists with that email.",
|
||||||
"slurs": "Your submission contains a term banned in this server.",
|
"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.",
|
"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.",
|
"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.",
|
"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.",
|
"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.",
|
"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.",
|
"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": {
|
"aria": {
|
||||||
"pagination": {
|
"pagination": {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<EntityHeader
|
<EntityHeader
|
||||||
name={site.site.name}
|
name={site.site.name}
|
||||||
avatar={site.site.icon}
|
avatar={site.site.icon}
|
||||||
banner={site.site.banner ?? null}
|
banner={site.site.banner || null}
|
||||||
compact="always"
|
compact="always"
|
||||||
avatarCircle={false}
|
avatarCircle={false}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import { t } from '$lib/app/i18n'
|
import { t } from '$lib/app/i18n'
|
||||||
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
|
||||||
import { Button, Modal } from 'mono-svelte'
|
import { Button, Modal } from 'mono-svelte'
|
||||||
import { preventDefault } from 'svelte/legacy'
|
|
||||||
import UserLink from '../user/UserLink.svelte'
|
import UserLink from '../user/UserLink.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -28,13 +27,14 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal bind:open>
|
<Modal bind:open title={$t('routes.admin.applications.modalTitle')}>
|
||||||
{#snippet customTitle()}
|
<form
|
||||||
<h1 class="text-2xl font-bold">
|
onsubmit={(e) => {
|
||||||
{$t('routes.admin.applications.modalTitle')}
|
e.preventDefault()
|
||||||
</h1>
|
deny()
|
||||||
{/snippet}
|
}}
|
||||||
<form onsubmit={preventDefault(() => deny())} class="flex flex-col gap-4">
|
class="flex flex-col gap-4"
|
||||||
|
>
|
||||||
<UserLink avatar {user} />
|
<UserLink avatar {user} />
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
bind:value={denyReason}
|
bind:value={denyReason}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#snippet icon(width: number)}
|
{#snippet pfp(width: number)}
|
||||||
<Avatar
|
<Avatar
|
||||||
{width}
|
{width}
|
||||||
url={avatar}
|
url={avatar}
|
||||||
@@ -79,20 +79,22 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<div class="contents @md:hidden">
|
<div class="contents @md:hidden">
|
||||||
{@render icon(48)}
|
{@render pfp(48)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hidden @md:contents">
|
<div class="hidden @md:contents">
|
||||||
{@render icon(72)}
|
{@render pfp(72)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<svelte:element
|
<svelte:element
|
||||||
this={url ? 'a' : 'h1'}
|
this={url ? 'a' : 'h1'}
|
||||||
href={url}
|
href={url}
|
||||||
class="text-xl @md:text-2xl font-medium tracking-tight {url
|
class={[
|
||||||
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
|
'text-xl @md:text-2xl font-medium tracking-tight',
|
||||||
: ''}"
|
url &&
|
||||||
|
'hover:underline hover:text-primary-900 dark:hover:text-primary-100',
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { Icon, type IconSource } from 'svelte-hero-icons/dist'
|
||||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||||
|
|
||||||
type Elevation = keyof typeof elevationClass
|
type Elevation = keyof typeof elevationClass
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
rounding?: Rounding
|
rounding?: Rounding
|
||||||
color?: Color
|
color?: Color
|
||||||
element?: string
|
element?: string
|
||||||
|
icon?: IconSource
|
||||||
class?: ClassValue
|
class?: ClassValue
|
||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
@@ -64,6 +66,7 @@
|
|||||||
rounding = 'xl',
|
rounding = 'xl',
|
||||||
color = 'uniform',
|
color = 'uniform',
|
||||||
element = 'div',
|
element = 'div',
|
||||||
|
icon,
|
||||||
class: clazz = '',
|
class: clazz = '',
|
||||||
children,
|
children,
|
||||||
...rest
|
...rest
|
||||||
@@ -82,6 +85,14 @@
|
|||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
{#if icon}
|
||||||
|
<Icon
|
||||||
|
src={icon}
|
||||||
|
size="20"
|
||||||
|
mini
|
||||||
|
class="inline-block rounded-lg clear-both float-left mr-2"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
|
||||||
@@ -159,7 +170,7 @@
|
|||||||
.material-error {
|
.material-error {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
--alpha(var(--color-red-300) / 10%),
|
--alpha(var(--color-red-300) / 5%),
|
||||||
--alpha(var(--color-red-500) / 15%)
|
--alpha(var(--color-red-500) / 15%)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -189,7 +200,7 @@
|
|||||||
.material-warning {
|
.material-warning {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
to bottom,
|
to bottom,
|
||||||
--alpha(var(--color-yellow-300) / 10%),
|
--alpha(var(--color-yellow-300) / 5%),
|
||||||
--alpha(var(--color-yellow-500) / 15%)
|
--alpha(var(--color-yellow-500) / 15%)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { t } from '$lib/app/i18n'
|
import { t } from '$lib/app/i18n'
|
||||||
import { searchParam } from '$lib/app/util.svelte'
|
import { searchParam } from '$lib/app/util.svelte'
|
||||||
import Placeholder from '$lib/ui/info/Placeholder.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 { Option, Select } from 'mono-svelte'
|
||||||
import { ClipboardDocumentCheck, Funnel, Icon } from 'svelte-hero-icons/dist'
|
import { ClipboardDocumentCheck, Funnel, Icon } from 'svelte-hero-icons/dist'
|
||||||
import Application from './Application.svelte'
|
import Application from './Application.svelte'
|
||||||
@@ -32,11 +32,17 @@
|
|||||||
</Select>
|
</Select>
|
||||||
</form>
|
</form>
|
||||||
{#if data.applications?.value && data.applications?.value.length > 0}
|
{#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)}
|
{#each data.applications?.value as application (application.registration_application.id)}
|
||||||
|
<li
|
||||||
|
class={application.creator_local_user.accepted_application
|
||||||
|
? 'material-success'
|
||||||
|
: 'material-error'}
|
||||||
|
>
|
||||||
<Application {application} />
|
<Application {application} />
|
||||||
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</CommonList>
|
||||||
{#if data.applications?.value.length >= 40}
|
{#if data.applications?.value.length >= 40}
|
||||||
<div class="mt-auto">
|
<div class="mt-auto">
|
||||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
user={application.creator}
|
user={application.creator}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/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">
|
<div class="flex flex-col gap-2">
|
||||||
<span class="text-slate-600 dark:text-zinc-400 text-xs">
|
<span class="text-slate-600 dark:text-zinc-400 text-xs">
|
||||||
<RelativeDate
|
<RelativeDate
|
||||||
@@ -184,4 +184,4 @@
|
|||||||
></Button>
|
></Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</Material>
|
</div>
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
import {
|
import {
|
||||||
ArrowLeft,
|
ArrowLeft,
|
||||||
ArrowPath,
|
ArrowPath,
|
||||||
ExclamationCircle,
|
|
||||||
ExclamationTriangle,
|
ExclamationTriangle,
|
||||||
Icon,
|
Icon,
|
||||||
Plus,
|
Plus,
|
||||||
@@ -211,17 +210,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
|
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
|
||||||
<Material
|
<Material rounding="2xl" color="warning" icon={ExclamationTriangle}>
|
||||||
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"
|
|
||||||
/>
|
|
||||||
{$t('form.signup.application.info')}
|
{$t('form.signup.application.info')}
|
||||||
</Material>
|
</Material>
|
||||||
{#if data.site_view.local_site.application_question}
|
{#if data.site_view.local_site.application_question}
|
||||||
@@ -256,13 +245,7 @@
|
|||||||
</Material>
|
</Material>
|
||||||
{/if}
|
{/if}
|
||||||
{:catch err}
|
{:catch err}
|
||||||
<Material
|
<ErrorContainer message={errorMessage(err)} />
|
||||||
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>
|
|
||||||
{/await}
|
{/await}
|
||||||
<Button onclick={() => getCaptcha()} size="square-md">
|
<Button onclick={() => getCaptcha()} size="square-md">
|
||||||
<Icon src={ArrowPath} size="16" mini />
|
<Icon src={ArrowPath} size="16" mini />
|
||||||
|
|||||||
Reference in new issue
Block a user