refactor(ui): move Discogs results into artwork panel
cx
This commit is contained in:
1 parent
9dc0a87740
commit
4d139f78a0
1 file changed
+144
-78
@@ -3175,89 +3175,102 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Album Artwork</label>
|
||||
<div class="artwork-row">
|
||||
{#if selectedAlbum.artwork_path}
|
||||
<img
|
||||
src={getArtworkUrl(selectedAlbum.artwork_path)}
|
||||
alt="Current artwork"
|
||||
class="artwork-preview"
|
||||
/>
|
||||
{:else}
|
||||
<div class="artwork-preview artwork-placeholder-mini">
|
||||
<Disc3 size={24} />
|
||||
<div class="artwork-layout">
|
||||
<div class="artwork-left">
|
||||
<div class="artwork-row">
|
||||
{#if selectedAlbum.artwork_path}
|
||||
<img
|
||||
src={getArtworkUrl(selectedAlbum.artwork_path)}
|
||||
alt="Current artwork"
|
||||
class="artwork-preview"
|
||||
/>
|
||||
{:else}
|
||||
<div class="artwork-preview artwork-placeholder-mini">
|
||||
<Disc3 size={24} />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="artwork-actions">
|
||||
<button
|
||||
class="discogs-btn"
|
||||
onclick={handleSetAlbumArtwork}
|
||||
disabled={updatingArtwork}
|
||||
>
|
||||
<Upload size={14} />
|
||||
<span>{updatingArtwork ? 'Updating...' : 'Change Cover'}</span>
|
||||
</button>
|
||||
<button
|
||||
class="discogs-btn"
|
||||
onclick={fetchDiscogsArtwork}
|
||||
disabled={fetchingDiscogsImages}
|
||||
>
|
||||
<img src="/discogs_icon.svg" alt="Discogs" class="discogs-icon" />
|
||||
<span>{fetchingDiscogsImages ? 'Fetching...' : 'Fetch from Discogs'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="artwork-actions">
|
||||
<button
|
||||
class="discogs-btn"
|
||||
onclick={handleSetAlbumArtwork}
|
||||
disabled={updatingArtwork}
|
||||
>
|
||||
<Upload size={14} />
|
||||
<span>{updatingArtwork ? 'Updating...' : 'Change Cover'}</span>
|
||||
</button>
|
||||
<button
|
||||
class="discogs-btn"
|
||||
onclick={fetchDiscogsArtwork}
|
||||
disabled={fetchingDiscogsImages}
|
||||
>
|
||||
<img src="/discogs_icon.svg" alt="Discogs" class="discogs-icon" />
|
||||
<span>{fetchingDiscogsImages ? 'Fetching...' : 'Fetch from Discogs'}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="discogs-panel">
|
||||
<div class="discogs-header">
|
||||
<div class="discogs-title">Select Artwork from Discogs</div>
|
||||
{#if discogsImageOptions.length > IMAGES_PER_PAGE}
|
||||
<div class="carousel-controls">
|
||||
<button
|
||||
class="carousel-btn"
|
||||
onclick={prevDiscogsPage}
|
||||
disabled={!hasPrevDiscogsPages}
|
||||
title="Previous"
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
<span class="page-indicator">
|
||||
{discogsImagePage + 1} / {Math.ceil(discogsImageOptions.length / IMAGES_PER_PAGE)}
|
||||
</span>
|
||||
<button
|
||||
class="carousel-btn"
|
||||
onclick={nextDiscogsPage}
|
||||
disabled={!hasMoreDiscogsPages}
|
||||
title="Next"
|
||||
>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if discogsImageOptions.length === 0}
|
||||
<div class="discogs-placeholder">
|
||||
{#if fetchingDiscogsImages}
|
||||
<span>Fetching...</span>
|
||||
{:else}
|
||||
<span>Click “Fetch from Discogs” to show results here.</span>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="discogs-options discogs-options-compact">
|
||||
{#each paginatedDiscogsImages as option, i}
|
||||
<button
|
||||
class="discogs-option"
|
||||
class:selected={selectedDiscogsImage === option.url}
|
||||
onclick={() => selectedDiscogsImage = option.url}
|
||||
title={option.release_title ? `${option.release_title}${option.release_year ? ` (${option.release_year})` : ''}` : ''}
|
||||
>
|
||||
<img src={option.url} alt={`Option ${discogsImagePage * IMAGES_PER_PAGE + i + 1}`} />
|
||||
<div class="option-info">
|
||||
{#if option.release_title}
|
||||
<div class="release-title">{option.release_title}{#if option.release_year} ({option.release_year}){/if}</div>
|
||||
{/if}
|
||||
<div class="image-dims">{option.width}x{option.height}</div>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<p class="form-hint discogs-hint">Click a cover to select it, then Save.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if discogsImageOptions.length > 0}
|
||||
<div class="form-group">
|
||||
<div class="discogs-header">
|
||||
<label>Select Artwork from Discogs</label>
|
||||
{#if discogsImageOptions.length > IMAGES_PER_PAGE}
|
||||
<div class="carousel-controls">
|
||||
<button
|
||||
class="carousel-btn"
|
||||
onclick={prevDiscogsPage}
|
||||
disabled={!hasPrevDiscogsPages}
|
||||
title="Previous"
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
<span class="page-indicator">
|
||||
{discogsImagePage + 1} / {Math.ceil(discogsImageOptions.length / IMAGES_PER_PAGE)}
|
||||
</span>
|
||||
<button
|
||||
class="carousel-btn"
|
||||
onclick={nextDiscogsPage}
|
||||
disabled={!hasMoreDiscogsPages}
|
||||
title="Next"
|
||||
>
|
||||
<ChevronRight size={16} />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="discogs-options">
|
||||
{#each paginatedDiscogsImages as option, i}
|
||||
<button
|
||||
class="discogs-option"
|
||||
class:selected={selectedDiscogsImage === option.url}
|
||||
onclick={() => selectedDiscogsImage = option.url}
|
||||
title={option.release_title ? `${option.release_title}${option.release_year ? ` (${option.release_year})` : ''}` : ''}
|
||||
>
|
||||
<img src={option.url} alt={`Option ${discogsImagePage * IMAGES_PER_PAGE + i + 1}`} />
|
||||
<div class="option-info">
|
||||
{#if option.release_title}
|
||||
<div class="release-title">{option.release_title}{#if option.release_year} ({option.release_year}){/if}</div>
|
||||
{/if}
|
||||
<div class="image-dims">{option.width}x{option.height}</div>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="form-hint">Click an image to select it, then click Save</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
@@ -5140,6 +5153,46 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.artwork-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.discogs-panel {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
border-radius: 10px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-secondary);
|
||||
height: 208px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.discogs-title {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.discogs-placeholder {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.discogs-hint {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.artwork-preview {
|
||||
width: 74px;
|
||||
height: 74px;
|
||||
@@ -5199,6 +5252,19 @@
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.discogs-options-compact {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
grid-auto-rows: 70px;
|
||||
gap: 10px;
|
||||
margin-top: 0;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.discogs-panel .discogs-option:hover {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.discogs-option {
|
||||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
|
||||
Reference in new issue
Block a user