Spaces:
Sleeping
Sleeping
Aryanshh commited on
Commit ·
8c27c8f
1
Parent(s): 3ae8c00
feat: Side-by-side dashboard layout with static tour modal
Browse files- dashboard/app.js +3 -11
- dashboard/index.html +24 -56
- dashboard/style.css +17 -10
dashboard/app.js
CHANGED
|
@@ -149,23 +149,15 @@ window.execute = async function(type) {
|
|
| 149 |
// Tutorial Logic
|
| 150 |
function showStep(step) {
|
| 151 |
const content = document.getElementById('tutorial-step');
|
| 152 |
-
const modal = document.querySelector('.modal-card');
|
| 153 |
const data = TUTORIAL_STEPS[step];
|
| 154 |
|
| 155 |
content.innerHTML = `<h2>${data.title}</h2><p>${data.text}</p>`;
|
| 156 |
document.getElementById('tut-prev').classList.toggle('hidden', step === 0);
|
| 157 |
document.getElementById('tut-next').textContent = step === TUTORIAL_STEPS.length - 1 ? "Start Simulation" : "Next";
|
| 158 |
|
| 159 |
-
//
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
const rect = targetEl.getBoundingClientRect();
|
| 163 |
-
document.getElementById('tutorial-modal').style.alignItems = 'flex-start';
|
| 164 |
-
document.getElementById('tutorial-modal').style.paddingTop = `${Math.max(20, rect.top - 100)}px`;
|
| 165 |
-
} else {
|
| 166 |
-
document.getElementById('tutorial-modal').style.alignItems = 'center';
|
| 167 |
-
document.getElementById('tutorial-modal').style.paddingTop = '0';
|
| 168 |
-
}
|
| 169 |
}
|
| 170 |
|
| 171 |
document.getElementById('tut-next').addEventListener('click', () => {
|
|
|
|
| 149 |
// Tutorial Logic
|
| 150 |
function showStep(step) {
|
| 151 |
const content = document.getElementById('tutorial-step');
|
|
|
|
| 152 |
const data = TUTORIAL_STEPS[step];
|
| 153 |
|
| 154 |
content.innerHTML = `<h2>${data.title}</h2><p>${data.text}</p>`;
|
| 155 |
document.getElementById('tut-prev').classList.toggle('hidden', step === 0);
|
| 156 |
document.getElementById('tut-next').textContent = step === TUTORIAL_STEPS.length - 1 ? "Start Simulation" : "Next";
|
| 157 |
|
| 158 |
+
// Static Centered Position
|
| 159 |
+
document.getElementById('tutorial-modal').style.alignItems = 'center';
|
| 160 |
+
document.getElementById('tutorial-modal').style.paddingTop = '0';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
document.getElementById('tut-next').addEventListener('click', () => {
|
dashboard/index.html
CHANGED
|
@@ -33,72 +33,40 @@
|
|
| 33 |
</div>
|
| 34 |
|
| 35 |
<main>
|
| 36 |
-
<section class="
|
| 37 |
-
<
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
<h4>📦 Supply Logistics</h4>
|
| 43 |
-
<div class="op-row">
|
| 44 |
-
<select id="part-select">
|
| 45 |
-
<option value="chips">Order Microchips</option>
|
| 46 |
-
<option value="sensors">Order Sensors</option>
|
| 47 |
-
</select>
|
| 48 |
-
<select id="mode-select">
|
| 49 |
-
<option value="sea">SEA ($50, 10d, 0.5kg)</option>
|
| 50 |
-
<option value="rail">RAIL ($125, 5d, 2.5kg)</option>
|
| 51 |
-
<option value="air">AIR ($250, 2d, 10kg)</option>
|
| 52 |
-
</select>
|
| 53 |
-
<button onclick="execute('order_parts')" class="btn btn-primary small">Order</button>
|
| 54 |
</div>
|
| 55 |
</div>
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
<
|
| 61 |
-
|
| 62 |
-
<div class="
|
| 63 |
-
<
|
| 64 |
-
|
| 65 |
-
<option value="GreenTab">Produce GreenTab</option>
|
| 66 |
-
</select>
|
| 67 |
-
<button onclick="execute('produce')" class="btn btn-primary small">Start Run</button>
|
| 68 |
</div>
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
<!-- Section 3: ESG / Offsetting -->
|
| 74 |
-
<div id="section-offset" class="op-section">
|
| 75 |
-
<h4>🌳 ESG Strategy</h4>
|
| 76 |
-
<div class="op-row">
|
| 77 |
-
<span class="op-text">Carbon Offset Purchase (100 units)</span>
|
| 78 |
-
<button onclick="execute('offset')" class="btn btn-primary small">Buy Offset</button>
|
| 79 |
</div>
|
| 80 |
</div>
|
| 81 |
</div>
|
| 82 |
-
|
| 83 |
-
<div id="impact-preview" class="impact-preview">
|
| 84 |
-
<span class="preview-label">Live Estimate:</span>
|
| 85 |
-
<span id="preview-cost" class="val">$0</span>
|
| 86 |
-
<span class="sep">|</span>
|
| 87 |
-
<span id="preview-carbon" class="val">0kg CO2</span>
|
| 88 |
-
</div>
|
| 89 |
-
|
| 90 |
-
<div class="time-controls">
|
| 91 |
-
<button id="skip-btn" class="btn btn-secondary">Advance to Next Day</button>
|
| 92 |
-
<button id="trigger-btn" class="btn btn-danger">Trigger Suez Jam</button>
|
| 93 |
-
<button id="reset-btn" class="btn btn-outline">Reset Sim</button>
|
| 94 |
-
</div>
|
| 95 |
-
<div id="news-alert" class="news-alert hidden">
|
| 96 |
-
<span class="warning-icon">⚠️</span>
|
| 97 |
-
<span id="news-text"></span>
|
| 98 |
-
</div>
|
| 99 |
</section>
|
| 100 |
|
| 101 |
-
<section class="
|
|
|
|
| 102 |
<div class="card metric-card">
|
| 103 |
<h3>Carbon Footprint</h3>
|
| 104 |
<div class="gauge-container">
|
|
|
|
| 33 |
</div>
|
| 34 |
|
| 35 |
<main>
|
| 36 |
+
<section class="metrics-grid">
|
| 37 |
+
<div class="card metric-card">
|
| 38 |
+
<h3>Carbon Footprint</h3>
|
| 39 |
+
<div class="gauge-container">
|
| 40 |
+
<div id="carbon-gauge" class="gauge">
|
| 41 |
+
<span id="carbon-value">0</span><small>kg</small>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
</div>
|
| 43 |
</div>
|
| 44 |
+
<p class="limit">Limit: <span id="carbon-limit">1000</span>kg</p>
|
| 45 |
+
</div>
|
| 46 |
|
| 47 |
+
<div class="card metric-card">
|
| 48 |
+
<h3>Capital Balance</h3>
|
| 49 |
+
<div class="value-large">$<span id="cash-value">0</span></div>
|
| 50 |
+
<div class="trend" id="cash-trend">Fulfillment: <span id="orders-done">0</span></div>
|
| 51 |
+
</div>
|
| 52 |
|
| 53 |
+
<div class="card metric-card">
|
| 54 |
+
<h3>Raw Inventory</h3>
|
| 55 |
+
<div class="inventory-grid">
|
| 56 |
+
<div class="inv-item">
|
| 57 |
+
<span class="label">Chips</span>
|
| 58 |
+
<span id="chips-count" class="count">0</span>
|
|
|
|
|
|
|
|
|
|
| 59 |
</div>
|
| 60 |
+
<div class="inv-item">
|
| 61 |
+
<span class="label">Sensors</span>
|
| 62 |
+
<span id="sensors-count" class="count">0</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
</div>
|
| 64 |
</div>
|
| 65 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
</section>
|
| 67 |
|
| 68 |
+
<section class="control-panel card">
|
| 69 |
+
<h3><span class="i-icon">ℹ️</span> Command Console</h3>
|
| 70 |
<div class="card metric-card">
|
| 71 |
<h3>Carbon Footprint</h3>
|
| 72 |
<div class="gauge-container">
|
dashboard/style.css
CHANGED
|
@@ -96,20 +96,27 @@ header {
|
|
| 96 |
|
| 97 |
.status-online { background: #E1F5E1; color: #2C5F2D; }
|
| 98 |
|
| 99 |
-
|
| 100 |
display: grid;
|
| 101 |
-
grid-template-columns:
|
| 102 |
gap: 2rem;
|
| 103 |
-
margin-bottom: 2rem;
|
| 104 |
}
|
| 105 |
|
| 106 |
-
.
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
.card h3 {
|
|
|
|
| 96 |
|
| 97 |
.status-online { background: #E1F5E1; color: #2C5F2D; }
|
| 98 |
|
| 99 |
+
main {
|
| 100 |
display: grid;
|
| 101 |
+
grid-template-columns: 1fr 400px;
|
| 102 |
gap: 2rem;
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
+
.metrics-grid {
|
| 106 |
+
display: grid;
|
| 107 |
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
| 108 |
+
gap: 1.5rem;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.control-panel {
|
| 112 |
+
background: #F9F7F2;
|
| 113 |
+
height: fit-content;
|
| 114 |
+
position: sticky;
|
| 115 |
+
top: 2rem;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.details-section, .log-section, .guide-section {
|
| 119 |
+
grid-column: 1 / -1;
|
| 120 |
}
|
| 121 |
|
| 122 |
.card h3 {
|