Files
akai-utils/web/ui/style.css
T
david cf53912a33 feat: Audio Preview Player — browse and play WAV samples via Web Audio API
Issue: #9

Backend:
- GET /api/list-wavs?dir=<path> — lists .wav files in a directory
- GET /wavs/<file> — static file serving from ./output/wavs

Web UI:
- WAV Browser section with path input + Browse button
- AudioContext-based playback (zero deps) — progress bar, time display
- WAV file grid with Play buttons, active item highlighting

Tests:
- 3 new tests for handleListWavs (wav files, empty dir, nonexistent dir)
- Fix TestFindAkaiutil: add t.Chdir(tmp) so relative path lookups don't
  accidentally find the repo's third_party/akaiutil/akaiutil binary
2026-06-22 00:01:15 -07:00

313 lines
5.5 KiB
CSS

:root {
--bg: #1a1a2e;
--bg2: #16213e;
--bg3: #0f3460;
--text: #e0e0e0;
--text2: #a0a0b0;
--accent: #e94560;
--accent2: #533483;
--green: #4ecca3;
--yellow: #f0c040;
--radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.5;
min-height: 100vh;
}
#app {
max-width: 1100px;
margin: 0 auto;
padding: 20px;
}
header {
text-align: center;
padding: 30px 0 20px;
border-bottom: 1px solid var(--bg3);
margin-bottom: 24px;
}
header h1 {
font-size: 28px;
color: var(--accent);
letter-spacing: 1px;
}
header .subtitle {
color: var(--text2);
font-size: 14px;
}
section {
background: var(--bg2);
border-radius: var(--radius);
padding: 20px;
margin-bottom: 20px;
}
h2 {
font-size: 16px;
color: var(--text2);
margin-bottom: 12px;
text-transform: uppercase;
letter-spacing: 1px;
}
.search-bar {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.search-bar input {
flex: 1;
min-width: 200px;
padding: 10px 14px;
border: 1px solid var(--bg3);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font-size: 14px;
}
.search-bar input:focus {
outline: none;
border-color: var(--accent);
}
.search-bar button {
padding: 10px 20px;
border: none;
border-radius: var(--radius);
background: var(--accent);
color: white;
font-size: 14px;
cursor: pointer;
white-space: nowrap;
}
.search-bar button:hover { opacity: 0.9; }
#search-dl-all {
background: var(--green);
color: #111;
}
#search-status {
margin-top: 10px;
color: var(--text2);
font-size: 13px;
}
#search-results {
margin-top: 16px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 10px;
}
.result-card {
background: var(--bg);
border: 1px solid var(--bg3);
border-radius: var(--radius);
padding: 14px;
display: flex;
flex-direction: column;
gap: 8px;
}
.result-card .title {
font-weight: 600;
font-size: 14px;
word-break: break-word;
}
.result-card .meta {
font-size: 12px;
color: var(--text2);
display: flex;
justify-content: space-between;
}
.result-card .actions {
display: flex;
gap: 6px;
}
.result-card button {
flex: 1;
padding: 6px 12px;
border: none;
border-radius: 4px;
font-size: 12px;
cursor: pointer;
}
.btn-dl { background: var(--accent); color: white; }
.btn-list { background: var(--bg3); color: var(--text); }
.btn-dl:hover, .btn-list:hover { opacity: 0.85; }
.dl-item {
background: var(--bg);
border: 1px solid var(--bg3);
border-radius: var(--radius);
padding: 12px;
margin-bottom: 8px;
}
.dl-item .dl-name {
font-size: 13px;
font-weight: 600;
margin-bottom: 6px;
word-break: break-all;
}
.dl-item .dl-bar {
height: 6px;
background: var(--bg3);
border-radius: 3px;
overflow: hidden;
margin-bottom: 4px;
}
.dl-item .dl-bar-fill {
height: 100%;
background: var(--accent);
border-radius: 3px;
transition: width 0.3s;
}
.dl-item .dl-bar-fill.done { background: var(--green); }
.dl-item .dl-bar-fill.error { background: var(--yellow); }
.dl-item .dl-info {
font-size: 11px;
color: var(--text2);
display: flex;
justify-content: space-between;
}
.extract-controls {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.extract-controls input {
flex: 1;
min-width: 150px;
padding: 10px 14px;
border: 1px solid var(--bg3);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font-size: 14px;
}
.extract-controls button {
padding: 10px 20px;
border: none;
border-radius: var(--radius);
background: var(--accent2);
color: white;
font-size: 14px;
cursor: pointer;
}
#extract-status {
margin-top: 10px;
font-size: 13px;
color: var(--text2);
}
.wav-controls {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.wav-controls input {
flex: 1;
min-width: 200px;
padding: 10px 14px;
border: 1px solid var(--bg3);
border-radius: var(--radius);
background: var(--bg);
color: var(--text);
font-size: 14px;
}
.wav-controls button {
padding: 10px 20px;
border: none;
border-radius: var(--radius);
background: var(--accent);
color: white;
font-size: 14px;
cursor: pointer;
}
.wav-player {
margin-top: 14px;
}
.now-playing {
font-size: 13px;
color: var(--green);
margin-bottom: 6px;
min-height: 18px;
}
.audio-bar {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.audio-progress {
flex: 1;
height: 6px;
background: var(--bg3);
border-radius: 3px;
overflow: hidden;
}
.audio-progress-fill {
height: 100%;
background: var(--green);
border-radius: 3px;
width: 0%;
transition: width 0.1s;
}
#wav-time {
font-size: 12px;
color: var(--text2);
min-width: 40px;
}
.wav-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 8px;
}
.wav-item {
background: var(--bg);
border: 1px solid var(--bg3);
border-radius: var(--radius);
padding: 10px 12px;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
.wav-item:hover {
border-color: var(--accent);
}
.wav-item.playing {
border-color: var(--green);
background: rgba(78, 204, 163, 0.1);
}
.wav-item .wav-name {
flex: 1;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wav-item .wav-play-btn {
background: var(--accent2);
color: white;
border: none;
border-radius: 4px;
padding: 4px 10px;
font-size: 11px;
cursor: pointer;
}