merge fixes/1.1.10/debug into pre-release
Brings in: sidebar virtualization, alpha-index fix, quality badge tooltips, developer mode, factory reset, logs modal, back navigation, scroll position memory, custom tooltip system, artist click-through, download button fixes, and more. Conflicts resolved: - main.rs: keep pre-release WebKitGTK pin + fixes' VM detection, developer settings, and logging module - FavoritesView: keep virtualized components + fixes' top-bar - SearchView: keep virtualized album grid
This commit is contained in:
commit
b1d47ded31
44 files changed
+2660
-584
No files matched your search
@@ -37,6 +37,8 @@
|
||||
downloadStateVersion?: number;
|
||||
/** Source badge for local library: 'user' for local files, 'qobuz_download' for Qobuz offline */
|
||||
sourceBadge?: 'user' | 'qobuz_download';
|
||||
artistId?: number;
|
||||
onArtistClick?: (artistId: number) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -64,7 +66,9 @@
|
||||
onOpenContainingFolder,
|
||||
onReDownloadAlbum,
|
||||
downloadStateVersion,
|
||||
sourceBadge
|
||||
sourceBadge,
|
||||
artistId,
|
||||
onArtistClick
|
||||
}: Props = $props();
|
||||
|
||||
const isDownloaded = $derived.by(() => {
|
||||
@@ -77,7 +81,7 @@
|
||||
let titleRef: HTMLDivElement | null = $state(null);
|
||||
let titleTextRef: HTMLSpanElement | null = $state(null);
|
||||
let titleOverflow = $state(0);
|
||||
let artistRef: HTMLDivElement | null = $state(null);
|
||||
let artistRef: HTMLElement | null = $state(null);
|
||||
let artistTextRef: HTMLSpanElement | null = $state(null);
|
||||
let artistOverflow = $state(0);
|
||||
const titleOffset = $derived(titleOverflow > 0 ? `-${titleOverflow + 16}px` : '0px');
|
||||
@@ -123,8 +127,18 @@
|
||||
onPlay?.();
|
||||
}
|
||||
|
||||
function handleArtistClick(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
if (artistId && onArtistClick) {
|
||||
onArtistClick(artistId);
|
||||
}
|
||||
}
|
||||
|
||||
const artistClickable = $derived(!!(artistId && onArtistClick));
|
||||
|
||||
function isOverlayAction(target: EventTarget | null) {
|
||||
return target instanceof HTMLElement && !!target.closest('.action-buttons');
|
||||
if (!(target instanceof HTMLElement)) return false;
|
||||
return !!target.closest('.action-buttons') || !!target.closest('.artist-link');
|
||||
}
|
||||
|
||||
function handleCardClick(event: MouseEvent) {
|
||||
@@ -282,14 +296,27 @@
|
||||
>
|
||||
<span class="title-text" bind:this={titleTextRef}>{title}</span>
|
||||
</div>
|
||||
<div
|
||||
class="artist"
|
||||
class:scrollable={artistOverflow > 0}
|
||||
style="--ticker-offset: {artistOffset}; --ticker-duration: {artistDuration};"
|
||||
bind:this={artistRef}
|
||||
>
|
||||
<span class="artist-text" bind:this={artistTextRef}>{artist}</span>
|
||||
</div>
|
||||
{#if artistClickable}
|
||||
<button
|
||||
class="artist artist-link"
|
||||
class:scrollable={artistOverflow > 0}
|
||||
style="--ticker-offset: {artistOffset}; --ticker-duration: {artistDuration};"
|
||||
bind:this={artistRef}
|
||||
onclick={handleArtistClick}
|
||||
type="button"
|
||||
>
|
||||
<span class="artist-text" bind:this={artistTextRef}>{artist}</span>
|
||||
</button>
|
||||
{:else}
|
||||
<div
|
||||
class="artist"
|
||||
class:scrollable={artistOverflow > 0}
|
||||
style="--ticker-offset: {artistOffset}; --ticker-duration: {artistDuration};"
|
||||
bind:this={artistRef}
|
||||
>
|
||||
<span class="artist-text" bind:this={artistTextRef}>{artist}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if quality}
|
||||
<div class="quality-badge">{quality}</div>
|
||||
{/if}
|
||||
@@ -608,6 +635,25 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.artist.artist-link {
|
||||
display: block;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.artist.artist-link:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.artist.scrollable {
|
||||
text-overflow: clip;
|
||||
}
|
||||
@@ -617,7 +663,8 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.album-card:hover .artist.scrollable .artist-text {
|
||||
.album-card:hover .artist.scrollable .artist-text,
|
||||
.artist.artist-link.scrollable:hover .artist-text {
|
||||
animation: title-ticker var(--ticker-duration) linear infinite;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { CloudDownload, Loader, AlertCircle, CloudOff } from 'lucide-svelte';
|
||||
import { CloudDownload, AlertCircle, CloudOff } from 'lucide-svelte';
|
||||
import { t } from '$lib/i18n';
|
||||
import {
|
||||
subscribe as subscribeOffline,
|
||||
@@ -95,9 +95,16 @@
|
||||
{#if status === 'ready'}
|
||||
<CloudOff {size} />
|
||||
{:else if status === 'downloading' || status === 'queued'}
|
||||
<div class="progress-ring" style="--progress: {progress}">
|
||||
<Loader {size} class="spinning" />
|
||||
</div>
|
||||
{@const r = (size - 2) / 2}
|
||||
{@const circumference = 2 * Math.PI * r}
|
||||
{@const dashOffset = status === 'queued' ? circumference * 0.75 : circumference * (1 - progress / 100)}
|
||||
<svg class="progress-ring" class:indeterminate={status === 'queued'} width={size} height={size} viewBox="0 0 {size} {size}">
|
||||
<circle class="ring-bg" cx={size / 2} cy={size / 2} r={r} />
|
||||
<circle class="ring-fill" cx={size / 2} cy={size / 2} r={r}
|
||||
stroke-dasharray={circumference}
|
||||
stroke-dashoffset={dashOffset}
|
||||
/>
|
||||
</svg>
|
||||
{:else if status === 'failed'}
|
||||
<AlertCircle {size} />
|
||||
{:else if isOffline}
|
||||
@@ -123,14 +130,13 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.download-button:hover:not(:disabled) {
|
||||
.download-button:hover:not(:disabled):not(.downloading) {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.download-button:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.download-button.ready {
|
||||
@@ -155,22 +161,30 @@
|
||||
}
|
||||
|
||||
.progress-ring {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.progress-ring :global(.spinning) {
|
||||
animation: spin 1s linear infinite;
|
||||
.ring-bg {
|
||||
fill: none;
|
||||
stroke: var(--bg-tertiary, #333);
|
||||
stroke-width: 1.5;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
.ring-fill {
|
||||
fill: none;
|
||||
stroke: var(--accent-primary);
|
||||
stroke-width: 1.5;
|
||||
stroke-linecap: round;
|
||||
transition: stroke-dashoffset 300ms ease;
|
||||
}
|
||||
|
||||
.progress-ring.indeterminate {
|
||||
animation: ring-spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes ring-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -119,24 +119,24 @@
|
||||
if (!album) return;
|
||||
albumTitle = album.title ?? '';
|
||||
albumArtist = album.artist ?? '';
|
||||
const firstWithYear = tracks.find(t => typeof t.year === 'number')?.year;
|
||||
const firstWithYear = tracks.find(trk => typeof trk.year === 'number')?.year;
|
||||
yearInput = (album.year ?? firstWithYear) ? String(album.year ?? firstWithYear) : '';
|
||||
|
||||
const firstGenre = tracks.find(t => (t.genre ?? '').trim())?.genre;
|
||||
const firstGenre = tracks.find(trk => (trk.genre ?? '').trim())?.genre;
|
||||
genre = (album.genre ?? firstGenre ?? '').toString();
|
||||
|
||||
const firstCatalog = tracks.find(t => (t.catalog_number ?? '').trim())?.catalog_number;
|
||||
const firstCatalog = tracks.find(trk => (trk.catalog_number ?? '').trim())?.catalog_number;
|
||||
catalogNumber = (album.catalog_number ?? firstCatalog ?? '').toString();
|
||||
albumTotalDiscs = totalDiscs;
|
||||
persistence = 'sidecar';
|
||||
|
||||
trackEdits = tracks.map(t => ({
|
||||
id: t.id,
|
||||
filePath: t.file_path,
|
||||
cueStartSecs: t.cue_start_secs,
|
||||
title: t.title ?? '',
|
||||
discNumber: t.disc_number,
|
||||
trackNumber: t.track_number
|
||||
trackEdits = tracks.map(trk => ({
|
||||
id: trk.id,
|
||||
filePath: trk.file_path,
|
||||
cueStartSecs: trk.cue_start_secs,
|
||||
title: trk.title ?? '',
|
||||
discNumber: trk.disc_number,
|
||||
trackNumber: trk.track_number
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -286,13 +286,13 @@
|
||||
year,
|
||||
genre: genre.trim() ? genre.trim() : null,
|
||||
catalogNumber: catalogNumber.trim() ? catalogNumber.trim() : null,
|
||||
tracks: trackEdits.map(t => ({
|
||||
id: t.id,
|
||||
filePath: t.filePath,
|
||||
cueStartSecs: t.cueStartSecs ?? null,
|
||||
title: t.title.trim(),
|
||||
discNumber: t.discNumber ?? null,
|
||||
trackNumber: t.trackNumber ?? null
|
||||
tracks: trackEdits.map(trk => ({
|
||||
id: trk.id,
|
||||
filePath: trk.filePath,
|
||||
cueStartSecs: trk.cueStartSecs ?? null,
|
||||
title: trk.title.trim(),
|
||||
discNumber: trk.discNumber ?? null,
|
||||
trackNumber: trk.trackNumber ?? null
|
||||
}))
|
||||
};
|
||||
}
|
||||
@@ -322,13 +322,13 @@
|
||||
alert('Album title is required.');
|
||||
return;
|
||||
}
|
||||
if (trackEdits.some(t => !t.title.trim())) {
|
||||
if (trackEdits.some(trk => !trk.title.trim())) {
|
||||
alert('Track titles cannot be empty.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (persistence === 'direct') {
|
||||
const anyCue = tracks.some(t => !!t.cue_file_path || typeof t.cue_start_secs === 'number');
|
||||
const anyCue = tracks.some(trk => !!trk.cue_file_path || typeof trk.cue_start_secs === 'number');
|
||||
if (anyCue) {
|
||||
alert('Writing tags to files is not supported for CUE-based albums. Use sidecar mode.');
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
<script lang="ts">
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { writeText as copyToClipboard } from '@tauri-apps/plugin-clipboard-manager';
|
||||
import { t } from '$lib/i18n';
|
||||
import Modal from './Modal.svelte';
|
||||
import { getConsoleLogsAsText } from '$lib/stores/consoleLogStore';
|
||||
import { showToast } from '$lib/stores/toastStore';
|
||||
import { Loader2, Copy, Check } from 'lucide-svelte';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
let { isOpen, onClose }: Props = $props();
|
||||
|
||||
let activeTab = $state<'terminal' | 'console'>('terminal');
|
||||
let terminalLogs = $state('');
|
||||
let consoleLogs = $state('');
|
||||
let isUploadingTerminal = $state(false);
|
||||
let isUploadingConsole = $state(false);
|
||||
let isLoading = $state(false);
|
||||
let terminalUrl = $state('');
|
||||
let consoleUrl = $state('');
|
||||
let copiedTerminal = $state(false);
|
||||
let copiedConsole = $state(false);
|
||||
|
||||
async function loadLogs() {
|
||||
isLoading = true;
|
||||
terminalUrl = '';
|
||||
consoleUrl = '';
|
||||
try {
|
||||
const lines: string[] = await invoke('get_backend_logs');
|
||||
terminalLogs = lines.join('\n');
|
||||
} catch (e) {
|
||||
terminalLogs = `Error loading logs: ${e}`;
|
||||
}
|
||||
consoleLogs = getConsoleLogsAsText();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (isOpen) loadLogs();
|
||||
});
|
||||
|
||||
async function uploadTab(tab: 'terminal' | 'console') {
|
||||
const content = tab === 'terminal' ? terminalLogs : consoleLogs;
|
||||
if (tab === 'terminal') isUploadingTerminal = true;
|
||||
else isUploadingConsole = true;
|
||||
|
||||
try {
|
||||
const url: string = await invoke('upload_logs_to_paste', { content });
|
||||
if (tab === 'terminal') terminalUrl = url;
|
||||
else consoleUrl = url;
|
||||
await copyToClipboard(url);
|
||||
showToast($t('settings.developer.uploadSuccess'), 'success');
|
||||
} catch (e) {
|
||||
showToast(`${$t('settings.developer.uploadError')}: ${e}`, 'error');
|
||||
} finally {
|
||||
if (tab === 'terminal') isUploadingTerminal = false;
|
||||
else isUploadingConsole = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyUrl(tab: 'terminal' | 'console') {
|
||||
const url = tab === 'terminal' ? terminalUrl : consoleUrl;
|
||||
if (!url) return;
|
||||
await copyToClipboard(url);
|
||||
if (tab === 'terminal') { copiedTerminal = true; setTimeout(() => copiedTerminal = false, 2000); }
|
||||
else { copiedConsole = true; setTimeout(() => copiedConsole = false, 2000); }
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {isOpen} {onClose} title={$t('settings.developer.logsTitle')} maxWidth="760px">
|
||||
{#snippet children()}
|
||||
<div class="tabs">
|
||||
<button
|
||||
class="tab"
|
||||
class:active={activeTab === 'terminal'}
|
||||
onclick={() => activeTab = 'terminal'}
|
||||
>
|
||||
{$t('settings.developer.tabTerminal')}
|
||||
{#if terminalUrl}<span class="tab-check">✓</span>{/if}
|
||||
</button>
|
||||
<button
|
||||
class="tab"
|
||||
class:active={activeTab === 'console'}
|
||||
onclick={() => activeTab = 'console'}
|
||||
>
|
||||
{$t('settings.developer.tabConsole')}
|
||||
{#if consoleUrl}<span class="tab-check">✓</span>{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="log-container">
|
||||
{#if isLoading}
|
||||
<div class="loading">
|
||||
<Loader2 size={20} class="spin" />
|
||||
</div>
|
||||
{:else}
|
||||
<pre class="log-output">{activeTab === 'terminal' ? terminalLogs : consoleLogs}</pre>
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
{#snippet footer()}
|
||||
<div class="footer-content">
|
||||
<div class="footer-left">
|
||||
<button
|
||||
class="upload-btn"
|
||||
onclick={() => uploadTab(activeTab)}
|
||||
disabled={activeTab === 'terminal' ? isUploadingTerminal : isUploadingConsole}
|
||||
>
|
||||
{#if (activeTab === 'terminal' ? isUploadingTerminal : isUploadingConsole)}
|
||||
<Loader2 size={14} class="spin" />
|
||||
{$t('settings.developer.uploading')}
|
||||
{:else}
|
||||
{$t('settings.developer.uploadTab', { values: { tab: activeTab === 'terminal' ? $t('settings.developer.tabTerminal') : $t('settings.developer.tabConsole') } })}
|
||||
{/if}
|
||||
</button>
|
||||
{#if activeTab === 'terminal' && terminalUrl}
|
||||
<div class="url-row">
|
||||
<code class="uploaded-url">{terminalUrl}</code>
|
||||
<button class="copy-url-btn" onclick={() => copyUrl('terminal')}>
|
||||
{#if copiedTerminal}<Check size={12} />{:else}<Copy size={12} />{/if}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if activeTab === 'console' && consoleUrl}
|
||||
<div class="url-row">
|
||||
<code class="uploaded-url">{consoleUrl}</code>
|
||||
<button class="copy-url-btn" onclick={() => copyUrl('console')}>
|
||||
{#if copiedConsole}<Check size={12} />{:else}<Copy size={12} />{/if}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if terminalUrl || consoleUrl}
|
||||
<p class="help-hint">
|
||||
{$t('settings.developer.bugReportHint')}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 16px;
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
.tab:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.tab.active {
|
||||
background: var(--accent-primary);
|
||||
color: white;
|
||||
border-color: var(--accent-primary);
|
||||
}
|
||||
|
||||
.tab-check {
|
||||
font-size: 11px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.log-container {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
border-radius: 8px;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.log-output {
|
||||
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
|
||||
font-size: 11px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-secondary);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.footer-left {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 16px;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: all 150ms ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.upload-btn:hover:not(:disabled) {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.upload-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.url-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.uploaded-url {
|
||||
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
|
||||
font-size: 12px;
|
||||
color: var(--accent-primary);
|
||||
background: var(--bg-secondary);
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
.copy-url-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
.copy-url-btn:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.help-hint {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
max-width: 280px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
:global(.spin) {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
|
||||
interface HardwareAudioStatus {
|
||||
hardware_sample_rate: number | null;
|
||||
hardware_format: string | null;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
@@ -19,19 +28,53 @@
|
||||
compact = false
|
||||
}: Props = $props();
|
||||
|
||||
// Check if quality was downgraded due to settings
|
||||
const isDowngraded = $derived.by(() => {
|
||||
// Need both original and current values to compare
|
||||
if (!originalSamplingRate || !samplingRate) return false;
|
||||
// Significant difference (more than 10% lower)
|
||||
return samplingRate < originalSamplingRate * 0.9;
|
||||
// Hardware sample rate from /proc/asound (sub-ms read)
|
||||
let hardwareSampleRate = $state<number | null>(null);
|
||||
let isHovering = $state(false);
|
||||
|
||||
// Poll hardware audio status when we have a sampling rate to compare against
|
||||
$effect(() => {
|
||||
if (!samplingRate) return;
|
||||
|
||||
async function poll() {
|
||||
try {
|
||||
const status = await invoke<HardwareAudioStatus>('get_hardware_audio_status').catch(() => null);
|
||||
if (status?.is_active && status.hardware_sample_rate) {
|
||||
hardwareSampleRate = status.hardware_sample_rate;
|
||||
} else {
|
||||
hardwareSampleRate = null;
|
||||
}
|
||||
} catch {
|
||||
hardwareSampleRate = null;
|
||||
}
|
||||
}
|
||||
|
||||
poll();
|
||||
const interval = setInterval(poll, 2000);
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
|
||||
// Format original quality for tooltip
|
||||
const originalQualityText = $derived.by(() => {
|
||||
if (!isDowngraded || !originalSamplingRate) return '';
|
||||
const depth = originalBitDepth || 24;
|
||||
return `${depth}-bit / ${originalSamplingRate} kHz`;
|
||||
// Downgrade detection: compare decoded rate (kHz) vs hardware rate (Hz)
|
||||
const isDowngraded = $derived.by(() => {
|
||||
if (hardwareSampleRate && samplingRate) {
|
||||
// samplingRate is in kHz (e.g. 192), hardwareSampleRate is in Hz (e.g. 48000)
|
||||
const decodedHz = samplingRate * 1000;
|
||||
// Significant difference: hardware is more than 10% lower than decoded
|
||||
return hardwareSampleRate < decodedHz * 0.9;
|
||||
}
|
||||
// Fallback: compare original vs current (old logic, for when hardware unavailable)
|
||||
if (originalSamplingRate && samplingRate) {
|
||||
return samplingRate < originalSamplingRate * 0.9;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Effective output rate for tooltip display (in kHz)
|
||||
const effectiveOutputRateKHz = $derived.by(() => {
|
||||
if (hardwareSampleRate) {
|
||||
return hardwareSampleRate / 1000;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// Determine quality tier
|
||||
@@ -138,7 +181,9 @@
|
||||
<div
|
||||
class="quality-badge"
|
||||
class:downgraded={isDowngraded}
|
||||
title={isDowngraded ? `Playing at ${displayText} (original: ${originalQualityText})` : `${tierLabel}: ${displayText}`}
|
||||
title={isDowngraded ? undefined : `${tierLabel}: ${displayText}`}
|
||||
onmouseenter={() => { isHovering = true; }}
|
||||
onmouseleave={() => { isHovering = false; }}
|
||||
>
|
||||
<!-- Icon container with fixed width -->
|
||||
<div class="icon-container">
|
||||
@@ -158,6 +203,23 @@
|
||||
</span>
|
||||
<span class="quality-info">{displayText}</span>
|
||||
</div>
|
||||
|
||||
<!-- Custom tooltip for degraded state -->
|
||||
{#if isDowngraded && isHovering}
|
||||
<div class="quality-tooltip">
|
||||
<div class="tooltip-section">
|
||||
<div class="tooltip-label">{$t('quality.tooltip.source')}</div>
|
||||
<div class="tooltip-value">{displayText}</div>
|
||||
</div>
|
||||
<div class="tooltip-section">
|
||||
<div class="tooltip-label">{$t('quality.tooltip.output')}</div>
|
||||
<div class="tooltip-value">{effectiveOutputRateKHz ? `${effectiveOutputRateKHz} kHz` : displayText}</div>
|
||||
</div>
|
||||
<div class="tooltip-divider"></div>
|
||||
<div class="tooltip-warning">{$t('quality.tooltip.resampled')}</div>
|
||||
<div class="tooltip-fix">{$t('quality.tooltip.fix')}</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -174,6 +236,7 @@
|
||||
|
||||
/* Full mode styles */
|
||||
.quality-badge {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
@@ -248,4 +311,70 @@
|
||||
.downgrade-indicator.visible {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* Custom tooltip for degraded quality */
|
||||
.quality-tooltip {
|
||||
position: absolute;
|
||||
bottom: calc(100% + 8px);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--alpha-10);
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
min-width: 180px;
|
||||
max-width: 240px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
|
||||
z-index: 9999;
|
||||
animation: tooltip-appear 150ms ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@keyframes tooltip-appear {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-50%) translateY(4px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.tooltip-section {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.tooltip-label {
|
||||
font-size: 9px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--alpha-40);
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.tooltip-value {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.tooltip-divider {
|
||||
height: 1px;
|
||||
background: var(--alpha-10);
|
||||
margin: 6px 0;
|
||||
}
|
||||
|
||||
.tooltip-warning {
|
||||
font-size: 11px;
|
||||
color: #eab308;
|
||||
font-weight: 500;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.tooltip-fix {
|
||||
font-size: 10px;
|
||||
color: var(--alpha-50);
|
||||
line-height: 1.3;
|
||||
}
|
||||
</style>
|
||||
@@ -124,6 +124,21 @@
|
||||
let showCreateFolderModal = $state(false);
|
||||
let newFolderName = $state('');
|
||||
|
||||
// Virtual scroll state for playlists
|
||||
type VirtualPlaylistItem =
|
||||
| { type: 'folder-header'; folder: PlaylistFolder; folderId: string; top: number; height: number }
|
||||
| { type: 'folder-playlist'; playlist: Playlist; folder: PlaylistFolder; folderId: string; top: number; height: number }
|
||||
| { type: 'root-playlist'; playlist: Playlist; folderId: null; top: number; height: number }
|
||||
| { type: 'collapsed-folder'; folder: PlaylistFolder; folderId: string; top: number; height: number };
|
||||
|
||||
let playlistScrollEl: HTMLDivElement | null = $state(null);
|
||||
let playlistScrollTop = $state(0);
|
||||
let playlistContainerHeight = $state(0);
|
||||
|
||||
const PLAYLIST_ITEM_HEIGHT = 34; // 32px item + 2px gap
|
||||
const PLAYLIST_FOLDER_HEADER_HEIGHT = 34; // ~32px header + 2px gap
|
||||
const PLAYLIST_BUFFER_ITEMS = 10;
|
||||
|
||||
// Context menu state
|
||||
let contextMenu = $state<{
|
||||
visible: boolean;
|
||||
@@ -588,6 +603,154 @@
|
||||
// Check if any playlists exist in root (no folder)
|
||||
let rootPlaylists = $derived(getPlaylistsInFolder(null));
|
||||
|
||||
// Flattened virtual playlist items for virtualized scrolling
|
||||
let virtualPlaylistItems = $derived.by(() => {
|
||||
const items: VirtualPlaylistItem[] = [];
|
||||
let currentTop = 0;
|
||||
|
||||
// Reference folderExpandState to trigger re-derivation when folders are toggled
|
||||
// (isFolderExpanded reads from a non-reactive Set, so we need this dependency)
|
||||
void folderExpandState;
|
||||
|
||||
if (isExpanded) {
|
||||
// Expanded sidebar: folders with headers + playlists, then root playlists
|
||||
for (const folder of folders) {
|
||||
const folderPlaylists = getPlaylistsInFolder(folder.id);
|
||||
const expanded = isFolderExpanded(folder.id);
|
||||
|
||||
// Folder header
|
||||
items.push({
|
||||
type: 'folder-header',
|
||||
folder,
|
||||
folderId: folder.id,
|
||||
top: currentTop,
|
||||
height: PLAYLIST_FOLDER_HEADER_HEIGHT
|
||||
});
|
||||
currentTop += PLAYLIST_FOLDER_HEADER_HEIGHT;
|
||||
|
||||
// Folder playlists (only if expanded)
|
||||
if (expanded) {
|
||||
for (const playlist of folderPlaylists) {
|
||||
items.push({
|
||||
type: 'folder-playlist',
|
||||
playlist,
|
||||
folder,
|
||||
folderId: folder.id,
|
||||
top: currentTop,
|
||||
height: PLAYLIST_ITEM_HEIGHT
|
||||
});
|
||||
currentTop += PLAYLIST_ITEM_HEIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Root playlists
|
||||
for (const playlist of rootPlaylists) {
|
||||
items.push({
|
||||
type: 'root-playlist',
|
||||
playlist,
|
||||
folderId: null,
|
||||
top: currentTop,
|
||||
height: PLAYLIST_ITEM_HEIGHT
|
||||
});
|
||||
currentTop += PLAYLIST_ITEM_HEIGHT;
|
||||
}
|
||||
} else {
|
||||
// Collapsed sidebar: folder icons + playlist icons
|
||||
for (const folder of folders) {
|
||||
items.push({
|
||||
type: 'collapsed-folder',
|
||||
folder,
|
||||
folderId: folder.id,
|
||||
top: currentTop,
|
||||
height: PLAYLIST_ITEM_HEIGHT
|
||||
});
|
||||
currentTop += PLAYLIST_ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
for (const playlist of rootPlaylists) {
|
||||
items.push({
|
||||
type: 'root-playlist',
|
||||
playlist,
|
||||
folderId: null,
|
||||
top: currentTop,
|
||||
height: PLAYLIST_ITEM_HEIGHT
|
||||
});
|
||||
currentTop += PLAYLIST_ITEM_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
});
|
||||
|
||||
let totalPlaylistHeight = $derived(
|
||||
virtualPlaylistItems.length > 0
|
||||
? virtualPlaylistItems[virtualPlaylistItems.length - 1].top + virtualPlaylistItems[virtualPlaylistItems.length - 1].height
|
||||
: 0
|
||||
);
|
||||
|
||||
// Binary search for first visible item
|
||||
function playlistBinarySearchStart(items: VirtualPlaylistItem[], targetTop: number): number {
|
||||
let low = 0;
|
||||
let high = items.length - 1;
|
||||
let result = 0;
|
||||
|
||||
while (low <= high) {
|
||||
const mid = Math.floor((low + high) / 2);
|
||||
const item = items[mid];
|
||||
if (item.top + item.height > targetTop) {
|
||||
result = mid;
|
||||
high = mid - 1;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Binary search for last visible item
|
||||
function playlistBinarySearchEnd(items: VirtualPlaylistItem[], targetBottom: number, startFrom: number): number {
|
||||
let low = startFrom;
|
||||
let high = items.length - 1;
|
||||
let result = high;
|
||||
|
||||
while (low <= high) {
|
||||
const mid = Math.floor((low + high) / 2);
|
||||
const item = items[mid];
|
||||
if (item.top > targetBottom) {
|
||||
result = mid;
|
||||
high = mid - 1;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
let visiblePlaylistItems = $derived.by(() => {
|
||||
if (virtualPlaylistItems.length === 0) return [];
|
||||
|
||||
const viewportTop = playlistScrollTop;
|
||||
const viewportBottom = playlistScrollTop + playlistContainerHeight;
|
||||
|
||||
const firstVisible = playlistBinarySearchStart(virtualPlaylistItems, viewportTop);
|
||||
const lastVisible = playlistBinarySearchEnd(virtualPlaylistItems, viewportBottom, firstVisible);
|
||||
|
||||
const startIdx = Math.max(0, firstVisible - PLAYLIST_BUFFER_ITEMS);
|
||||
const endIdx = Math.min(virtualPlaylistItems.length - 1, lastVisible + PLAYLIST_BUFFER_ITEMS);
|
||||
|
||||
return virtualPlaylistItems.slice(startIdx, endIdx + 1);
|
||||
});
|
||||
|
||||
function handlePlaylistScroll(e: Event) {
|
||||
playlistScrollTop = (e.target as HTMLDivElement).scrollTop;
|
||||
}
|
||||
|
||||
function getPlaylistItemKey(item: VirtualPlaylistItem): string {
|
||||
if (item.type === 'folder-header' || item.type === 'collapsed-folder') return `f-${item.folder.id}`;
|
||||
return `p-${item.playlist.id}`;
|
||||
}
|
||||
|
||||
// Subscribe to global floating menu store
|
||||
$effect(() => {
|
||||
const unsubscribe = subscribeFloatingMenu(() => {
|
||||
@@ -722,7 +885,7 @@
|
||||
try {
|
||||
const prefs = await invoke<FavoritesPreferences>('get_favorites_preferences');
|
||||
// Filter out 'playlists' from tab order for sidebar display
|
||||
favoritesTabOrder = (prefs.tab_order || ['tracks', 'albums', 'artists']).filter(t => t !== 'playlists');
|
||||
favoritesTabOrder = (prefs.tab_order || ['tracks', 'albums', 'artists']).filter(tab => tab !== 'playlists');
|
||||
} catch (err) {
|
||||
console.debug('[Sidebar] Failed to load favorites preferences:', err);
|
||||
}
|
||||
@@ -796,6 +959,22 @@
|
||||
};
|
||||
});
|
||||
|
||||
// ResizeObserver for playlist virtual scroll container
|
||||
$effect(() => {
|
||||
if (playlistScrollEl) {
|
||||
playlistContainerHeight = playlistScrollEl.clientHeight;
|
||||
|
||||
const observer = new ResizeObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
playlistContainerHeight = entry.contentRect.height;
|
||||
}
|
||||
});
|
||||
observer.observe(playlistScrollEl);
|
||||
|
||||
return () => observer.disconnect();
|
||||
}
|
||||
});
|
||||
|
||||
// Sidebar search handlers
|
||||
const SEARCH_NAV_THRESHOLD = 3; // Navigate to search after this many characters
|
||||
|
||||
@@ -1229,76 +1408,67 @@
|
||||
{/if}
|
||||
|
||||
{#if !playlistsCollapsed || !isExpanded}
|
||||
<div class="playlists-scroll">
|
||||
<div class="playlists-scroll" bind:this={playlistScrollEl} onscroll={handlePlaylistScroll}>
|
||||
{#if playlistsLoading}
|
||||
{#if isExpanded}
|
||||
<div class="playlists-loading">{$t('actions.loading')}</div>
|
||||
{/if}
|
||||
{:else if visiblePlaylists.length > 0 || folders.length > 0}
|
||||
<nav class="playlists-nav">
|
||||
<!-- Folders with their playlists -->
|
||||
{#each folders as folder (folder.id)}
|
||||
{@const folderPlaylists = getPlaylistsInFolder(folder.id)}
|
||||
{@const isExpanded_ = isFolderExpanded(folder.id)}
|
||||
{#if isExpanded}
|
||||
<div class="folder-item">
|
||||
<div class="playlists-virtual-content" style="height: {totalPlaylistHeight}px;">
|
||||
{#each visiblePlaylistItems as item (getPlaylistItemKey(item))}
|
||||
<div class="playlists-virtual-item" style="transform: translateY({item.top}px); height: {item.height}px;">
|
||||
{#if item.type === 'folder-header'}
|
||||
{@const folderPlaylists = getPlaylistsInFolder(item.folder.id)}
|
||||
{@const isFolderExp = isFolderExpanded(item.folder.id)}
|
||||
<button
|
||||
class="folder-header"
|
||||
onclick={() => handleToggleFolder(folder.id)}
|
||||
onclick={() => handleToggleFolder(item.folder.id)}
|
||||
>
|
||||
<Folder size={14} />
|
||||
<span class="folder-name">{folder.name}</span>
|
||||
<span class="folder-name">{item.folder.name}</span>
|
||||
<span class="folder-count">{folderPlaylists.length}</span>
|
||||
<span class="folder-chevron" class:expanded={isExpanded_}>
|
||||
<span class="folder-chevron" class:expanded={isFolderExp}>
|
||||
<ChevronRight size={12} />
|
||||
</span>
|
||||
</button>
|
||||
{#if isExpanded_}
|
||||
<div class="folder-playlists">
|
||||
{#each folderPlaylists as playlist (playlist.id)}
|
||||
<NavigationItem
|
||||
label={playlist.name}
|
||||
tooltip={getPlaylistTooltip(playlist, true)}
|
||||
active={activeView === 'playlist' && selectedPlaylistId === playlist.id}
|
||||
onclick={() => handlePlaylistClick(playlist)}
|
||||
onHover={() => loadPlaylistTooltip(playlist)}
|
||||
oncontextmenu={(e) => handlePlaylistContextMenu(e, playlist, folder.id)}
|
||||
showLabel={true}
|
||||
indented={true}
|
||||
>
|
||||
{#snippet icon()}<ListMusic size={14} />{/snippet}
|
||||
</NavigationItem>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Collapsed sidebar: show folder icon only -->
|
||||
<button
|
||||
class="collapsed-folder-btn"
|
||||
onclick={(e) => showFolderPopover(e, folder)}
|
||||
title="{folder.name} ({folderPlaylists.length})"
|
||||
>
|
||||
<Folder size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
{:else if item.type === 'folder-playlist'}
|
||||
<NavigationItem
|
||||
label={item.playlist.name}
|
||||
tooltip={getPlaylistTooltip(item.playlist, true)}
|
||||
active={activeView === 'playlist' && selectedPlaylistId === item.playlist.id}
|
||||
onclick={() => handlePlaylistClick(item.playlist)}
|
||||
onHover={() => loadPlaylistTooltip(item.playlist)}
|
||||
oncontextmenu={(e) => handlePlaylistContextMenu(e, item.playlist, item.folderId)}
|
||||
showLabel={true}
|
||||
indented={true}
|
||||
>
|
||||
{#snippet icon()}<ListMusic size={14} />{/snippet}
|
||||
</NavigationItem>
|
||||
{:else if item.type === 'root-playlist'}
|
||||
<NavigationItem
|
||||
label={item.playlist.name}
|
||||
tooltip={getPlaylistTooltip(item.playlist, isExpanded)}
|
||||
active={activeView === 'playlist' && selectedPlaylistId === item.playlist.id}
|
||||
onclick={() => handlePlaylistClick(item.playlist)}
|
||||
onHover={() => loadPlaylistTooltip(item.playlist)}
|
||||
oncontextmenu={(e) => handlePlaylistContextMenu(e, item.playlist, null)}
|
||||
showLabel={isExpanded}
|
||||
>
|
||||
{#snippet icon()}<ListMusic size={14} />{/snippet}
|
||||
</NavigationItem>
|
||||
{:else if item.type === 'collapsed-folder'}
|
||||
{@const folderPlaylists = getPlaylistsInFolder(item.folder.id)}
|
||||
<button
|
||||
class="collapsed-folder-btn"
|
||||
onclick={(e) => showFolderPopover(e, item.folder)}
|
||||
title="{item.folder.name} ({folderPlaylists.length})"
|
||||
>
|
||||
<Folder size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<!-- Root playlists (not in any folder) -->
|
||||
{#each rootPlaylists as playlist (playlist.id)}
|
||||
<NavigationItem
|
||||
label={playlist.name}
|
||||
tooltip={getPlaylistTooltip(playlist, isExpanded)}
|
||||
active={activeView === 'playlist' && selectedPlaylistId === playlist.id}
|
||||
onclick={() => handlePlaylistClick(playlist)}
|
||||
onHover={() => loadPlaylistTooltip(playlist)}
|
||||
oncontextmenu={(e) => handlePlaylistContextMenu(e, playlist, null)}
|
||||
showLabel={isExpanded}
|
||||
>
|
||||
{#snippet icon()}<ListMusic size={14} />{/snippet}
|
||||
</NavigationItem>
|
||||
{/each}
|
||||
</nav>
|
||||
</div>
|
||||
{:else if userPlaylists.length > 0}
|
||||
{#if isExpanded}
|
||||
<div class="no-playlists">{$t('playlist.allHidden')}</div>
|
||||
@@ -1731,11 +1901,17 @@
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Playlist list view */
|
||||
.playlists-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
/* Virtualized playlist list */
|
||||
.playlists-virtual-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.playlists-virtual-item {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.playlists-scroll {
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
let tooltipEl: HTMLDivElement;
|
||||
let visible = $state(false);
|
||||
let positioned = $state(false);
|
||||
let text = $state('');
|
||||
let position = $state({ x: 0, y: 0 });
|
||||
|
||||
let hoverTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let currentTarget: HTMLElement | null = null;
|
||||
|
||||
const DELAY = 400;
|
||||
const OFFSET = 8;
|
||||
|
||||
onMount(() => {
|
||||
document.addEventListener('pointerenter', handleEnter, true);
|
||||
document.addEventListener('pointerleave', handleLeave, true);
|
||||
document.addEventListener('scroll', hide, true);
|
||||
window.addEventListener('blur', hide);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
document.removeEventListener('pointerenter', handleEnter, true);
|
||||
document.removeEventListener('pointerleave', handleLeave, true);
|
||||
document.removeEventListener('scroll', hide, true);
|
||||
window.removeEventListener('blur', hide);
|
||||
if (hoverTimer) clearTimeout(hoverTimer);
|
||||
});
|
||||
|
||||
function handleEnter(e: PointerEvent) {
|
||||
const target = e.target as HTMLElement;
|
||||
if (!target?.closest) return;
|
||||
|
||||
// Match elements with title (first hover) or data-sys-tooltip (subsequent hovers)
|
||||
const el = (target.closest('[title]') || target.closest('[data-sys-tooltip]')) as HTMLElement | null;
|
||||
if (!el) return;
|
||||
|
||||
// On first hover, migrate title → data-sys-tooltip
|
||||
const titleText = el.getAttribute('title');
|
||||
if (titleText) {
|
||||
el.setAttribute('data-sys-tooltip', titleText);
|
||||
el.removeAttribute('title');
|
||||
}
|
||||
|
||||
const storedText = el.getAttribute('data-sys-tooltip');
|
||||
if (!storedText) return;
|
||||
|
||||
if (hoverTimer) clearTimeout(hoverTimer);
|
||||
currentTarget = el;
|
||||
|
||||
hoverTimer = setTimeout(() => {
|
||||
if (currentTarget !== el) return;
|
||||
text = storedText;
|
||||
// Set visible but not yet positioned — tooltip renders offscreen for measurement
|
||||
positioned = false;
|
||||
visible = true;
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
if (!tooltipEl || currentTarget !== el) return;
|
||||
computePosition(el);
|
||||
positioned = true;
|
||||
});
|
||||
}, DELAY);
|
||||
}
|
||||
|
||||
function handleLeave(e: PointerEvent) {
|
||||
const el = (e.target as HTMLElement)?.closest?.('[data-sys-tooltip]');
|
||||
if (!el || el !== currentTarget) return;
|
||||
hide();
|
||||
}
|
||||
|
||||
function hide() {
|
||||
if (hoverTimer) clearTimeout(hoverTimer);
|
||||
hoverTimer = null;
|
||||
currentTarget = null;
|
||||
visible = false;
|
||||
positioned = false;
|
||||
}
|
||||
|
||||
function computePosition(el: HTMLElement) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const vw = window.innerWidth;
|
||||
const vh = window.innerHeight;
|
||||
const tw = tooltipEl.offsetWidth;
|
||||
const th = tooltipEl.offsetHeight;
|
||||
|
||||
let x = rect.left + rect.width / 2 - tw / 2;
|
||||
let y = rect.top - th - OFFSET;
|
||||
|
||||
// If clips top, try bottom
|
||||
if (y < 4) {
|
||||
y = rect.bottom + OFFSET;
|
||||
// If clips bottom too, try right
|
||||
if (y + th > vh - 4) {
|
||||
x = rect.right + OFFSET;
|
||||
y = rect.top + rect.height / 2 - th / 2;
|
||||
// If clips right, try left
|
||||
if (x + tw > vw - 4) {
|
||||
x = rect.left - tw - OFFSET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clamp to viewport
|
||||
x = Math.max(4, Math.min(x, vw - tw - 4));
|
||||
y = Math.max(4, Math.min(y, vh - th - 4));
|
||||
|
||||
position = { x, y };
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="sys-tooltip"
|
||||
class:visible={visible && positioned}
|
||||
class:measuring={visible && !positioned}
|
||||
bind:this={tooltipEl}
|
||||
style="left: {position.x}px; top: {position.y}px;"
|
||||
>
|
||||
{text}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.sys-tooltip {
|
||||
position: fixed;
|
||||
z-index: 10001;
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
border-radius: 6px;
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
max-width: 280px;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.sys-tooltip.measuring {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.sys-tooltip.visible {
|
||||
visibility: visible;
|
||||
animation: sys-tooltip-in 150ms ease forwards;
|
||||
}
|
||||
|
||||
@keyframes sys-tooltip-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -75,7 +75,7 @@
|
||||
limit: 20
|
||||
});
|
||||
// Filter out non-streamable tracks
|
||||
results = response.items.filter(t => t.streamable !== false);
|
||||
results = response.items.filter(trk => trk.streamable !== false);
|
||||
} catch (err) {
|
||||
console.error('Search failed:', err);
|
||||
results = [];
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
function handleConfirm() {
|
||||
const selected = results.find(t => t.id === selectedTrackId);
|
||||
const selected = results.find(trk => trk.id === selectedTrackId);
|
||||
if (selected) {
|
||||
onSelect(selected);
|
||||
}
|
||||
|
||||
@@ -577,16 +577,19 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
opacity: 0.3;
|
||||
opacity: 0;
|
||||
transition: opacity 150ms ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.download-indicator.has-download {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.track-row:hover .download-indicator {
|
||||
opacity: 0.6;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.track-row:hover .download-indicator.has-download,
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
samplingRate?: number;
|
||||
originalBitDepth?: number;
|
||||
originalSamplingRate?: number;
|
||||
format?: string;
|
||||
// Playback state
|
||||
isPlaying: boolean;
|
||||
currentTime: number;
|
||||
@@ -96,6 +99,9 @@
|
||||
quality,
|
||||
bitDepth,
|
||||
samplingRate,
|
||||
originalBitDepth,
|
||||
originalSamplingRate,
|
||||
format,
|
||||
isPlaying,
|
||||
currentTime,
|
||||
duration,
|
||||
@@ -382,6 +388,9 @@
|
||||
{quality}
|
||||
{bitDepth}
|
||||
{samplingRate}
|
||||
{originalBitDepth}
|
||||
{originalSamplingRate}
|
||||
{format}
|
||||
{queueTracks}
|
||||
{queueCurrentIndex}
|
||||
onNavigate={(index) => onQueuePlayTrack?.(index)}
|
||||
@@ -397,6 +406,9 @@
|
||||
{quality}
|
||||
{bitDepth}
|
||||
{samplingRate}
|
||||
{originalBitDepth}
|
||||
{originalSamplingRate}
|
||||
{format}
|
||||
/>
|
||||
{:else if activeFocusTab === 'vinyl'}
|
||||
<!-- Vinyl: Spinning record with album cover -->
|
||||
@@ -409,6 +421,9 @@
|
||||
{quality}
|
||||
{bitDepth}
|
||||
{samplingRate}
|
||||
{originalBitDepth}
|
||||
{originalSamplingRate}
|
||||
{format}
|
||||
/>
|
||||
{:else if activeFocusTab === 'visualizer'}
|
||||
<!-- Visualizer: Audio spectrum with mirror mode -->
|
||||
@@ -421,6 +436,9 @@
|
||||
{quality}
|
||||
{bitDepth}
|
||||
{samplingRate}
|
||||
{originalBitDepth}
|
||||
{originalSamplingRate}
|
||||
{format}
|
||||
/>
|
||||
{:else if activeFocusTab === 'lyrics-focus'}
|
||||
<!-- Lyrics Focus: Single line, large, centered -->
|
||||
@@ -458,7 +476,7 @@
|
||||
<p class="split-track-album">{album}</p>
|
||||
{/if}
|
||||
<div class="split-quality-badge">
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} />
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} {originalBitDepth} {originalSamplingRate} {format} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
samplingRate?: number;
|
||||
originalBitDepth?: number;
|
||||
originalSamplingRate?: number;
|
||||
format?: string;
|
||||
// Queue for coverflow
|
||||
queueTracks?: QueueTrack[];
|
||||
queueCurrentIndex?: number;
|
||||
@@ -32,6 +35,9 @@
|
||||
quality,
|
||||
bitDepth,
|
||||
samplingRate,
|
||||
originalBitDepth,
|
||||
originalSamplingRate,
|
||||
format,
|
||||
queueTracks = [],
|
||||
queueCurrentIndex = 0,
|
||||
onNavigate
|
||||
@@ -132,7 +138,7 @@
|
||||
<p class="track-album">{album}</p>
|
||||
{/if}
|
||||
<div class="quality-badge-wrapper">
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} />
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} {originalBitDepth} {originalSamplingRate} {format} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
samplingRate?: number;
|
||||
originalBitDepth?: number;
|
||||
originalSamplingRate?: number;
|
||||
format?: string;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -20,7 +23,10 @@
|
||||
isPlaying = false,
|
||||
quality,
|
||||
bitDepth,
|
||||
samplingRate
|
||||
samplingRate,
|
||||
originalBitDepth,
|
||||
originalSamplingRate,
|
||||
format
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
@@ -49,7 +55,7 @@
|
||||
<p class="track-album">{album}</p>
|
||||
{/if}
|
||||
<div class="quality-badge-wrapper">
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} />
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} {originalBitDepth} {originalSamplingRate} {format} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
// Extract tracks for recommendations
|
||||
let tracks: Track[] = [];
|
||||
if (artist.tracks_appears_on?.items) {
|
||||
const filtered = artist.tracks_appears_on.items.filter(t => t.id !== trackId);
|
||||
const filtered = artist.tracks_appears_on.items.filter(trk => trk.id !== trackId);
|
||||
tracks = dedupeByExactTitle(filtered);
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@
|
||||
offset: 0
|
||||
});
|
||||
if (artistTracks.items) {
|
||||
const filtered = artistTracks.items.filter(t => t.id !== trackId);
|
||||
const filtered = artistTracks.items.filter(trk => trk.id !== trackId);
|
||||
const deduped = dedupeByExactTitle(filtered);
|
||||
// Merge with existing, prioritizing new tracks
|
||||
const existingIds = new Set(tracks.map(t => t.id));
|
||||
for (const t of deduped) {
|
||||
if (!existingIds.has(t.id)) {
|
||||
tracks.push(t);
|
||||
const existingIds = new Set(tracks.map(trk => trk.id));
|
||||
for (const trk of deduped) {
|
||||
if (!existingIds.has(trk.id)) {
|
||||
tracks.push(trk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
samplingRate?: number;
|
||||
originalBitDepth?: number;
|
||||
originalSamplingRate?: number;
|
||||
format?: string;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -21,7 +24,10 @@
|
||||
isPlaying = false,
|
||||
quality,
|
||||
bitDepth,
|
||||
samplingRate
|
||||
samplingRate,
|
||||
originalBitDepth,
|
||||
originalSamplingRate,
|
||||
format
|
||||
}: Props = $props();
|
||||
|
||||
// WebGL2 refs
|
||||
@@ -316,7 +322,7 @@
|
||||
<p class="track-album">{album}</p>
|
||||
{/if}
|
||||
<div class="quality-badge-wrapper">
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} />
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} {originalBitDepth} {originalSamplingRate} {format} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
quality?: string;
|
||||
bitDepth?: number;
|
||||
samplingRate?: number;
|
||||
originalBitDepth?: number;
|
||||
originalSamplingRate?: number;
|
||||
format?: string;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -23,7 +26,10 @@
|
||||
album = '',
|
||||
quality,
|
||||
bitDepth,
|
||||
samplingRate
|
||||
samplingRate,
|
||||
originalBitDepth,
|
||||
originalSamplingRate,
|
||||
format
|
||||
}: Props = $props();
|
||||
|
||||
let canvasRef: HTMLCanvasElement | null = $state(null);
|
||||
@@ -264,7 +270,7 @@
|
||||
<p class="track-album">{album}</p>
|
||||
{/if}
|
||||
<div class="quality-badge-wrapper">
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} />
|
||||
<QualityBadge {quality} {bitDepth} {samplingRate} {originalBitDepth} {originalSamplingRate} {format} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import ViewTransition from '../ViewTransition.svelte';
|
||||
import { getOfflineCacheState, type OfflineCacheStatus, isAlbumFullyCached } from '$lib/stores/offlineCacheState';
|
||||
import { consumeContextTrackFocus } from '$lib/stores/playbackContextStore';
|
||||
import { saveScrollPosition, getSavedScrollPosition } from '$lib/stores/navigationStore';
|
||||
import {
|
||||
subscribe as subscribeAlbumFavorites,
|
||||
isAlbumFavorite,
|
||||
@@ -260,6 +261,14 @@
|
||||
}
|
||||
})();
|
||||
|
||||
// Restore scroll position
|
||||
requestAnimationFrame(() => {
|
||||
const saved = getSavedScrollPosition('album');
|
||||
if (scrollContainer && saved > 0) {
|
||||
scrollContainer.scrollTop = saved;
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribe?.();
|
||||
};
|
||||
@@ -304,7 +313,7 @@
|
||||
</script>
|
||||
|
||||
<ViewTransition duration={200} distance={12} direction="up">
|
||||
<div class="album-detail" bind:this={scrollContainer}>
|
||||
<div class="album-detail" bind:this={scrollContainer} onscroll={(e) => saveScrollPosition('album', (e.target as HTMLElement).scrollTop)}>
|
||||
<!-- Back Navigation -->
|
||||
<button class="back-btn" onclick={onBack}>
|
||||
<ArrowLeft size={16} />
|
||||
@@ -506,6 +515,8 @@
|
||||
artwork={relatedAlbum.artwork}
|
||||
title={relatedAlbum.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onTrackGoToArtist}
|
||||
genre={relatedAlbum.genre}
|
||||
releaseDate={relatedAlbum.releaseDate}
|
||||
size="large"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import TrackMenu from '../TrackMenu.svelte';
|
||||
import QualityBadge from '../QualityBadge.svelte';
|
||||
import { consumeContextTrackFocus, setPlaybackContext, getPlaybackContext } from '$lib/stores/playbackContextStore';
|
||||
import { saveScrollPosition, getSavedScrollPosition } from '$lib/stores/navigationStore';
|
||||
import { togglePlay } from '$lib/stores/playerStore';
|
||||
import { getQueue, syncQueueState, playQueueIndex } from '$lib/stores/queueStore';
|
||||
import { subscribeContentSidebar, toggleContentSidebar, type ContentSidebarType } from '$lib/stores/sidebarStore';
|
||||
@@ -176,6 +177,14 @@
|
||||
unsubscribeTrackFavorites = subscribeFavorites(() => {
|
||||
trackFavoritesVersion++;
|
||||
});
|
||||
|
||||
// Restore scroll position
|
||||
requestAnimationFrame(() => {
|
||||
const saved = getSavedScrollPosition('artist');
|
||||
if (artistDetailEl && saved > 0) {
|
||||
artistDetailEl.scrollTop = saved;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -1144,7 +1153,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="artist-detail" bind:this={artistDetailEl}>
|
||||
<div class="artist-detail" bind:this={artistDetailEl} onscroll={(e) => saveScrollPosition('artist', (e.target as HTMLElement).scrollTop)}>
|
||||
<!-- Back Navigation -->
|
||||
<button class="back-btn" onclick={onBack}>
|
||||
<ArrowLeft size={16} />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { onMount, tick } from 'svelte';
|
||||
import { get } from 'svelte/store';
|
||||
import { t } from '$lib/i18n';
|
||||
import { Heart, Play, Disc3, Mic2, Music, Search, X, LayoutGrid, List, ChevronDown, ListMusic, Edit3, Star, Folder, Library, CloudDownload, Shuffle, MoreHorizontal, PanelLeftClose, Loader2 } from 'lucide-svelte';
|
||||
import { Heart, Play, Disc3, Mic2, Music, Search, X, LayoutGrid, List, ChevronDown, ListMusic, Edit3, Star, Folder, Library, CloudDownload, Shuffle, MoreHorizontal, PanelLeftClose, Loader2, ArrowLeft } from 'lucide-svelte';
|
||||
import AlbumCard from '../AlbumCard.svelte';
|
||||
import TrackRow from '../TrackRow.svelte';
|
||||
import QualityBadge from '../QualityBadge.svelte';
|
||||
@@ -29,6 +29,7 @@
|
||||
type GenreFilterContext
|
||||
} from '$lib/stores/genreFilterStore';
|
||||
import type { FavoritesPreferences, QobuzAlbum } from '$lib/types';
|
||||
import { saveScrollPosition, getSavedScrollPosition, getActiveView } from '$lib/stores/navigationStore';
|
||||
|
||||
const GENRE_CONTEXT: GenreFilterContext = 'favorites';
|
||||
|
||||
@@ -74,6 +75,7 @@
|
||||
}
|
||||
|
||||
interface Props {
|
||||
onBack?: () => void;
|
||||
onAlbumClick?: (albumId: string) => void;
|
||||
onAlbumPlay?: (albumId: string) => void;
|
||||
onAlbumPlayNext?: (albumId: string) => void;
|
||||
@@ -130,6 +132,7 @@
|
||||
}
|
||||
|
||||
let {
|
||||
onBack,
|
||||
onAlbumClick,
|
||||
onAlbumPlay,
|
||||
onAlbumPlayNext,
|
||||
@@ -542,7 +545,7 @@
|
||||
trackGroupingEnabled = loadStoredBool('qbz-favorites-track-group-enabled', false);
|
||||
artistGroupingEnabled = loadStoredBool('qbz-favorites-artist-group-enabled', false);
|
||||
artistViewMode = loadStoredString('qbz-favorites-artist-view-mode', 'grid', ['grid', 'sidepanel']) as ArtistViewMode;
|
||||
loadFavoritesPreferences().then(() => {
|
||||
loadFavoritesPreferences().then(async () => {
|
||||
preferencesLoaded = true;
|
||||
if (selectedTab) {
|
||||
activeTab = selectedTab;
|
||||
@@ -550,9 +553,22 @@
|
||||
activeTab = favoritesPreferences.tab_order[0] as TabType;
|
||||
}
|
||||
loadTabIfNeeded(activeTab);
|
||||
// Restore scroll position after content loads
|
||||
await tick();
|
||||
requestAnimationFrame(() => {
|
||||
const saved = getSavedScrollPosition(getActiveView());
|
||||
if (scrollContainer && saved > 0) {
|
||||
scrollContainer.scrollTop = saved;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function handleFavoritesScroll(e: Event) {
|
||||
const target = e.target as HTMLElement;
|
||||
saveScrollPosition(getActiveView(), target.scrollTop);
|
||||
}
|
||||
|
||||
async function loadFavoritesPreferences() {
|
||||
try {
|
||||
const prefs = await invoke<FavoritesPreferences>('get_favorites_preferences');
|
||||
@@ -661,7 +677,7 @@
|
||||
if (type === 'tracks') {
|
||||
favoriteTracks = items as FavoriteTrack[];
|
||||
// Sync to local cache for other views
|
||||
const trackIds = favoriteTracks.map(t => t.id);
|
||||
const trackIds = favoriteTracks.map(trk => trk.id);
|
||||
void syncTrackCache(trackIds);
|
||||
} else if (type === 'albums') {
|
||||
favoriteAlbums = items as FavoriteAlbum[];
|
||||
@@ -1007,32 +1023,32 @@
|
||||
}
|
||||
|
||||
function buildFavoritesQueueTracks(tracks: FavoriteTrack[]) {
|
||||
return tracks.map(t => ({
|
||||
id: t.id,
|
||||
title: t.title,
|
||||
artist: t.performer?.name || 'Unknown Artist',
|
||||
album: t.album?.title || 'Favorites',
|
||||
duration_secs: t.duration,
|
||||
artwork_url: t.album?.image?.large || t.album?.image?.thumbnail || t.album?.image?.small || '',
|
||||
hires: t.hires ?? false,
|
||||
bit_depth: t.maximum_bit_depth ?? null,
|
||||
sample_rate: t.maximum_sampling_rate ?? null,
|
||||
return tracks.map(trk => ({
|
||||
id: trk.id,
|
||||
title: trk.title,
|
||||
artist: trk.performer?.name || 'Unknown Artist',
|
||||
album: trk.album?.title || 'Favorites',
|
||||
duration_secs: trk.duration,
|
||||
artwork_url: trk.album?.image?.large || trk.album?.image?.thumbnail || trk.album?.image?.small || '',
|
||||
hires: trk.hires ?? false,
|
||||
bit_depth: trk.maximum_bit_depth ?? null,
|
||||
sample_rate: trk.maximum_sampling_rate ?? null,
|
||||
is_local: false,
|
||||
album_id: t.album?.id || null,
|
||||
artist_id: t.performer?.id ?? null,
|
||||
album_id: trk.album?.id || null,
|
||||
artist_id: trk.performer?.id ?? null,
|
||||
}));
|
||||
}
|
||||
|
||||
// Accessor functions for VirtualizedTrackList (adapts FavoriteTrack to expected interface)
|
||||
const getFavoriteTrackId = (t: FavoriteTrack) => t.id;
|
||||
const getFavoriteTrackNumber = (t: FavoriteTrack, idx: number) => t.track_number || idx + 1;
|
||||
const getFavoriteTrackTitle = (t: FavoriteTrack) => t.title;
|
||||
const getFavoriteTrackArtist = (t: FavoriteTrack) => t.performer?.name;
|
||||
const getFavoriteTrackDuration = (t: FavoriteTrack) => t.duration;
|
||||
const getFavoriteTrackAlbumKey = (t: FavoriteTrack) => t.album?.id;
|
||||
const getFavoriteTrackAlbum = (t: FavoriteTrack) => t.album?.title;
|
||||
const getFavoriteArtistId = (t: FavoriteTrack) => t.performer?.id;
|
||||
const getFavoriteAlbumId = (t: FavoriteTrack) => t.album?.id;
|
||||
const getFavoriteTrackId = (trk: FavoriteTrack) => trk.id;
|
||||
const getFavoriteTrackNumber = (trk: FavoriteTrack, idx: number) => trk.track_number || idx + 1;
|
||||
const getFavoriteTrackTitle = (trk: FavoriteTrack) => trk.title;
|
||||
const getFavoriteTrackArtist = (trk: FavoriteTrack) => trk.performer?.name;
|
||||
const getFavoriteTrackDuration = (trk: FavoriteTrack) => trk.duration;
|
||||
const getFavoriteTrackAlbumKey = (trk: FavoriteTrack) => trk.album?.id;
|
||||
const getFavoriteTrackAlbum = (trk: FavoriteTrack) => trk.album?.title;
|
||||
const getFavoriteArtistId = (trk: FavoriteTrack) => trk.performer?.id;
|
||||
const getFavoriteAlbumId = (trk: FavoriteTrack) => trk.album?.id;
|
||||
|
||||
// VirtualizedTrackList requires this but we don't have disc info in favorites
|
||||
function buildFavoritesAlbumSections(tracks: FavoriteTrack[]) {
|
||||
@@ -1070,7 +1086,7 @@
|
||||
}
|
||||
|
||||
async function handleTrackClick(track: FavoriteTrack, index: number) {
|
||||
const trackIds = filteredTracks.map(t => t.id);
|
||||
const trackIds = filteredTracks.map(trk => trk.id);
|
||||
await setFavoritesContext(trackIds, index);
|
||||
|
||||
try {
|
||||
@@ -1089,7 +1105,7 @@
|
||||
|
||||
try {
|
||||
await setFavoritesQueue(0);
|
||||
await setFavoritesContext(filteredTracks.map(t => t.id), 0);
|
||||
await setFavoritesContext(filteredTracks.map(trk => trk.id), 0);
|
||||
onTrackPlay(buildDisplayTrack(filteredTracks[0], 0));
|
||||
} catch (err) {
|
||||
console.error('Failed to set queue:', err);
|
||||
@@ -1104,7 +1120,7 @@
|
||||
const shuffled = [...filteredTracks].sort(() => Math.random() - 0.5);
|
||||
const queueTracks = buildFavoritesQueueTracks(shuffled);
|
||||
await invoke('set_queue', { tracks: queueTracks, startIndex: 0 });
|
||||
await setFavoritesContext(shuffled.map(t => t.id), 0);
|
||||
await setFavoritesContext(shuffled.map(trk => trk.id), 0);
|
||||
onTrackPlay(buildDisplayTrack(shuffled[0], 0));
|
||||
} catch (err) {
|
||||
console.error('Failed to shuffle queue:', err);
|
||||
@@ -1136,7 +1152,18 @@
|
||||
</script>
|
||||
|
||||
<ViewTransition duration={200} distance={12} direction="down">
|
||||
<div class="favorites-view" class:no-outer-scroll={(activeTab === 'tracks' && !loading && filteredTracks.length > 0) || (activeTab === 'albums' && !loading && filteredAlbums.length > 0) || (activeTab === 'artists' && !loading && filteredArtists.length > 0)} bind:this={scrollContainer}>
|
||||
<div class="favorites-view" class:no-outer-scroll={(activeTab === 'tracks' && !loading && filteredTracks.length > 0) || (activeTab === 'albums' && !loading && filteredAlbums.length > 0) || (activeTab === 'artists' && !loading && filteredArtists.length > 0)} bind:this={scrollContainer} onscroll={handleFavoritesScroll}>
|
||||
<div class="top-bar">
|
||||
{#if onBack}
|
||||
<button class="back-btn" onclick={onBack}>
|
||||
<ArrowLeft size={16} />
|
||||
<span>{$t('actions.back')}</span>
|
||||
</button>
|
||||
{/if}
|
||||
<button class="edit-btn" onclick={() => editModalOpen = true} title={$t('favorites.editSettings')}>
|
||||
<Edit3 size={16} />
|
||||
</button>
|
||||
</div>
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div
|
||||
@@ -1200,9 +1227,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<button class="edit-btn" onclick={() => editModalOpen = true} title={$t('favorites.editSettings')}>
|
||||
<Edit3 size={16} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Navigation Bar (Artist-style) -->
|
||||
@@ -1531,8 +1555,8 @@
|
||||
getQualityBadge={getQualityLabel}
|
||||
buildAlbumSections={buildFavoritesAlbumSections}
|
||||
onTrackPlay={handleVirtualizedTrackPlay}
|
||||
onTrackPlayNext={onTrackPlayNext ? (t) => onTrackPlayNext(buildDisplayTrackFromFavorite(t)) : undefined}
|
||||
onTrackPlayLater={onTrackPlayLater ? (t) => onTrackPlayLater(buildDisplayTrackFromFavorite(t)) : undefined}
|
||||
onTrackPlayNext={onTrackPlayNext ? (trk) => onTrackPlayNext(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||
onTrackPlayLater={onTrackPlayLater ? (trk) => onTrackPlayLater(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||
onTrackAddToPlaylist={onTrackAddToPlaylist}
|
||||
getTrackId={getFavoriteTrackId}
|
||||
getTrackNumber={getFavoriteTrackNumber}
|
||||
@@ -1549,14 +1573,14 @@
|
||||
hideFavorite={false}
|
||||
isFavoriteOverride={true}
|
||||
getOfflineCacheStatus={getTrackOfflineCacheStatus}
|
||||
onDownload={onTrackDownload ? (t) => onTrackDownload(buildDisplayTrackFromFavorite(t)) : undefined}
|
||||
onDownload={onTrackDownload ? (trk) => onTrackDownload(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||
onRemoveDownload={onTrackRemoveDownload}
|
||||
onShareQobuz={onTrackShareQobuz}
|
||||
onShareSonglink={onTrackShareSonglink ? (t) => onTrackShareSonglink(buildDisplayTrackFromFavorite(t)) : undefined}
|
||||
onShareSonglink={onTrackShareSonglink ? (trk) => onTrackShareSonglink(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||
onGoToAlbum={onTrackGoToAlbum}
|
||||
onGoToArtist={onTrackGoToArtist}
|
||||
onShowInfo={onTrackShowInfo}
|
||||
onReDownload={onTrackReDownload ? (t) => onTrackReDownload(buildDisplayTrackFromFavorite(t)) : undefined}
|
||||
onReDownload={onTrackReDownload ? (trk) => onTrackReDownload(buildDisplayTrackFromFavorite(trk)) : undefined}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1711,6 +1735,8 @@
|
||||
artwork={getQobuzImage(album.image)}
|
||||
title={album.title}
|
||||
artist={album.artist.name}
|
||||
artistId={album.artist.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre?.name}
|
||||
releaseDate={album.release_date_original}
|
||||
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
|
||||
@@ -1763,6 +1789,8 @@
|
||||
artwork={getQobuzImage(album.image)}
|
||||
title={album.title}
|
||||
artist={album.artist.name}
|
||||
artistId={album.artist.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre?.name}
|
||||
releaseDate={album.release_date_original}
|
||||
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
|
||||
@@ -1815,6 +1843,8 @@
|
||||
artwork={getQobuzImage(album.image)}
|
||||
title={album.title}
|
||||
artist={album.artist.name}
|
||||
artistId={album.artist.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre?.name}
|
||||
releaseDate={album.release_date_original}
|
||||
quality={formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate)}
|
||||
@@ -1940,6 +1970,30 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
transition: color 150ms ease;
|
||||
}
|
||||
|
||||
.back-btn:hover {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Custom scrollbar */
|
||||
.favorites-view::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
@@ -1984,7 +2038,6 @@
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
margin-bottom: 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
@@ -2023,9 +2076,6 @@
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
@@ -2035,6 +2085,7 @@
|
||||
border: none;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
@@ -2517,6 +2568,7 @@
|
||||
.alpha-index {
|
||||
position: sticky;
|
||||
top: 120px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount, tick } from 'svelte';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { Music, User, Loader2 } from 'lucide-svelte';
|
||||
import {
|
||||
@@ -71,6 +71,7 @@
|
||||
artwork: string;
|
||||
title: string;
|
||||
artist: string;
|
||||
artistId?: number;
|
||||
genre: string;
|
||||
quality?: string;
|
||||
releaseDate?: string;
|
||||
@@ -554,6 +555,7 @@
|
||||
artwork: getQobuzImage(album.image),
|
||||
title: album.title,
|
||||
artist: album.artist?.name || 'Unknown Artist',
|
||||
artistId: album.artist?.id,
|
||||
genre: album.genre?.name || 'Unknown genre',
|
||||
quality: formatQuality(album.hires_streamable, album.maximum_bit_depth, album.maximum_sampling_rate),
|
||||
releaseDate: album.release_date_original
|
||||
@@ -745,10 +747,11 @@
|
||||
|
||||
// Start Qobuz API calls in parallel (don't await)
|
||||
if (isSectionVisible('newReleases')) {
|
||||
fetchFeaturedAlbums('new-releases', homeLimits.featuredAlbums, genreIds).then(albums => {
|
||||
fetchFeaturedAlbums('new-releases', homeLimits.featuredAlbums, genreIds).then(async (albums) => {
|
||||
newReleases = albums;
|
||||
loadingNewReleases = false;
|
||||
loadAllAlbumDownloadStatuses(albums);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(albums).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load newReleases:', err);
|
||||
loadingNewReleases = false;
|
||||
@@ -758,10 +761,11 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('pressAwards')) {
|
||||
fetchFeaturedAlbums('press-awards', homeLimits.featuredAlbums, genreIds).then(albums => {
|
||||
fetchFeaturedAlbums('press-awards', homeLimits.featuredAlbums, genreIds).then(async (albums) => {
|
||||
pressAwards = albums;
|
||||
loadingPressAwards = false;
|
||||
loadAllAlbumDownloadStatuses(albums);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(albums).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load pressAwards:', err);
|
||||
loadingPressAwards = false;
|
||||
@@ -771,10 +775,11 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('mostStreamed')) {
|
||||
fetchFeaturedAlbums('most-streamed', homeLimits.featuredAlbums, genreIds).then(albums => {
|
||||
fetchFeaturedAlbums('most-streamed', homeLimits.featuredAlbums, genreIds).then(async (albums) => {
|
||||
mostStreamed = albums;
|
||||
loadingMostStreamed = false;
|
||||
loadAllAlbumDownloadStatuses(albums);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(albums).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load mostStreamed:', err);
|
||||
loadingMostStreamed = false;
|
||||
@@ -784,10 +789,11 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('qobuzissimes')) {
|
||||
fetchFeaturedAlbums('qobuzissimes', homeLimits.featuredAlbums, genreIds).then(albums => {
|
||||
fetchFeaturedAlbums('qobuzissimes', homeLimits.featuredAlbums, genreIds).then(async (albums) => {
|
||||
qobuzissimes = albums;
|
||||
loadingQobuzissimes = false;
|
||||
loadAllAlbumDownloadStatuses(albums);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(albums).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load qobuzissimes:', err);
|
||||
loadingQobuzissimes = false;
|
||||
@@ -797,10 +803,11 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('editorPicks')) {
|
||||
fetchFeaturedAlbums('editor-picks', homeLimits.featuredAlbums, genreIds).then(albums => {
|
||||
fetchFeaturedAlbums('editor-picks', homeLimits.featuredAlbums, genreIds).then(async (albums) => {
|
||||
editorPicks = albums;
|
||||
loadingEditorPicks = false;
|
||||
loadAllAlbumDownloadStatuses(albums);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(albums).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load editorPicks:', err);
|
||||
loadingEditorPicks = false;
|
||||
@@ -841,11 +848,12 @@
|
||||
const recentAlbumIds = normalizeAlbumIds(seeds.recentlyPlayedAlbumIds);
|
||||
// Fetch more if filtering, to have enough after filter
|
||||
const fetchLimit = hasGenreFilter() ? homeLimits.recentAlbums * 3 : homeLimits.recentAlbums;
|
||||
fetchAlbums(recentAlbumIds.slice(0, fetchLimit)).then(albums => {
|
||||
fetchAlbums(recentAlbumIds.slice(0, fetchLimit)).then(async (albums) => {
|
||||
const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.recentAlbums);
|
||||
recentAlbums = filtered;
|
||||
loadingRecentAlbums = false;
|
||||
loadAllAlbumDownloadStatuses(filtered);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(filtered).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load recentAlbums:', err);
|
||||
loadingRecentAlbums = false;
|
||||
@@ -881,7 +889,8 @@
|
||||
const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.favoriteAlbums);
|
||||
favoriteAlbums = filtered;
|
||||
loadingFavoriteAlbums = false;
|
||||
loadAllAlbumDownloadStatuses(filtered);
|
||||
await tick();
|
||||
loadAllAlbumDownloadStatuses(filtered).catch(() => {});
|
||||
}).catch(err => {
|
||||
console.error('Failed to load favoriteAlbums:', err);
|
||||
loadingFavoriteAlbums = false;
|
||||
@@ -946,6 +955,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -987,6 +998,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -1028,6 +1041,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -1069,6 +1084,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -1110,6 +1127,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -1201,6 +1220,8 @@
|
||||
artwork={album.image?.large || album.image?.small || ''}
|
||||
title={album.title}
|
||||
artist={album.artists?.[0]?.name || 'Unknown Artist'}
|
||||
artistId={album.artists?.[0]?.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre?.name || ''}
|
||||
releaseDate={album.dates?.original}
|
||||
size="large"
|
||||
@@ -1246,6 +1267,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
@@ -1304,6 +1327,8 @@
|
||||
hideFavorite={trackBlacklisted}
|
||||
downloadStatus={cacheStatus.status}
|
||||
downloadProgress={cacheStatus.progress}
|
||||
onDownload={!trackBlacklisted && onTrackDownload ? () => onTrackDownload(track) : undefined}
|
||||
onRemoveDownload={isTrackDownloaded && onTrackRemoveDownload ? () => onTrackRemoveDownload(track.id) : undefined}
|
||||
onArtistClick={track.artistId && onArtistClick ? () => onArtistClick(track.artistId!) : undefined}
|
||||
onAlbumClick={track.albumId && onAlbumClick ? () => onAlbumClick(track.albumId!) : undefined}
|
||||
onPlay={trackBlacklisted ? undefined : () => handleContinueTrackPlay(track, index)}
|
||||
@@ -1390,6 +1415,8 @@
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.artist}
|
||||
artistId={album.artistId}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={album.genre}
|
||||
releaseDate={album.releaseDate}
|
||||
size="large"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
onReDownloadAlbum?: (albumId: string) => void;
|
||||
checkAlbumFullyDownloaded?: (albumId: string) => Promise<boolean>;
|
||||
downloadStateVersion?: number;
|
||||
onArtistClick?: (artistId: number) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -39,7 +40,8 @@
|
||||
onOpenAlbumFolder,
|
||||
onReDownloadAlbum,
|
||||
checkAlbumFullyDownloaded,
|
||||
downloadStateVersion
|
||||
downloadStateVersion,
|
||||
onArtistClick
|
||||
}: Props = $props();
|
||||
|
||||
// State
|
||||
@@ -277,6 +279,8 @@
|
||||
artwork={album.image?.large || album.image?.thumbnail || ''}
|
||||
title={album.title}
|
||||
artist={album.artist?.name || 'Unknown Artist'}
|
||||
artistId={album.artist?.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={getGenreLabel(album)}
|
||||
releaseDate={album.release_date_original}
|
||||
quality={getQualityLabel(album)}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
type OfflineStatus
|
||||
} from '$lib/stores/offlineStore';
|
||||
import { consumeContextTrackFocus, setPlaybackContext } from '$lib/stores/playbackContextStore';
|
||||
import { saveScrollPosition, getSavedScrollPosition } from '$lib/stores/navigationStore';
|
||||
import { isTrackUnavailable, clearTrackUnavailable, subscribe as subscribeUnavailable } from '$lib/stores/unavailableTracksStore';
|
||||
import { isBlacklisted as isArtistBlacklisted } from '$lib/stores/artistBlacklistStore';
|
||||
import { showToast } from '$lib/stores/toastStore';
|
||||
@@ -311,6 +312,14 @@
|
||||
unavailableVersion++;
|
||||
});
|
||||
|
||||
// Restore scroll position
|
||||
requestAnimationFrame(() => {
|
||||
const saved = getSavedScrollPosition('playlist');
|
||||
if (scrollContainer && saved > 0) {
|
||||
scrollContainer.scrollTop = saved;
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unsubscribeOffline();
|
||||
unsubscribeUnavailable();
|
||||
@@ -361,7 +370,7 @@
|
||||
}
|
||||
|
||||
try {
|
||||
const qobuzTrackIds = tracks.filter(t => !t.isLocal).map(t => t.id);
|
||||
const qobuzTrackIds = tracks.filter(trk => !trk.isLocal).map(trk => trk.id);
|
||||
if (qobuzTrackIds.length === 0) {
|
||||
tracksWithLocalCopies = new Set();
|
||||
return;
|
||||
@@ -427,7 +436,7 @@
|
||||
...track,
|
||||
playlist_position: pending.trackIds.length + idx // Local tracks come after Qobuz tracks
|
||||
}));
|
||||
localTracksMap = new Map(localTracks.map(t => [t.id, t]));
|
||||
localTracksMap = new Map(localTracks.map(trk => [trk.id, trk]));
|
||||
} else {
|
||||
localTracks = [];
|
||||
localTracksMap = new Map();
|
||||
@@ -436,7 +445,7 @@
|
||||
// Regular playlist - use existing command
|
||||
const result = await invoke<PlaylistLocalTrack[]>('playlist_get_local_tracks_with_position', { playlistId });
|
||||
localTracks = result;
|
||||
localTracksMap = new Map(result.map(t => [t.id, t]));
|
||||
localTracksMap = new Map(result.map(trk => [trk.id, trk]));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to load local tracks:', err);
|
||||
@@ -695,15 +704,15 @@
|
||||
const trackIds: [number, boolean][] = [];
|
||||
|
||||
// Add Qobuz tracks first (in original order)
|
||||
for (const t of allTracks) {
|
||||
if (!t.isLocal) {
|
||||
trackIds.push([t.id, false]);
|
||||
for (const trk of allTracks) {
|
||||
if (!trk.isLocal) {
|
||||
trackIds.push([trk.id, false]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add local tracks (by their position)
|
||||
for (const t of localTracksInPlaylist) {
|
||||
trackIds.push([t.id, true]);
|
||||
for (const trk of localTracksInPlaylist) {
|
||||
trackIds.push([trk.id, true]);
|
||||
}
|
||||
|
||||
// Save to backend
|
||||
@@ -871,9 +880,9 @@
|
||||
if (selectedIndices[0] === 0) return;
|
||||
|
||||
// Build new order: swap each selected with the one above
|
||||
const currentOrder = displayTracks.map(t => ({
|
||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
||||
isLocal: t.isLocal ?? false
|
||||
const currentOrder = displayTracks.map(trk => ({
|
||||
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||
isLocal: trk.isLocal ?? false
|
||||
}));
|
||||
|
||||
// Move from top to bottom to avoid conflicts
|
||||
@@ -914,9 +923,9 @@
|
||||
if (selectedIndices[0] === displayTracks.length - 1) return;
|
||||
|
||||
// Build new order: swap each selected with the one below
|
||||
const currentOrder = displayTracks.map(t => ({
|
||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
||||
isLocal: t.isLocal ?? false
|
||||
const currentOrder = displayTracks.map(trk => ({
|
||||
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||
isLocal: trk.isLocal ?? false
|
||||
}));
|
||||
|
||||
// Move from bottom to top to avoid conflicts
|
||||
@@ -1028,10 +1037,10 @@
|
||||
let filtered = result;
|
||||
if (searchQuery.trim()) {
|
||||
const query = searchQuery.toLowerCase();
|
||||
filtered = result.filter(t =>
|
||||
t.title.toLowerCase().includes(query) ||
|
||||
(t.artist?.toLowerCase().includes(query)) ||
|
||||
(t.album?.toLowerCase().includes(query))
|
||||
filtered = result.filter(trk =>
|
||||
trk.title.toLowerCase().includes(query) ||
|
||||
(trk.artist?.toLowerCase().includes(query)) ||
|
||||
(trk.album?.toLowerCase().includes(query))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1126,30 +1135,30 @@
|
||||
|
||||
function buildQueueTracks(tracks: DisplayTrack[]) {
|
||||
// Filter out blacklisted artists before building queue
|
||||
const filteredTracks = tracks.filter(t => {
|
||||
if (t.isLocal) return true; // Local tracks are never blacklisted
|
||||
if (!t.artistId) return true; // No artist ID, can't check blacklist
|
||||
return !isArtistBlacklisted(t.artistId);
|
||||
const filteredTracks = tracks.filter(trk => {
|
||||
if (trk.isLocal) return true; // Local tracks are never blacklisted
|
||||
if (!trk.artistId) return true; // No artist ID, can't check blacklist
|
||||
return !isArtistBlacklisted(trk.artistId);
|
||||
});
|
||||
|
||||
const queueTracks = filteredTracks.map(t => ({
|
||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
||||
title: t.title,
|
||||
artist: t.artist || 'Unknown Artist',
|
||||
album: t.album || playlist?.name || 'Playlist',
|
||||
duration_secs: t.durationSeconds,
|
||||
artwork_url: t.albumArt || getPlaylistImage(),
|
||||
hires: t.hires ?? false,
|
||||
bit_depth: t.bitDepth ?? null,
|
||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
||||
is_local: t.isLocal ?? false,
|
||||
album_id: t.isLocal ? null : (t.albumId || null),
|
||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
||||
const queueTracks = filteredTracks.map(trk => ({
|
||||
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||
title: trk.title,
|
||||
artist: trk.artist || 'Unknown Artist',
|
||||
album: trk.album || playlist?.name || 'Playlist',
|
||||
duration_secs: trk.durationSeconds,
|
||||
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||
hires: trk.hires ?? false,
|
||||
bit_depth: trk.bitDepth ?? null,
|
||||
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||
is_local: trk.isLocal ?? false,
|
||||
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||
}));
|
||||
|
||||
const localIds = filteredTracks
|
||||
.filter(t => t.isLocal)
|
||||
.map(t => Math.abs(t.id));
|
||||
.filter(trk => trk.isLocal)
|
||||
.map(trk => Math.abs(trk.id));
|
||||
|
||||
return { queueTracks, localIds };
|
||||
}
|
||||
@@ -1168,9 +1177,9 @@
|
||||
// Create playlist context before playing
|
||||
if (playlist) {
|
||||
const trackIds = displayTracks
|
||||
.filter(t => !t.isLocal) // Only Qobuz tracks in context
|
||||
.map(t => t.id);
|
||||
|
||||
.filter(trk => !trk.isLocal) // Only Qobuz tracks in context
|
||||
.map(trk => trk.id);
|
||||
|
||||
const contextIndex = trackIds.indexOf(track.id);
|
||||
|
||||
if (contextIndex >= 0 && trackIds.length > 0) {
|
||||
@@ -1279,7 +1288,7 @@
|
||||
|
||||
try {
|
||||
// Get the current position of the track being replaced
|
||||
const currentIndex = displayTracks.findIndex(t => t.id === trackToReplace!.id);
|
||||
const currentIndex = displayTracks.findIndex(trk => trk.id === trackToReplace!.id);
|
||||
|
||||
// Remove the old track
|
||||
await invoke('remove_tracks_from_playlist', {
|
||||
@@ -1407,10 +1416,10 @@
|
||||
if (allTracks.length === 0) return;
|
||||
|
||||
// Filter out blacklisted tracks
|
||||
const playableTracks = allTracks.filter(t => {
|
||||
if (t.isLocal) return true;
|
||||
if (!t.artistId) return true;
|
||||
return !isArtistBlacklisted(t.artistId);
|
||||
const playableTracks = allTracks.filter(trk => {
|
||||
if (trk.isLocal) return true;
|
||||
if (!trk.artistId) return true;
|
||||
return !isArtistBlacklisted(trk.artistId);
|
||||
});
|
||||
|
||||
if (playableTracks.length === 0) return;
|
||||
@@ -1418,8 +1427,8 @@
|
||||
// Set playback context for playlist
|
||||
if (playlist) {
|
||||
const trackIds = playableTracks
|
||||
.filter(t => !t.isLocal) // Only Qobuz tracks in context
|
||||
.map(t => t.id);
|
||||
.filter(trk => !trk.isLocal) // Only Qobuz tracks in context
|
||||
.map(trk => trk.id);
|
||||
|
||||
if (trackIds.length > 0) {
|
||||
await setPlaybackContext(
|
||||
@@ -1440,7 +1449,7 @@
|
||||
// Play first playable track (handle local vs Qobuz)
|
||||
const firstTrack = playableTracks[0];
|
||||
if (firstTrack.isLocal && onLocalTrackPlay) {
|
||||
const localTrack = localTracks.find(t => t.id === Math.abs(firstTrack.id));
|
||||
const localTrack = localTracks.find(trk => trk.id === Math.abs(firstTrack.id));
|
||||
if (localTrack) onLocalTrackPlay(localTrack);
|
||||
} else if (onTrackPlay) {
|
||||
onTrackPlay(firstTrack);
|
||||
@@ -1484,37 +1493,37 @@
|
||||
if (allTracks.length === 0) return;
|
||||
|
||||
// Filter out blacklisted tracks
|
||||
const playableTracks = allTracks.filter(t => {
|
||||
if (t.isLocal) return true;
|
||||
if (!t.artistId) return true;
|
||||
return !isArtistBlacklisted(t.artistId);
|
||||
const playableTracks = allTracks.filter(trk => {
|
||||
if (trk.isLocal) return true;
|
||||
if (!trk.artistId) return true;
|
||||
return !isArtistBlacklisted(trk.artistId);
|
||||
});
|
||||
|
||||
if (playableTracks.length === 0) return;
|
||||
|
||||
// Collect local track IDs to add to set
|
||||
const localIds = playableTracks
|
||||
.filter(t => t.isLocal)
|
||||
.map(t => Math.abs(t.id));
|
||||
.filter(trk => trk.isLocal)
|
||||
.map(trk => Math.abs(trk.id));
|
||||
|
||||
// Add in reverse order so first track ends up right after current
|
||||
for (let i = playableTracks.length - 1; i >= 0; i--) {
|
||||
const t = playableTracks[i];
|
||||
const trk = playableTracks[i];
|
||||
try {
|
||||
await invoke('add_to_queue_next', {
|
||||
track: {
|
||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
||||
title: t.title,
|
||||
artist: t.artist || 'Unknown Artist',
|
||||
album: t.album || playlist?.name || 'Playlist',
|
||||
duration_secs: t.durationSeconds,
|
||||
artwork_url: t.albumArt || getPlaylistImage(),
|
||||
hires: t.hires ?? false,
|
||||
bit_depth: t.bitDepth ?? null,
|
||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
||||
is_local: t.isLocal ?? false,
|
||||
album_id: t.isLocal ? null : (t.albumId || null),
|
||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
||||
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||
title: trk.title,
|
||||
artist: trk.artist || 'Unknown Artist',
|
||||
album: trk.album || playlist?.name || 'Playlist',
|
||||
duration_secs: trk.durationSeconds,
|
||||
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||
hires: trk.hires ?? false,
|
||||
bit_depth: trk.bitDepth ?? null,
|
||||
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||
is_local: trk.isLocal ?? false,
|
||||
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
@@ -1533,33 +1542,33 @@
|
||||
if (allTracks.length === 0) return;
|
||||
|
||||
// Filter out blacklisted tracks
|
||||
const playableTracks = allTracks.filter(t => {
|
||||
if (t.isLocal) return true;
|
||||
if (!t.artistId) return true;
|
||||
return !isArtistBlacklisted(t.artistId);
|
||||
const playableTracks = allTracks.filter(trk => {
|
||||
if (trk.isLocal) return true;
|
||||
if (!trk.artistId) return true;
|
||||
return !isArtistBlacklisted(trk.artistId);
|
||||
});
|
||||
|
||||
if (playableTracks.length === 0) return;
|
||||
|
||||
const queueTracks = playableTracks.map(t => ({
|
||||
id: t.isLocal ? Math.abs(t.id) : t.id,
|
||||
title: t.title,
|
||||
artist: t.artist || 'Unknown Artist',
|
||||
album: t.album || playlist?.name || 'Playlist',
|
||||
duration_secs: t.durationSeconds,
|
||||
artwork_url: t.albumArt || getPlaylistImage(),
|
||||
hires: t.hires ?? false,
|
||||
bit_depth: t.bitDepth ?? null,
|
||||
sample_rate: t.samplingRate != null ? (t.isLocal ? t.samplingRate * 1000 : t.samplingRate) : null,
|
||||
is_local: t.isLocal ?? false,
|
||||
album_id: t.isLocal ? null : (t.albumId || null),
|
||||
artist_id: t.isLocal ? null : (t.artistId ?? null),
|
||||
const queueTracks = playableTracks.map(trk => ({
|
||||
id: trk.isLocal ? Math.abs(trk.id) : trk.id,
|
||||
title: trk.title,
|
||||
artist: trk.artist || 'Unknown Artist',
|
||||
album: trk.album || playlist?.name || 'Playlist',
|
||||
duration_secs: trk.durationSeconds,
|
||||
artwork_url: trk.albumArt || getPlaylistImage(),
|
||||
hires: trk.hires ?? false,
|
||||
bit_depth: trk.bitDepth ?? null,
|
||||
sample_rate: trk.samplingRate != null ? (trk.isLocal ? trk.samplingRate * 1000 : trk.samplingRate) : null,
|
||||
is_local: trk.isLocal ?? false,
|
||||
album_id: trk.isLocal ? null : (trk.albumId || null),
|
||||
artist_id: trk.isLocal ? null : (trk.artistId ?? null),
|
||||
}));
|
||||
|
||||
// Collect local track IDs
|
||||
const localIds = playableTracks
|
||||
.filter(t => t.isLocal)
|
||||
.map(t => Math.abs(t.id));
|
||||
.filter(trk => trk.isLocal)
|
||||
.map(trk => Math.abs(trk.id));
|
||||
|
||||
try {
|
||||
await invoke('add_tracks_to_queue', { tracks: queueTracks });
|
||||
@@ -1581,7 +1590,7 @@
|
||||
</script>
|
||||
|
||||
<ViewTransition duration={200} distance={12} direction="down">
|
||||
<div class="playlist-detail" bind:this={scrollContainer}>
|
||||
<div class="playlist-detail" bind:this={scrollContainer} onscroll={(e) => saveScrollPosition('playlist', (e.target as HTMLElement).scrollTop)}>
|
||||
<!-- Navigation Row -->
|
||||
<div class="nav-row">
|
||||
<button class="back-btn" onclick={onBack}>
|
||||
@@ -1624,7 +1633,7 @@
|
||||
{:else}
|
||||
<div class="collage-wrapper">
|
||||
<PlaylistCollage
|
||||
artworks={tracks.slice(0, 4).map(t => t.albumArt).filter((a): a is string => !!a)}
|
||||
artworks={tracks.slice(0, 4).map(trk => trk.albumArt).filter((a): a is string => !!a)}
|
||||
size={200}
|
||||
/>
|
||||
<div class="artwork-overlay">
|
||||
@@ -1911,7 +1920,7 @@
|
||||
playlistId={playlistId}
|
||||
artists={playlistArtists}
|
||||
excludeTrackIds={excludeTrackIds}
|
||||
existingTracks={tracks.filter(t => !t.isLocal).map(t => ({ title: t.title, artist: t.artist }))}
|
||||
existingTracks={tracks.filter(trk => !trk.isLocal).map(trk => ({ title: trk.title, artist: trk.artist }))}
|
||||
onAddTrack={handleAddSuggestedTrack}
|
||||
onGoToAlbum={onTrackGoToAlbum}
|
||||
onGoToArtist={onTrackGoToArtist}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { getSearchState, setSearchState, subscribeSearchFocus, subscribeSearchQuery, setSearchQuery, type SearchResults, type SearchAllResults, type SearchTab, type SearchFilterType, type Playlist } from '$lib/stores/searchState';
|
||||
import { setPlaybackContext } from '$lib/stores/playbackContextStore';
|
||||
import { togglePlay } from '$lib/stores/playerStore';
|
||||
import { saveScrollPosition, getSavedScrollPosition } from '$lib/stores/navigationStore';
|
||||
import { t } from '$lib/i18n';
|
||||
|
||||
let searchInput: HTMLInputElement | null = null;
|
||||
@@ -30,6 +31,14 @@
|
||||
searchInput?.focus();
|
||||
calculateAlbumsPerPage();
|
||||
calculateArtistsPerPage();
|
||||
|
||||
// Restore scroll position
|
||||
requestAnimationFrame(() => {
|
||||
const saved = getSavedScrollPosition('search');
|
||||
if (scrollContainer && saved > 0) {
|
||||
scrollContainer.scrollTop = saved;
|
||||
}
|
||||
});
|
||||
window.addEventListener('resize', handleResize);
|
||||
|
||||
// Auto-search if query is pre-filled (e.g., from performer link)
|
||||
@@ -61,6 +70,7 @@
|
||||
function handleScroll(event: Event) {
|
||||
const target = event.target as HTMLDivElement;
|
||||
isScrolled = target.scrollTop > 60;
|
||||
saveScrollPosition('search', target.scrollTop);
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
@@ -470,8 +480,9 @@
|
||||
results.most_popular = allResults.most_popular;
|
||||
}
|
||||
allResults = results;
|
||||
await tick(); // Yield to UI loop — render results before background work
|
||||
if (allResults && allResults.albums.items) {
|
||||
await loadAllAlbumDownloadStatuses(allResults.albums.items);
|
||||
loadAllAlbumDownloadStatuses(allResults.albums.items); // fire-and-forget
|
||||
}
|
||||
} else if (activeTab === 'albums') {
|
||||
const results = await invoke<SearchResults<Album>>('search_albums', {
|
||||
@@ -483,8 +494,9 @@
|
||||
if (query.trim() !== searchQuery) return;
|
||||
albumResults = results;
|
||||
console.log('Album results:', albumResults);
|
||||
await tick(); // Yield to UI loop
|
||||
if (albumResults && albumResults.items) {
|
||||
await loadAllAlbumDownloadStatuses(albumResults.items);
|
||||
loadAllAlbumDownloadStatuses(albumResults.items); // fire-and-forget
|
||||
}
|
||||
} else if (activeTab === 'tracks') {
|
||||
const results = await invoke<SearchResults<Track>>('search_tracks', {
|
||||
@@ -545,12 +557,12 @@
|
||||
offset: newOffset,
|
||||
searchType: filterType
|
||||
});
|
||||
await loadAllAlbumDownloadStatuses(moreResults.items);
|
||||
albumResults = {
|
||||
...moreResults,
|
||||
items: [...albumResults.items, ...moreResults.items],
|
||||
offset: 0 // Keep offset at 0 since we're accumulating
|
||||
};
|
||||
loadAllAlbumDownloadStatuses(moreResults.items); // fire-and-forget
|
||||
} else if (activeTab === 'tracks' && trackResults && hasMoreTracks) {
|
||||
const newOffset = trackResults.offset + trackResults.items.length;
|
||||
const moreResults = await invoke<SearchResults<Track>>('search_tracks', {
|
||||
@@ -1576,6 +1588,8 @@
|
||||
artwork={getAlbumArtwork(album)}
|
||||
title={album.title}
|
||||
artist={album.artist?.name || 'Unknown Artist'}
|
||||
artistId={album.artist?.id}
|
||||
onArtistClick={onArtistClick}
|
||||
genre={getGenreLabel(album)}
|
||||
releaseDate={album.release_date_original}
|
||||
size="large"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import AlsaUtilsHelpModal from '../AlsaUtilsHelpModal.svelte';
|
||||
import DACSetupWizard from '../DACSetupWizard.svelte';
|
||||
import RemoteControlSetupGuide from '../RemoteControlSetupGuide.svelte';
|
||||
import LogsModal from '../LogsModal.svelte';
|
||||
import VolumeSlider from '../VolumeSlider.svelte';
|
||||
import UpdateCheckResultModal from '../updates/UpdateCheckResultModal.svelte';
|
||||
import WhatsNewModal from '../updates/WhatsNewModal.svelte';
|
||||
@@ -166,6 +167,11 @@
|
||||
let artworkCacheStats = $state<{ artwork_cache_bytes: number; thumbnails_cache_bytes: number; artwork_file_count: number; thumbnail_file_count: number } | null>(null);
|
||||
let isClearingAllCaches = $state(false);
|
||||
|
||||
// Reset & factory reset state
|
||||
let isResettingAudio = $state(false);
|
||||
let factoryResetConfirmed = $state(false);
|
||||
let isFactoryResetting = $state(false);
|
||||
|
||||
// Migration state
|
||||
let showMigrationModal = $state(false);
|
||||
let legacyTracksCount = $state(0);
|
||||
@@ -218,6 +224,9 @@
|
||||
// Collapsible sections state (closed by default)
|
||||
let offlineLibraryCollapsed = $state(true);
|
||||
let storageCollapsed = $state(true);
|
||||
let developerCollapsed = $state(true);
|
||||
let forceDmabuf = $state(false);
|
||||
let showLogsModal = $state(false);
|
||||
|
||||
// Navigation section IDs with translation keys
|
||||
const navSectionIds = [
|
||||
@@ -797,6 +806,11 @@
|
||||
// Check for legacy cached files
|
||||
checkLegacyCachedFiles();
|
||||
|
||||
// Load developer settings
|
||||
invoke('get_developer_settings').then((settings: any) => {
|
||||
forceDmabuf = settings.force_dmabuf;
|
||||
}).catch(() => {});
|
||||
|
||||
// Subscribe to offline state changes
|
||||
const unsubscribeOffline = subscribeOffline(() => {
|
||||
offlineStatus = getOfflineStatus();
|
||||
@@ -2103,6 +2117,71 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function handleResetAudioSettings() {
|
||||
if (isResettingAudio) return;
|
||||
const confirmed = await ask($t('settings.audio.resetConfirmDesc'), {
|
||||
title: $t('settings.audio.resetConfirmTitle'),
|
||||
kind: 'warning',
|
||||
});
|
||||
if (!confirmed) return;
|
||||
isResettingAudio = true;
|
||||
try {
|
||||
await invoke('stop_playback');
|
||||
await invoke('reset_audio_settings');
|
||||
await invoke('reinit_audio_device', { device: null });
|
||||
// Reset all audio UI state to defaults
|
||||
outputDevice = 'System Default';
|
||||
exclusiveMode = false;
|
||||
dacPassthrough = false;
|
||||
selectedBackend = 'Auto';
|
||||
selectedAlsaPlugin = 'hw (Direct Hardware)';
|
||||
alsaHardwareVolume = false;
|
||||
streamFirstTrack = false;
|
||||
streamBufferSeconds = 3;
|
||||
streamingOnly = false;
|
||||
limitQualityToDevice = false;
|
||||
// Reset playback UI state to defaults
|
||||
autoplayMode = 'continue';
|
||||
showContextIcon = false;
|
||||
gaplessPlayback = false;
|
||||
showToast($t('settings.audio.resetSuccess'), 'success');
|
||||
} catch (err) {
|
||||
console.error('Failed to reset audio settings:', err);
|
||||
showToast($t('settings.audio.resetError', { values: { error: String(err) } }), 'error');
|
||||
} finally {
|
||||
isResettingAudio = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFactoryReset() {
|
||||
if (isFactoryResetting) return;
|
||||
const confirmed = await ask($t('settings.storage.factoryResetFinalConfirm'), {
|
||||
title: $t('settings.storage.factoryResetTitle'),
|
||||
kind: 'warning',
|
||||
});
|
||||
if (!confirmed) return;
|
||||
isFactoryResetting = true;
|
||||
try {
|
||||
await invoke('factory_reset');
|
||||
onLogout?.();
|
||||
} catch (err) {
|
||||
console.error('Factory reset failed:', err);
|
||||
showToast($t('settings.storage.factoryResetError', { values: { error: String(err) } }), 'error');
|
||||
isFactoryResetting = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleForceDmabufChange(enabled: boolean) {
|
||||
try {
|
||||
await invoke('set_developer_force_dmabuf', { enabled });
|
||||
forceDmabuf = enabled;
|
||||
showToast($t('settings.developer.restartRequired'), 'info');
|
||||
} catch (err) {
|
||||
console.error('Failed to set force_dmabuf:', err);
|
||||
showToast(String(err), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
function formatBytes(bytes: number): string {
|
||||
if (bytes === 0) return '0 B';
|
||||
const k = 1024;
|
||||
@@ -2351,37 +2430,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.audio.streamUncached')}</span>
|
||||
<span class="setting-desc">{$t('settings.audio.streamUncachedDesc')}</span>
|
||||
</div>
|
||||
<Toggle enabled={streamFirstTrack} onchange={handleStreamFirstTrackChange} />
|
||||
</div>
|
||||
{#if streamFirstTrack}
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.audio.initialBuffer')}</span>
|
||||
<span class="setting-desc">{$t('settings.audio.initialBufferDesc', { values: { seconds: streamBufferSeconds } })}</span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="1"
|
||||
max="10"
|
||||
step="1"
|
||||
value={streamBufferSeconds}
|
||||
oninput={(e) => handleStreamBufferSecondsChange(parseInt(e.currentTarget.value))}
|
||||
class="buffer-slider"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.audio.streamingOnly')}</span>
|
||||
<span class="setting-desc">{$t('settings.audio.streamingOnlyDesc')}</span>
|
||||
</div>
|
||||
<Toggle enabled={streamingOnly} onchange={handleStreamingOnlyChange} />
|
||||
</div>
|
||||
<div class="setting-row last">
|
||||
<span class="setting-label">{$t('settings.audio.currentSampleRate')}</span>
|
||||
<span class="setting-value" class:muted={!hardwareStatus?.is_active}>
|
||||
{#if hardwareStatus?.is_active && hardwareStatus.hardware_sample_rate}
|
||||
@@ -2394,6 +2442,19 @@
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
<div class="setting-row last">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.audio.resetTitle')}</span>
|
||||
<span class="setting-desc">{$t('settings.audio.resetDesc')}</span>
|
||||
</div>
|
||||
<button
|
||||
class="reset-btn"
|
||||
onclick={handleResetAudioSettings}
|
||||
disabled={isResettingAudio}
|
||||
>
|
||||
{isResettingAudio ? $t('settings.storage.clearing') : $t('settings.audio.resetButton')}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Playback Section -->
|
||||
@@ -2406,7 +2467,7 @@
|
||||
</div>
|
||||
<Toggle enabled={autoplayMode === 'continue'} onchange={(enabled) => handleAutoplayModeChange(enabled ? 'continue' : 'track_only')} />
|
||||
</div>
|
||||
<div class="setting-row last">
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.playback.showContextIcon')}</span>
|
||||
<span class="setting-desc">{$t('settings.playback.showContextIconTooltip')}</span>
|
||||
@@ -2420,6 +2481,37 @@
|
||||
</div>
|
||||
<Toggle enabled={gaplessPlayback} onchange={handleGaplessPlaybackChange} disabled={gaplessDisabled} />
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.playback.streamUncached')}</span>
|
||||
<span class="setting-desc">{$t('settings.playback.streamUncachedDesc')}</span>
|
||||
</div>
|
||||
<Toggle enabled={streamFirstTrack} onchange={handleStreamFirstTrackChange} />
|
||||
</div>
|
||||
{#if streamFirstTrack}
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.playback.initialBuffer')}</span>
|
||||
<span class="setting-desc">{$t('settings.playback.initialBufferDesc', { values: { seconds: streamBufferSeconds } })}</span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
min="1"
|
||||
max="10"
|
||||
step="1"
|
||||
value={streamBufferSeconds}
|
||||
oninput={(e) => handleStreamBufferSecondsChange(parseInt(e.currentTarget.value))}
|
||||
class="buffer-slider"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="setting-row last">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.playback.streamingOnly')}</span>
|
||||
<span class="setting-desc">{$t('settings.playback.streamingOnlyDesc')}</span>
|
||||
</div>
|
||||
<Toggle enabled={streamingOnly} onchange={handleStreamingOnlyChange} />
|
||||
</div>
|
||||
<!-- Crossfade, Normalize Volume hidden until properly implemented (see issue #29) -->
|
||||
<!-- <div class="setting-row">
|
||||
<span class="setting-label">{$t('settings.playback.crossfade')}</span>
|
||||
@@ -3234,7 +3326,7 @@
|
||||
{isClearingArtwork ? $t('settings.storage.clearing') : $t('actions.clear')}
|
||||
</button>
|
||||
</div>
|
||||
<div class="setting-row last">
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">Clear All Caches</span>
|
||||
<small class="setting-note">
|
||||
@@ -3249,9 +3341,63 @@
|
||||
{isClearingAllCaches ? $t('settings.storage.clearing') : $t('actions.clearAll')}
|
||||
</button>
|
||||
</div>
|
||||
<div class="setting-row last">
|
||||
<div class="danger-zone">
|
||||
<div class="danger-zone-header">
|
||||
<span class="setting-label danger-label">{$t('settings.storage.factoryResetTitle')}</span>
|
||||
<span class="setting-desc">{$t('settings.storage.factoryResetDesc')}</span>
|
||||
</div>
|
||||
<div class="factory-reset-controls">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" bind:checked={factoryResetConfirmed} />
|
||||
<span>{$t('settings.storage.factoryResetCheckbox')}</span>
|
||||
</label>
|
||||
<button
|
||||
class="factory-reset-btn"
|
||||
onclick={handleFactoryReset}
|
||||
disabled={!factoryResetConfirmed || isFactoryResetting}
|
||||
>
|
||||
{isFactoryResetting ? $t('settings.storage.clearing') : $t('settings.storage.factoryResetButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<!-- Developer Mode Section (not in jump-nav, collapsed by default) -->
|
||||
<section class="section collapsible-section">
|
||||
<button class="section-title-btn" onclick={() => developerCollapsed = !developerCollapsed}>
|
||||
<h3 class="section-title">{$t('settings.developer.title')}</h3>
|
||||
<span class="section-summary">{$t('settings.developer.summary')}</span>
|
||||
{#if developerCollapsed}
|
||||
<ChevronDown size={16} />
|
||||
{:else}
|
||||
<ChevronUp size={16} />
|
||||
{/if}
|
||||
</button>
|
||||
{#if !developerCollapsed}
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.developer.forceDmabuf')}</span>
|
||||
<small class="setting-note">{$t('settings.developer.forceDmabufDesc')}</small>
|
||||
</div>
|
||||
<Toggle enabled={forceDmabuf} onchange={handleForceDmabufChange} />
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.developer.viewLogs')}</span>
|
||||
<small class="setting-note">{$t('settings.developer.viewLogsDesc')}</small>
|
||||
</div>
|
||||
<button class="clear-btn" onclick={() => showLogsModal = true}>
|
||||
{$t('settings.developer.viewLogs')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<LogsModal isOpen={showLogsModal} onClose={() => showLogsModal = false} />
|
||||
|
||||
<!-- Flatpak Section (only shown when running in Flatpak) -->
|
||||
<!-- NOTE: Keep this section LAST. If adding new settings sections, add them BEFORE this one. -->
|
||||
{#if isFlatpak}
|
||||
@@ -3926,6 +4072,93 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz</pre>
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--text-muted);
|
||||
background: none;
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background-color 150ms ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.reset-btn:hover:not(:disabled) {
|
||||
background-color: rgba(255, 107, 107, 0.1);
|
||||
border-color: #ff6b6b;
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
.reset-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.danger-zone {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(255, 107, 107, 0.3);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
background: rgba(255, 107, 107, 0.05);
|
||||
}
|
||||
|
||||
.danger-zone-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.danger-label {
|
||||
color: #ff6b6b;
|
||||
}
|
||||
|
||||
.factory-reset-controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"] {
|
||||
margin-top: 2px;
|
||||
flex-shrink: 0;
|
||||
accent-color: #ff6b6b;
|
||||
}
|
||||
|
||||
.factory-reset-btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #ff6b6b;
|
||||
background: rgba(255, 107, 107, 0.1);
|
||||
color: #ff6b6b;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background-color 150ms ease;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.factory-reset-btn:hover:not(:disabled) {
|
||||
background-color: rgba(255, 107, 107, 0.2);
|
||||
}
|
||||
|
||||
.factory-reset-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Harmonize button widths across settings rows */
|
||||
.connect-btn,
|
||||
.clear-btn {
|
||||
|
||||
Reference in new issue
Block a user