Working on recommendations
This commit is contained in:
@@ -35,7 +35,15 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="card-wrapper" class="w-52 flex-shrink-0">
|
<div id="card-wrapper" class="w-52 flex-shrink-0">
|
||||||
<div bind:this={card} id="card" class="relative transition-all duration-200 ease-out grid place-items-center" on:mousemove={(event) => rotateCard(event)} on:mouseleave={() => (card.style.transform = '')} role="menuitem" tabindex="-1">
|
<div
|
||||||
|
bind:this={card}
|
||||||
|
id="card"
|
||||||
|
class="relative grid place-items-center transition-all duration-200 ease-out"
|
||||||
|
on:mousemove={(event) => rotateCard(event)}
|
||||||
|
on:mouseleave={() => (card.style.transform = '')}
|
||||||
|
role="menuitem"
|
||||||
|
tabindex="-1"
|
||||||
|
>
|
||||||
<button on:click={() => goto(`/details/${mediaItem.type}?id=${mediaItem.id}&connection=${mediaItem.connectionId}`)}>
|
<button on:click={() => goto(`/details/${mediaItem.type}?id=${mediaItem.id}&connection=${mediaItem.connectionId}`)}>
|
||||||
{#if mediaItem.thumbnail}
|
{#if mediaItem.thumbnail}
|
||||||
<img id="card-image" class="h-full rounded-lg transition-all" src={mediaItem.thumbnail} alt="{mediaItem.name} thumbnail" />
|
<img id="card-image" class="h-full rounded-lg transition-all" src={mediaItem.thumbnail} alt="{mediaItem.name} thumbnail" />
|
||||||
@@ -46,7 +54,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<div bind:this={cardGlare} id="card-glare" class="absolute top-0 h-full w-full rounded-lg opacity-0 transition-opacity duration-200 ease-out" />
|
<div bind:this={cardGlare} id="card-glare" class="absolute top-0 h-full w-full rounded-lg opacity-0 transition-opacity duration-200 ease-out" />
|
||||||
</button>
|
</button>
|
||||||
<span id="play-button" class="h-12 absolute opacity-0 transition-opacity duration-200 ease-out">
|
<span id="play-button" class="absolute h-12 opacity-0 transition-opacity duration-200 ease-out">
|
||||||
<IconButton halo={true}>
|
<IconButton halo={true}>
|
||||||
<i slot="icon" class="fa-solid fa-play text-xl" />
|
<i slot="icon" class="fa-solid fa-play text-xl" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
@@ -54,12 +62,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="p-2.5 text-sm">
|
<div class="p-2.5 text-sm">
|
||||||
<div class="overflow-hidden text-ellipsis" title={mediaItem.name}>{mediaItem.name}</div>
|
<div class="overflow-hidden text-ellipsis" title={mediaItem.name}>{mediaItem.name}</div>
|
||||||
<div class="flex w-full items-center gap-1.5 overflow-hidden text-neutral-400">
|
<div class="flex w-full items-center overflow-hidden text-neutral-400">
|
||||||
<span class="overflow-hidden text-ellipsis" style="font-size: 0; line-height: 0;">
|
|
||||||
{#if checkSong(mediaItem) || checkAlbum(mediaItem)}
|
{#if checkSong(mediaItem) || checkAlbum(mediaItem)}
|
||||||
{#each mediaItem.artists as artist}
|
{#each mediaItem.artists as artist}
|
||||||
{@const listIndex = mediaItem.artists.indexOf(artist)}
|
{@const listIndex = mediaItem.artists.indexOf(artist)}
|
||||||
<a class="text-sm hover:underline" href="/details/artist?id={artist.id}&connection={mediaItem.connectionId}">{artist.name}</a>
|
<a class="text-sm hover:underline focus:underline" href="/details/artist?id={artist.id}&connection={mediaItem.connectionId}">{artist.name}</a>
|
||||||
{#if listIndex === mediaItem.artists.length - 2}
|
{#if listIndex === mediaItem.artists.length - 2}
|
||||||
<span class="mx-0.5 text-sm">&</span>
|
<span class="mx-0.5 text-sm">&</span>
|
||||||
{:else if listIndex < mediaItem.artists.length - 2}
|
{:else if listIndex < mediaItem.artists.length - 2}
|
||||||
@@ -67,11 +74,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
<!-- {#if mediaItem.type}
|
||||||
{#if mediaItem.type}
|
|
||||||
<span>•</span>
|
<span>•</span>
|
||||||
<i title="Stream from {Services[mediaItem.service.type].displayName}" class="{iconClasses[mediaItem.type]} text-xs" style="color: var({Services[mediaItem.service.type].primaryColor});" />
|
<i title="Stream from {Services[mediaItem.service.type].displayName}" class="{iconClasses[mediaItem.type]} text-xs" style="color: var({Services[mediaItem.service.type].primaryColor});" />
|
||||||
{/if}
|
{/if} -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +92,9 @@
|
|||||||
#card-wrapper:focus-within #card-glare {
|
#card-wrapper:focus-within #card-glare {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
#card-wrapper:focus-within #play-button {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
#card:hover {
|
#card:hover {
|
||||||
scale: 1.05;
|
scale: 1.05;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { SECRET_INTERNAL_API_KEY } from '$env/static/private'
|
import { SECRET_INTERNAL_API_KEY } from '$env/static/private'
|
||||||
import type { PageServerLoad } from './$types'
|
import type { PageServerLoad } from './$types'
|
||||||
|
|
||||||
export const prerender = false
|
export const load: PageServerLoad = async ({ locals, fetch }) => {
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ locals, fetch, url }) => {
|
|
||||||
const recommendationResponse = await fetch(`/api/users/${locals.user.id}/recommendations`, { headers: { apikey: SECRET_INTERNAL_API_KEY } })
|
const recommendationResponse = await fetch(`/api/users/${locals.user.id}/recommendations`, { headers: { apikey: SECRET_INTERNAL_API_KEY } })
|
||||||
const recommendationData = await recommendationResponse.json()
|
const recommendationData = await recommendationResponse.json()
|
||||||
const { recommendations } = recommendationData
|
const { recommendations } = recommendationData
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import type { LayoutServerLoad } from './$types'
|
import type { LayoutServerLoad } from './$types'
|
||||||
|
|
||||||
|
export const ssr = false
|
||||||
|
|
||||||
export const load: LayoutServerLoad = ({ url, locals }) => {
|
export const load: LayoutServerLoad = ({ url, locals }) => {
|
||||||
const { pathname, search } = url
|
const { pathname, search } = url
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import IconButton from '$lib/components/util/iconButton.svelte'
|
import IconButton from '$lib/components/util/iconButton.svelte'
|
||||||
import Toggle from '$lib/components/util/toggle.svelte'
|
import Toggle from '$lib/components/util/toggle.svelte'
|
||||||
import type { SubmitFunction } from '@sveltejs/kit'
|
import type { SubmitFunction } from '@sveltejs/kit'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly, scale } from 'svelte/transition'
|
||||||
import { enhance } from '$app/forms'
|
import { enhance } from '$app/forms'
|
||||||
|
|
||||||
export let connection: Connection
|
export let connection: Connection
|
||||||
@@ -31,7 +31,13 @@
|
|||||||
<i slot="icon" class="fa-solid fa-link-slash" />
|
<i slot="icon" class="fa-solid fa-link-slash" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{#if showUnlinkModal}
|
{#if showUnlinkModal}
|
||||||
<form use:enhance={submitFunction} action="?/deleteConnection" method="post" class="absolute right-full top-0 flex -translate-x-3 flex-col items-center justify-center gap-3 rounded-md bg-neutral-925 p-4">
|
<form
|
||||||
|
transition:scale={{ start: 0.5 }}
|
||||||
|
use:enhance={submitFunction}
|
||||||
|
action="?/deleteConnection"
|
||||||
|
method="post"
|
||||||
|
class="absolute right-full top-0 flex -translate-x-3 flex-col items-center justify-center gap-3 rounded-md bg-neutral-925 p-4"
|
||||||
|
>
|
||||||
<span class="whitespace-nowrap">Delete Connection</span>
|
<span class="whitespace-nowrap">Delete Connection</span>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<button class="w-20 rounded-md bg-red-500 px-2 py-1">Confirm</button>
|
<button class="w-20 rounded-md bg-red-500 px-2 py-1">Confirm</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user