fix: broken unread/all applications selector
This commit is contained in:
5 files changed
+51
-45
No files matched your search
@@ -15,34 +15,34 @@
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/admin/config',
|
||||
name: $t('routes.admin.config.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/applications',
|
||||
name: $t('routes.admin.applications.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/taglines',
|
||||
name: $t('routes.admin.taglines.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/team',
|
||||
name: $t('routes.admin.team.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/federation',
|
||||
name: $t('routes.admin.federation.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/media',
|
||||
name: $t('routes.admin.media.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/admin/config',
|
||||
name: $t('routes.admin.config.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/applications',
|
||||
name: $t('routes.admin.applications.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/taglines',
|
||||
name: $t('routes.admin.taglines.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/team',
|
||||
name: $t('routes.admin.team.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/federation',
|
||||
name: $t('routes.admin.federation.title'),
|
||||
},
|
||||
{
|
||||
href: '/admin/media',
|
||||
name: $t('routes.admin.media.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -1,9 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { searchParam } from '$lib/app/util.svelte'
|
||||
import Placeholder from '$lib/ui/info/Placeholder.svelte'
|
||||
import { Header, Pageination } from '$lib/ui/layout'
|
||||
import { Option, Select } from 'mono-svelte'
|
||||
import { ClipboardDocumentCheck } from 'svelte-hero-icons/dist'
|
||||
import { ClipboardDocumentCheck, Funnel, Icon } from 'svelte-hero-icons/dist'
|
||||
import Application from './Application.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
@@ -14,12 +16,19 @@
|
||||
<Header pageHeader>{$t('routes.admin.applications.title')}</Header>
|
||||
<form bind:this={selectForm} action="/admin/applications" class="w-max">
|
||||
<Select
|
||||
name="unreadOnly"
|
||||
onchange={() => selectForm?.requestSubmit?.()}
|
||||
label={$t('filter.filter')}
|
||||
bind:value={data.type.value}
|
||||
onchange={async () => {
|
||||
searchParam(page.url, 'type', data.type.value, 'page')
|
||||
}}
|
||||
>
|
||||
<Option value="false">{$t('filter.location.all')}</Option>
|
||||
<Option value="true">{$t('filter.unread')}</Option>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="all">{$t('filter.location.all')}</Option>
|
||||
<Option value="unread">{$t('filter.unread')}</Option>
|
||||
</Select>
|
||||
</form>
|
||||
{#if data.applications?.value && data.applications?.value.length > 0}
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
import { getClient } from '$lib/api/client.svelte'
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { ReactiveState } from '$lib/app/util.svelte'
|
||||
|
||||
export async function load({ fetch, url }) {
|
||||
if (!profile) return
|
||||
|
||||
const { jwt } = profile.current!
|
||||
if (!jwt) return
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const unreadOnly = (url.searchParams.get('unreadOnly') || 'true') == 'true'
|
||||
const type = url.searchParams.get('type') || 'unread'
|
||||
|
||||
const res = await getClient(undefined, fetch).listRegistrationApplications({
|
||||
page: page,
|
||||
limit: 40,
|
||||
unread_only: unreadOnly,
|
||||
unread_only: type == 'all',
|
||||
})
|
||||
|
||||
return {
|
||||
unreadOnly: unreadOnly,
|
||||
page: page,
|
||||
applications: new ReactiveState(res.registration_applications),
|
||||
type: new ReactiveState(type),
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@
|
||||
honeypot = $state<string>(),
|
||||
nsfw = $state(false),
|
||||
verifying = $state(false)
|
||||
|
||||
|
||||
const instanceType: ClientType = $state({ name: 'lemmy', baseUrl: '/api/v3' })
|
||||
|
||||
const getCaptcha = async () =>
|
||||
@@ -100,7 +100,7 @@
|
||||
if (res.verify_email_sent) return (stage = 'verify')
|
||||
|
||||
if (registrationMode == 'RequireApplication')
|
||||
return stage == 'application'
|
||||
return (stage = 'application')
|
||||
} else {
|
||||
throw new Error($t('toast.failSignup'))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user