feat(04-01): add mute button with CSS, wire audio toggle in main.ts

- Add mute-btn element to index.html outside all screen sections
- Add .mute-btn CSS styles (fixed position, bottom-right, circular)
- Wire mute button click handler to toggle audioEnabled in Settings
- Initialize AudioContext on first user interaction (autoplay policy)
- Fix lint issues: import ordering, non-null assertion
This commit is contained in:
2026-03-29 18:18:31 +02:00
parent 370b76725b
commit 52596c57b0
5 changed files with 90 additions and 6 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import { getSettings } from "../storage/db";
import { getDB } from "../app";
import { getSettings } from "../storage/db";
let audioCtx: AudioContext | null = null;
@@ -83,12 +83,12 @@ export async function playRewardSound(): Promise<void> {
const noteDuration = 0.15;
const now = ctx.currentTime;
for (let i = 0; i < notes.length; i++) {
for (const [i, freq] of notes.entries()) {
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.type = "sine";
osc.frequency.value = notes[i]!;
osc.frequency.value = freq;
gain.gain.value = 0.12;
osc.connect(gain);