Skip to content

Commit 253ffc0

Browse files
committed
Fixed css issues with setup.html
1 parent f7e1a90 commit 253ffc0

File tree

6 files changed

+35
-32
lines changed

6 files changed

+35
-32
lines changed

data/fans.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ <h1>Fans & Temperatures</h1>
186186
`);
187187
fanContainer.append(tabsContainer);
188188

189-
const controlsContainer = $('<div>').addClass('chart-controls-container').attr('id', `chart-controls-${key}`);
189+
const controlsContainer = $('<div>').addClass('chart-controls-container form-grid').attr('id', `chart-controls-${key}`);
190190
const chartContainer = $('<div>').addClass('chart-container').attr('id', `chart-${key}`);
191191
chartContainer.append(`<h3 style="position: absolute; opacity: 30%; margin-inline: auto; width: fit-content; left:0; right:0; top: 50%; transform: translateY(-50%); user-select: none;">${fanLabelOverride}</h3>`);
192192

193193
const svg = $(`<svg width="100%" height="100%"></svg>`).attr('id', `svg-${key}`).appendTo(chartContainer);
194194

195195
const temp_src_select_label = $(`<label for="sensor_id-${key}">Temperature source:</label>`);
196-
const temp_src_select = $(`<select style="bottom: 10px; right: 10px;"></select><br>`).attr('id', `sensor_id-${key}`)
196+
const temp_src_select = $(`<select style="bottom: 10px; right: 10px;"></select>`).attr('id', `sensor_id-${key}`)
197197
for (const t_sensor of available_sensors) {
198198
temp_src_select.append($('<option>', {
199199
value: t_sensor,
@@ -212,7 +212,6 @@ <h1>Fans & Temperatures</h1>
212212
}
213213
rpm_select_label.appendTo(controlsContainer);
214214
rpm_select.appendTo(controlsContainer);
215-
$(`<br>`).appendTo(controlsContainer);
216215

217216
const temp_select_label = $(`<label for="temp_th-${key}">Temperature alarm:</label>`);
218217
const temp_select = $(`<select style="bottom: 10px; right: 100px;"></select>`).attr('id', `temp_th-${key}`);
@@ -228,7 +227,6 @@ <h1>Fans & Temperatures</h1>
228227
}
229228
temp_select_label.appendTo(controlsContainer);
230229
temp_select.appendTo(controlsContainer);
231-
$(`<br>`).appendTo(controlsContainer);
232230

233231
const halt_select_label = $(`<label for="halt_on-${key}">Halt PC on:</label>`);
234232
const halt_select = $(`<select style="bottom: 10px; right: 100px;"></select>`).attr('id', `halt-${key}`);
@@ -238,7 +236,6 @@ <h1>Fans & Temperatures</h1>
238236
halt_select.append($('<option>', { value: 3, text : 'Halt on both', selected: halt_on == 3 }));
239237
halt_select_label.appendTo(controlsContainer);
240238
halt_select.appendTo(controlsContainer);
241-
$(`<br>`).appendTo(controlsContainer);
242239

243240
const stepupdown_select_label = $(`<label for="step-${key}">Step up/down duration:</label>`);
244241
const stepupdown_select = $(`<select style="bottom: 10px; right: 100px;"></select>`).attr('id', `step-${key}`);
@@ -247,22 +244,21 @@ <h1>Fans & Temperatures</h1>
247244
}
248245
stepupdown_select_label.appendTo(controlsContainer);
249246
stepupdown_select.appendTo(controlsContainer);
250-
$(`<br>`).appendTo(controlsContainer);
251247

252-
$('<hr>').appendTo(controlsContainer);
248+
$('<hr style="grid-column: 1 / -1;">').appendTo(controlsContainer);
253249

254250
$('#tab-curve-' + key).append(chartContainer);
255251

256252
const pidControlsContainer = $(`
257-
<div class="pid-controls" id="pid-controls-${key}" style="display: block;">
253+
<div class="pid-controls form-grid" id="pid-controls-${key}" style="display: grid; gap: 15px 10px;">
258254
<label for="pid_target-${key}">Target Temperature (°${units}):</label>
259-
<input type="number" id="pid_setpoint-${key}" value="${pid_setpoint || 30}"><br>
255+
<input type="number" id="pid_setpoint-${key}" value="${pid_setpoint || 30}">
260256
<label for="pid_p-${key}" title="Proportional (Kp): How strongly the fan reacts to the current temperature difference. Higher values mean a stronger reaction. Range: 0.1 - 10.0">Reaction Speed:</label>
261-
<input type="number" id="pid_kp-${key}" step="0.1" value="${pid_kp || 1.0}" min="0.1" max="10.0"><br>
257+
<input type="number" id="pid_kp-${key}" step="0.1" value="${pid_kp || 1.0}" min="0.1" max="10.0">
262258
<label for="pid_i-${key}" title="Integral (Ki): Corrects for small, steady-state temperature errors over time. Helps eliminate temperature drift. Range: 0.0 - 10.0">Correction Strength:</label>
263-
<input type="number" id="pid_ki-${key}" step="0.1" value="${pid_ki || 0.1}" min="0.0" max="10.0"><br>
259+
<input type="number" id="pid_ki-${key}" step="0.1" value="${pid_ki || 0.1}" min="0.0" max="10.0">
264260
<label for="pid_d-${key}" title="Derivative (Kd): Predicts future temperature changes and dampens the fan's reaction to prevent overshooting the target. Range: 0.0 - 10.0">Stability:</label>
265-
<input type="number" id="pid_kd-${key}" step="0.1" value="${pid_kd || 0.5}" min="0.0" max="10.0"><br>
261+
<input type="number" id="pid_kd-${key}" step="0.1" value="${pid_kd || 0.5}" min="0.0" max="10.0">
266262
</div>
267263
`);
268264
$('#tab-pid-' + key).append(pidControlsContainer);

data/rgb.html

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ <h2>Menu</h2>
2525
<div class="card">
2626
<h1>RGB Control</h1>
2727

28-
<form id="rgb-form">
28+
<form id="rgb-form" class="form-grid" style="gap: 15px 10px;">
2929
<label for="mode_led_0">Operation mode for ARGB header #1:</label>
30-
<br>
3130
<select name="mode_led_0" id="mode_led_0">
3231
<option value="0">Off</option>
3332
<option value="1">Static single color</option>
@@ -36,7 +35,6 @@ <h1>RGB Control</h1>
3635
<option value="4">Rainbow effect</option>
3736
<option value="5">Pass-through from the external source</option>
3837
</select>
39-
<br><br>
4038
<label for="num_leds_led_0">Amount of LEDs on the strip (<span id="num_leds_led_0_val">32</span>):</label>
4139
<input type="range" min="1" max="64" value="10" class="slider" id="num_leds_led_0" name="num_leds_led_0">
4240
<label for="start_color_led_0">ARGB 1 Color 1:</label>
@@ -46,10 +44,9 @@ <h1>RGB Control</h1>
4644
<label for="speed_led_0">Effect speed (<span id="speed_led_0_val">32</span>):</label>
4745
<input type="range" min="1" max="100" value="11" class="slider" id="speed_led_0" name="speed_led_0">
4846

49-
<hr>
47+
<hr style="grid-column: 1 / -1;">
5048

5149
<label for="mode_led_1">Operation mode for ARGB header #2:</label>
52-
<br>
5350
<select name="mode_led_1" id="mode_led_1">
5451
<option value="0">Off</option>
5552
<option value="1">Static single color</option>
@@ -58,19 +55,16 @@ <h1>RGB Control</h1>
5855
<option value="4">Rainbow effect</option>
5956
<option value="5">Pass-through from the external source</option>
6057
</select>
61-
<br><br>
6258
<label for="num_leds_led_1">Amount of LEDs on the strip (<span id="num_leds_led_1_val">32</span>):</label>
6359
<input type="range" min="1" max="64" value="12" class="slider" id="num_leds_led_1" name="num_leds_led_1">
64-
<br><br>
6560
<label for="start_color_led_1">ARGB 2 Color 1:</label>
6661
<input type="color" id="start_color_led_1" name="start_color_led_1" value="#0000ff">
6762
<label for="end_color_led_1">ARGB 2 Color 2:</label>
6863
<input type="color" id="end_color_led_1" name="end_color_led_1" value="#ff0000">
6964
<label for="speed_led_1">Effect speed (<span id="speed_led_1_val">32</span>):</label>
7065
<input type="range" min="1" max="100" value="13" class="slider" id="speed_led_1" name="speed_led_1">
71-
<br><br>
7266

73-
<button type="submit">Save Colors</button>
67+
<button type="submit" style="grid-column: 2;">Save Colors</button>
7468
</form>
7569
</div>
7670
</div>
@@ -94,6 +88,7 @@ <h1>RGB Control</h1>
9488
value = name.includes("color") ? toHexColorString(value) : value;
9589
$("#" + name + "_" + led_id).val(value);
9690

91+
console.log(name, led_id, value);
9792
if($("#" + name + "_" + led_id + "_val").length) {
9893
$("#" + name + "_" + led_id + "_val").text(value);
9994
}

data/settings.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h2>Menu</h2>
2626
<div class="card">
2727
<h1>WiFi Setup</h1>
2828

29-
<form id="wifi-form">
29+
<form id="wifi-form" class="form-grid" style="gap: 15px 10px;">
3030
<label for="ssid">WiFi Network:</label>
3131
<select id="ssid" name="ssid">
3232
<option value="">Scanning your WiFi networks, please wait..</option>
@@ -44,11 +44,10 @@ <h1>WiFi Setup</h1>
4444
<option value="F">Farenheit</option>
4545
</select>
4646

47-
<hr>
48-
<input type="checkbox" id="mqtt_enable" name="mqtt_enable" value="true" disabled>
49-
<label style="display: inline" for="mqtt_enable">Enable sending telemetry via MQTT</label>
50-
<br><br>
51-
47+
<hr style="grid-column: 1 / -1;">
48+
<label style="text-align: right;" for="mqtt_enable">Enable sending telemetry via MQTT</label>
49+
<input type="checkbox" id="mqtt_enable" name="mqtt_enable" value="true" disabled style="width: min-content;">
50+
5251
<label for="mqtt_broker">MQTT Broker:</label>
5352
<input type="text" id="mqtt_broker" name="mqtt_broker">
5453

@@ -75,7 +74,7 @@ <h1>WiFi Setup</h1>
7574
<input type="hidden" id="force_reboot" name="force_reboot" value="true">
7675
<input type="hidden" id="offline_mode" name="offline_mode" value="true">
7776

78-
<button type="submit">Save</button>
77+
<button type="submit" style="grid-column: 2;">Save</button>
7978
</form>
8079
<hr>
8180
<button id="reset" style="background-color: red">Factory Reset</button>

data/setup.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</div>
1818
<div>
1919
<h1>WiFi Setup</h1>
20-
<form id="wifi-form">
20+
<form id="wifi-form" class="form-grid" style="gap: 15px 10px;">
2121
<label for="ssid">WiFi Network:</label>
2222
<select id="ssid" name="ssid">
2323
<option value="">Scanning your WiFi networks, please wait..</option>
@@ -40,7 +40,7 @@ <h1>WiFi Setup</h1>
4040
<input type="hidden" id="force_reboot" name="force_reboot" value="false">
4141
<input type="hidden" id="offline_mode" name="offline_mode" value="true">
4242

43-
<button type="submit">Finish Setup & Connect</button>
43+
<button type="submit" style="grid-column: 2;">Finish Setup & Connect</button>
4444
</form>
4545
</div>
4646
</div>

data/styles.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ h1 {
8686
margin-bottom: 10px;
8787
}
8888

89+
.form-grid {
90+
display: grid;
91+
grid-template-columns: max-content 1fr;
92+
gap: 5px 10px;
93+
align-items: center;
94+
}
95+
96+
.form-grid label {
97+
text-align: left;
98+
margin-bottom: 0; /* Override default margin */
99+
}
100+
89101
.chart-container {
90102
display: inline-block;
91103
width: 640px;
@@ -267,7 +279,7 @@ input[type="text"],
267279
input[type="password"],
268280
input[type="number"],
269281
select {
270-
width: 100%;
282+
width: auto;
271283
padding: 12px;
272284
border: 1px solid #ccc;
273285
border-radius: 4px;
@@ -287,6 +299,7 @@ select:read-only {
287299
justify-content: center;
288300
align-items: center;
289301
min-height: 100vh;
302+
width: 100%;
290303
}
291304

292305
.card-content {

mock-ui/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func main() {
9999
h3 := fmt.Sprintf("%x", 7134613)
100100
h4 := fmt.Sprintf("%x", 5847134)
101101

102-
fmt.Fprintf(w, `{"LED_1": {"mode": 2, "speed": 69, "start_color": "#%s", "end_color": "#%s", "num_leds": 16}, "LED_2": {"mode": 1, "speed": 69, "start_color": "#%s", "end_color": "#%s", "num_leds": 59}}`, h1, h2, h3, h4)
102+
fmt.Fprintf(w, `{"LED_0": {"mode": 2, "speed": 69, "start_color": "%s", "end_color": "%s", "num_leds": 16}, "LED_1": {"mode": 1, "speed": 69, "start_color": "%s", "end_color": "%s", "num_leds": 59}}`, h1, h2, h3, h4)
103103
})
104104

105105
http.HandleFunc("/get-data", func(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)