Add path to bookmarks, add logout button
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { bookmark_del, bookmarks_store } from "lib/Bookmarks";
|
||||
import { fs_encode_path } from "lib/FilesystemAPI";
|
||||
import { highlight_current_page } from "lib/HighlightCurrentPage";
|
||||
</script>
|
||||
|
||||
{#each $bookmarks_store as bookmark}
|
||||
<div class="row">
|
||||
<a class="button" href="/d/{bookmark.id}" use:highlight_current_page>
|
||||
<a class="button" href="/d{fs_encode_path(bookmark.path)}" use:highlight_current_page>
|
||||
<i class="icon">{bookmark.icon}</i>
|
||||
<span class="hide_small">{bookmark.label}</span>
|
||||
</a>
|
||||
|
||||
@@ -10,9 +10,14 @@ import { fs_get_node } from "lib/FilesystemAPI";
|
||||
import { css_from_path } from "filesystem/edit_window/Branding";
|
||||
import { loading_run, loading_store } from "lib/Loading";
|
||||
import Spinner from "util/Spinner.svelte";
|
||||
import { get_user, logout_user } from "lib/PixeldrainAPI";
|
||||
|
||||
onMount(async () => {
|
||||
await loading_run(async () => {
|
||||
const user = await get_user()
|
||||
if (user.username === undefined || user.username === "") {
|
||||
return
|
||||
}
|
||||
const root = await fs_get_node("/me")
|
||||
document.documentElement.style = css_from_path(root.path)
|
||||
})
|
||||
@@ -21,10 +26,20 @@ onMount(async () => {
|
||||
|
||||
<div class="nav_container">
|
||||
<nav class="nav">
|
||||
<a class="button" href="/" use:highlight_current_page>
|
||||
<i class="icon">home</i>
|
||||
<span class="hide_small">Home</span>
|
||||
</a>
|
||||
|
||||
{#if $user.username !== undefined && $user.username !== ""}
|
||||
<div class="separator hide_small"></div>
|
||||
|
||||
<div class="username hide_small">
|
||||
{$user.username}
|
||||
</div>
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<div class="stats_table hide_small">
|
||||
<div>Subscription</div>
|
||||
<div>{$user.subscription.name}</div>
|
||||
@@ -39,14 +54,28 @@ onMount(async () => {
|
||||
<div>Transfer used</div>
|
||||
<div>{formatDataVolume($user.monthly_transfer_used, 3)}</div>
|
||||
</div>
|
||||
<div class="separator hide_small"></div>
|
||||
{/if}
|
||||
|
||||
<a class="button" href="/" use:highlight_current_page>
|
||||
<i class="icon">home</i>
|
||||
<span class="hide_small">Home</span>
|
||||
</a>
|
||||
{#if !$user.username}
|
||||
<div class="separator hide_small"></div>
|
||||
|
||||
<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" on:click={()=> 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>
|
||||
@@ -55,22 +84,10 @@ onMount(async () => {
|
||||
<i class="icon">how_to_reg</i>
|
||||
<span class="hide_small">Register</span>
|
||||
</a>
|
||||
{:else}
|
||||
<a class="button" href="/user" use:highlight_current_page>
|
||||
<i class="icon">dashboard</i>
|
||||
<span class="hide_small">Dashboard</span>
|
||||
</a>
|
||||
<a class="button" href="/d/me" use:highlight_current_page>
|
||||
<i class="icon">folder</i>
|
||||
<span class="hide_small">Filesystem</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}
|
||||
{/if}
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<a class="button" href="/speedtest" use:highlight_current_page>
|
||||
<i class="icon">speed</i>
|
||||
<span class="hide_small">Speedtest</span>
|
||||
@@ -80,7 +97,8 @@ onMount(async () => {
|
||||
<span class="hide_small">Themes</span>
|
||||
</a>
|
||||
|
||||
<div class="separator hide_small"></div>
|
||||
<div class="separator"></div>
|
||||
|
||||
<Bookmarks/>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user