add web UI: search, download queue with progress, cancel
- ui/index.html, ui/styles.css, ui/scripts.js — minimal two-tab UI - Search tab: big search bar, results with size/votes, add-to-queue button - Queue tab: progress bar, speed, downloaded/total, status badges, cancel - Switches to queue tab on load if downloads are active - Backend: GET /api/search, POST /api/queue/add, GET /api/queue, POST /api/queue/cancel - Speed tracking in streamToFile, abort tracking for immediate cancel - No rounded corners, dark theme
This commit is contained in:
262
ui/styles.css
Normal file
262
ui/styles.css
Normal file
@@ -0,0 +1,262 @@
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:root {
|
||||
--bg: #0d1117;
|
||||
--surface: #161b22;
|
||||
--surface-hover: #1c2333;
|
||||
--border: #30363d;
|
||||
--text: #e6edf3;
|
||||
--text-dim: #8b949e;
|
||||
--accent: #58a6ff;
|
||||
--accent-hover: #79b8ff;
|
||||
--green: #3fb950;
|
||||
--orange: #d29922;
|
||||
--red: #f85149;
|
||||
--radius: 0px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
max-width: 860px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px 80px;
|
||||
}
|
||||
|
||||
/* ── Tabs ─────────────────────────────────────────────── */
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.tab {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-dim);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
transition: color 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.tab:hover { color: var(--text); }
|
||||
|
||||
.tab.active {
|
||||
color: var(--accent);
|
||||
border-bottom-color: var(--accent);
|
||||
}
|
||||
|
||||
.tab-content { display: none; }
|
||||
.tab-content.active { display: block; }
|
||||
|
||||
/* ── Search bar ───────────────────────────────────────── */
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.search-bar input {
|
||||
flex: 1;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text);
|
||||
font-size: 16px;
|
||||
padding: 12px 16px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
|
||||
.search-bar input:focus { border-color: var(--accent); }
|
||||
.search-bar input::placeholder { color: var(--text-dim); }
|
||||
|
||||
.search-bar button {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding: 0 20px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.search-bar button:hover { background: var(--accent-hover); }
|
||||
|
||||
/* ── Result items ─────────────────────────────────────── */
|
||||
|
||||
.results { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.result-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 12px 16px;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
|
||||
.result-item:hover { border-color: var(--text-dim); }
|
||||
|
||||
.result-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.result-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.result-meta {
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.result-item button {
|
||||
background: var(--green);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 6px 14px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.result-item button:hover { filter: brightness(1.15); }
|
||||
|
||||
.result-item button.added {
|
||||
background: var(--text-dim);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* ── Queue items ──────────────────────────────────────── */
|
||||
|
||||
.queue-item {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.queue-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.queue-name .badge { flex-shrink: 0; }
|
||||
|
||||
.queue-name > span:last-child {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
background: var(--red);
|
||||
color: #fff;
|
||||
border: none;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 4px 10px;
|
||||
cursor: pointer;
|
||||
transition: filter 0.15s;
|
||||
}
|
||||
|
||||
.cancel-btn:hover { filter: brightness(1.2); }
|
||||
.cancel-btn:disabled { opacity: 0.5; cursor: default; }
|
||||
|
||||
.queue-stats {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.queue-speed {
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
/* ── Progress bar ─────────────────────────────────────── */
|
||||
|
||||
.progress-bar {
|
||||
height: 6px;
|
||||
background: var(--border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
transition: width 0.5s ease;
|
||||
}
|
||||
|
||||
.progress-fill.done { background: var(--green); }
|
||||
.progress-fill.error { background: var(--red); }
|
||||
.progress-fill.queued { background: var(--orange); }
|
||||
|
||||
/* ── Status badges ────────────────────────────────────── */
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 2px 8px;
|
||||
border-radius: 0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.badge.downloading { background: #1f3a5f; color: var(--accent); }
|
||||
.badge.uploading { background: #1a3a1a; color: var(--green); }
|
||||
.badge.queuedDL { background: #3a2e1a; color: var(--orange); }
|
||||
.badge.error { background: #3a1a1a; color: var(--red); }
|
||||
|
||||
/* ── Empty state ──────────────────────────────────────── */
|
||||
|
||||
.empty {
|
||||
text-align: center;
|
||||
color: var(--text-dim);
|
||||
padding: 40px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
text-align: center;
|
||||
color: var(--text-dim);
|
||||
padding: 20px 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
Reference in New Issue
Block a user