<script lang="ts">
	import type { PageData } from './$types';
	import { env } from '$env/dynamic/public';
	import { Cog6Tooth, Flag, UserGroup, Users } from 'svelte-heros-v2';

	export let data: PageData;

	let tabs = [
		{
			path: `${env.PUBLIC_BASE_PATH}/admin/users`,
			icon: UserGroup,
			name: 'Registrierte Nutzer',
			enabled: data.userCount != null
		},
		{
			path: `${env.PUBLIC_BASE_PATH}/admin/reports`,
			icon: Flag,
			name: 'Reports',
			enabled: data.reportCount != null
		},
		{
			path: `${env.PUBLIC_BASE_PATH}/admin/admin`,
			icon: Users,
			name: 'Website Admins',
			enabled: data.adminCount != null
		},
		{
			path: `${env.PUBLIC_BASE_PATH}/admin/settings`,
			icon: Cog6Tooth,
			name: 'Website Einstellungen',
			enabled: data.settingsRead
		}
	];
</script>

<div class="flex justify-around items-center h-screen">
	{#each tabs as tab}
		{#if tab.enabled}
			<div class="flex flex-col gap-4 justify-center items-center">
				<a
					class="h-64 w-64 border flex justify-center items-center rounded-xl duration-100 hover:bg-base-200"
					href={tab.path}
					title={tab.name}
				>
					<svelte:component this={tab.icon} width="5rem" height="5rem" />
				</a>
				<span>{tab.name}</span>
			</div>
		{/if}
	{/each}
</div>
