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