2025-10-09 15:48:23 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { highlight_current_page } from "lib/HighlightCurrentPage";
|
|
|
|
|
import { user } from "lib/UserStore";
|
|
|
|
|
import Euro from "util/Euro.svelte";
|
|
|
|
|
import { formatDataVolume } from "util/Formatting";
|
|
|
|
|
import Router from "wrap/Router.svelte";
|
|
|
|
|
import Bookmarks from "./Bookmarks.svelte";
|
|
|
|
|
import { onMount } from "svelte";
|
2025-10-13 23:20:42 +02:00
|
|
|
import { fs_get_node } from "lib/FilesystemAPI.svelte";
|
2025-10-09 15:48:23 +02:00
|
|
|
import { css_from_path } from "filesystem/edit_window/Branding";
|
|
|
|
|
import { loading_run, loading_store } from "lib/Loading";
|
|
|
|
|
import Spinner from "util/Spinner.svelte";
|
2025-10-10 00:12:14 +02:00
|
|
|
import { get_user, logout_user } from "lib/PixeldrainAPI";
|
2025-10-09 15:48:23 +02:00
|
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
|
await loading_run(async () => {
|
2025-10-10 00:12:14 +02:00
|
|
|
const user = await get_user()
|
|
|
|
|
if (user.username === undefined || user.username === "") {
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-10-09 15:48:23 +02:00
|
|
|
const root = await fs_get_node("/me")
|
|
|
|
|
document.documentElement.style = css_from_path(root.path)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="nav_container">
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="scroll_container">
|
|
|
|
|
<nav class="nav">
|
|
|
|
|
<a class="button" href="/" use:highlight_current_page>
|
|
|
|
|
<i class="icon">home</i>
|
|
|
|
|
<span class="hide_small">Home</span>
|
|
|
|
|
</a>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
{#if $user.username !== undefined && $user.username !== ""}
|
|
|
|
|
<div class="separator hide_small"></div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="username hide_small">
|
|
|
|
|
{$user.username}
|
|
|
|
|
</div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="separator"></div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="stats_table hide_small">
|
|
|
|
|
<div>Subscription</div>
|
|
|
|
|
<div>{$user.subscription.name}</div>
|
2025-10-09 15:48:23 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
{#if $user.subscription.type === "prepaid"}
|
|
|
|
|
<div>Credit</div>
|
|
|
|
|
<div><Euro amount={$user.balance_micro_eur}/></div>
|
|
|
|
|
{/if}
|
2025-10-09 15:48:23 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div>Storage used</div>
|
|
|
|
|
<div>{formatDataVolume($user.filesystem_storage_used, 3)}</div>
|
|
|
|
|
<div>Transfer used</div>
|
|
|
|
|
<div>{formatDataVolume($user.monthly_transfer_used, 3)}</div>
|
|
|
|
|
</div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="separator hide_small"></div>
|
2025-10-09 15:48:23 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<a class="button" href="/d/me" use:highlight_current_page>
|
|
|
|
|
<i class="icon">folder</i>
|
|
|
|
|
<span class="hide_small">Filesystem</span>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="button" href="/user" use:highlight_current_page>
|
|
|
|
|
<i class="icon">dashboard</i>
|
|
|
|
|
<span class="hide_small">Dashboard</span>
|
|
|
|
|
</a>
|
|
|
|
|
{#if $user.is_admin}
|
|
|
|
|
<a class="button" href="/admin" use:highlight_current_page>
|
|
|
|
|
<i class="icon">admin_panel_settings</i>
|
|
|
|
|
<span class="hide_small">Admin Panel</span>
|
|
|
|
|
</a>
|
|
|
|
|
{/if}
|
|
|
|
|
<button class="button" onclick={()=> logout_user("/")}>
|
|
|
|
|
<i class="icon">logout</i>
|
|
|
|
|
<span class="hide_small">Log out</span>
|
|
|
|
|
</button>
|
|
|
|
|
{:else}
|
|
|
|
|
<a class="button" href="/login" use:highlight_current_page>
|
|
|
|
|
<i class="icon">login</i>
|
|
|
|
|
<span class="hide_small">Login</span>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="button" href="/register" use:highlight_current_page>
|
|
|
|
|
<i class="icon">how_to_reg</i>
|
|
|
|
|
<span class="hide_small">Register</span>
|
2025-10-09 15:48:23 +02:00
|
|
|
</a>
|
|
|
|
|
{/if}
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="separator"></div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<a class="button" href="/speedtest" use:highlight_current_page>
|
|
|
|
|
<i class="icon">speed</i>
|
|
|
|
|
<span class="hide_small">Speedtest</span>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="button" href="/appearance" use:highlight_current_page>
|
|
|
|
|
<i class="icon">palette</i>
|
|
|
|
|
<span class="hide_small">Themes</span>
|
|
|
|
|
</a>
|
2025-10-09 15:48:23 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<div class="separator"></div>
|
2025-10-10 00:12:14 +02:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
<Bookmarks/>
|
|
|
|
|
</nav>
|
|
|
|
|
</div>
|
2025-10-09 15:48:23 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="page">
|
|
|
|
|
<Router/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{#if $loading_store !== 0}
|
|
|
|
|
<div class="spinner">
|
|
|
|
|
<Spinner/>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
:global(body) {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
|
|
|
|
|
color: var(--body_text_color);
|
|
|
|
|
background-image: var(--background_image);
|
|
|
|
|
background-color: var(--background_pattern_color);
|
|
|
|
|
background-size: var(--background_image_size, initial);
|
|
|
|
|
background-position: var(--background_image_position, initial);
|
|
|
|
|
background-repeat: var(--background_image_repeat, repeat);
|
|
|
|
|
background-attachment: fixed;
|
|
|
|
|
}
|
|
|
|
|
.nav_container {
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
border-right: 1px solid var(--separator);
|
|
|
|
|
background: var(--shaded_background);
|
|
|
|
|
backdrop-filter: blur(4px);
|
|
|
|
|
}
|
2025-10-13 23:20:42 +02:00
|
|
|
.scroll_container {
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
max-height: 100vh;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
2025-10-09 15:48:23 +02:00
|
|
|
.nav {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
max-width: 15em;
|
|
|
|
|
}
|
|
|
|
|
.nav > .button {
|
|
|
|
|
background: none;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
|
|
|
|
.page {
|
|
|
|
|
flex: 1 1 auto;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.separator {
|
|
|
|
|
height: 1px;
|
|
|
|
|
margin: 2px 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: var(--separator);
|
|
|
|
|
}
|
|
|
|
|
.username {
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin: 3px;
|
|
|
|
|
}
|
|
|
|
|
.stats_table {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: auto auto;
|
|
|
|
|
gap: 0.2em 1em;
|
2025-10-13 23:20:42 +02:00
|
|
|
margin: 5px;
|
2025-10-09 15:48:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media(max-width: 1000px) {
|
|
|
|
|
.hide_small {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.spinner {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 10px;
|
|
|
|
|
right: 10px;
|
|
|
|
|
height: 120px;
|
|
|
|
|
width: 120px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|