i18n: Localize applications page
This commit is contained in:
1 parent
62901081ab
commit
f960062603
4 files changed
+76
-53
No files matched your search
@@ -6,15 +6,17 @@
|
||||
import { ClipboardDocumentCheck, Icon } from 'svelte-hero-icons'
|
||||
import Application from './Application.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Applications</h1>
|
||||
<Header>{$t('routes.admin.applications.title')}</Header>
|
||||
<MultiSelect
|
||||
options={[false, true]}
|
||||
selected={data.unreadOnly ?? true}
|
||||
optionNames={['All', 'Unread']}
|
||||
optionNames={[$t('filter.location.all'), $t('filter.unread')]}
|
||||
on:select={(e) =>
|
||||
searchParam($page.url, 'unreadOnly', e.detail.toString(), 'page')}
|
||||
/>
|
||||
@@ -35,7 +37,7 @@
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={ClipboardDocumentCheck}
|
||||
title="No new applications"
|
||||
description="Applications to join your instance will appear here."
|
||||
title={$t('routes.admin.applications.empty.title')}
|
||||
description={$t('routes.admin.applications.empty.description')}
|
||||
/>
|
||||
{/if}
|
||||
@@ -4,12 +4,16 @@
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type {ApproveRegistrationApplication, RegistrationApplicationView} from 'lemmy-js-client'
|
||||
import type {
|
||||
ApproveRegistrationApplication,
|
||||
RegistrationApplicationView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Check, Icon, 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 ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let application: RegistrationApplicationView
|
||||
|
||||
@@ -31,21 +35,21 @@
|
||||
} else {
|
||||
reviewing = true
|
||||
while (reviewing) {
|
||||
await new Promise(res => setTimeout(res, 1000))
|
||||
await new Promise((res) => setTimeout(res, 1000))
|
||||
}
|
||||
if (!denying) {
|
||||
denyReason = ""
|
||||
denyReason = ''
|
||||
return
|
||||
}
|
||||
if (denyReason != "") {
|
||||
if (denyReason != '') {
|
||||
registrationApplicationAnswer.deny_reason = denyReason
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
await getClient().approveRegistrationApplication(registrationApplicationAnswer)
|
||||
await getClient().approveRegistrationApplication(
|
||||
registrationApplicationAnswer
|
||||
)
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
approve ? 'approved' : 'denied'
|
||||
@@ -71,7 +75,12 @@
|
||||
</script>
|
||||
|
||||
{#if reviewing}
|
||||
<ApplicationDenyModal bind:open={reviewing} bind:denying bind:denyReason user={application.creator}/>
|
||||
<ApplicationDenyModal
|
||||
bind:open={reviewing}
|
||||
bind:denying
|
||||
bind:denyReason
|
||||
user={application.creator}
|
||||
/>
|
||||
{/if}
|
||||
<Material class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-1">
|
||||
@@ -81,7 +90,7 @@
|
||||
/>
|
||||
</span>
|
||||
|
||||
<SectionTitle>User</SectionTitle>
|
||||
<SectionTitle>{$t('routes.admin.applications.user')}</SectionTitle>
|
||||
<span class="text-sm">
|
||||
<UserLink user={application.creator} avatar avatarSize={20} />
|
||||
</span>
|
||||
@@ -95,12 +104,12 @@
|
||||
{#if typeof application.registration_application.deny_reason !== 'undefined' && application.registration_application.deny_reason !== ''}
|
||||
<div>
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? 'Approved'
|
||||
: 'Denied'} by
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>:</SectionTitle>
|
||||
</div>
|
||||
<p>{application.registration_application.deny_reason}</p>
|
||||
@@ -108,12 +117,12 @@
|
||||
<div class="md:ml-auto" />
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? 'Approved'
|
||||
: 'Denied'} by
|
||||
</SectionTitle>
|
||||
<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" />
|
||||
{/if}
|
||||
@@ -125,7 +134,7 @@
|
||||
.accepted_application === false && application.admin
|
||||
? '!text-red-500'
|
||||
: ''}"
|
||||
aria-label="Deny"
|
||||
aria-label={$t('routes.admin.applications.deny')}
|
||||
on:click={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
@@ -138,7 +147,7 @@
|
||||
.accepted_application
|
||||
? '!text-green-500'
|
||||
: ''}"
|
||||
aria-label="Approve"
|
||||
title={$t('routes.admin.applications.approve')}
|
||||
on:click={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
|
||||
Reference in new issue
Block a user