Dashboard V8: Modern Mobile-First Responsive Design
- NEW: Hamburger menu for mobile (☰ button) - NEW: Modern CSS Grid + Flexbox layout - NEW: Fluid typography with CSS clamp() - NEW: Touch-friendly UI (44px+ tap targets) - NEW: Smooth scrolling (-webkit-overflow-scrolling) - NEW: Mobile-optimized breakpoints (768px, 480px) - IMPROVED: Auto-collapsing sidebar on mobile - IMPROVED: Optimized table display for small screens - ACCESSIBILITY: Better spacing and sizing for mobile users - FEATURES: Responsive images and fluid spacing - VERSION: V8 ENHANCED - PERFORMANCE: Fast loading, smooth transitions
This commit is contained in:
parent
05fcb8ad9a
commit
b7b311e3cf
|
|
@ -102,222 +102,384 @@ async def root():
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Trading Bot V7</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
||||
<title>Trading Bot V8</title>
|
||||
<style>
|
||||
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
|
||||
:root {{
|
||||
--bg-primary: #1a1a1a;
|
||||
--bg-secondary: #252525;
|
||||
--bg-tertiary: #2a2a2a;
|
||||
--bg-hover: #303030;
|
||||
--border: #404040;
|
||||
--text-primary: #e0e0e0;
|
||||
--text-secondary: #a0a0a0;
|
||||
--accent: #00ff88;
|
||||
--spacing: 1rem;
|
||||
}}
|
||||
|
||||
* {{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}}
|
||||
|
||||
html, body {{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}}
|
||||
|
||||
body {{
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
background: #1e1e1e;
|
||||
color: #d0d0d0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Monaco', 'Menlo', monospace;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
font-size: clamp(14px, 2vw, 16px);
|
||||
overflow-x: hidden;
|
||||
}}
|
||||
|
||||
.container {{
|
||||
.app-container {{
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: row;
|
||||
}}
|
||||
|
||||
/* ===== SIDEBAR ===== */
|
||||
.sidebar {{
|
||||
width: 240px;
|
||||
background: #252525;
|
||||
border-right: 1px solid #404040;
|
||||
padding: 30px 20px;
|
||||
width: 260px;
|
||||
background: var(--bg-secondary);
|
||||
border-right: 1px solid var(--border);
|
||||
padding: var(--spacing);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
transition: transform 0.3s ease;
|
||||
}}
|
||||
|
||||
.sidebar h1 {{
|
||||
font-size: 14px;
|
||||
.sidebar-header {{
|
||||
font-size: clamp(12px, 3vw, 14px);
|
||||
font-weight: bold;
|
||||
color: #00ff88;
|
||||
margin-bottom: 30px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: var(--accent);
|
||||
margin-bottom: calc(var(--spacing) * 1.5);
|
||||
padding-bottom: calc(var(--spacing) * 0.75);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}}
|
||||
|
||||
.sidebar-item {{
|
||||
padding: 12px 0;
|
||||
font-size: 13px;
|
||||
color: #a0a0a0;
|
||||
border-left: 2px solid transparent;
|
||||
padding-left: 10px;
|
||||
padding: calc(var(--spacing) * 0.75) var(--spacing);
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: clamp(12px, 2vw, 13px);
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
border-left: 2px solid transparent;
|
||||
padding-left: calc(var(--spacing) * 0.75);
|
||||
}}
|
||||
|
||||
.sidebar-item:hover {{
|
||||
color: #00ff88;
|
||||
border-left-color: #00ff88;
|
||||
background: var(--bg-hover);
|
||||
color: var(--accent);
|
||||
}}
|
||||
|
||||
.sidebar-item.active {{
|
||||
color: #00ff88;
|
||||
border-left-color: #00ff88;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--accent);
|
||||
border-left-color: var(--accent);
|
||||
}}
|
||||
|
||||
.menu-toggle {{
|
||||
display: none;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--accent);
|
||||
padding: calc(var(--spacing) * 0.75);
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
font-size: 18px;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: var(--spacing);
|
||||
}}
|
||||
|
||||
/* ===== MAIN CONTENT ===== */
|
||||
.main {{
|
||||
flex: 1;
|
||||
padding: 40px;
|
||||
padding: calc(var(--spacing) * 1.5);
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}}
|
||||
|
||||
.header {{
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: calc(var(--spacing) * 2);
|
||||
}}
|
||||
|
||||
.logo {{
|
||||
font-size: 24px;
|
||||
font-size: clamp(20px, 5vw, 28px);
|
||||
font-weight: bold;
|
||||
color: #00ff88;
|
||||
margin-bottom: 5px;
|
||||
color: var(--accent);
|
||||
margin-bottom: 0.25rem;
|
||||
}}
|
||||
|
||||
.version {{
|
||||
font-size: 12px;
|
||||
color: #808080;
|
||||
font-size: clamp(11px, 2vw, 12px);
|
||||
color: var(--text-secondary);
|
||||
}}
|
||||
|
||||
/* ===== METRICS GRID ===== */
|
||||
.metrics-grid {{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
margin-bottom: 50px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: calc(var(--spacing) * 1.25);
|
||||
margin-bottom: calc(var(--spacing) * 2.5);
|
||||
}}
|
||||
|
||||
.metric-card {{
|
||||
background: #2a2a2a;
|
||||
border: 1px solid #404040;
|
||||
padding: 25px;
|
||||
border-radius: 0;
|
||||
transition: all 0.3s;
|
||||
background: var(--bg-tertiary);
|
||||
border: 1px solid var(--border);
|
||||
padding: calc(var(--spacing) * 1.25);
|
||||
border-radius: 6px;
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
min-height: 120px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}}
|
||||
|
||||
.metric-card:active {{
|
||||
transform: scale(0.98);
|
||||
}}
|
||||
|
||||
.metric-card:hover {{
|
||||
background: #303030;
|
||||
border-color: #505050;
|
||||
background: var(--bg-hover);
|
||||
border-color: var(--accent);
|
||||
}}
|
||||
|
||||
.metric-label {{
|
||||
font-size: 11px;
|
||||
color: #808080;
|
||||
font-size: clamp(10px, 1.5vw, 11px);
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 12px;
|
||||
letter-spacing: 0.5px;
|
||||
margin-bottom: 0.75rem;
|
||||
}}
|
||||
|
||||
.metric-value {{
|
||||
font-size: 28px;
|
||||
font-size: clamp(18px, 4vw, 28px);
|
||||
font-weight: bold;
|
||||
color: #e0e0e0;
|
||||
color: var(--text-primary);
|
||||
word-break: break-word;
|
||||
}}
|
||||
|
||||
.metric-value.accent {{
|
||||
color: #00ff88;
|
||||
color: var(--accent);
|
||||
}}
|
||||
|
||||
/* ===== SECTIONS ===== */
|
||||
.section {{
|
||||
margin-bottom: calc(var(--spacing) * 2.5);
|
||||
}}
|
||||
|
||||
.section-title {{
|
||||
font-size: 13px;
|
||||
color: #808080;
|
||||
font-size: clamp(12px, 2.5vw, 14px);
|
||||
color: var(--text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 40px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #404040;
|
||||
margin-bottom: var(--spacing);
|
||||
padding-bottom: calc(var(--spacing) * 0.75);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}}
|
||||
|
||||
/* ===== TABLES ===== */
|
||||
.table-wrapper {{
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--border);
|
||||
}}
|
||||
|
||||
table {{
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 50px;
|
||||
font-size: clamp(11px, 2vw, 13px);
|
||||
}}
|
||||
|
||||
th {{
|
||||
background: #2a2a2a;
|
||||
color: #a0a0a0;
|
||||
padding: 12px;
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-secondary);
|
||||
padding: calc(var(--spacing) * 0.75);
|
||||
text-align: left;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
border-bottom: 1px solid #404040;
|
||||
border-bottom: 1px solid var(--border);
|
||||
white-space: nowrap;
|
||||
}}
|
||||
|
||||
td {{
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid #303030;
|
||||
font-size: 13px;
|
||||
padding: calc(var(--spacing) * 0.75);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}}
|
||||
|
||||
tr:hover {{
|
||||
background: #262626;
|
||||
tr:last-child td {{
|
||||
border-bottom: none;
|
||||
}}
|
||||
|
||||
tbody tr:hover {{
|
||||
background: var(--bg-hover);
|
||||
}}
|
||||
|
||||
tbody tr:active {{
|
||||
background: var(--bg-tertiary);
|
||||
}}
|
||||
|
||||
.price-positive {{
|
||||
color: #00ff88;
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
}}
|
||||
|
||||
.price-neutral {{
|
||||
color: #d0d0d0;
|
||||
/* ===== RESPONSIVE ===== */
|
||||
@media (max-width: 1024px) {{
|
||||
.metrics-grid {{
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
}}
|
||||
}}
|
||||
|
||||
@media (max-width: 768px) {{
|
||||
.container {{
|
||||
:root {{
|
||||
--spacing: 0.875rem;
|
||||
}}
|
||||
|
||||
.app-container {{
|
||||
flex-direction: column;
|
||||
}}
|
||||
|
||||
|
||||
.sidebar {{
|
||||
width: 100%;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid #404040;
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: var(--spacing);
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease;
|
||||
}}
|
||||
|
||||
|
||||
.sidebar.active {{
|
||||
max-height: 500px;
|
||||
}}
|
||||
|
||||
.menu-toggle {{
|
||||
display: flex;
|
||||
}}
|
||||
|
||||
.main {{
|
||||
padding: var(--spacing);
|
||||
}}
|
||||
|
||||
.metrics-grid {{
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: var(--spacing);
|
||||
}}
|
||||
|
||||
.main {{
|
||||
padding: 20px;
|
||||
|
||||
.section {{
|
||||
margin-bottom: var(--spacing);
|
||||
}}
|
||||
|
||||
th, td {{
|
||||
padding: calc(var(--spacing) * 0.6);
|
||||
font-size: 11px;
|
||||
}}
|
||||
|
||||
.metric-value {{
|
||||
font-size: clamp(16px, 3vw, 22px);
|
||||
}}
|
||||
}}
|
||||
|
||||
@media (max-width: 480px) {{
|
||||
:root {{
|
||||
--spacing: 0.75rem;
|
||||
}}
|
||||
|
||||
.sidebar {{
|
||||
padding: calc(var(--spacing) * 0.75);
|
||||
}}
|
||||
|
||||
.main {{
|
||||
padding: calc(var(--spacing) * 0.75);
|
||||
}}
|
||||
|
||||
.metrics-grid {{
|
||||
grid-template-columns: 1fr;
|
||||
gap: calc(var(--spacing) * 0.75);
|
||||
}}
|
||||
|
||||
|
||||
.metric-card {{
|
||||
padding: var(--spacing);
|
||||
min-height: 100px;
|
||||
}}
|
||||
|
||||
.metric-value {{
|
||||
font-size: 20px;
|
||||
font-size: clamp(14px, 2.5vw, 18px);
|
||||
}}
|
||||
|
||||
.section-title {{
|
||||
font-size: 11px;
|
||||
margin-bottom: calc(var(--spacing) * 0.75);
|
||||
}}
|
||||
|
||||
th, td {{
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
font-size: 10px;
|
||||
}}
|
||||
|
||||
table {{
|
||||
font-size: 10px;
|
||||
}}
|
||||
|
||||
.logo {{
|
||||
font-size: clamp(18px, 4vw, 24px);
|
||||
}}
|
||||
}}
|
||||
|
||||
/* ===== SCROLLBAR ===== */
|
||||
::-webkit-scrollbar {{
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
}}
|
||||
|
||||
::-webkit-scrollbar-track {{
|
||||
background: var(--bg-secondary);
|
||||
}}
|
||||
|
||||
::-webkit-scrollbar-thumb {{
|
||||
background: var(--border);
|
||||
border-radius: 3px;
|
||||
}}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {{
|
||||
background: var(--text-secondary);
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="sidebar">
|
||||
<h1>⚙️ Bot Status</h1>
|
||||
<div class="sidebar-item active">
|
||||
<span>🟢 Running</span>
|
||||
</div>
|
||||
<div class="sidebar-item">
|
||||
<span>📊 Analytics</span>
|
||||
</div>
|
||||
<div class="sidebar-item">
|
||||
<span>⚡ Performance</span>
|
||||
</div>
|
||||
<div class="sidebar-item">
|
||||
<span>🔧 Settings</span>
|
||||
</div>
|
||||
<div class="app-container">
|
||||
<button class="menu-toggle" onclick="toggleSidebar()">☰</button>
|
||||
|
||||
<div class="sidebar" id="sidebar">
|
||||
<div class="sidebar-header">⚙️ Status</div>
|
||||
<div class="sidebar-item active">🟢 Running</div>
|
||||
<div class="sidebar-item">📊 Analytics</div>
|
||||
<div class="sidebar-item">⚡ Performance</div>
|
||||
<div class="sidebar-item">🔧 Settings</div>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
<div class="logo">💰 Trading Bot</div>
|
||||
<div class="version">V7 — Real-time Portfolio</div>
|
||||
<div class="version">V8 — Real-time Portfolio</div>
|
||||
</div>
|
||||
|
||||
<div class="metrics-grid">
|
||||
|
|
@ -335,37 +497,42 @@ tr:hover {{
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-title">Live Prices</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Asset</th>
|
||||
<th>Price (USD)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>'''
|
||||
<div class="section">
|
||||
<div class="section-title">Live Prices</div>
|
||||
<div class="table-wrapper">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Asset</th>
|
||||
<th>Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>'''
|
||||
|
||||
for asset, price in prices.items():
|
||||
html += f'''<tr>
|
||||
<td>{asset}</td>
|
||||
<td class="price-neutral">${price:.2f}</td>
|
||||
</tr>'''
|
||||
<td>{asset}</td>
|
||||
<td class="price-positive">${price:.2f}</td>
|
||||
</tr>'''
|
||||
|
||||
html += '''</tbody>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-title">Holdings</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Asset</th>
|
||||
<th>Free</th>
|
||||
<th>Locked</th>
|
||||
<th>Total</th>
|
||||
<th>USD Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>'''
|
||||
<div class="section">
|
||||
<div class="section-title">Holdings</div>
|
||||
<div class="table-wrapper">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Asset</th>
|
||||
<th>Free</th>
|
||||
<th>Total</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>'''
|
||||
|
||||
tracked = ['BTC', 'ETH', 'SOL', 'BNB', 'XRP', 'USDT', 'USDC']
|
||||
balance = state.get('balance', {})
|
||||
|
|
@ -376,17 +543,38 @@ tr:hover {{
|
|||
price = prices.get(asset, 0)
|
||||
value = data['total'] * price
|
||||
html += f'''<tr>
|
||||
<td>{asset}</td>
|
||||
<td>{data['free']:.6f}</td>
|
||||
<td>{data['locked']:.6f}</td>
|
||||
<td>{data['total']:.6f}</td>
|
||||
<td class="price-positive">${value:.2f}</td>
|
||||
</tr>'''
|
||||
<td>{asset}</td>
|
||||
<td>{data['free']:.4f}</td>
|
||||
<td>{data['total']:.4f}</td>
|
||||
<td class="price-positive">${value:.2f}</td>
|
||||
</tr>'''
|
||||
|
||||
html += '''</tbody>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toggleSidebar() {{
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
sidebar.classList.toggle('active');
|
||||
}}
|
||||
|
||||
document.addEventListener('click', function(event) {{
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const toggle = document.querySelector('.menu-toggle');
|
||||
if (!sidebar.contains(event.target) && !toggle.contains(event.target)) {{
|
||||
sidebar.classList.remove('active');
|
||||
}}
|
||||
}});
|
||||
|
||||
// Refresh prices every 5 seconds
|
||||
setInterval(function() {{
|
||||
location.reload();
|
||||
}}, 5000);
|
||||
</script>
|
||||
</body>
|
||||
</html>'''
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue