Update notification sound to notification.mp3

Replaces all references to hohoho.mp3 with notification.mp3 for notification sounds across the app. Moves AudioPreloader to layout component and removes duplicate usage. Adds a guard in BroadcastDialog to prevent duplicate sends.
This commit is contained in:
g
2025-12-28 19:21:02 +00:00
parent 07fa34d831
commit 96638f968f
9 changed files with 31 additions and 24 deletions

View File

@@ -5,7 +5,7 @@ export default function Document() {
<Html lang="en">
<Head>
<meta charSet="utf-8" />
<link rel="preload" href="/hohoho.mp3" as="audio" type="audio/mpeg" />
<link rel="preload" href="/notification.mp3" as="audio" type="audio/mpeg" />
</Head>
<body>
<Main />

View File

@@ -9,7 +9,6 @@ import KeepOnlineWrapper from "@/components/layout/KeepOnlineWrapper"
// Christmas theme disabled
// import { ChristmasDecorations } from "@/components/christmas-decorations"
// import { isDecember } from "@/lib/utils/christmas"
import { AudioPreloader } from "@/components/audio-preloader"
const inter = Inter({ subsets: ["latin"] })
@@ -79,7 +78,6 @@ export default function RootLayout({
<html lang="en" suppressHydrationWarning className="dark">
<body className={inter.className}>
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem disableTransitionOnChange>
<AudioPreloader />
<NotificationProvider>
{/* Christmas decorations disabled */}
<Toaster

View File

@@ -8,7 +8,7 @@ import { useEffect } from "react"
export function AudioPreloader() {
useEffect(() => {
// Preload the audio file
const audio = new Audio('/hohoho.mp3')
const audio = new Audio('/notification.mp3')
audio.preload = 'auto'
// Try to load it immediately

View File

@@ -130,9 +130,9 @@ export default function ChatDetail({ chatId }: { chatId: string }) {
// Initialize audio element
useEffect(() => {
// Create audio element for notification sound
audioRef.current = new Audio('/hohoho.mp3');
audioRef.current = new Audio('/notification.mp3');
// Fallback if hohoho.mp3 doesn't exist - use browser API for a simple beep
// Fallback if notification.mp3 doesn't exist - use browser API for a simple beep
audioRef.current.addEventListener('error', () => {
audioRef.current = null;
});

View File

@@ -81,7 +81,7 @@ export default function ChatTable() {
// Initialize audio element for notifications
useEffect(() => {
audioRef.current = new Audio('/hohoho.mp3');
audioRef.current = new Audio('/notification.mp3');
return () => {
if (audioRef.current) {
audioRef.current = null;

View File

@@ -5,6 +5,7 @@ import { useTheme } from "next-themes"
import { usePathname } from "next/navigation"
import Sidebar from "./sidebar"
import UnifiedNotifications from "@/components/notifications/UnifiedNotifications"
import { AudioPreloader } from "@/components/audio-preloader"
import type React from "react"
interface LayoutProps {
@@ -45,21 +46,24 @@ export default function Layout({ children }: LayoutProps) {
}
return (
<div className="flex h-screen">
<Sidebar />
<div className="w-full flex flex-1 flex-col">
{!isChatDetailPage && !isAdminPage && (
<header className="h-16 border-b border-border flex items-center justify-end px-6 bg-background">
<div className="flex items-center space-x-2">
<UnifiedNotifications />
</div>
</header>
)}
<main className={`flex-1 ${isChatDetailPage ? 'p-0 overflow-hidden' : 'p-6 overflow-auto'} bg-background relative`}>
{children}
</main>
<>
<AudioPreloader />
<div className="flex h-screen">
<Sidebar />
<div className="w-full flex flex-1 flex-col">
{!isChatDetailPage && !isAdminPage && (
<header className="h-16 border-b border-border flex items-center justify-end px-6 bg-background">
<div className="flex items-center space-x-2">
<UnifiedNotifications />
</div>
</header>
)}
<main className={`flex-1 ${isChatDetailPage ? 'p-0 overflow-hidden' : 'p-6 overflow-auto'} bg-background relative`}>
{children}
</main>
</div>
</div>
</div>
</>
)
}

View File

@@ -83,6 +83,11 @@ export default function BroadcastDialog({ open, setOpen }: BroadcastDialogProps)
};
const sendBroadcast = async () => {
// Prevent duplicate sends
if (isSending) {
return;
}
if ((!broadcastMessage || !broadcastMessage.trim()) && !selectedImage) {
toast.warning("Please provide a message or image to broadcast.");
return;

View File

@@ -33,9 +33,9 @@ export default function OrderNotifications() {
const audioRef = useRef<HTMLAudioElement | null>(null);
useEffect(() => {
audioRef.current = new Audio('/hohoho.mp3');
audioRef.current = new Audio('/notification.mp3');
// Fallback if hohoho.mp3 doesn't exist
// Fallback if notification.mp3 doesn't exist
audioRef.current.addEventListener('error', () => {
audioRef.current = null;
});

View File

@@ -92,7 +92,7 @@ export function NotificationProvider({ children }: NotificationProviderProps) {
}
// Initialize audio
audioRef.current = new Audio('/hohoho.mp3');
audioRef.current = new Audio('/notification.mp3');
audioRef.current.addEventListener('error', () => {
audioRef.current = null;
});