Feedback: Icon-Buttons — Haus/Wolke-Chips, Download-Pfeil auf laden, Papierkorb auf löschen, Play-Icon

This commit is contained in:
2026-11-06 20:17:33 +01:00
parent e7f7f26ded
commit 14b93e2fb1
3 changed files with 58 additions and 10 deletions

View File

@ -14,6 +14,7 @@
type Book,
type DlItem,
} from './lib/audible'
import Icon from './lib/Icon.svelte'
type View = 'loading' | 'login' | 'library'
type SortKey = 'added' | 'title' | 'author' | 'runtime' | 'percent'
@ -373,9 +374,12 @@
<div class="muted small">{b.authors}</div>
<div class="chips">
{#if isLocal(b)}
<span class="chip ok" title="book.m4b liegt lokal vor">lokal</span>
{:else if b.is_finished}
<span class="chip done">fertig</span>
<span class="chip ok" title="book.m4b liegt lokal vor"><Icon name="home" size={13} /> lokal</span>
{:else}
<span class="chip" title="In deiner Audible-Bibliothek (online)"><Icon name="cloud" size={13} /> Bibliothek</span>
{/if}
{#if b.is_finished && !isLocal(b)}
<span class="chip done" title="Buch abgehört"><Icon name="play" size={12} /> fertig</span>
{/if}
{#if b.runtime_length_min > 0}<span class="chip">{fmtRuntime(b.runtime_length_min)}</span>{/if}
{#if d && d.status === 'failed'}<span class="chip err" title={d.msg}>Fehlgeschlagen</span>{/if}
@ -396,7 +400,7 @@
class="ghost"
onclick={() => (info = 'Wiedergabe folgt mit M2 — diesen Titel liefert Audible nur zum Streamen.')}
>
▶ Abspielen
<Icon name="play" size={14} /> Abspielen
</button>
<span class="muted small">nur Streaming</span>
{:else if dlg === 'running' || dlg === 'queued' || dlg === 'decrypting'}
@ -405,16 +409,16 @@
</button>
{#if dlg === 'queued'}<span class="muted small">wartet…</span>{/if}
{:else if d && d.status === 'failed'}
<button class="ghost" onclick={() => laden(b)}>Nochmal laden</button>
<button class="ghost" onclick={() => loeschen(b)}>Löschen</button>
<button class="ghost" onclick={() => laden(b)}><Icon name="download" size={14} /> Nochmal laden</button>
<button class="ghost" onclick={() => loeschen(b)}><Icon name="trash" size={14} /> Löschen</button>
<span class="muted small" title={d.msg}>{d.msg.slice(0, 60)}</span>
{:else if d && d.status === 'done'}
<button class="ghost" onclick={() => loeschen(b)}>Löschen</button>
<button class="ghost" onclick={() => loeschen(b)}><Icon name="trash" size={14} /> Löschen</button>
{:else if d && d.status === 'cancelled'}
<button class="ghost" onclick={() => laden(b)}>Laden</button>
<button class="ghost" onclick={() => loeschen(b)}>Löschen</button>
<button class="ghost" onclick={() => laden(b)}><Icon name="download" size={14} /> Laden</button>
<button class="ghost" onclick={() => loeschen(b)}><Icon name="trash" size={14} /> Löschen</button>
{:else if !isLocal(b)}
<button class="primary" onclick={() => laden(b)}>Laden</button>
<button class="primary" onclick={() => laden(b)}><Icon name="download" size={14} /> Laden</button>
{/if}
</div>
</div>

View File

@ -251,6 +251,18 @@ button.activechip {
border: 1px solid var(--border);
border-radius: 99px;
color: var(--fg-muted);
display: inline-flex;
align-items: center;
gap: 0.28rem;
}
.actions {
display: flex;
align-items: center;
gap: 0.45rem;
margin-top: 0.15rem;
min-height: 2rem;
flex-wrap: wrap;
}
.chip.ok {

32
src/lib/Icon.svelte Normal file
View File

@ -0,0 +1,32 @@
<script lang="ts">
// Minimal-Icon-Set (Stroke-Stil, currentColor)
const icons: Record<string, string> = {
home: '<path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h5v-6h4v6h5V9.5"/>',
cloud:
'<path d="M6.5 19a4.5 4.5 0 1 1 .42-8.98 6 6 0 0 1 11.6 1.4A4 4 0 0 1 18 19H6.5z"/>',
download: '<path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/>',
trash:
'<path d="M4 7h16"/><path d="M9 7V4h6v3"/><path d="M6.5 7l1 14h9l1-14"/>',
play: '<path d="M8 5v14l11-7z" fill="currentColor" stroke="none"/>',
x: '<path d="M5 5l14 14"/><path d="M19 5 5 19"/>',
}
let { name, size = 15 }: { name: string; size?: number } = $props()
const markup = $derived(
`<svg viewBox="0 0 24 24" width="${String(size)}" height="${String(size)}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icons[name] ?? ''}</svg>`
)
</script>
<span class="hw-icon" style={`width:${size}px;height:${size}px`}>{@html markup}</span>
<style>
.hw-icon {
display: inline-flex;
flex: none;
}
.hw-icon :global(svg) {
display: block;
}
</style>