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-11-16 13:58:00 +01:00
|
|
|
import Transactions from "./Transactions.svelte";
|
2021-11-16 21:11:59 +01:00
|
|
|
import Subscription from "./Subscription.svelte";
|
2021-12-20 20:31:39 +01:00
|
|
|
import ConnectApp from "./ConnectApp.svelte";
|
2022-02-01 18:43:52 +01:00
|
|
|
import ActivityLog from "./ActivityLog.svelte";
|
2022-04-26 15:23:57 +02:00
|
|
|
import SharingSettings from "./SharingSettings.svelte";
|
2022-10-11 14:21:06 +02:00
|
|
|
import Footer from "../layout/Footer.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
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-11-16 13:58:00 +01:00
|
|
|
let get_page = () => {
|
2021-09-21 21:39:28 +02:00
|
|
|
let newpage = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1)
|
|
|
|
if (newpage === "user") {
|
2021-11-16 13:58:00 +01:00
|
|
|
newpage = "home"
|
2021-09-21 21:39:28 +02:00
|
|
|
}
|
2021-11-16 13:58:00 +01:00
|
|
|
|
2021-09-21 21:39:28 +02:00
|
|
|
page = newpage
|
2021-11-16 13:58:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
get_page()
|
2021-09-21 21:39:28 +02:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2021-11-16 13:58:00 +01:00
|
|
|
<svelte:window on:popstate={get_page} />
|
|
|
|
|
2022-01-11 13:28:22 +01:00
|
|
|
<header>
|
2022-01-03 14:02:50 +01:00
|
|
|
<h1>Welcome home, {window.user.username}!</h1>
|
|
|
|
|
2021-09-21 23:12:55 +02:00
|
|
|
<div class="tab_bar">
|
2021-09-23 20:38:17 +02:00
|
|
|
<a class="button"
|
2021-09-21 23:12:55 +02:00
|
|
|
href="/user"
|
2021-11-16 13:58:00 +01:00
|
|
|
class:button_highlight={page === "home"}
|
|
|
|
on:click|preventDefault={() => {navigate("home", "My home")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">home</i><br/>
|
2021-09-21 23:12:55 +02:00
|
|
|
My home
|
|
|
|
</a>
|
2021-09-23 20:38:17 +02:00
|
|
|
<a class="button"
|
2021-09-21 23:12:55 +02:00
|
|
|
href="/user/settings"
|
|
|
|
class:button_highlight={page === "settings"}
|
2022-02-22 19:53:31 +01:00
|
|
|
on:click|preventDefault={() => {navigate("settings", "Settings")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">settings</i><br/>
|
2022-02-22 19:53:31 +01:00
|
|
|
Settings
|
|
|
|
</a>
|
2022-04-26 15:23:57 +02:00
|
|
|
<a class="button"
|
|
|
|
href="/user/sharing"
|
|
|
|
class:button_highlight={page === "sharing"}
|
|
|
|
on:click|preventDefault={() => {navigate("sharing", "Sharing")}}>
|
|
|
|
<i class="icon">share</i><br/>
|
|
|
|
Sharing
|
|
|
|
</a>
|
2022-02-22 19:53:31 +01:00
|
|
|
<a class="button"
|
|
|
|
href="/user/connect_app"
|
|
|
|
class:button_highlight={page === "connect_app"}
|
|
|
|
on:click|preventDefault={() => {navigate("connect_app", "Apps")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">app_registration</i><br/>
|
2022-02-22 19:53:31 +01:00
|
|
|
Apps
|
2021-09-21 23:12:55 +02:00
|
|
|
</a>
|
2021-09-23 20:38:17 +02:00
|
|
|
<a class="button"
|
2021-09-21 23:12:55 +02:00
|
|
|
href="/user/api_keys"
|
|
|
|
class:button_highlight={page === "api_keys"}
|
|
|
|
on:click|preventDefault={() => {navigate("api_keys", "API keys")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">vpn_key</i><br/>
|
2022-02-22 19:53:31 +01:00
|
|
|
Keys
|
2021-09-21 23:12:55 +02:00
|
|
|
</a>
|
2022-02-01 18:43:52 +01:00
|
|
|
<a class="button"
|
|
|
|
href="/user/activity"
|
|
|
|
class:button_highlight={page === "activity"}
|
|
|
|
on:click|preventDefault={() => {navigate("activity", "Activity log")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">list</i><br/>
|
2022-02-01 18:43:52 +01:00
|
|
|
Activity log
|
|
|
|
</a>
|
2021-11-22 21:34:14 +01:00
|
|
|
<a class="button"
|
|
|
|
href="/user/subscription"
|
|
|
|
class:button_highlight={page === "subscription"}
|
|
|
|
on:click|preventDefault={() => {navigate("subscription", "Subscription")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">shopping_cart</i><br/>
|
2021-11-22 21:34:14 +01:00
|
|
|
Subscription
|
|
|
|
</a>
|
2021-11-30 16:33:57 +01:00
|
|
|
{#if window.user.subscription.type !== "patreon"}
|
2021-11-16 13:58:00 +01:00
|
|
|
<a class="button"
|
|
|
|
href="/user/transactions"
|
|
|
|
class:button_highlight={page === "transactions"}
|
|
|
|
on:click|preventDefault={() => {navigate("transactions", "Transactions")}}>
|
2022-03-29 21:41:46 +02:00
|
|
|
<i class="icon">receipt_long</i><br/>
|
2021-11-16 13:58:00 +01:00
|
|
|
Transactions
|
|
|
|
</a>
|
|
|
|
{/if}
|
2021-09-21 23:12:55 +02:00
|
|
|
</div>
|
2022-01-11 13:28:22 +01:00
|
|
|
</header>
|
2022-10-11 14:21:06 +02:00
|
|
|
<div id="page_content" class="page_content">
|
|
|
|
{#if page === "home"}
|
|
|
|
<Home/>
|
|
|
|
{:else if page === "settings"}
|
|
|
|
<AccountSettings/>
|
|
|
|
{:else if page === "sharing"}
|
|
|
|
<SharingSettings/>
|
|
|
|
{:else if page === "api_keys"}
|
|
|
|
<APIKeys/>
|
|
|
|
{:else if page === "activity"}
|
|
|
|
<ActivityLog/>
|
|
|
|
{:else if page === "connect_app"}
|
|
|
|
<ConnectApp/>
|
|
|
|
{:else if page === "transactions"}
|
|
|
|
<Transactions/>
|
|
|
|
{:else if page === "subscription"}
|
|
|
|
<Subscription/>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
<Footer/>
|