Skip to content

Commit

Permalink
ベルを2回鳴らす
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Nov 4, 2024
1 parent d8832f8 commit 40149ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Binary file added pos/app/assets/bell_twice.mp3
Binary file not shown.
18 changes: 4 additions & 14 deletions pos/app/components/pages/CashierV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { WithId } from "common/lib/typeguard";
import type { ItemEntity } from "common/models/item";
import type { OrderEntity } from "common/models/order";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import bellSound from "~/assets/bell.mp3";
import bellTwice from "~/assets/bell_twice.mp3";
import { Switch } from "~/components/ui/switch";
import { usePrinter } from "~/label/print-util";
import { cn } from "~/lib/utils";
Expand Down Expand Up @@ -47,17 +47,10 @@ const CashierV2 = ({ items, orders, submitPayload, syncOrder }: props) => {
const [menuOpen, setMenuOpen] = useState(false);
const [UISession, renewUISession] = useUISession();
const { nextOrderId } = useLatestOrderId(orders);
const soundRef1 = useRef<HTMLAudioElement>(null);
const soundRef2 = useRef<HTMLAudioElement>(null);
const soundRef = useRef<HTMLAudioElement>(null);

const playSound = useCallback(() => {
soundRef1.current?.play();
const timer = setTimeout(() => {
soundRef2.current?.play();
}, 500);
return () => {
clearTimeout(timer);
};
soundRef.current?.play();
}, []);

useSyncCahiserOrder(newOrder, syncOrder);
Expand Down Expand Up @@ -255,10 +248,7 @@ const CashierV2 = ({ items, orders, submitPayload, syncOrder }: props) => {
/>
</div>
</div>
<audio src={bellSound} ref={soundRef1}>
<track kind="captions" />
</audio>
<audio src={bellSound} ref={soundRef2}>
<audio src={bellTwice} ref={soundRef}>
<track kind="captions" />
</audio>
</div>
Expand Down

0 comments on commit 40149ac

Please sign in to comment.