2021-09-21 21:39:28 +02:00
|
|
|
<script>
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
import Home from "./Home.svelte";
|
|
|
|
import AccountSettings from "./AccountSettings.svelte";
|
2021-09-21 22:47:38 +02:00
|
|
|
import APIKeys from "./APIKeys.svelte";
|
2021-09-21 21:39:28 +02:00
|
|
|
|
|
|
|
let page = ""
|
|
|
|
|
|
|
|
let navigate = (path, title) => {
|
|
|
|
page = path
|
|
|
|
window.document.title = title+" ~ pixeldrain"
|
|
|
|
window.history.pushState(
|
|
|
|
{}, window.document.title, "/user/"+path
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
let newpage = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1)
|
|
|
|
if (newpage === "user") {
|
|
|
|
newpage = ""
|
|
|
|
}
|
|
|
|
page = newpage
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div>
|
2021-09-21 23:12:55 +02:00
|
|
|
<div class="tab_bar">
|
|
|
|
<a class="button tab"
|
|
|
|
href="/user"
|
|
|
|
class:button_highlight={page === ""}
|
|
|
|
on:click|preventDefault={() => {navigate("", "My home")}}>
|
|
|
|
<i class="icon">home</i>
|
|
|
|
My home
|
|
|
|
</a>
|
|
|
|
<a class="button tab"
|
|
|
|
href="/user/settings"
|
|
|
|
class:button_highlight={page === "settings"}
|
|
|
|
on:click|preventDefault={() => {navigate("settings", "Account settings")}}>
|
|
|
|
<i class="icon">settings</i>
|
|
|
|
Account settings
|
|
|
|
</a>
|
|
|
|
<a class="button tab"
|
|
|
|
href="/user/api_keys"
|
|
|
|
class:button_highlight={page === "api_keys"}
|
|
|
|
on:click|preventDefault={() => {navigate("api_keys", "API keys")}}>
|
|
|
|
<i class="icon">vpn_key</i>
|
|
|
|
API keys
|
|
|
|
</a>
|
|
|
|
</div>
|
2021-09-21 21:39:28 +02:00
|
|
|
<hr/>
|
|
|
|
|
|
|
|
{#if page === ""}
|
|
|
|
<Home></Home>
|
|
|
|
{:else if page === "settings"}
|
|
|
|
<AccountSettings></AccountSettings>
|
2021-09-21 22:47:38 +02:00
|
|
|
{:else if page === "api_keys"}
|
|
|
|
<APIKeys></APIKeys>
|
2021-09-21 21:39:28 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|