ccfb674318
continuous-integration/drone/push Build is passing
- Implement Social Features: Shared Tasks, Global Access, Privacy Settings (Leaderboard/Searchable). - Add Leaderboard Page and API. - Enhance Auth: Support Email/Username login, explicit duplicate registration errors. - Fix: Admin login password hash regression. - Refactor: Move to wouter for routing, add Admin Dashboard and User Management. - Add Setup Wizard. - Update UI with Sidebar and Gamification elements.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
// Simple sound effects using base64 or public URLs to avoid asset management issues for this demo
|
|
// Using a short "pop" sound
|
|
|
|
const POP_SOUND = "data:audio/wav;base64,UklGRl9vT19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YU"; // Placeholder, real sound below
|
|
|
|
export const playSuccessSound = () => {
|
|
// A simple pleasant "pop" sound frequency sequence using Web Audio API for zero-dependency
|
|
try {
|
|
const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
|
|
if (!AudioContext) return;
|
|
|
|
const ctx = new AudioContext();
|
|
const osc = ctx.createOscillator();
|
|
const gain = ctx.createGain();
|
|
|
|
osc.connect(gain);
|
|
gain.connect(ctx.destination);
|
|
|
|
osc.type = 'sine';
|
|
osc.frequency.setValueAtTime(800, ctx.currentTime);
|
|
osc.frequency.exponentialRampToValueAtTime(1200, ctx.currentTime + 0.1);
|
|
|
|
gain.gain.setValueAtTime(0.3, ctx.currentTime);
|
|
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);
|
|
|
|
osc.start(ctx.currentTime);
|
|
osc.stop(ctx.currentTime + 0.1);
|
|
} catch (e) {
|
|
console.error("Audio play failed", e);
|
|
}
|
|
};
|