Files
exchange-monitor-go/web/static/style.css
T
jackyu66git c2489614a7 Phase 2: Web dashboard with SSE real-time push
- dashboard.go: SSE hub + HTTP server + price history ring buffer
- static.go: //go:embed for static files
- web/static/index.html: Full dashboard HTML (6 panels)
- web/static/app.js: SSE client, Chart.js price chart, live table updates
- web/static/style.css: GitHub-style dark theme
- main.go: Start dashboard on :8888 + wire price recording + scan results

Dashboard features:
  - Real-time price table (6 coins × 4 exchanges)
  - Arbitrage opportunities table
  - Open positions view
  - Historical trades table (from SQLite)
  - Chart.js price chart with coin/exchange selector
  - Stats summary (total/converged/diverged/flat)
  - 🚫 Zero external Go dependencies (Chart.js loaded from CDN)
2026-05-03 17:38:26 +08:00

164 lines
3.6 KiB
CSS

/* ============================================================
Exchange Monitor Dashboard — Dark Theme
============================================================ */
:root {
--bg: #0d1117;
--card: #161b22;
--border: #30363d;
--text: #c9d1d9;
--text-dim: #8b949e;
--accent: #58a6ff;
--green: #3fb950;
--red: #f85149;
--yellow: #d29922;
--blue: #58a6ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
background: var(--bg);
color: var(--text);
font-size: 14px;
line-height: 1.5;
min-height: 100vh;
}
#app { max-width: 1440px; margin: 0 auto; padding: 16px; }
/* Header */
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: var(--card);
border: 1px solid var(--border);
border-radius: 8px;
margin-bottom: 16px;
}
header h1 { font-size: 18px; font-weight: 600; }
.header-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.sep { color: var(--border); }
.status-offline { color: var(--red); }
.status-online { color: var(--green); }
/* Grid layout */
.grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.card-wide { grid-column: 1 / -1; }
/* Cards */
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px;
}
.card h2 {
font-size: 14px;
font-weight: 600;
color: var(--text-dim);
margin-bottom: 10px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border);
}
/* Stats row */
.stats-row {
display: flex;
gap: 16px;
flex-wrap: wrap;
}
.stat {
display: flex;
flex-direction: column;
align-items: center;
min-width: 60px;
}
.stat label { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.stat span { font-size: 20px; font-weight: 700; }
.pct-green { color: var(--green); }
.pct-red { color: var(--red); }
.pct-gray { color: var(--text-dim); }
.pct-yellow { color: var(--yellow); }
.pct-blue { color: var(--blue); }
/* Tables */
.table-wrap {
overflow-x: auto;
max-height: 320px;
overflow-y: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
text-align: left;
padding: 6px 8px;
color: var(--text-dim);
font-weight: 500;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
position: sticky;
top: 0;
background: var(--card);
border-bottom: 1px solid var(--border);
}
td {
padding: 5px 8px;
border-bottom: 1px solid rgba(48, 54, 61, 0.5);
white-space: nowrap;
}
tr:hover td { background: rgba(88, 166, 255, 0.05); }
.loading { text-align: center; color: var(--text-dim); padding: 20px !important; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-dim { color: var(--text-dim); }
.text-right { text-align: right; }
/* Chart controls */
.chart-controls {
display: flex;
gap: 8px;
margin-bottom: 10px;
}
.chart-controls select {
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 4px;
padding: 4px 8px;
font-size: 13px;
cursor: pointer;
}
.chart-container {
position: relative;
height: 300px;
}
/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }
/* Responsive */
@media (max-width: 768px) {
.grid { grid-template-columns: 1fr; }
header { flex-direction: column; gap: 8px; }
.stats-row { justify-content: center; }
}