mastoradio-fork/src/components/Queue.svelte

45 lines
989 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-01-20 04:49:38 +01:00
<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>
2020-01-13 14:39:22 +01:00
2020-02-14 16:48:49 +01:00
{#each history as track (track.status.id)}
<div class="entry" class:active={track === $current} on:click={() => select(track)}>
<div class>{track.metadata.title}</div>
<div class>shared by {track.status.account.acct}</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>