feat: admin details in account pending overlay

This commit is contained in:
Timothy J. Baek
2024-06-03 21:17:43 -07:00
parent 61867c1545
commit 25336f85f3
9 changed files with 333 additions and 278 deletions

View File

@@ -37,6 +37,8 @@
import { getBanners } from '$lib/apis/configs';
import { getUserSettings } from '$lib/apis/users';
import Help from '$lib/components/layout/Help.svelte';
import AccountPending from '$lib/components/layout/Overlay/AccountPending.svelte';
import { error } from '@sveltejs/kit';
const i18n = getContext('i18n');
@@ -74,7 +76,10 @@
// IndexedDB Not Found
}
const userSettings = await getUserSettings(localStorage.token);
const userSettings = await getUserSettings(localStorage.token).catch((error) => {
console.error(error);
return null;
});
if (userSettings) {
await settings.set(userSettings.ui);
@@ -186,44 +191,7 @@
>
{#if loaded}
{#if !['user', 'admin'].includes($user.role)}
<div class="fixed w-full h-full flex z-[999]">
<div
class="absolute w-full h-full backdrop-blur-lg bg-white/10 dark:bg-gray-900/50 flex justify-center"
>
<div class="m-auto pb-10 flex flex-col justify-center">
<div class="max-w-md">
<div class="text-center dark:text-white text-2xl font-medium z-50">
Account Activation Pending<br /> Contact Admin for WebUI Access
</div>
<div class=" mt-4 text-center text-sm dark:text-gray-200 w-full">
Your account status is currently pending activation. To access the WebUI, please
reach out to the administrator. Admins can manage user statuses from the Admin
Panel.
</div>
<div class=" mt-6 mx-auto relative group w-fit">
<button
class="relative z-20 flex px-5 py-2 rounded-full bg-white border border-gray-100 dark:border-none hover:bg-gray-100 text-gray-700 transition font-medium text-sm"
on:click={async () => {
location.href = '/';
}}
>
{$i18n.t('Check Again')}
</button>
<button
class="text-xs text-center w-full mt-2 text-gray-400 underline"
on:click={async () => {
localStorage.removeItem('token');
location.href = '/auth';
}}>{$i18n.t('Sign Out')}</button
>
</div>
</div>
</div>
</div>
</div>
<AccountPending />
{:else if localDBChats.length > 0}
<div class="fixed w-full h-full flex z-50">
<div