use bandcamp like playlist
This commit is contained in:
parent
5b02f84a86
commit
e6a2a6d461
@ -10,12 +10,24 @@
|
|||||||
<section class="queue">
|
<section class="queue">
|
||||||
<div>
|
<div>
|
||||||
{#each $entries as entry}
|
{#each $entries as entry}
|
||||||
<div class="entry" class:active={entry === $currentEntry} on:click={() => $currentEntry = entry}>
|
<div class="entry" class:active={entry === $currentEntry}>
|
||||||
<div>{entry.data.metadata.title}</div>
|
<div>
|
||||||
|
<button on:click={() => toggleEntry(entry)}>
|
||||||
|
{#if entry === $currentEntry && !$paused}
|
||||||
|
⏸️
|
||||||
|
{:else}
|
||||||
|
▶️
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<small>{entry.url}</small>
|
<div>{entry.data.metadata.title}</div>
|
||||||
<b>{entry.status.account.username} <small>{entry.status.account.acct}</small></b>
|
|
||||||
|
<div>
|
||||||
|
<small>{entry.url}</small>
|
||||||
|
<b>{entry.status.account.username} <small>{entry.status.account.acct}</small></b>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@ -34,7 +46,15 @@
|
|||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import Controls from '/components/Controls.svelte'
|
import Controls from '/components/Controls.svelte'
|
||||||
import Viewer from '/components/Viewer.svelte'
|
import Viewer from '/components/Viewer.svelte'
|
||||||
import { entry as currentEntry, entries } from '/store.js'
|
import { paused, entry as currentEntry, entries } from '/store.js'
|
||||||
|
|
||||||
|
const toggleEntry = (entry) => {
|
||||||
|
if (entry !== $currentEntry) {
|
||||||
|
$currentEntry = entry
|
||||||
|
} else {
|
||||||
|
$paused = !$paused
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const unsubscribe = entries.subscribe(async (xs) => {
|
const unsubscribe = entries.subscribe(async (xs) => {
|
||||||
@ -110,7 +130,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.entry {
|
.entry {
|
||||||
cursor: pointer;
|
display: flex;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user