|
@@ -1,7 +1,6 @@
|
|
<script lang="typescript" context="module">
|
|
<script lang="typescript" context="module">
|
|
import type { AppSession, PageData, PreloadContext } from "src/utils/session";
|
|
import type { AppSession, PageData, PreloadContext } from "src/utils/session";
|
|
import type { AuthInfo } from "src/routes/login/check";
|
|
import type { AuthInfo } from "src/routes/login/check";
|
|
- import { goto } from "@sapper/app";
|
|
|
|
|
|
|
|
// TODO: Clean up this awful mess
|
|
// TODO: Clean up this awful mess
|
|
export async function preload(
|
|
export async function preload(
|
|
@@ -35,6 +34,7 @@
|
|
|
|
|
|
<script lang="typescript">
|
|
<script lang="typescript">
|
|
import { stores } from "@sapper/app";
|
|
import { stores } from "@sapper/app";
|
|
|
|
+ import Nav from "../components/Nav.svelte";
|
|
const { page } = stores();
|
|
const { page } = stores();
|
|
|
|
|
|
export let loggedIn!: boolean;
|
|
export let loggedIn!: boolean;
|
|
@@ -43,9 +43,9 @@
|
|
$: path = $page.path.slice(1);
|
|
$: path = $page.path.slice(1);
|
|
|
|
|
|
const ROUTES_NAV = [
|
|
const ROUTES_NAV = [
|
|
- { route: "rules", moderator: false, name: "Rules" },
|
|
|
|
- { route: "rules/edit", moderator: true, name: "Edit rules" },
|
|
|
|
- { route: "logs", moderator: true, name: "Event logs" },
|
|
|
|
|
|
+ { route: "rules", moderatorOnly: false, name: "Rules" },
|
|
|
|
+ { route: "rules/edit", moderatorOnly: true, name: "Edit rules" },
|
|
|
|
+ { route: "logs", moderatorOnly: true, name: "Event logs" },
|
|
];
|
|
];
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -58,23 +58,6 @@
|
|
@apply font-sans;
|
|
@apply font-sans;
|
|
}
|
|
}
|
|
|
|
|
|
- nav {
|
|
|
|
- @apply fixed w-screen h-12 shadow-lg flex flex-row items-center px-4 z-10;
|
|
|
|
- background-color: #0a0d13;
|
|
|
|
-
|
|
|
|
- a {
|
|
|
|
- @apply text-white px-5 py-3;
|
|
|
|
-
|
|
|
|
- &:hover {
|
|
|
|
- @apply bg-gray-800 cursor-pointer;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &.active {
|
|
|
|
- @apply bg-gray-800;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.viewport {
|
|
.viewport {
|
|
@apply bg-gray-700 h-screen w-full pb-8 px-20 pt-16;
|
|
@apply bg-gray-700 h-screen w-full pb-8 px-20 pt-16;
|
|
margin-top: 3rem;
|
|
margin-top: 3rem;
|
|
@@ -91,15 +74,7 @@
|
|
|
|
|
|
|
|
|
|
{#if loggedIn}
|
|
{#if loggedIn}
|
|
- <nav>
|
|
|
|
- {#each ROUTES_NAV as route (route.route) }
|
|
|
|
- {#if !route.moderator || (route.moderator && moderator) }
|
|
|
|
- <a href="/{route.route}" class:active={route.route == path}>{route.name}</a>
|
|
|
|
- {/if}
|
|
|
|
- {/each}
|
|
|
|
- <span class="mx-auto"></span>
|
|
|
|
- <a href="/logout">Log out</a>
|
|
|
|
- </nav>
|
|
|
|
|
|
+ <Nav routes={ROUTES_NAV} currentPath={path} isModerator={moderator} />
|
|
{/if}
|
|
{/if}
|
|
|
|
|
|
<div class="flex items-center justify-center bg-gray-900 h-screen w-screen">
|
|
<div class="flex items-center justify-center bg-gray-900 h-screen w-screen">
|