feat: collapsible section and libraries, compact card layout
- Sample Library section now collapsible via header click - Library cards collapsible via header click (toggle icon ▾) - Collapse All button to batch-collapse all libraries - Compact sample cards: 28px height, 10px font, 70px min grid column - Tighter spacing throughout (8px lib gap, 4px sample grid gap) - Play icon removed from cards (card itself is clickable)
This commit was merged in pull request #15.
This commit is contained in:
+16
-3
@@ -204,7 +204,6 @@ function renderSampleCards(samples) {
|
||||
return samples.map(s => `
|
||||
<div class="sample-card" data-action="play" data-wav="${esc(s.fullPath)}">
|
||||
<span class="sample-name" title="${esc(s.name)}">${esc(s.name)}</span>
|
||||
<span class="sample-play-icon">▶</span>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
@@ -234,8 +233,8 @@ function renderLibraries(libs) {
|
||||
const sampleCount = Object.values(programs).reduce((sum, s) => sum + s.length, 0);
|
||||
return `
|
||||
<div class="library-card">
|
||||
<div class="library-header">
|
||||
<h3>${esc(cleanName(lib))}</h3>
|
||||
<div class="library-header" onclick="this.parentNode.classList.toggle('collapsed')">
|
||||
<h3>${esc(cleanName(lib))}<span class="lib-toggle">▾</span></h3>
|
||||
<span class="lib-meta">${progCount} programs · ${sampleCount} samples</span>
|
||||
</div>
|
||||
<div class="library-programs">
|
||||
@@ -383,3 +382,17 @@ document.addEventListener('click', function(e) {
|
||||
playWav(btn.dataset.wav);
|
||||
}
|
||||
});
|
||||
|
||||
// Section collapse toggle
|
||||
document.querySelectorAll('.section-toggle').forEach(h => {
|
||||
h.addEventListener('click', function () {
|
||||
this.classList.toggle('collapsed');
|
||||
const target = document.getElementById(this.dataset.section);
|
||||
target.style.display = target.style.display === 'none' ? '' : 'none';
|
||||
});
|
||||
});
|
||||
|
||||
// Collapse all libraries
|
||||
document.getElementById('wav-collapse-all').addEventListener('click', function () {
|
||||
document.querySelectorAll('.library-card').forEach(c => c.classList.add('collapsed'));
|
||||
});
|
||||
|
||||
+7
-2
@@ -40,13 +40,17 @@
|
||||
</section>
|
||||
|
||||
<section id="wav-section">
|
||||
<h2>Sample Library</h2>
|
||||
<h2 class="section-toggle" data-section="wav-body">Sample Library <span class="toggle-icon">▾</span></h2>
|
||||
<div id="wav-body">
|
||||
<div class="wav-controls">
|
||||
<input type="text" id="wav-dir" placeholder="WAV directory" value="./output/wavs">
|
||||
<button id="wav-browse-btn">Browse</button>
|
||||
</div>
|
||||
<div id="wav-results" style="display:none">
|
||||
<div id="wav-summary" class="wav-summary"></div>
|
||||
<div class="wav-summary-row">
|
||||
<div id="wav-summary" class="wav-summary"></div>
|
||||
<button id="wav-collapse-all" class="collapse-all-btn">Collapse All</button>
|
||||
</div>
|
||||
<div id="wav-player" class="wav-player" style="display:none">
|
||||
<div id="wav-now-playing" class="now-playing"></div>
|
||||
<div class="audio-bar">
|
||||
@@ -56,6 +60,7 @@
|
||||
</div>
|
||||
<div id="wav-list" class="wav-library"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="results-section">
|
||||
|
||||
+79
-24
@@ -50,6 +50,23 @@ section {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Section collapse toggle */
|
||||
.section-toggle {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.toggle-icon {
|
||||
font-size: 12px;
|
||||
transition: transform 0.2s;
|
||||
display: inline-block;
|
||||
}
|
||||
.section-toggle.collapsed .toggle-icon {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
color: var(--text2);
|
||||
@@ -298,52 +315,59 @@ h2 {
|
||||
border: 1px solid var(--bg3);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.library-header {
|
||||
padding: 14px 18px;
|
||||
padding: 10px 16px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
background: var(--bg);
|
||||
border-bottom: 1px solid transparent;
|
||||
border-bottom: 1px solid var(--bg3);
|
||||
transition: border-color 0.15s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.library-header:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.library-header h3 {
|
||||
font-size: 15px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
margin: 0;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
.library-header .lib-meta {
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
color: var(--text2);
|
||||
margin-top: 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.library-programs {
|
||||
padding: 10px 18px 16px;
|
||||
padding: 8px 16px 12px;
|
||||
}
|
||||
|
||||
/* Program cards */
|
||||
.program-card {
|
||||
margin-top: 14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.program-card:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.program-header {
|
||||
cursor: pointer;
|
||||
cursor: default;
|
||||
user-select: none;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.program-header h4 {
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--accent);
|
||||
margin: 0;
|
||||
@@ -352,30 +376,28 @@ h2 {
|
||||
display: inline;
|
||||
}
|
||||
.program-header .prog-meta {
|
||||
font-size: 11px;
|
||||
font-size: 10px;
|
||||
color: var(--text2);
|
||||
margin-left: 8px;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.program-samples {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||
gap: 6px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
/* Sample cards */
|
||||
.sample-card {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--bg3);
|
||||
border-radius: var(--radius);
|
||||
padding: 8px 10px;
|
||||
border-radius: 4px;
|
||||
padding: 4px 8px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
min-height: 64px;
|
||||
min-height: 28px;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
}
|
||||
.sample-card:hover {
|
||||
@@ -383,10 +405,10 @@ h2 {
|
||||
}
|
||||
.sample-card.playing {
|
||||
border-color: var(--green);
|
||||
background: rgba(78, 204, 163, 0.1);
|
||||
background: rgba(78, 204, 163, 0.15);
|
||||
}
|
||||
.sample-card .sample-name {
|
||||
font-size: 11px;
|
||||
font-size: 10px;
|
||||
color: var(--text);
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
@@ -395,7 +417,40 @@ h2 {
|
||||
max-width: 100%;
|
||||
}
|
||||
.sample-card .sample-play-icon {
|
||||
font-size: 14px;
|
||||
color: var(--accent2);
|
||||
line-height: 1;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Collapse all button */
|
||||
.wav-summary-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
.collapse-all-btn {
|
||||
background: var(--bg3);
|
||||
color: var(--text2);
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 4px 10px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.collapse-all-btn:hover {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* Library collapse state */
|
||||
.library-card.collapsed .library-programs {
|
||||
display: none;
|
||||
}
|
||||
.library-header .lib-toggle {
|
||||
font-size: 11px;
|
||||
transition: transform 0.2s;
|
||||
margin-left: 8px;
|
||||
color: var(--text2);
|
||||
}
|
||||
.library-card.collapsed .lib-toggle {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
Reference in New Issue
Block a user