feat: add separate sound beep test button + always show move modal on open
- Add testSound() function: plays AudioContext beep independently of TTS
- Add '🔔 Esegui Test Suono' button in TTS settings (above voice test btn)
- Add translations: settings.tts.test_sound_btn (it/en/de)
- Remove hasOtherLocs guard in showMoveAfterUseModal: always show
location-choice modal when opening a package, regardless of whether
the product already exists in other locations (e.g. peas only in pantry
→ user can now choose to move opened portion to fridge)
This commit is contained in:
+11
-8
@@ -9390,14 +9390,6 @@ function showMoveAfterUseModal(product, fromLoc, remaining, openedId, openedVacu
|
||||
return;
|
||||
}
|
||||
|
||||
// If the product only exists at fromLoc (no other active locations), there is
|
||||
// nothing to move — auto-stay silently without showing the modal.
|
||||
const hasOtherLocs = (_useCurrentItems || []).some(i => i.location !== fromLoc);
|
||||
if (!hasOtherLocs) {
|
||||
_saveVacuumAndStay(openedId || 0);
|
||||
return;
|
||||
}
|
||||
|
||||
const otherLocs = Object.entries(LOCATIONS).filter(([k]) => k !== fromLoc);
|
||||
const locButtons = otherLocs.map(([k, v]) =>
|
||||
`<button type="button" class="loc-btn" onclick="clearMoveModalTimer();confirmMoveAfterUse(${product.id}, '${fromLoc}', '${k}', ${openedId || 0})">${v.icon} ${v.label}</button>`
|
||||
@@ -14156,6 +14148,17 @@ function _speakBrowser(text) {
|
||||
}
|
||||
}
|
||||
|
||||
function testSound() {
|
||||
const statusEl = document.getElementById('tts-test-status');
|
||||
_ensureAudioUnlocked();
|
||||
_playCookingTimerSound('done');
|
||||
if (statusEl) {
|
||||
statusEl.style.display = 'block';
|
||||
statusEl.className = 'settings-status success';
|
||||
statusEl.textContent = '🔔 Suono inviato — hai sentito un beep?';
|
||||
}
|
||||
}
|
||||
|
||||
async function testTTS() {
|
||||
const statusEl = document.getElementById('tts-test-status');
|
||||
const enabled = document.getElementById('setting-tts-enabled')?.checked;
|
||||
|
||||
@@ -1314,6 +1314,7 @@
|
||||
</div>
|
||||
</div><!-- /tts-server-section -->
|
||||
|
||||
<button class="btn btn-large btn-secondary full-width mt-2" onclick="testSound()" data-i18n="settings.tts.test_sound_btn">🔔 Esegui Test Suono</button>
|
||||
<button class="btn btn-large btn-accent full-width mt-2" onclick="testTTS()" data-i18n="settings.tts.test_btn">🔊 Invia Test Vocale</button>
|
||||
<div id="tts-test-status" style="display:none;margin-top:8px"></div>
|
||||
<!-- HA TTS quick-fill hint -->
|
||||
|
||||
@@ -693,6 +693,7 @@
|
||||
"extra_fields_label": "➕ Zusätzliche Felder (JSON)",
|
||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||
"extra_fields_hint": "Zusätzliche Felder im Payload, im JSON-Format. Leer lassen wenn nicht benötigt.",
|
||||
"test_sound_btn": "🔔 Klangtest ausführen",
|
||||
"test_btn": "🔊 Testansage senden",
|
||||
"voices_loading": "Stimmen werden geladen…",
|
||||
"voice_not_supported": "Stimme vom Browser nicht unterstützt",
|
||||
|
||||
@@ -693,6 +693,7 @@
|
||||
"extra_fields_label": "➕ Extra fields (JSON)",
|
||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||
"extra_fields_hint": "Additional fields to include in the payload, in JSON format. Leave empty if not needed.",
|
||||
"test_sound_btn": "🔔 Run Sound Test",
|
||||
"test_btn": "🔊 Send Test Voice",
|
||||
"voices_loading": "Loading voices…",
|
||||
"voice_not_supported": "Voice not supported by this browser",
|
||||
|
||||
@@ -693,6 +693,7 @@
|
||||
"extra_fields_label": "➕ Campi extra (JSON)",
|
||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||
"extra_fields_hint": "Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.",
|
||||
"test_sound_btn": "🔔 Esegui Test Suono",
|
||||
"test_btn": "🔊 Invia Test Vocale",
|
||||
"voices_loading": "Caricamento voci…",
|
||||
"voice_not_supported": "Voce non supportata dal browser",
|
||||
|
||||
Reference in New Issue
Block a user