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:
dadaloop82
2026-05-26 12:17:18 +00:00
parent 875250626d
commit be3dceeebb
5 changed files with 15 additions and 8 deletions
+11 -8
View File
@@ -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;