mastoradio/src/components/Queue.svelte

45 lines
947 B
Svelte
Raw Normal View History

2020-01-13 14:39:22 +01:00
<div>
2020-01-20 04:49:38 +01:00
<h6>PLAY NEXT</h6>
2020-02-14 16:48:49 +01:00
2020-01-20 04:49:38 +01:00
{#if $next}
2020-02-14 16:48:49 +01:00
<div class="entry" on:click={() => select($next)}>
2020-02-15 23:12:53 +01:00
<div class="title">{$next.title}</div>
2020-02-16 17:02:39 +01:00
<div class="user">by {$next.referer.username}</div>
2020-01-20 04:49:38 +01:00
</div>
{/if}
{#if $enqueueing}
LOADING NEXT
{/if}
<h6>HISTORY</h6>
2020-01-13 14:39:22 +01:00
2020-02-15 23:12:53 +01:00
{#each history as track}
2020-02-14 16:48:49 +01:00
<div class="entry" class:active={track === $current} on:click={() => select(track)}>
2020-02-15 23:12:53 +01:00
<div class>{track.title}</div>
2020-02-16 17:02:39 +01:00
<div class>shared by {track.referer.username}</div>
2020-01-13 14:39:22 +01:00
</div>
{/each}
</div>
<script>
2020-02-14 16:48:49 +01:00
import { queue, next, current, enqueueing, select } from '/store.js'
2020-01-13 14:39:22 +01:00
2020-02-14 16:48:49 +01:00
$: history = $queue.filter(x => x !== $next).reverse()
2020-01-13 14:39:22 +01:00
</script>
<style>
.entry {
2020-01-20 04:49:38 +01:00
padding: 1em 2em;
2020-02-14 16:48:49 +01:00
cursor: pointer;
2020-01-13 14:39:22 +01:00
}
.entry.active {
background-color: plum;
}
2020-02-14 16:48:49 +01:00
.entry.active::before {
content: "▶️";
}
2020-01-13 14:39:22 +01:00
</style>