- Enhance fetchWithAuth with auto-401, retry w/ exponential backoff, timeout - Remove ~40 manual 401 checks across 10 feature files - Fix state: brightness cache setter, manual edit flag resets, static import - Add ARIA: role=dialog/tablist, aria-modal, aria-labelledby, aria-selected - Add focus trapping in Modal base class, aria-expanded on hint toggles - Fix WCAG AA color contrast with --primary-text-color variable - Add i18n pluralization (CLDR rules for en/ru), getCurrentLocale export - Replace hardcoded strings in dashboard.js and profiles.js - Add data-i18n-aria-label support, 20 new keys in en.json and ru.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
90 lines
6.2 KiB
HTML
90 lines
6.2 KiB
HTML
<!-- Add Device Modal -->
|
|
<div id="add-device-modal" class="modal" role="dialog" aria-modal="true" aria-labelledby="add-device-modal-title">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h2 id="add-device-modal-title" data-i18n="devices.add">Add New Device</h2>
|
|
<div class="modal-header-actions">
|
|
<button type="button" class="modal-header-btn" id="scan-network-btn" onclick="scanForDevices()" data-i18n-title="device.scan" title="Auto Discovery">🔍</button>
|
|
<button class="modal-close-btn" onclick="closeAddDeviceModal()" title="Close" data-i18n-aria-label="aria.close">✕</button>
|
|
</div>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div id="discovery-section" class="discovery-section" style="display: none;">
|
|
<div id="discovery-loading" class="discovery-loading" style="display: none;">
|
|
<span class="discovery-spinner"></span>
|
|
</div>
|
|
<div id="discovery-list" class="discovery-list"></div>
|
|
<div id="discovery-empty" style="display: none;">
|
|
<small data-i18n="device.scan.empty">No devices found</small>
|
|
</div>
|
|
<hr class="modal-divider">
|
|
</div>
|
|
<form id="add-device-form">
|
|
<div class="form-group">
|
|
<div class="label-row">
|
|
<label for="device-type" data-i18n="device.type">Device Type:</label>
|
|
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
|
|
</div>
|
|
<small class="input-hint" style="display:none" data-i18n="device.type.hint">Select the type of LED controller</small>
|
|
<select id="device-type" onchange="onDeviceTypeChanged()">
|
|
<option value="wled">WLED</option>
|
|
<option value="adalight">Adalight</option>
|
|
<option value="ambiled">AmbiLED</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="device-name" data-i18n="device.name">Device Name:</label>
|
|
<input type="text" id="device-name" data-i18n-placeholder="device.name.placeholder" placeholder="Living Room TV" required>
|
|
</div>
|
|
<div class="form-group" id="device-url-group">
|
|
<div class="label-row">
|
|
<label for="device-url" id="device-url-label" data-i18n="device.url">URL:</label>
|
|
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
|
|
</div>
|
|
<small class="input-hint" style="display:none" id="device-url-hint" data-i18n="device.url.hint">IP address or hostname of the device (e.g. http://192.168.1.100)</small>
|
|
<input type="text" id="device-url" data-i18n-placeholder="device.url.placeholder" placeholder="http://192.168.1.100" required>
|
|
</div>
|
|
<div class="form-group" id="device-serial-port-group" style="display: none;">
|
|
<div class="label-row">
|
|
<label for="device-serial-port" id="device-serial-port-label" data-i18n="device.serial_port">Serial Port:</label>
|
|
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
|
|
</div>
|
|
<small class="input-hint" style="display:none" data-i18n="device.serial_port.hint">Select the COM port of the Adalight device</small>
|
|
<select id="device-serial-port" onfocus="onSerialPortFocus()"></select>
|
|
</div>
|
|
<div class="form-group" id="device-led-count-group" style="display: none;">
|
|
<div class="label-row">
|
|
<label for="device-led-count" data-i18n="device.led_count">LED Count:</label>
|
|
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
|
|
</div>
|
|
<small class="input-hint" style="display:none" data-i18n="device.led_count_manual.hint">Number of LEDs on the strip (must match your Arduino sketch)</small>
|
|
<input type="number" id="device-led-count" min="1" max="10000" placeholder="60" oninput="updateBaudFpsHint()">
|
|
</div>
|
|
<div class="form-group" id="device-baud-rate-group" style="display: none;">
|
|
<div class="label-row">
|
|
<label for="device-baud-rate" data-i18n="device.baud_rate">Baud Rate:</label>
|
|
<button type="button" class="hint-toggle" onclick="toggleHint(this)" title="?">?</button>
|
|
</div>
|
|
<small class="input-hint" style="display:none" data-i18n="device.baud_rate.hint">Serial communication speed. Higher = more FPS but requires matching Arduino sketch.</small>
|
|
<select id="device-baud-rate" onchange="updateBaudFpsHint()">
|
|
<option value="115200">115200</option>
|
|
<option value="230400">230400</option>
|
|
<option value="460800">460800</option>
|
|
<option value="500000">500000</option>
|
|
<option value="921600">921600</option>
|
|
<option value="1000000">1000000</option>
|
|
<option value="1500000">1500000</option>
|
|
<option value="2000000">2000000</option>
|
|
</select>
|
|
<small id="baud-fps-hint" class="fps-hint" style="display:none"></small>
|
|
</div>
|
|
<div id="add-device-error" class="error-message" style="display: none;"></div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-icon btn-secondary" onclick="closeAddDeviceModal()" title="Cancel" data-i18n-aria-label="aria.cancel">✕</button>
|
|
<button class="btn btn-icon btn-primary" onclick="document.getElementById('add-device-form').requestSubmit()" title="Add Device" data-i18n-aria-label="aria.save">✓</button>
|
|
</div>
|
|
</div>
|
|
</div>
|