feat: play sound effect on new text particle

This commit is contained in:
talksik
2026-03-21 18:06:58 -07:00
parent 4a4d213eb6
commit f6ee5e998a
3 changed files with 12 additions and 1 deletions
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
declare module "*.wav" {
const src: string;
export default src;
}
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useRef } from "react";
import { useNavigate } from "react-router-dom";
import beepSound from "../../../assets/sound.wav";
import {
Radio,
MessageSquare,
@@ -103,9 +104,15 @@ function StreamRow({
if (latestChild.id === settledIdRef.current) return;
settledIdRef.current = latestChild.id;
if (latestChild.type !== "media") return;
if (latestChild.created_by_email === userEmail) return;
if (latestChild.type === "text") {
new Audio(beepSound).play().catch(() => {});
return;
}
if (latestChild.type !== "media") return;
useAutoplayStore.getState().play(latestChild, particle.id);
}, [latestChild?.id]); // eslint-disable-line react-hooks/exhaustive-deps