2020-01-13 14:39:22 +01:00
|
|
|
<div>
|
2020-01-20 04:49:38 +01:00
|
|
|
<h6>PLAY NEXT</h6>
|
|
|
|
{#if $next}
|
|
|
|
<div class="entry">
|
|
|
|
<div class="title">{$next.metadata.title}</div>
|
|
|
|
<div class="user">by {$next.status.account.acct}</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{#if $enqueueing}
|
|
|
|
LOADING NEXT
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
<h6>HISTORY</h6>
|
|
|
|
{#each $queue as track, i (track.status.id)}
|
2020-01-16 20:10:40 +01:00
|
|
|
<div class="entry" class:active={i === $index}>
|
2020-01-13 14:39:22 +01:00
|
|
|
<div>
|
2020-01-16 20:10:40 +01:00
|
|
|
<button on:click={() => toggle(i)}>
|
|
|
|
{#if i != $index}
|
|
|
|
▶️
|
|
|
|
{:else if $loading}
|
|
|
|
🕒
|
|
|
|
{:else if $paused}
|
2020-01-13 14:39:22 +01:00
|
|
|
▶️
|
2020-01-16 20:10:40 +01:00
|
|
|
{:else}
|
|
|
|
⏸️
|
2020-01-13 14:39:22 +01:00
|
|
|
{/if}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2020-01-20 04:49:38 +01:00
|
|
|
<div class="title">{track.metadata.title}</div>
|
|
|
|
<div class="user">by {track.status.account.acct}</div>
|
2020-01-13 14:39:22 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { onMount } from 'svelte'
|
2020-01-20 04:49:38 +01:00
|
|
|
import { next, enqueueing, queue, index, paused, loading, canNext, selectNext } from '/store.js'
|
2020-01-13 14:39:22 +01:00
|
|
|
|
2020-01-16 20:10:40 +01:00
|
|
|
const toggle = i => {
|
|
|
|
if (i === $index) {
|
2020-01-13 14:39:22 +01:00
|
|
|
$paused = !$paused
|
2020-01-16 20:10:40 +01:00
|
|
|
} else {
|
|
|
|
$index = i
|
|
|
|
$paused = false
|
2020-01-13 14:39:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 04:49:38 +01:00
|
|
|
$: if ($queue.length === 0 && $index === null && $next !== null) {
|
|
|
|
$queue = [$next]
|
|
|
|
$next = null
|
|
|
|
$index = 0
|
2020-01-16 20:10:40 +01:00
|
|
|
}
|
2020-01-13 14:39:22 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.entry {
|
2020-01-20 04:49:38 +01:00
|
|
|
padding: 1em 2em;
|
2020-01-13 14:39:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.entry.active {
|
|
|
|
background-color: plum;
|
|
|
|
}
|
|
|
|
</style>
|