Skip to content

Commit

Permalink
add elements for logged out user, delete separate verify component
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Oct 24, 2024
1 parent 6722542 commit 4025b92
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 58 deletions.
108 changes: 71 additions & 37 deletions frontend/src/lib/components/UserLandingPage.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<script lang="ts">
import UserVerify from '$lib/components/UserVerify.svelte';
import { componentTable } from '$lib/stores/componentStore';
import { currentUser, refresh } from '$lib/stores/userStore';
import { TabItem, Tabs } from 'flowbite-svelte';
import { AtomOutline, CogSolid, GridPlusSolid, ProfileCardSolid } from 'flowbite-svelte-icons';
import { Button, TabItem, Tabs } from 'flowbite-svelte';
import {
AtomOutline,
CheckCircleOutline,
CogSolid,
GridPlusSolid,
ProfileCardSolid
} from 'flowbite-svelte-icons';
import { onMount } from 'svelte';
import { _ } from 'svelte-i18n';
import { get } from 'svelte/store';
Expand All @@ -14,49 +19,78 @@
await refresh();
});
const isVerifed = get(currentUser)?.is_verified;
export let userData: any[];
</script>

{#if isVerifed === true}
<div class="m-2 p-2">
<Tabs tabStyle="pill">
<TabItem open={true}>
<div slot="title" class="flex items-center gap-2 text-lg">
<ProfileCardSolid size="lg" />
Persönliche Daten
</div>
<svelte:component this={componentTable['userDataInput']} data={userData} />
</TabItem>
<TabItem>
<div slot="title" class="flex items-center gap-2 text-lg">
<GridPlusSolid size="lg" />
Kinder
</div>
<svelte:component this={componentTable['childrenGallery']} />
</TabItem>

{#if get(currentUser)?.is_superuser}
<TabItem>
{#if get(currentUser)}
{#if get(currentUser)?.is_verified === true}
<div class="m-2 p-2">
<Tabs tabStyle="pill">
<TabItem open={true}>
<div slot="title" class="flex items-center gap-2 text-lg">
<CogSolid size="lg" />
{$_('admin.title')}
<ProfileCardSolid size="lg" />
Persönliche Daten
</div>
<svelte:component this={componentTable['adminPage']} />
<svelte:component this={componentTable['userDataInput']} data={userData} />
</TabItem>
{/if}
{#if get(currentUser)?.is_researcher}
<TabItem>
<div slot="title" class="flex items-center gap-2 text-lg">
<AtomOutline size="lg" />
{$_('researcher.title')}
<GridPlusSolid size="lg" />
Kinder
</div>
<svelte:component this={componentTable['researchPage']} />
<svelte:component this={componentTable['childrenGallery']} />
</TabItem>
{/if}
</Tabs>
</div>

{#if get(currentUser)?.is_superuser}
<TabItem>
<div slot="title" class="flex items-center gap-2 text-lg">
<CogSolid size="lg" />
{$_('admin.title')}
</div>
<svelte:component this={componentTable['adminPage']} />
</TabItem>
{/if}
{#if get(currentUser)?.is_researcher}
<TabItem>
<div slot="title" class="flex items-center gap-2 text-lg">
<AtomOutline size="lg" />
{$_('researcher.title')}
</div>
<svelte:component this={componentTable['researchPage']} />
</TabItem>
{/if}
</Tabs>
</div>
{:else}
<div
class="m-2 mx-auto flex w-full items-center justify-center p-2 text-gray-700 dark:text-gray-400"
>
<CheckCircleOutline size="xl" color="green" class="m-2" />
<div class="m-2 p-2">
{$_('registration.successMessage')}
</div>
</div>
<Button
type="button"
class="dark:bg-primay-700 bg-primary-700 hover:bg-primary-800 dark:hover:bg-primary-800 w-full text-center text-sm text-white hover:text-white"
href="/"
>
{$_('registration.goHome')}
</Button>
{/if}
{:else}
<UserVerify />
<div
class="m-2 mx-auto flex w-full items-center justify-center p-2 text-gray-700 dark:text-gray-400"
>
<div class="m-2 p-2">
{$_('registration.successMessage')}
</div>
</div>
<Button
type="button"
class="dark:bg-primay-700 bg-primary-700 hover:bg-primary-800 dark:hover:bg-primary-800 w-full text-center text-sm text-white hover:text-white"
href="/"
>
{$_('registration.goHome')}
</Button>
{/if}
21 changes: 0 additions & 21 deletions frontend/src/lib/components/UserVerify.svelte

This file was deleted.

0 comments on commit 4025b92

Please sign in to comment.