fix(frontend): reposition search indicator into toolbar and fix album cover art lookup
Move search indicator from absolute-positioned overlay into sort toolbar (or dedicated search-bar-row for artists/genres views). Shows indicator on empty-state screens. Fix cover art not displaying for expanded album tracks by checking expandedAlbumId before the albumName guard. Add ScanWarning model bindings.
This commit is contained in:
@@ -313,10 +313,12 @@ export class AlbumSelectionManager {
|
||||
albumName: string,
|
||||
expandedAlbumId: number | null,
|
||||
): CoverArtUrls | null {
|
||||
if (!albumName) return null;
|
||||
|
||||
// Prefer the expanded album (we know the track
|
||||
// belongs to it) for an O(1) lookup.
|
||||
// belongs to it) for an O(1) lookup. This must
|
||||
// run before the albumName guard because
|
||||
// GetAlbumTracks returns tracks without an Album
|
||||
// field, so albumName may be empty even when the
|
||||
// album ID is known.
|
||||
if (expandedAlbumId !== null) {
|
||||
const album = this.albumById.get(
|
||||
expandedAlbumId,
|
||||
@@ -333,6 +335,8 @@ export class AlbumSelectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (!albumName) return null;
|
||||
|
||||
// Fallback: name-based search across all albums.
|
||||
for (const album of this.albumById.values()) {
|
||||
if (
|
||||
|
||||
@@ -243,17 +243,19 @@ const gridStyles = css`
|
||||
color: var(--yj-text-secondary, #b3b3b3);
|
||||
}
|
||||
|
||||
.sort-toolbar {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.search-indicator {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 5;
|
||||
pointer-events: none;
|
||||
background: var(--yj-bg-overlay, #495057);
|
||||
color: var(--yj-text-secondary, #b3b3b3);
|
||||
font-size: var(--yj-text-sm);
|
||||
padding: 4px 14px;
|
||||
padding: 2px 14px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid
|
||||
var(--yj-border-subtle, #555);
|
||||
|
||||
@@ -1613,6 +1613,12 @@ export class CoverGrid
|
||||
name=${dirIcon}
|
||||
></wa-icon>
|
||||
</button>
|
||||
${this.searchCtrl.term
|
||||
? html`<div class="search-indicator">
|
||||
Showing results for
|
||||
“${this.searchCtrl.term}”
|
||||
</div>`
|
||||
: nothing}
|
||||
</div>
|
||||
${this.renderSortDropdownPopup()}
|
||||
`;
|
||||
@@ -1812,6 +1818,7 @@ export class CoverGrid
|
||||
|
||||
if (this.cachedFilteredAlbums.length === 0) {
|
||||
return html`
|
||||
${this.renderSortToolbar()}
|
||||
<div class="empty-state">
|
||||
<p>No albums match your search.</p>
|
||||
</div>
|
||||
@@ -1824,12 +1831,6 @@ export class CoverGrid
|
||||
|
||||
return html`
|
||||
${this.renderSortToolbar()}
|
||||
${this.searchCtrl.term
|
||||
? html`<div class="search-indicator">
|
||||
Showing results for
|
||||
“${this.searchCtrl.term}”
|
||||
</div>`
|
||||
: nothing}
|
||||
<div
|
||||
class="grid-scroll-container"
|
||||
@click=${this.onGridClick}
|
||||
|
||||
Reference in New Issue
Block a user