2024-01-25 19:50:26 -05:00
|
|
|
<script lang="ts">
|
2024-03-30 01:15:12 -04:00
|
|
|
import SearchBar from '$lib/components/util/searchBar.svelte'
|
2024-01-28 02:41:13 -05:00
|
|
|
import type { LayoutData } from './$types'
|
2024-01-30 00:33:19 -05:00
|
|
|
import NavTab from '$lib/components/navbar/navTab.svelte'
|
|
|
|
|
import PlaylistTab from '$lib/components/navbar/playlistTab.svelte'
|
2024-04-05 02:00:17 -04:00
|
|
|
import MediaPlayer from '$lib/components/media/mediaPlayer.svelte'
|
2024-01-28 02:41:13 -05:00
|
|
|
|
|
|
|
|
export let data: LayoutData
|
2024-01-25 19:50:26 -05:00
|
|
|
|
2024-01-28 02:41:13 -05:00
|
|
|
const inPathnameHeirarchy = (pathname: string, rootPathname: string): boolean => {
|
|
|
|
|
return (pathname.startsWith(rootPathname) && rootPathname !== '/') || (pathname === '/' && rootPathname === '/')
|
|
|
|
|
}
|
2024-01-30 00:33:19 -05:00
|
|
|
let playlistTooltip: HTMLDivElement
|
|
|
|
|
|
|
|
|
|
const setTooltip = (x: number, y: number, content: string): void => {
|
|
|
|
|
const textWrapper = playlistTooltip.firstChild! as HTMLDivElement
|
|
|
|
|
textWrapper.innerText = content
|
|
|
|
|
playlistTooltip.style.display = 'block'
|
|
|
|
|
playlistTooltip.style.left = `${x}px`
|
|
|
|
|
playlistTooltip.style.top = `${y}px`
|
|
|
|
|
}
|
2024-01-26 01:30:18 -05:00
|
|
|
</script>
|
|
|
|
|
|
2024-04-05 02:00:17 -04:00
|
|
|
<div class="h-full overflow-hidden">
|
|
|
|
|
<div class="no-scrollbar fixed left-0 top-0 z-10 grid h-full w-20 grid-cols-1 grid-rows-[min-content_auto] gap-5 px-3 py-12">
|
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
|
{#each data.navTabs as nav}
|
|
|
|
|
<NavTab {nav} disabled={inPathnameHeirarchy(data.url.pathname, nav.pathname)} />
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="no-scrollbar flex flex-col gap-5 overflow-y-scroll px-1.5">
|
|
|
|
|
{#each data.playlistTabs as playlist}
|
|
|
|
|
<PlaylistTab {playlist} on:mouseenter={(event) => setTooltip(event.detail.x, event.detail.y, event.detail.content)} on:mouseleave={() => (playlistTooltip.style.display = 'none')} />
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
<div bind:this={playlistTooltip} class="absolute hidden max-w-48 -translate-y-1/2 translate-x-10 whitespace-nowrap rounded bg-neutral-800 px-2 py-1.5 text-sm">
|
|
|
|
|
<div class="overflow-clip text-ellipsis">PLAYLIST_NAME</div>
|
|
|
|
|
<div class="overflow-clip text-ellipsis text-neutral-400">Playlist • {data.user.username}</div>
|
2024-01-28 02:41:13 -05:00
|
|
|
</div>
|
2024-01-26 01:30:18 -05:00
|
|
|
</div>
|
2024-04-05 02:00:17 -04:00
|
|
|
<section class="no-scrollbar overflow-y-scroll px-[max(7rem,_7vw)]">
|
|
|
|
|
<div class="my-6 max-w-xl">
|
|
|
|
|
<SearchBar />
|
|
|
|
|
</div>
|
|
|
|
|
<slot />
|
|
|
|
|
</section>
|
2024-04-09 00:10:23 -04:00
|
|
|
<section class="absolute bottom-0 z-40 grid max-h-full w-full place-items-center">
|
2024-04-13 00:45:35 -04:00
|
|
|
<MediaPlayer />
|
2024-04-05 02:00:17 -04:00
|
|
|
</section>
|
|
|
|
|
</div>
|