Communicate current title if the player is compatible

This commit is contained in:
nemunaire 2023-11-15 11:30:38 +01:00
commit b8bff830ca
5 changed files with 36 additions and 30 deletions

View file

@ -4,16 +4,12 @@
<ul class="list-group list-group-flush">
{#each $activeSources as source}
<li class="list-group-item py-3 d-flex justify-content-between">
<li class="list-group-item py-3 d-flex justify-content-between align-items-center">
<div>
<strong>{source.name}</strong>
{#await source.currently()}
<div class="spinner-border spinner-border-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
{:then title}
<span class="text-muted">{title}</span>
{/await}
{#if source.currentTitle}
<span class="text-muted">{source.currentTitle}</span>
{/if}
</div>
{#if source.controlable}
<div>

View file

@ -6,11 +6,12 @@ export class Source {
}
}
update({ name, enabled, active, controlable }) {
update({ name, enabled, active, controlable, currentTitle }) {
this.name = name;
this.enabled = enabled;
this.active = active;
this.controlable = controlable;
this.currentTitle = currentTitle;
}
async activate() {

View file

@ -24,15 +24,11 @@
<div class="d-inline-block me-3">
<div class="d-flex justify-content-between align-items-center">
<div>
{#await source.currently()}
<div class="spinner-border spinner-border-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div> <span class="text-muted">@ {source.name}</span>
{:then title}
<strong>{title}</strong> <span class="text-muted">@ {source.name}</span>
{:catch error}
{#if source.currentTitle}
<strong>{source.currentTitle}</strong> <span class="text-muted">@ {source.name}</span>
{:else}
{source.name} activée
{/await}
{/if}
</div>
</div>
</div>