fix: broken unread/all applications selector
This commit is contained in:
5 files changed
+25
-19
No files matched your search
@@ -1,4 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { Community } from '$lib/api/types'
|
||||
import Avatar from '$lib/ui/generic/Avatar.svelte'
|
||||
|
||||
interface Props {
|
||||
community: Community
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
<Tabs
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/admin/config',
|
||||
@@ -43,6 +42,7 @@
|
||||
name: $t('routes.admin.media.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
/>
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
{@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),
|
||||
}
|
||||
}
|
||||
@@ -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