Detailansicht: Klick auf Cover/Titel → Modal mit Cover groß, Untertitel, Chips, Rating, Genres/Daten, Klappentext (per Audible-API), direkte Aktionen (Abspielen/Laden/Löschen/Alter)
This commit is contained in:
@ -31,6 +31,8 @@
|
||||
bmSetNote,
|
||||
autostartEnabled,
|
||||
autostartSet,
|
||||
bookDetails,
|
||||
type BookExtra,
|
||||
type Bm,
|
||||
type Book,
|
||||
type DlItem,
|
||||
@ -126,6 +128,29 @@
|
||||
playerSetPosition(bookmarks[idx]?.time ?? 0)
|
||||
}
|
||||
|
||||
// Detailansicht (Titel-Details)
|
||||
let detail = $state<Book | null>(null)
|
||||
let detailExtra = $state<BookExtra | null>(null)
|
||||
let detailLoading = $state(false)
|
||||
|
||||
function openDetail(b: Book): void {
|
||||
detail = b
|
||||
detailExtra = null
|
||||
detailLoading = true
|
||||
bookDetails(b.asin)
|
||||
.then((x) => {
|
||||
// Nur anwenden, wenn noch das gleiche Buch offen ist
|
||||
if (detail?.asin === b.asin) detailExtra = x
|
||||
})
|
||||
.catch(() => detailExtra = null)
|
||||
.finally(() => (detailLoading = false))
|
||||
}
|
||||
|
||||
function closeDetail(): void {
|
||||
detail = null
|
||||
detailExtra = null
|
||||
}
|
||||
|
||||
// Einstellungen (T-032)
|
||||
let settingsOpen = $state(false)
|
||||
let autostart = $state(false)
|
||||
@ -560,7 +585,7 @@
|
||||
{@const d = downloads[b.asin]}
|
||||
{@const dlg = activeDl(b)}
|
||||
<article class="card">
|
||||
<div class="cover">
|
||||
<div class="cover clickable" title="Details" onclick={() => openDetail(b)} onkeydown={(e) => e.key === 'Enter' && openDetail(b)} role="button" tabindex="0">
|
||||
<img
|
||||
src={coverSrc(b)}
|
||||
alt="Cover von {b.title}"
|
||||
@ -576,7 +601,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="meta">
|
||||
<div class="t">{b.title}</div>
|
||||
<div class="t clickable" role="button" tabindex="0" title="Details" onclick={() => openDetail(b)} onkeydown={(e) => e.key === 'Enter' && openDetail(b)}>{b.title}</div>
|
||||
<div class="muted small">{b.authors}</div>
|
||||
<div class="chips">
|
||||
{#if isLocal(b)}
|
||||
@ -761,6 +786,61 @@
|
||||
</main>
|
||||
{/if}
|
||||
|
||||
{#if detail}
|
||||
<div class="backdrop" onclick={closeDetail} role="presentation"></div>
|
||||
<div class="detailpanel" role="dialog" aria-modal="true">
|
||||
<button class="ghost dclose" title="Schließen" onclick={closeDetail}><Icon name="x" size={14} /></button>
|
||||
<div class="dtop">
|
||||
<img class="dcover" src={coverSrc(detail)} alt={detail.title} />
|
||||
<div class="dmeta">
|
||||
<h2 class="dtitle">{detail.title}</h2>
|
||||
{#if detail.subtitle}<p class="muted small">{detail.subtitle}</p>{/if}
|
||||
<p>{detail.authors}{detail.narrators ? ` · Sprecher: ${detail.narrators}` : ''}</p>
|
||||
<div class="chips" style="margin:0.4rem 0">
|
||||
{#if isLocal(detail)}<span class="chip ok"><Icon name="home" size={12} /> lokal</span>
|
||||
{:else}<span class="chip"><Icon name="cloud" size={12} /> Bibliothek</span>{/if}
|
||||
{#if alterNote(detail)}<span class="chip age">{alterNote(detail)}</span>
|
||||
{:else if ageTag(detail)}<span class="chip">{ageTag(detail)}</span>{/if}
|
||||
{#if detail.runtime_length_min > 0}<span class="chip">{fmtRuntime(detail.runtime_length_min)}</span>{/if}
|
||||
{#if detail.rating > 0}<span class="chip">★ {detail.rating.toFixed(1)}{detail.num_ratings > 0 ? ` (${detail.num_ratings})` : ''}</span>{/if}
|
||||
</div>
|
||||
<p class="muted small">
|
||||
{#if detail.genres}Genres: {detail.genres} · {/if}
|
||||
{#if detail.release_date}erschienen {detail.release_date} · {/if}
|
||||
hinzugefügt {detail.date_added.slice(0, 10) || '—'}{detail.purchase_date ? ` · gekauft ${detail.purchase_date.slice(0, 10)}` : ''}
|
||||
</p>
|
||||
<div class="dactions">
|
||||
{#if isLocal(detail)}
|
||||
<button class="primary" title="Abspielen" onclick={() => { abspielen(detail!); closeDetail() }}><Icon name="play" size={14} /> Abspielen</button>
|
||||
{:else if streamOnly[detail.asin]}
|
||||
<button class="ghost" title="Nur Streaming" onclick={() => (info = 'Wiedergabe folgt mit M2 — nur Streaming.')}><Icon name="play" size={14} /> Abspielen</button>
|
||||
{:else}
|
||||
<button class="primary" title="Laden" onclick={() => laden(detail!)}><Icon name="download" size={14} /> Laden</button>
|
||||
{/if}
|
||||
<button class="ghost" title="Altersnote setzen" onclick={() => startEditAlter(detail!)}><Icon name="pencil" size={13} /> Alter</button>
|
||||
{#if isLocal(detail)}
|
||||
<button class="ghost" title="Löschen" onclick={() => { loeschen(detail!); closeDetail() }}><Icon name="trash" size={14} /> Löschen</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dbody">
|
||||
<h3>Klappentext</h3>
|
||||
{#if detailLoading}
|
||||
<p class="muted small">Lade Beschreibung…</p>
|
||||
{:else if detailExtra?.description}
|
||||
<p class="ddesc">{detailExtra.description}</p>
|
||||
<p class="muted small">
|
||||
{detailExtra.format_type === 'unabridged' ? 'Ungekürzt' : detailExtra.format_type || 'Format: unbekannt'}
|
||||
{detailExtra.language ? ` · Sprache: ${detailExtra.language}` : ''}
|
||||
</p>
|
||||
{:else}
|
||||
<p class="muted small">Keine Beschreibung verfügbar (offline?).</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<footer class="statusbar">
|
||||
<span class="statcell">
|
||||
{#if profile}
|
||||
|
||||
Reference in New Issue
Block a user