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:
Marc Blatter 2026-07-04 23:29:28 +02:00
parent 05fcb8ad9a
commit b7b311e3cf
1 changed files with 317 additions and 129 deletions

View File

@ -102,222 +102,384 @@ async def root():
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Trading Bot V7</title> <title>Trading Bot V8</title>
<style> <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 {{ body {{
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Monaco', 'Menlo', monospace;
background: #1e1e1e; background: var(--bg-primary);
color: #d0d0d0; color: var(--text-primary);
padding: 0; line-height: 1.6;
margin: 0; font-size: clamp(14px, 2vw, 16px);
overflow-x: hidden;
}} }}
.container {{ .app-container {{
display: flex; display: flex;
min-height: 100vh; min-height: 100vh;
flex-direction: row;
}} }}
/* ===== SIDEBAR ===== */
.sidebar {{ .sidebar {{
width: 240px; width: 260px;
background: #252525; background: var(--bg-secondary);
border-right: 1px solid #404040; border-right: 1px solid var(--border);
padding: 30px 20px; padding: var(--spacing);
display: flex;
flex-direction: column;
overflow-y: auto; overflow-y: auto;
transition: transform 0.3s ease;
}} }}
.sidebar h1 {{ .sidebar-header {{
font-size: 14px; font-size: clamp(12px, 3vw, 14px);
font-weight: bold; font-weight: bold;
color: #00ff88;
margin-bottom: 30px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1px; 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 {{ .sidebar-item {{
padding: 12px 0; padding: calc(var(--spacing) * 0.75) var(--spacing);
font-size: 13px; margin-bottom: 0.5rem;
color: #a0a0a0; font-size: clamp(12px, 2vw, 13px);
border-left: 2px solid transparent; color: var(--text-secondary);
padding-left: 10px;
cursor: pointer; cursor: pointer;
border-radius: 4px;
transition: all 0.2s; transition: all 0.2s;
border-left: 2px solid transparent;
padding-left: calc(var(--spacing) * 0.75);
}} }}
.sidebar-item:hover {{ .sidebar-item:hover {{
color: #00ff88; background: var(--bg-hover);
border-left-color: #00ff88; color: var(--accent);
}} }}
.sidebar-item.active {{ .sidebar-item.active {{
color: #00ff88; background: var(--bg-tertiary);
border-left-color: #00ff88; 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 {{ .main {{
flex: 1; flex: 1;
padding: 40px; padding: calc(var(--spacing) * 1.5);
overflow-y: auto; overflow-y: auto;
-webkit-overflow-scrolling: touch;
}} }}
.header {{ .header {{
margin-bottom: 40px; margin-bottom: calc(var(--spacing) * 2);
}} }}
.logo {{ .logo {{
font-size: 24px; font-size: clamp(20px, 5vw, 28px);
font-weight: bold; font-weight: bold;
color: #00ff88; color: var(--accent);
margin-bottom: 5px; margin-bottom: 0.25rem;
}} }}
.version {{ .version {{
font-size: 12px; font-size: clamp(11px, 2vw, 12px);
color: #808080; color: var(--text-secondary);
}} }}
/* ===== METRICS GRID ===== */
.metrics-grid {{ .metrics-grid {{
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px; gap: calc(var(--spacing) * 1.25);
margin-bottom: 50px; margin-bottom: calc(var(--spacing) * 2.5);
}} }}
.metric-card {{ .metric-card {{
background: #2a2a2a; background: var(--bg-tertiary);
border: 1px solid #404040; border: 1px solid var(--border);
padding: 25px; padding: calc(var(--spacing) * 1.25);
border-radius: 0; border-radius: 6px;
transition: all 0.3s; 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 {{ .metric-card:hover {{
background: #303030; background: var(--bg-hover);
border-color: #505050; border-color: var(--accent);
}} }}
.metric-label {{ .metric-label {{
font-size: 11px; font-size: clamp(10px, 1.5vw, 11px);
color: #808080; color: var(--text-secondary);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1px; letter-spacing: 0.5px;
margin-bottom: 12px; margin-bottom: 0.75rem;
}} }}
.metric-value {{ .metric-value {{
font-size: 28px; font-size: clamp(18px, 4vw, 28px);
font-weight: bold; font-weight: bold;
color: #e0e0e0; color: var(--text-primary);
word-break: break-word;
}} }}
.metric-value.accent {{ .metric-value.accent {{
color: #00ff88; color: var(--accent);
}}
/* ===== SECTIONS ===== */
.section {{
margin-bottom: calc(var(--spacing) * 2.5);
}} }}
.section-title {{ .section-title {{
font-size: 13px; font-size: clamp(12px, 2.5vw, 14px);
color: #808080; color: var(--text-secondary);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1px; letter-spacing: 1px;
margin-bottom: 20px; margin-bottom: var(--spacing);
margin-top: 40px; padding-bottom: calc(var(--spacing) * 0.75);
padding-bottom: 10px; border-bottom: 1px solid var(--border);
border-bottom: 1px solid #404040; }}
/* ===== TABLES ===== */
.table-wrapper {{
overflow-x: auto;
-webkit-overflow-scrolling: touch;
border-radius: 6px;
border: 1px solid var(--border);
}} }}
table {{ table {{
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
margin-bottom: 50px; font-size: clamp(11px, 2vw, 13px);
}} }}
th {{ th {{
background: #2a2a2a; background: var(--bg-tertiary);
color: #a0a0a0; color: var(--text-secondary);
padding: 12px; padding: calc(var(--spacing) * 0.75);
text-align: left; text-align: left;
font-size: 11px; font-weight: 600;
font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
border-bottom: 1px solid #404040; border-bottom: 1px solid var(--border);
white-space: nowrap;
}} }}
td {{ td {{
padding: 12px; padding: calc(var(--spacing) * 0.75);
border-bottom: 1px solid #303030; border-bottom: 1px solid var(--border);
font-size: 13px;
}} }}
tr:hover {{ tr:last-child td {{
background: #262626; border-bottom: none;
}}
tbody tr:hover {{
background: var(--bg-hover);
}}
tbody tr:active {{
background: var(--bg-tertiary);
}} }}
.price-positive {{ .price-positive {{
color: #00ff88; color: var(--accent);
font-weight: 600;
}} }}
.price-neutral {{ /* ===== RESPONSIVE ===== */
color: #d0d0d0; @media (max-width: 1024px) {{
.metrics-grid {{
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}}
}} }}
@media (max-width: 768px) {{ @media (max-width: 768px) {{
.container {{ :root {{
--spacing: 0.875rem;
}}
.app-container {{
flex-direction: column; flex-direction: column;
}} }}
.sidebar {{ .sidebar {{
width: 100%; width: 100%;
border-right: none; border-right: none;
border-bottom: 1px solid #404040; border-bottom: 1px solid var(--border);
padding: 20px; 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 {{ .metrics-grid {{
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: var(--spacing);
}} }}
.main {{ .section {{
padding: 20px; 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) {{ @media (max-width: 480px) {{
:root {{
--spacing: 0.75rem;
}}
.sidebar {{
padding: calc(var(--spacing) * 0.75);
}}
.main {{
padding: calc(var(--spacing) * 0.75);
}}
.metrics-grid {{ .metrics-grid {{
grid-template-columns: 1fr; grid-template-columns: 1fr;
gap: calc(var(--spacing) * 0.75);
}}
.metric-card {{
padding: var(--spacing);
min-height: 100px;
}} }}
.metric-value {{ .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> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="app-container">
<div class="sidebar"> <button class="menu-toggle" onclick="toggleSidebar()"></button>
<h1> Bot Status</h1>
<div class="sidebar-item active"> <div class="sidebar" id="sidebar">
<span>🟢 Running</span> <div class="sidebar-header"> Status</div>
</div> <div class="sidebar-item active">🟢 Running</div>
<div class="sidebar-item"> <div class="sidebar-item">📊 Analytics</div>
<span>📊 Analytics</span> <div class="sidebar-item"> Performance</div>
</div> <div class="sidebar-item">🔧 Settings</div>
<div class="sidebar-item">
<span> Performance</span>
</div>
<div class="sidebar-item">
<span>🔧 Settings</span>
</div>
</div> </div>
<div class="main"> <div class="main">
<div class="header"> <div class="header">
<div class="logo">💰 Trading Bot</div> <div class="logo">💰 Trading Bot</div>
<div class="version">V7 Real-time Portfolio</div> <div class="version">V8 Real-time Portfolio</div>
</div> </div>
<div class="metrics-grid"> <div class="metrics-grid">
@ -335,12 +497,14 @@ tr:hover {{
</div> </div>
</div> </div>
<div class="section">
<div class="section-title">Live Prices</div> <div class="section-title">Live Prices</div>
<div class="table-wrapper">
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Asset</th> <th>Asset</th>
<th>Price (USD)</th> <th>Price</th>
</tr> </tr>
</thead> </thead>
<tbody>''' <tbody>'''
@ -348,21 +512,24 @@ tr:hover {{
for asset, price in prices.items(): for asset, price in prices.items():
html += f'''<tr> html += f'''<tr>
<td>{asset}</td> <td>{asset}</td>
<td class="price-neutral">${price:.2f}</td> <td class="price-positive">${price:.2f}</td>
</tr>''' </tr>'''
html += '''</tbody> html += '''</tbody>
</table> </table>
</div>
</div>
<div class="section">
<div class="section-title">Holdings</div> <div class="section-title">Holdings</div>
<div class="table-wrapper">
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Asset</th> <th>Asset</th>
<th>Free</th> <th>Free</th>
<th>Locked</th>
<th>Total</th> <th>Total</th>
<th>USD Value</th> <th>Value</th>
</tr> </tr>
</thead> </thead>
<tbody>''' <tbody>'''
@ -377,16 +544,37 @@ tr:hover {{
value = data['total'] * price value = data['total'] * price
html += f'''<tr> html += f'''<tr>
<td>{asset}</td> <td>{asset}</td>
<td>{data['free']:.6f}</td> <td>{data['free']:.4f}</td>
<td>{data['locked']:.6f}</td> <td>{data['total']:.4f}</td>
<td>{data['total']:.6f}</td>
<td class="price-positive">${value:.2f}</td> <td class="price-positive">${value:.2f}</td>
</tr>''' </tr>'''
html += '''</tbody> html += '''</tbody>
</table> </table>
</div> </div>
</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> </body>
</html>''' </html>'''