// ================================================================ // Command Log Component // ================================================================ window.renderLog = function(cmds) { const el = document.getElementById('log-content'); if (!cmds.length) { el.innerHTML = '
No commands sent yet.
'; return; } const rows = cmds.map(cmd => { const p = typeof cmd.payload === 'string' ? JSON.parse(cmd.payload) : cmd.payload; let desc = ''; if (cmd.type === 'build') { desc = `Build: ${p.building_id}`; } else if (cmd.type === 'recruit') { desc = `Recruit: ${p.amount}x ${p.unit_id}`; } else if (cmd.type === 'market_offer') { desc = `Market: ${p.offer} ${p.offer_type} ➞ ${p.demand} ${p.demand_type}`; } const statusClass = `status-${cmd.status}`; const cancelBtn = ``; const timeStr = new Date(cmd.created_at + 'Z').toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }); return `| # | Town | Command | Status | Result |
|---|