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:
@@ -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 />
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,6 +46,8 @@ export default function Layout({ children }: LayoutProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<AudioPreloader />
|
||||
<div className="flex h-screen">
|
||||
<Sidebar />
|
||||
<div className="w-full flex flex-1 flex-col">
|
||||
@@ -60,6 +63,7 @@ export default function Layout({ children }: LayoutProps) {
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user