Apply IconSelect to all type selectors across the app
- Value source type (5 types, static icons) - Device type (7 types, new wifi/usb icon paths + device icon map) - Capture engine (dynamic from API, uses getEngineIcon) - Audio engine (dynamic from API, new getAudioEngineIcon) - Add i18n description keys for value source and device types - Fix trigger button styling to match native input height Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
ICON_MUSIC, ICON_TRENDING_UP, ICON_MAP_PIN, ICON_MONITOR, ICON_REFRESH,
|
||||
} from '../core/icons.js';
|
||||
import { wrapCard } from '../core/card-colors.js';
|
||||
import { IconSelect } from '../core/icon-select.js';
|
||||
import { loadPictureSources } from './streams.js';
|
||||
|
||||
export { getValueSourceIcon };
|
||||
@@ -58,6 +59,28 @@ class ValueSourceModal extends Modal {
|
||||
|
||||
const valueSourceModal = new ValueSourceModal();
|
||||
|
||||
/* ── Icon-grid type selector ──────────────────────────────────── */
|
||||
|
||||
const VS_TYPE_KEYS = ['static', 'animated', 'audio', 'adaptive_time', 'adaptive_scene'];
|
||||
|
||||
function _buildVSTypeItems() {
|
||||
return VS_TYPE_KEYS.map(key => ({
|
||||
value: key,
|
||||
icon: getValueSourceIcon(key),
|
||||
label: t(`value_source.type.${key}`),
|
||||
desc: t(`value_source.type.${key}.desc`),
|
||||
}));
|
||||
}
|
||||
|
||||
let _vsTypeIconSelect = null;
|
||||
|
||||
function _ensureVSTypeIconSelect() {
|
||||
const sel = document.getElementById('value-source-type');
|
||||
if (!sel) return;
|
||||
if (_vsTypeIconSelect) { _vsTypeIconSelect.updateItems(_buildVSTypeItems()); return; }
|
||||
_vsTypeIconSelect = new IconSelect({ target: sel, items: _buildVSTypeItems(), columns: 2 });
|
||||
}
|
||||
|
||||
// ── Modal ─────────────────────────────────────────────────────
|
||||
|
||||
export async function showValueSourceModal(editData) {
|
||||
@@ -69,6 +92,7 @@ export async function showValueSourceModal(editData) {
|
||||
document.getElementById('value-source-id').value = isEdit ? editData.id : '';
|
||||
document.getElementById('value-source-error').style.display = 'none';
|
||||
|
||||
_ensureVSTypeIconSelect();
|
||||
const typeSelect = document.getElementById('value-source-type');
|
||||
document.getElementById('value-source-type-group').style.display = isEdit ? 'none' : '';
|
||||
|
||||
@@ -142,6 +166,7 @@ export async function closeValueSourceModal() {
|
||||
|
||||
export function onValueSourceTypeChange() {
|
||||
const type = document.getElementById('value-source-type').value;
|
||||
if (_vsTypeIconSelect) _vsTypeIconSelect.setValue(type);
|
||||
document.getElementById('value-source-static-section').style.display = type === 'static' ? '' : 'none';
|
||||
document.getElementById('value-source-animated-section').style.display = type === 'animated' ? '' : 'none';
|
||||
document.getElementById('value-source-audio-section').style.display = type === 'audio' ? '' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user