i18n: Localize applications page
This commit is contained in:
1 parent
62901081ab
commit
f960062603
4 files changed
+76
-53
No files matched your search
@@ -1,38 +1,38 @@
|
||||
<script lang="ts">
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
|
||||
export let denying: boolean
|
||||
export let denying: boolean
|
||||
|
||||
export let denyReason: string = ''
|
||||
export let denyReason: string = ''
|
||||
|
||||
let loading = false
|
||||
let loading = false
|
||||
|
||||
function deny() {
|
||||
denying = true
|
||||
open = false
|
||||
}
|
||||
function deny() {
|
||||
denying = true
|
||||
open = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open>
|
||||
<h1 class="text-2xl font-bold" slot="title">Deny Application</h1>
|
||||
<form on:submit|preventDefault={() => deny()} class="flex flex-col gap-4">
|
||||
<p class="inline-flex flex-row gap-2 items-center">
|
||||
Denying <UserLink avatar {user} />'s Application
|
||||
</p>
|
||||
<MarkdownEditor
|
||||
bind:value={denyReason}
|
||||
label="Deny Reason (optional)"
|
||||
placeholder="Application Reason breaks rule #3"
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
Deny
|
||||
</Button>
|
||||
</form>
|
||||
<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">
|
||||
<UserLink avatar {user} />
|
||||
<MarkdownEditor
|
||||
bind:value={denyReason}
|
||||
label={$t('routes.admin.applications.reason')}
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
{$t('routes.admin.applications.deny')}
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
+13
-1
@@ -265,7 +265,19 @@
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"title": "Taglines"
|
||||
|
||||
@@ -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