basic working

This commit is contained in:
Will Bradley
2025-10-11 21:05:39 -07:00
parent 4767b67460
commit d19c071814
8 changed files with 57 additions and 25 deletions
+12
View File
@@ -114,6 +114,18 @@ body {
font-size: 0.875rem;
}
.data-last-received {
display: flex;
align-items: center;
gap: 0.25rem;
font-size: 0.875rem;
color: var(--text-secondary);
}
.data-label {
opacity: 0.7;
}
/* Navigation Tabs */
.nav-tabs {
background: var(--surface-color);
+3 -10
View File
@@ -43,7 +43,7 @@
MQTT
</span>
<span class="data-last-received" id="data-last-received" title="Time since last data update">
<span style="opacity: 0.7;">Last data:</span> <span id="data-timer">0s ago</span>
<span class="data-label">Last data:</span> <span id="data-timer">0s ago</span>
</span>
<span class="user-info" id="user-info"></span>
<button id="logout-btn" class="btn btn-secondary">Logout</button>
@@ -115,15 +115,8 @@
<form id="send-message-form" class="message-form">
<div class="form-row">
<input type="text" id="message-text" placeholder="Type your message..." required>
<select id="message-channel">
<option value="0">Channel 0</option>
<option value="1">Channel 1</option>
<option value="2">Channel 2</option>
<option value="3">Channel 3</option>
<option value="4">Channel 4</option>
<option value="5">Channel 5</option>
<option value="6">Channel 6</option>
<option value="7">Channel 7</option>
<select id="message-from">
<option value="474572292">!1c496604</option>
</select>
<button type="submit" class="btn btn-primary">Send</button>
</div>
+4 -4
View File
@@ -173,10 +173,10 @@ const api = {
return this.request(`/api/messages?limit=${limit}`);
},
async sendMessage(text, channel = 0) {
async sendMessage(from, text) {
return this.request('/api/messages/send', {
method: 'POST',
body: JSON.stringify({ text, channel })
body: JSON.stringify({ text, from })
});
},
@@ -546,10 +546,10 @@ document.getElementById('send-message-form')?.addEventListener('submit', async (
e.preventDefault();
const text = document.getElementById('message-text').value;
const channel = parseInt(document.getElementById('message-channel').value);
const from = parseInt(document.getElementById('message-from').value);
try {
await api.sendMessage(text, channel);
await api.sendMessage(text, from);
document.getElementById('message-text').value = '';
// Reload messages after a short delay