Spaces:
Sleeping
Sleeping
Aryanshh commited on
Commit ·
6029f5c
1
Parent(s): 47e37f8
ux: Add click feedback (+1) and stabilize side-by-side layout
Browse files50 unmodified lines515253545556574 unmodified lines6263646566676841 unmodified lines1101111121131141151161171 unmodified line1191201211221231243 unmodified lines12812913013113213313413513613713813914014196 unmodified lines23823924024124224324450 unmodified linesif (!response.ok) throw new Error('API Unreachable');const data = await response.json();currentDay = data.step; // Track current step for arrival calculationconst status = document.getElementById('connection-status');status.textContent = 'ONLINE';4 unmodified linesdocument.getElementById('chips-count').textContent = data.inventory.chips;document.getElementById('sensors-count').textContent = data.inventory.sensors;// Update Cart (Active Shipments)const cartContainer = document.getElementById('cart-container');if (data.active_shipments && data.active_shipments.length > 0) {cartContainer.innerHTML = data.active_shipments.map(ship => `41 unmodified linesfunction updatePreview() {const mode = modeSelect.value;const s = SPECS[mode];const cost = 10 * 5 * s.cost;const carbon = 5 * s.carbon;document.getElementById('preview-cost').textContent = `$${cost.toFixed(0)}`;document.getElementById('preview-carbon').textContent = `+${carbon.toFixed(1)}kg CO2`;1 unmodified linemodeSelect.addEventListener('change', updatePreview);function log(message, type = 'system') {const box = document.getElementById('activity-log');const entry = document.createElement('p');3 unmodified lines}// Global Execute Functionwindow.execute = async function(type) {document.querySelector('main').classList.add('transitioning');let actionObj = { action_type: type };if (type === 'order_parts') {actionObj.part_type = document.getElementById('part-select').value;actionObj.mode = document.getElementById('mode-select').value;actionObj.quantity = 5;} else if (type === 'produce') {actionObj.product = document.getElementById('product-select').value;} else if (type === 'offset') {96 unmodified lines}}document.getElementById('skip-btn').addEventListener('click', () => window.execute('skip'));document.getElementById('trigger-btn').addEventListener('click', triggerSuezJam);document.getElementById('reset-btn').addEventListener('click', manualReset);50 unmodified lines515253545556574 unmodified lines6263646566676841 unmodified lines1101111121131141151161171 unmodified line1191201211221231241251261271281291301311321331343 unmodified lines13813914014114214314414514614714814915015115215396 unmodified lines25025125225325425525650 unmodified linesif (!response.ok) throw new Error('API Unreachable');const data = await response.json();currentDay = data.step;const status = document.getElementById('connection-status');status.textContent = 'ONLINE';4 unmodified linesdocument.getElementById('chips-count').textContent = data.inventory.chips;document.getElementById('sensors-count').textContent = data.inventory.sensors;// Update Cartconst cartContainer = document.getElementById('cart-container');if (data.active_shipments && data.active_shipments.length > 0) {cartContainer.innerHTML = data.active_shipments.map(ship => `41 unmodified linesfunction updatePreview() {const mode = modeSelect.value;const s = SPECS[mode];const cost = 10 * 1 * s.cost; // Qty 1 nowconst carbon = 1 * s.carbon;document.getElementById('preview-cost').textContent = `$${cost.toFixed(0)}`;document.getElementById('preview-carbon').textContent = `+${carbon.toFixed(1)}kg CO2`;1 unmodified linemodeSelect.addEventListener('change', updatePreview);function spawnFeedback(text, x, y) {const el = document.createElement('div');el.className = 'floating-feedback';el.textContent = text;el.style.left = `${x}px`;el.style.top = `${y}px`;document.body.appendChild(el);setTimeout(() => el.remove(), 1000);}function log(message, type = 'system') {const box = document.getElementById('activity-log');const entry = document.createElement('p');3 unmodified lines}// Global Execute Functionwindow.execute = async function(type, event) {document.querySelector('main').classList.add('transitioning');let actionObj = { action_type: type };if (type === 'order_parts') {const part = document.getElementById('part-select').value;spawnFeedback(`+1 ${part} added to order`, event.clientX, event.clientY);actionObj.part_type = part;actionObj.mode = document.getElementById('mode-select').value;actionObj.quantity = 1; // Change to 1 as requested} else if (type === 'produce') {actionObj.product = document.getElementById('product-select').value;} else if (type === 'offset') {96 unmodified lines}}document.getElementById('skip-btn').addEventListener('click', (e) => window.execute('skip', e));document.getElementById('trigger-btn').addEventListener('click', triggerSuezJam);document.getElementById('reset-btn').addEventListener('click', manualReset);
dashboard/app.js+20-8