2021-12-09 11:53:54 +00:00
|
|
|
<script lang="ts">
|
2021-12-12 07:01:10 +00:00
|
|
|
import {Navbar, NavbarBrand, Nav, NavItem, NavLink, Collapse, NavbarToggler, Dropdown, DropdownItem, DropdownMenu, DropdownToggle, Button} from 'sveltestrap';
|
2021-12-11 11:01:36 +00:00
|
|
|
import { loggedIn } from '../stores';
|
2021-12-12 07:01:10 +00:00
|
|
|
import { Link, navigate } from 'svelte-navigator';
|
|
|
|
import { get } from 'svelte/store';
|
2021-12-09 12:56:06 +00:00
|
|
|
|
2021-12-11 11:01:36 +00:00
|
|
|
export let style: string;
|
2021-12-09 12:56:06 +00:00
|
|
|
|
2021-12-09 11:53:54 +00:00
|
|
|
let isOpen = false;
|
|
|
|
const toggle = () => (isOpen = !isOpen);
|
|
|
|
|
2021-12-11 11:01:36 +00:00
|
|
|
let loggedIn_value: boolean;
|
|
|
|
|
|
|
|
loggedIn.subscribe(value => {
|
|
|
|
loggedIn_value = value;
|
|
|
|
});
|
2021-12-12 07:01:10 +00:00
|
|
|
|
|
|
|
function logout() {
|
|
|
|
localStorage.removeItem("pk-token");
|
|
|
|
localStorage.removeItem("pk-user");
|
|
|
|
loggedIn.update(() => false);
|
|
|
|
navigate("/");
|
|
|
|
}
|
|
|
|
|
2021-12-11 11:01:36 +00:00
|
|
|
</script>
|
2021-12-11 17:39:42 +00:00
|
|
|
<div style="background-color: #292929" class="mb-4">
|
|
|
|
<Navbar color="light" light expand="lg">
|
2021-12-11 11:01:36 +00:00
|
|
|
<NavbarBrand>pk-webs</NavbarBrand>
|
|
|
|
<NavbarToggler on:click={toggle}></NavbarToggler>
|
|
|
|
<Collapse {isOpen} navbar expand="lg">
|
|
|
|
<Nav class="ms-auto" navbar>
|
|
|
|
<Dropdown nav inNavbar>
|
|
|
|
<DropdownToggle color="transparent">Styles</DropdownToggle>
|
|
|
|
<DropdownMenu end>
|
|
|
|
<DropdownItem on:click={() => style = "light"}>Light</DropdownItem>
|
|
|
|
<DropdownItem on:click={() => style = "dark"}>Dark</DropdownItem>
|
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
{#if loggedIn_value || localStorage.getItem("pk-token")}
|
|
|
|
<Dropdown nav inNavbar>
|
|
|
|
<DropdownToggle color="transparent">Dash</DropdownToggle>
|
|
|
|
<DropdownMenu end>
|
2021-12-15 12:56:36 +00:00
|
|
|
<Link style="text-decoration: none;" to="/dash?tab=system"><DropdownItem>System</DropdownItem></Link>
|
|
|
|
<Link style="text-decoration: none;" to="/dash?tab=members"><DropdownItem>Members</DropdownItem></Link>
|
2021-12-18 23:58:34 +00:00
|
|
|
<Link style="text-decoration: none;" to="/dash?tab=groups"><DropdownItem>Groups</DropdownItem></Link>
|
2021-12-12 07:01:10 +00:00
|
|
|
<DropdownItem divider />
|
|
|
|
<DropdownItem on:click={logout}>Log out</DropdownItem>
|
2021-12-11 11:01:36 +00:00
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
{/if}
|
|
|
|
<NavItem>
|
|
|
|
<NavLink href="/settings">Settings</NavLink>
|
|
|
|
</NavItem>
|
|
|
|
<NavItem>
|
|
|
|
<NavLink href="/templates">Templates</NavLink>
|
|
|
|
</NavItem>
|
|
|
|
<NavItem>
|
2021-12-12 22:09:28 +00:00
|
|
|
<NavLink href="/profile">Public</NavLink>
|
2021-12-11 11:01:36 +00:00
|
|
|
</NavItem>
|
|
|
|
</Nav>
|
|
|
|
</Collapse>
|
|
|
|
</Navbar>
|
|
|
|
</div>
|