Spaces:
Sleeping
Sleeping
Aryanshh commited on
Commit ·
831a6aa
1
Parent(s): b31b55e
feat: Official production release with premium HUD and expanded tour guide
Browse files- dashboard/app.js +18 -27
- dashboard/index.html +19 -28
- dashboard/style.css +3 -41
dashboard/app.js
CHANGED
|
@@ -7,7 +7,7 @@ const SPECS = {
|
|
| 7 |
rail: { cost: 2.5, carbon: 0.5 }
|
| 8 |
};
|
| 9 |
|
| 10 |
-
// Tutorial Content
|
| 11 |
const TUTORIAL_STEPS = [
|
| 12 |
{
|
| 13 |
title: "Mission: NetZero-Nav",
|
|
@@ -16,22 +16,27 @@ const TUTORIAL_STEPS = [
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
title: "Ordering Parts",
|
| 19 |
-
text: "Select a component and Transport Mode. Click the <strong>'Order'</strong> button. SEA is green but takes 10 full days!",
|
| 20 |
target: "#section-order"
|
| 21 |
},
|
| 22 |
{
|
| 23 |
-
title: "The
|
| 24 |
-
text: "
|
| 25 |
-
target: "#
|
| 26 |
},
|
| 27 |
{
|
| 28 |
title: "Starting Production",
|
| 29 |
-
text: "Once
|
| 30 |
target: "#section-produce"
|
| 31 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
{
|
| 33 |
title: "Time Management",
|
| 34 |
-
text: "Use <strong>'Advance to Next Day'</strong> to
|
| 35 |
target: ".time-controls"
|
| 36 |
}
|
| 37 |
];
|
|
@@ -62,23 +67,6 @@ async function updateState() {
|
|
| 62 |
newsAlert.classList.add('hidden');
|
| 63 |
}
|
| 64 |
|
| 65 |
-
// --- UPDATE MINI CART ---
|
| 66 |
-
const cart = document.getElementById('mini-cart');
|
| 67 |
-
if (data.shipments && data.shipments.length > 0) {
|
| 68 |
-
const last = data.shipments[0]; // Show latest/most relevant
|
| 69 |
-
const arrivalDay = data.step + last.eta;
|
| 70 |
-
cart.innerHTML = `
|
| 71 |
-
<div class="cart-item">
|
| 72 |
-
<span>📦 ${last.part}</span>
|
| 73 |
-
<b>x${last.quantity}</b>
|
| 74 |
-
<span class="eta">Arrives: Day ${arrivalDay}</span>
|
| 75 |
-
</div>
|
| 76 |
-
`;
|
| 77 |
-
} else {
|
| 78 |
-
cart.innerHTML = '<div class="cart-placeholder">No active shipments</div>';
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
// --- UPDATE ORDERS HUD ---
|
| 82 |
const container = document.getElementById('shipments-container');
|
| 83 |
if (data.orders && data.orders.length > 0) {
|
| 84 |
container.innerHTML = data.orders.map(order => `
|
|
@@ -112,7 +100,7 @@ function updatePreview() {
|
|
| 112 |
document.getElementById('preview-carbon').textContent = `+${carbon.toFixed(1)}kg CO2`;
|
| 113 |
}
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
function log(message, type = 'system') {
|
| 118 |
const box = document.getElementById('activity-log');
|
|
@@ -122,6 +110,7 @@ function log(message, type = 'system') {
|
|
| 122 |
box.prepend(entry);
|
| 123 |
}
|
| 124 |
|
|
|
|
| 125 |
window.execute = async function(type) {
|
| 126 |
document.querySelector('main').classList.add('transitioning');
|
| 127 |
|
|
@@ -168,13 +157,14 @@ function showStep(step) {
|
|
| 168 |
const data = TUTORIAL_STEPS[step];
|
| 169 |
|
| 170 |
content.innerHTML = `
|
| 171 |
-
<div class="step-counter">
|
| 172 |
<h2>${data.title}</h2>
|
| 173 |
<p>${data.text}</p>
|
| 174 |
`;
|
| 175 |
document.getElementById('tut-prev').classList.toggle('hidden', step === 0);
|
| 176 |
-
document.getElementById('tut-next').textContent = step === TUTORIAL_STEPS.length - 1 ? "Start
|
| 177 |
|
|
|
|
| 178 |
const modalOverlay = document.getElementById('tutorial-modal');
|
| 179 |
modalOverlay.style.alignItems = 'center';
|
| 180 |
modalOverlay.style.paddingTop = '0';
|
|
@@ -206,6 +196,7 @@ document.getElementById('info-btn').addEventListener('click', () => {
|
|
| 206 |
document.getElementById('tutorial-modal').classList.remove('hidden');
|
| 207 |
});
|
| 208 |
|
|
|
|
| 209 |
async function manualReset() {
|
| 210 |
if (!confirm("Are you sure you want to reset the simulation?")) return;
|
| 211 |
try {
|
|
|
|
| 7 |
rail: { cost: 2.5, carbon: 0.5 }
|
| 8 |
};
|
| 9 |
|
| 10 |
+
// Tutorial Content - Updated with detailed button instructions
|
| 11 |
const TUTORIAL_STEPS = [
|
| 12 |
{
|
| 13 |
title: "Mission: NetZero-Nav",
|
|
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
title: "Ordering Parts",
|
| 19 |
+
text: "Select a component (Chips/Sensors) and a Transport Mode. Click the <strong>'Order'</strong> button to dispatch a shipment. SEA is green but takes 10 full days!",
|
| 20 |
target: "#section-order"
|
| 21 |
},
|
| 22 |
{
|
| 23 |
+
title: "The Impact Preview",
|
| 24 |
+
text: "Watch this box! Whenever you change a transport mode, we calculate the <strong>Financial Cost</strong> and <strong>Carbon Footprint</strong> in real-time before you commit.",
|
| 25 |
+
target: "#impact-preview"
|
| 26 |
},
|
| 27 |
{
|
| 28 |
title: "Starting Production",
|
| 29 |
+
text: "Once inventory arrives, use the <strong>'Start Run'</strong> button. This consumes parts and fulfills active orders, generating revenue for your fleet.",
|
| 30 |
target: "#section-produce"
|
| 31 |
},
|
| 32 |
+
{
|
| 33 |
+
title: "Buying Offsets",
|
| 34 |
+
text: "Exceeding your carbon quota? Click <strong>'Buy Offset'</strong> to trade capital for carbon credits and keep the gauges in the green zone.",
|
| 35 |
+
target: "#section-offset"
|
| 36 |
+
},
|
| 37 |
{
|
| 38 |
title: "Time Management",
|
| 39 |
+
text: "Use <strong>'Advance to Next Day'</strong> to process shipments. If you're feeling daring, trigger a <strong>Suez Jam</strong> to see if your strategy can survive a global crisis.",
|
| 40 |
target: ".time-controls"
|
| 41 |
}
|
| 42 |
];
|
|
|
|
| 67 |
newsAlert.classList.add('hidden');
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
const container = document.getElementById('shipments-container');
|
| 71 |
if (data.orders && data.orders.length > 0) {
|
| 72 |
container.innerHTML = data.orders.map(order => `
|
|
|
|
| 100 |
document.getElementById('preview-carbon').textContent = `+${carbon.toFixed(1)}kg CO2`;
|
| 101 |
}
|
| 102 |
|
| 103 |
+
modeSelect.addEventListener('change', updatePreview);
|
| 104 |
|
| 105 |
function log(message, type = 'system') {
|
| 106 |
const box = document.getElementById('activity-log');
|
|
|
|
| 110 |
box.prepend(entry);
|
| 111 |
}
|
| 112 |
|
| 113 |
+
// Global Execute Function (exposed to onclick in HTML)
|
| 114 |
window.execute = async function(type) {
|
| 115 |
document.querySelector('main').classList.add('transitioning');
|
| 116 |
|
|
|
|
| 157 |
const data = TUTORIAL_STEPS[step];
|
| 158 |
|
| 159 |
content.innerHTML = `
|
| 160 |
+
<div class="step-counter">Step ${step + 1} of ${TUTORIAL_STEPS.length}</div>
|
| 161 |
<h2>${data.title}</h2>
|
| 162 |
<p>${data.text}</p>
|
| 163 |
`;
|
| 164 |
document.getElementById('tut-prev').classList.toggle('hidden', step === 0);
|
| 165 |
+
document.getElementById('tut-next').textContent = step === TUTORIAL_STEPS.length - 1 ? "Start Mission" : "Next";
|
| 166 |
|
| 167 |
+
// Static Centering logic maintained
|
| 168 |
const modalOverlay = document.getElementById('tutorial-modal');
|
| 169 |
modalOverlay.style.alignItems = 'center';
|
| 170 |
modalOverlay.style.paddingTop = '0';
|
|
|
|
| 196 |
document.getElementById('tutorial-modal').classList.remove('hidden');
|
| 197 |
});
|
| 198 |
|
| 199 |
+
// Initialization
|
| 200 |
async function manualReset() {
|
| 201 |
if (!confirm("Are you sure you want to reset the simulation?")) return;
|
| 202 |
try {
|
dashboard/index.html
CHANGED
|
@@ -34,28 +34,23 @@
|
|
| 34 |
|
| 35 |
<main>
|
| 36 |
<section class="control-panel card">
|
| 37 |
-
<h3>Command Console</h3>
|
| 38 |
|
| 39 |
<div class="operation-sections">
|
| 40 |
<!-- Section 1: Logistics -->
|
| 41 |
<div id="section-order" class="op-section">
|
| 42 |
<h4>📦 Supply Logistics</h4>
|
| 43 |
-
<div class="op-row
|
| 44 |
-
<
|
| 45 |
-
<
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
<
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
</select>
|
| 54 |
-
</div>
|
| 55 |
<button onclick="execute('order_parts')" class="btn btn-primary small">Order</button>
|
| 56 |
-
<div id="mini-cart" class="mini-cart">
|
| 57 |
-
<div class="cart-placeholder">No active shipments</div>
|
| 58 |
-
</div>
|
| 59 |
</div>
|
| 60 |
</div>
|
| 61 |
|
|
@@ -64,27 +59,23 @@
|
|
| 64 |
<!-- Section 2: Manufacturing -->
|
| 65 |
<div id="section-produce" class="op-section">
|
| 66 |
<h4>🏭 Manufacturing</h4>
|
| 67 |
-
<div class="op-row
|
| 68 |
-
<
|
| 69 |
-
<
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
</select>
|
| 73 |
-
</div>
|
| 74 |
<button onclick="execute('produce')" class="btn btn-primary small">Start Run</button>
|
| 75 |
-
<div class="cart-spacer"></div>
|
| 76 |
</div>
|
| 77 |
</div>
|
| 78 |
|
| 79 |
<hr class="divider">
|
| 80 |
|
| 81 |
-
<!-- Section 3: ESG -->
|
| 82 |
<div id="section-offset" class="op-section">
|
| 83 |
<h4>🌳 ESG Strategy</h4>
|
| 84 |
-
<div class="op-row
|
| 85 |
-
<
|
| 86 |
<button onclick="execute('offset')" class="btn btn-primary small">Buy Offset</button>
|
| 87 |
-
<div class="cart-spacer"></div>
|
| 88 |
</div>
|
| 89 |
</div>
|
| 90 |
</div>
|
|
|
|
| 34 |
|
| 35 |
<main>
|
| 36 |
<section class="control-panel card">
|
| 37 |
+
<h3><span class="i-icon">ℹ️</span> Command Console</h3>
|
| 38 |
|
| 39 |
<div class="operation-sections">
|
| 40 |
<!-- Section 1: Logistics -->
|
| 41 |
<div id="section-order" class="op-section">
|
| 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 |
|
|
|
|
| 59 |
<!-- Section 2: Manufacturing -->
|
| 60 |
<div id="section-produce" class="op-section">
|
| 61 |
<h4>🏭 Manufacturing</h4>
|
| 62 |
+
<div class="op-row">
|
| 63 |
+
<select id="product-select">
|
| 64 |
+
<option value="EcoPhone">Produce EcoPhone</option>
|
| 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 |
</div>
|
| 70 |
|
| 71 |
<hr class="divider">
|
| 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>
|
dashboard/style.css
CHANGED
|
@@ -175,7 +175,6 @@ header {
|
|
| 175 |
|
| 176 |
.op-section {
|
| 177 |
padding: 0.5rem 0;
|
| 178 |
-
text-align: center;
|
| 179 |
}
|
| 180 |
|
| 181 |
.op-section h4 {
|
|
@@ -187,53 +186,16 @@ header {
|
|
| 187 |
font-weight: 700;
|
| 188 |
}
|
| 189 |
|
| 190 |
-
.op-row
|
| 191 |
-
display: flex;
|
| 192 |
-
gap: 2rem;
|
| 193 |
-
align-items: center;
|
| 194 |
-
justify-content: center;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.op-inputs {
|
| 198 |
-
display: flex;
|
| 199 |
-
gap: 1rem;
|
| 200 |
-
}
|
| 201 |
-
|
| 202 |
-
.mini-cart {
|
| 203 |
-
background: #FFFFFF;
|
| 204 |
-
border: 1px dashed var(--border-tan);
|
| 205 |
-
border-radius: 12px;
|
| 206 |
-
padding: 0.6rem 1rem;
|
| 207 |
-
min-width: 250px;
|
| 208 |
-
text-align: left;
|
| 209 |
-
height: 38px;
|
| 210 |
-
display: flex;
|
| 211 |
-
align-items: center;
|
| 212 |
-
overflow: hidden;
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
.cart-placeholder {
|
| 216 |
-
font-size: 0.75rem;
|
| 217 |
-
color: var(--text-muted);
|
| 218 |
-
font-style: italic;
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
.cart-item {
|
| 222 |
-
font-size: 0.8rem;
|
| 223 |
display: flex;
|
| 224 |
-
gap:
|
| 225 |
align-items: center;
|
| 226 |
-
animation: fadeIn 0.3s ease;
|
| 227 |
}
|
| 228 |
|
| 229 |
-
.cart-item b { color: var(--deep-forest); }
|
| 230 |
-
.cart-item .eta { color: var(--primary-green); font-weight: 600; }
|
| 231 |
-
|
| 232 |
-
.cart-spacer { min-width: 250px; }
|
| 233 |
-
|
| 234 |
.op-text {
|
| 235 |
font-size: 0.95rem;
|
| 236 |
color: var(--text-main);
|
|
|
|
| 237 |
font-weight: 500;
|
| 238 |
}
|
| 239 |
|
|
|
|
| 175 |
|
| 176 |
.op-section {
|
| 177 |
padding: 0.5rem 0;
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
.op-section h4 {
|
|
|
|
| 186 |
font-weight: 700;
|
| 187 |
}
|
| 188 |
|
| 189 |
+
.op-row {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
display: flex;
|
| 191 |
+
gap: 1.2rem;
|
| 192 |
align-items: center;
|
|
|
|
| 193 |
}
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
.op-text {
|
| 196 |
font-size: 0.95rem;
|
| 197 |
color: var(--text-main);
|
| 198 |
+
flex-grow: 1;
|
| 199 |
font-weight: 500;
|
| 200 |
}
|
| 201 |
|