Redoing account section
This commit is contained in:
@@ -4,7 +4,7 @@ import jwt from 'jsonwebtoken'
|
|||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Handle} */
|
/** @type {import('@sveltejs/kit').Handle} */
|
||||||
export async function handle({ event, resolve }) {
|
export async function handle({ event, resolve }) {
|
||||||
const nonProtectedRoutes = ['/login']
|
const nonProtectedRoutes = ['/login', '/api']
|
||||||
const urlpath = event.url.pathname
|
const urlpath = event.url.pathname
|
||||||
|
|
||||||
if (urlpath.startsWith('/api') && event.request.headers.get('apikey') !== SECRET_INTERNAL_API_KEY && event.url.searchParams.get('apikey') !== SECRET_INTERNAL_API_KEY) {
|
if (urlpath.startsWith('/api') && event.request.headers.get('apikey') !== SECRET_INTERNAL_API_KEY && event.url.searchParams.get('apikey') !== SECRET_INTERNAL_API_KEY) {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<script>
|
|
||||||
import IconButton from './iconButton.svelte'
|
|
||||||
import SearchBar from './searchBar.svelte'
|
|
||||||
import { goto } from '$app/navigation'
|
|
||||||
import { page } from '$app/stores'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<nav class="sticky top-0 z-10 flex items-center justify-between p-3 text-base duration-300" style="height: 4rem;">
|
|
||||||
<SearchBar />
|
|
||||||
<!-- <section class="flex h-14">
|
|
||||||
<IconButton halo={false} on:click={() => goto('/settings')}>
|
|
||||||
<i slot="icon" class="fa-solid fa-user" />
|
|
||||||
</IconButton>
|
|
||||||
{#if $page.url.pathname !== '/'}
|
|
||||||
<IconButton halo={false} on:click={() => history.back()}>
|
|
||||||
<i slot="icon" class="fa-solid fa-arrow-left" />
|
|
||||||
</IconButton>
|
|
||||||
<IconButton halo={false}>
|
|
||||||
<i slot="icon" class="fa-solid fa-magnifying-glass" />
|
|
||||||
</IconButton>
|
|
||||||
{/if}
|
|
||||||
</section> -->
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<!-- New Idea: We're going to do a search button, but it will toggle a floating search bar that flys in from the top and autofocuses -->
|
|
||||||
@@ -11,14 +11,18 @@
|
|||||||
header: 'Home',
|
header: 'Home',
|
||||||
icon: 'fa-solid fa-house',
|
icon: 'fa-solid fa-house',
|
||||||
},
|
},
|
||||||
'/library': {
|
'/account': {
|
||||||
header: 'Libray',
|
header: data.username,
|
||||||
icon: 'fa-solid fa-bars-staggered',
|
icon: 'fa-solid fa-user',
|
||||||
},
|
},
|
||||||
'/search': {
|
'/search': {
|
||||||
header: 'Search',
|
header: 'Search',
|
||||||
icon: 'fa-solid fa-search',
|
icon: 'fa-solid fa-search',
|
||||||
},
|
},
|
||||||
|
'/library': {
|
||||||
|
header: 'Libray',
|
||||||
|
icon: 'fa-solid fa-bars-staggered',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageTransitionTime = 200
|
const pageTransitionTime = 200
|
||||||
@@ -71,17 +75,21 @@
|
|||||||
|
|
||||||
{#if $pageWidth >= 768}
|
{#if $pageWidth >= 768}
|
||||||
<div id="content-grid" class="h-full overflow-hidden">
|
<div id="content-grid" class="h-full overflow-hidden">
|
||||||
<section class="relative mr-4 flex h-full flex-col gap-6 rounded-lg px-3 py-6" bind:this={tabList}>
|
<section class="relative mr-10 flex h-full flex-col gap-6 rounded-lg px-3 py-12" bind:this={tabList}>
|
||||||
{#each Object.entries(contentTabs) as [page, tabData]}
|
{#each Object.entries(contentTabs) as [page, tabData]}
|
||||||
{#if data.url === page}
|
{#if data.url === page}
|
||||||
<button bind:this={activeTab} class="pointer-events-none aspect-square w-14 text-white transition-colors" disabled="true">
|
<button bind:this={activeTab} class="pointer-events-none grid aspect-square w-14 place-items-center text-white transition-colors" disabled="true">
|
||||||
<i class="{tabData.icon} text-xl" />
|
<span class="text-xs">
|
||||||
<span class="text-xs">{tabData.header}</span>
|
<i class="{tabData.icon} mb-2 text-xl" />
|
||||||
|
{tabData.header}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<button class="aspect-square w-14 text-neutral-400 transition-colors hover:text-lazuli-primary" on:click={() => goto(page)}>
|
<button class="grid aspect-square w-14 place-items-center text-neutral-400 transition-colors hover:text-lazuli-primary" on:click={() => goto(page)}>
|
||||||
<i class="{tabData.icon} text-xl" />
|
<span class="text-xs">
|
||||||
<span class="text-xs">{tabData.header}</span>
|
<i class="{tabData.icon} mb-2 text-xl" />
|
||||||
|
{tabData.header}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
30
src/routes/(app)/account/+page.svelte
Normal file
30
src/routes/(app)/account/+page.svelte
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<script>
|
||||||
|
import IconButton from '$lib/components/utility/iconButton.svelte'
|
||||||
|
|
||||||
|
export let data
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="flex flex-col gap-8">
|
||||||
|
<section class="flex items-center justify-between text-xl">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<div class="grid aspect-square h-36 place-items-center rounded-full bg-neutral-800">
|
||||||
|
<i class="fa-solid fa-user text-6xl text-neutral-400" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>{data.username}</div>
|
||||||
|
<div class="text-base text-neutral-400">Other info about the user</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex h-12 gap-4">
|
||||||
|
<IconButton>
|
||||||
|
<i slot="icon" class="fa-solid fa-gear" />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton>
|
||||||
|
<i slot="icon" class="fa-solid fa-right-from-bracket" />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<div>This is where things like history would go</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
@@ -1,68 +1,22 @@
|
|||||||
<script>
|
<script>
|
||||||
import IconButton from '$lib/components/utility/iconButton.svelte'
|
import IconButton from '$lib/components/utility/iconButton.svelte'
|
||||||
import { goto } from '$app/navigation'
|
|
||||||
import { page } from '$app/stores'
|
|
||||||
|
|
||||||
const settingRoutes = {
|
|
||||||
connections: {
|
|
||||||
displayName: 'Connections',
|
|
||||||
uri: '/settings/connections',
|
|
||||||
icon: 'fa-solid fa-circle-nodes',
|
|
||||||
},
|
|
||||||
// devices: {
|
|
||||||
// displayName: 'Devices',
|
|
||||||
// uri: '/settings/devices',
|
|
||||||
// icon: 'fa-solid fa-mobile-screen',
|
|
||||||
// },
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="mx-auto grid h-full max-w-screen-xl gap-8 p-8">
|
<main class="h-full">
|
||||||
<nav class="h-full rounded-lg p-6">
|
<h1 class="sticky top-0 grid grid-cols-[1fr_auto_1fr] grid-rows-1 items-center text-2xl">
|
||||||
<h1 class="flex h-6 justify-between text-neutral-400">
|
<IconButton on:click={() => history.back()}>
|
||||||
<span>
|
<i slot="icon" class="fa-solid fa-arrow-left" />
|
||||||
<i class="fa-solid fa-gear" />
|
</IconButton>
|
||||||
Settings
|
<span>Account</span>
|
||||||
</span>
|
</h1>
|
||||||
{#if $page.url.pathname.split('/').at(-1) !== 'settings'}
|
<section class="px-[5vw]">
|
||||||
<IconButton on:click={() => goto('/settings')}>
|
|
||||||
<i slot="icon" class="fa-solid fa-caret-left" />
|
|
||||||
</IconButton>
|
|
||||||
{/if}
|
|
||||||
</h1>
|
|
||||||
<ol class="ml-2 mt-4 flex flex-col gap-3 border-2 border-transparent border-l-neutral-500 px-2">
|
|
||||||
{#each Object.values(settingRoutes) as route}
|
|
||||||
<li>
|
|
||||||
{#if $page.url.pathname === route.uri}
|
|
||||||
<div class="rounded-lg bg-neutral-500 px-3 py-1">
|
|
||||||
<i class={route.icon} />
|
|
||||||
{route.displayName}
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<a href={route.uri} class="block rounded-lg px-3 py-1 opacity-50 hover:bg-neutral-700">
|
|
||||||
<i class={route.icon} />
|
|
||||||
{route.displayName}
|
|
||||||
</a>
|
|
||||||
{/if}
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ol>
|
|
||||||
</nav>
|
|
||||||
<div class="relative h-full overflow-y-scroll rounded-lg">
|
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
main {
|
h1 {
|
||||||
grid-template-columns: 20rem auto;
|
height: 80px;
|
||||||
}
|
padding: 16px 5vw;
|
||||||
nav {
|
|
||||||
background-color: rgba(82, 82, 82, 0.25);
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
text-align: center;
|
|
||||||
width: 1rem;
|
|
||||||
margin-right: 0.2rem;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,13 +1,50 @@
|
|||||||
<!-- This is template for reference -->
|
|
||||||
<script>
|
<script>
|
||||||
|
import IconButton from '$lib/components/utility/iconButton.svelte'
|
||||||
|
import { goto } from '$app/navigation'
|
||||||
|
|
||||||
|
export let data
|
||||||
|
|
||||||
|
const settingRoutes = {
|
||||||
|
connections: {
|
||||||
|
displayName: 'Connections',
|
||||||
|
uri: '/settings/connections',
|
||||||
|
icon: 'fa-solid fa-circle-nodes',
|
||||||
|
},
|
||||||
|
// devices: {
|
||||||
|
// displayName: 'Devices',
|
||||||
|
// uri: '/settings/devices',
|
||||||
|
// icon: 'fa-solid fa-mobile-screen',
|
||||||
|
// },
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section></section>
|
<nav class="h-full rounded-lg bg-neutral-950 p-6">
|
||||||
|
<h1 class="flex h-6 justify-between text-neutral-400">
|
||||||
<style>
|
<span>
|
||||||
section {
|
<i class="fa-solid fa-gear" />
|
||||||
border-radius: 0.5rem;
|
Settings
|
||||||
background-color: rgba(82, 82, 82, 0.25);
|
</span>
|
||||||
height: 24rem;
|
{#if data.url.split('/').at(-1) !== 'settings'}
|
||||||
}
|
<IconButton on:click={() => goto('/settings')}>
|
||||||
</style>
|
<i slot="icon" class="fa-solid fa-caret-left" />
|
||||||
|
</IconButton>
|
||||||
|
{/if}
|
||||||
|
</h1>
|
||||||
|
<ol class="ml-2 mt-4 flex flex-col gap-3 border-2 border-transparent border-l-neutral-500 px-2">
|
||||||
|
{#each Object.values(settingRoutes) as route}
|
||||||
|
<li>
|
||||||
|
{#if data.url === route.uri}
|
||||||
|
<div class="rounded-lg bg-neutral-500 px-3 py-1">
|
||||||
|
<i class={route.icon} />
|
||||||
|
{route.displayName}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<a href={route.uri} class="block rounded-lg px-3 py-1 opacity-50 hover:bg-neutral-700">
|
||||||
|
<i class={route.icon} />
|
||||||
|
{route.displayName}
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|||||||
8
src/routes/+layout.server.js
Normal file
8
src/routes/+layout.server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/** @type {import('./$types').LayoutLoad} */
|
||||||
|
export const load = ({ url, locals }) => {
|
||||||
|
return {
|
||||||
|
url: url.pathname,
|
||||||
|
userId: locals.userId,
|
||||||
|
username: locals.username,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window bind:innerWidth={$pageWidth} />
|
<svelte:window bind:innerWidth={$pageWidth} />
|
||||||
<div class="no-scrollbar h-screen font-notoSans text-white">
|
<div class="no-scrollbar relative h-screen font-notoSans text-white">
|
||||||
<div class="fixed isolate -z-10 h-full w-screen bg-black">
|
<div class="fixed isolate -z-10 h-full w-screen bg-black">
|
||||||
<!-- This whole bg is a complete copy of ytmusic, design own at some point (Place for customization w/ album art etc?) (EDIT: Ok, it looks SICK with album art!) -->
|
<!-- This whole bg is a complete copy of ytmusic, design own at some point (Place for customization w/ album art etc?) (EDIT: Ok, it looks SICK with album art!) -->
|
||||||
<div id="background-gradient" class="absolute z-10 h-1/2 w-full bg-cover" />
|
<div id="background-gradient" class="absolute z-10 h-1/2 w-full bg-cover" />
|
||||||
|
|||||||
Reference in New Issue
Block a user