2024-01-25 19:50:26 -05:00
|
|
|
<script lang="ts">
|
2024-01-27 01:38:04 -05:00
|
|
|
import { fly } from 'svelte/transition'
|
2024-01-26 01:30:18 -05:00
|
|
|
import { goto } from '$app/navigation'
|
|
|
|
|
import { pageWidth } from '$lib/stores'
|
|
|
|
|
import NavbarSide, { type NavTab } from '$lib/components/util/navbarSide.svelte'
|
2024-01-27 01:38:04 -05:00
|
|
|
import NavbarFoot from '$lib/components/util/navbarFoot.svelte'
|
|
|
|
|
import { page } from '$app/stores'
|
2024-01-25 19:50:26 -05:00
|
|
|
|
2024-01-27 01:38:04 -05:00
|
|
|
let currentPathname = $page.url.pathname
|
2024-01-25 19:50:26 -05:00
|
|
|
|
2024-01-26 01:30:18 -05:00
|
|
|
const contentTabs: NavTab[] = [
|
|
|
|
|
{
|
|
|
|
|
pathname: '/',
|
|
|
|
|
name: 'Home',
|
2024-01-25 19:50:26 -05:00
|
|
|
icon: 'fa-solid fa-house',
|
|
|
|
|
},
|
2024-01-26 01:30:18 -05:00
|
|
|
{
|
|
|
|
|
pathname: '/user',
|
|
|
|
|
name: 'User',
|
|
|
|
|
icon: 'fa-solid fa-user', // This would be a cool spot for a user-uploaded pfp
|
2024-01-25 19:50:26 -05:00
|
|
|
},
|
2024-01-26 01:30:18 -05:00
|
|
|
{
|
|
|
|
|
pathname: '/search',
|
|
|
|
|
name: 'Search',
|
2024-01-25 19:50:26 -05:00
|
|
|
icon: 'fa-solid fa-search',
|
|
|
|
|
},
|
2024-01-26 01:30:18 -05:00
|
|
|
{
|
|
|
|
|
pathname: '/library',
|
|
|
|
|
name: 'Libray',
|
2024-01-25 19:50:26 -05:00
|
|
|
icon: 'fa-solid fa-bars-staggered',
|
|
|
|
|
},
|
2024-01-26 01:30:18 -05:00
|
|
|
]
|
2024-01-25 19:50:26 -05:00
|
|
|
|
|
|
|
|
const pageTransitionTime: number = 200
|
|
|
|
|
|
|
|
|
|
type PageTransitionDirection = 1 | -1
|
2024-01-27 01:38:04 -05:00
|
|
|
let directionMultiplier: PageTransitionDirection = 1
|
2024-01-26 01:30:18 -05:00
|
|
|
</script>
|
|
|
|
|
|
2024-01-27 01:38:04 -05:00
|
|
|
{#if $pageWidth >= 768}
|
|
|
|
|
<div id="content-grid" class="grid h-full grid-rows-1 gap-8 overflow-hidden">
|
|
|
|
|
<NavbarSide
|
|
|
|
|
navTabs={contentTabs}
|
|
|
|
|
{currentPathname}
|
|
|
|
|
transitionTime={pageTransitionTime}
|
|
|
|
|
on:navigate={(event) => {
|
|
|
|
|
event.detail.direction === 'up' ? (directionMultiplier = 1) : (directionMultiplier = -1)
|
|
|
|
|
currentPathname = event.detail.pathname
|
|
|
|
|
goto(currentPathname)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<section class="no-scrollbar relative overflow-y-scroll">
|
|
|
|
|
{#key currentPathname}
|
|
|
|
|
<div
|
|
|
|
|
in:fly={{ y: -50 * directionMultiplier, duration: pageTransitionTime, delay: pageTransitionTime }}
|
|
|
|
|
out:fly={{ y: 50 * directionMultiplier, duration: pageTransitionTime }}
|
|
|
|
|
class="absolute w-full pr-[5vw] pt-16"
|
|
|
|
|
>
|
|
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
{/key}
|
|
|
|
|
</section>
|
|
|
|
|
<footer class="fixed bottom-0 flex w-full flex-col items-center justify-center">
|
|
|
|
|
<!-- <MiniPlayer displayMode={'horizontal'} /> -->
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
2024-01-26 01:30:18 -05:00
|
|
|
<div class="h-full overflow-hidden">
|
2024-01-27 01:38:04 -05:00
|
|
|
{#key currentPathname}
|
2024-01-26 01:30:18 -05:00
|
|
|
<section
|
2024-01-27 01:38:04 -05:00
|
|
|
in:fly={{ x: 200 * directionMultiplier, duration: pageTransitionTime, delay: pageTransitionTime }}
|
|
|
|
|
out:fly={{ x: -200 * directionMultiplier, duration: pageTransitionTime }}
|
2024-01-26 01:30:18 -05:00
|
|
|
class="no-scrollbar h-full overflow-y-scroll px-[5vw] pt-16"
|
|
|
|
|
>
|
|
|
|
|
<slot />
|
|
|
|
|
</section>
|
|
|
|
|
{/key}
|
|
|
|
|
<footer class="fixed bottom-0 flex w-full flex-col items-center justify-center">
|
2024-01-27 01:38:04 -05:00
|
|
|
<!-- <MiniPlayer displayMode={'vertical'} /> -->
|
|
|
|
|
<NavbarFoot
|
|
|
|
|
navTabs={contentTabs}
|
|
|
|
|
{currentPathname}
|
|
|
|
|
transitionTime={pageTransitionTime}
|
|
|
|
|
on:navigate={(event) => {
|
|
|
|
|
event.detail.direction === 'right' ? (directionMultiplier = 1) : (directionMultiplier = -1)
|
|
|
|
|
currentPathname = event.detail.pathname
|
|
|
|
|
goto(currentPathname)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2024-01-26 01:30:18 -05:00
|
|
|
</footer>
|
|
|
|
|
</div>
|
2024-01-27 01:38:04 -05:00
|
|
|
{/if}
|
2024-01-26 01:30:18 -05:00
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
#content-grid {
|
|
|
|
|
grid-template-columns: max-content auto;
|
2024-01-25 19:50:26 -05:00
|
|
|
}
|
2024-01-26 01:30:18 -05:00
|
|
|
</style>
|