cleanup: tweak some designs in admin (#500)
* fix: application route constantly reloading * misc: tweak applications designs * misc: tweak team designs
This commit is contained in:
1 parent
81662e6f6d
commit
ced6d62934
4 files changed
+114
-66
No files matched your search
@@ -8,24 +8,37 @@
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { Option, Select } from 'mono-svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
let selectForm = $state<HTMLFormElement>()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.applications.title')}</Header>
|
||||
<MultiSelect
|
||||
<!-- <MultiSelect
|
||||
options={[false, true]}
|
||||
selected={data.unreadOnly ?? true}
|
||||
optionNames={[$t('filter.location.all'), $t('filter.unread')]}
|
||||
onselect={(e) => searchParam(page.url, 'unreadOnly', e.toString(), 'page')}
|
||||
/>
|
||||
{#if data.applications && data.applications.length > 0}
|
||||
/> -->
|
||||
<form bind:this={selectForm} action="/admin/applications" class="w-max">
|
||||
<Select
|
||||
name="unreadOnly"
|
||||
onchange={() => selectForm?.requestSubmit?.()}
|
||||
label={$t('filter.filter')}
|
||||
>
|
||||
<Option value="false">{$t('filter.location.all')}</Option>
|
||||
<Option value="true">{$t('filter.unread')}</Option>
|
||||
</Select>
|
||||
</form>
|
||||
{#if data.applications?.value && data.applications?.value.length > 0}
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each data.applications as application (application.registration_application.id)}
|
||||
{#each data.applications?.value as application (application.registration_application.id)}
|
||||
<Application {application} />
|
||||
{/each}
|
||||
</div>
|
||||
{#if data.applications.length >= 40}
|
||||
{#if data.applications?.value.length >= 40}
|
||||
<div class="mt-auto">
|
||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ data, fetch, url }) {
|
||||
@@ -20,6 +21,6 @@ export async function load({ data, fetch, url }) {
|
||||
return {
|
||||
unreadOnly: unreadOnly,
|
||||
page: page,
|
||||
applications: res.registration_applications,
|
||||
applications: new ReactiveState(res.registration_applications),
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,19 @@
|
||||
RegistrationApplicationView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||
import {
|
||||
Check,
|
||||
Icon,
|
||||
ShieldCheck,
|
||||
ShieldExclamation,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation'
|
||||
import { fullCommunityName } from '$lib/util.svelte'
|
||||
|
||||
interface Props {
|
||||
application: RegistrationApplicationView
|
||||
@@ -86,82 +94,101 @@
|
||||
user={application.creator}
|
||||
/>
|
||||
{/if}
|
||||
<Material class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-slate-600 dark:text-zinc-400">
|
||||
<Material color="uniform" rounding="xl" 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
|
||||
date={publishedToDate(application.registration_application.published)}
|
||||
/>
|
||||
</span>
|
||||
|
||||
<SectionTitle>{$t('routes.admin.applications.user')}</SectionTitle>
|
||||
<span class="text-sm">
|
||||
<UserLink user={application.creator} avatar avatarSize={20} />
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<SectionTitle>Application</SectionTitle>
|
||||
<p>{application.registration_application.answer}</p>
|
||||
<Material
|
||||
color="uniform"
|
||||
rounding="xl"
|
||||
padding="none"
|
||||
class="dark:bg-zinc-925 p-3 py-2"
|
||||
>
|
||||
<p>{application.registration_application.answer}</p>
|
||||
</Material>
|
||||
</div>
|
||||
<div class="flex flex-col md:flex-row gap-2 md:items-center">
|
||||
{#if application.admin}
|
||||
{#if typeof application.registration_application.deny_reason !== 'undefined' && application.registration_application.deny_reason !== ''}
|
||||
<div>
|
||||
<div class="flex flex-row gap-1">
|
||||
<div class="flex flex-col md:flex-row gap-2 md:items-center">
|
||||
{#if application.admin}
|
||||
{@const accepted = application.creator_local_user.accepted_application}
|
||||
{#if typeof application.registration_application.deny_reason !== 'undefined' && application.registration_application.deny_reason !== ''}
|
||||
<div>
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<Icon
|
||||
src={accepted ? ShieldCheck : ShieldExclamation}
|
||||
mini
|
||||
size="20"
|
||||
class={accepted ? 'text-green-400' : 'text-red-400'}
|
||||
/>
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{accepted
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
<SectionTitle>:</SectionTitle>
|
||||
</div>
|
||||
<p>{application.registration_application.deny_reason}</p>
|
||||
</div>
|
||||
<div class="md:ml-auto"></div>
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<Icon
|
||||
src={accepted ? ShieldCheck : ShieldExclamation}
|
||||
mini
|
||||
size="20"
|
||||
class={accepted ? 'text-green-400' : 'text-red-400'}
|
||||
/>
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
{accepted
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
<SectionTitle>:</SectionTitle>
|
||||
</div>
|
||||
<p>{application.registration_application.deny_reason}</p>
|
||||
</div>
|
||||
<div class="md:ml-auto"></div>
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
</div>
|
||||
<div class="md:ml-auto"></div>
|
||||
<div class="md:ml-auto"></div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
<div class="ml-auto self-end">
|
||||
<Button
|
||||
size="square-md"
|
||||
class="hover:bg-slate-200 {application.creator_local_user
|
||||
.accepted_application === false && application.admin
|
||||
? '!text-red-500'
|
||||
: ''}"
|
||||
aria-label={$t('routes.admin.applications.deny')}
|
||||
onclick={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
class="hover:bg-slate-200 {application.creator_local_user
|
||||
.accepted_application
|
||||
? '!text-green-500'
|
||||
: ''}"
|
||||
title={$t('routes.admin.applications.approve')}
|
||||
onclick={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
<Button
|
||||
size="square-md"
|
||||
class="hover:bg-slate-200 {application.creator_local_user
|
||||
.accepted_application === false && application.admin
|
||||
? '!text-red-500'
|
||||
: ''}"
|
||||
aria-label={$t('routes.admin.applications.deny')}
|
||||
onclick={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
class="hover:bg-slate-200 {application.creator_local_user
|
||||
.accepted_application
|
||||
? '!text-green-500'
|
||||
: ''}"
|
||||
title={$t('routes.admin.applications.approve')}
|
||||
onclick={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Material>
|
||||
@@ -103,9 +103,16 @@
|
||||
class="flex-1"
|
||||
pattern={'@[^ |]{1,}'}
|
||||
/>
|
||||
<Button loading={adding} disabled={adding} size="md" class="h-full" submit>
|
||||
<Button
|
||||
loading={adding}
|
||||
disabled={adding}
|
||||
rounding="xl"
|
||||
color="primary"
|
||||
class="h-full"
|
||||
submit
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="16" />
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user