@@ -2,6 +2,7 @@ import React, { useEffect } from "react";
22import { Label } from "semantic-ui-react" ;
33import timerAudio from "./timeupsound.mp3" ;
44import { usePlayer } from "../../../hooks/player" ;
5+ import { checkPermissions } from "../../../utils/notifications" ;
56
67interface QuestionTimerProps {
78 questionStartTime : string ;
@@ -14,7 +15,7 @@ const QuestionTimer = ({
1415 const [ , , play ] = usePlayer ( timerAudio ) ;
1516 const now = Date . now ( ) ;
1617 const diff =
17- ( timerStartTime / 10 ) * 60 * 1000 -
18+ timerStartTime * 60 * 1000 -
1819 ( now - new Date ( questionStartTime ) . getTime ( ) ) ;
1920 const minutes = Math . floor ( Math . abs ( diff ) / ( 1000 * 60 ) ) ;
2021 const seconds = Math . floor ( ( Math . abs ( diff ) % ( 1000 * 60 ) ) / 1000 ) ;
@@ -23,9 +24,10 @@ const QuestionTimer = ({
2324 // Play a sound effect when hit zero (once)
2425 useEffect ( ( ) => {
2526 if ( minutes + seconds === 0 ) {
26- play . current (
27- `Timer is up! You have answered this question for ${ timerStartTime } minute(s).`
28- ) ;
27+ if ( ! checkPermissions ( ) )
28+ play . current (
29+ `Timer is up! You have answered this question for ${ timerStartTime } minute(s).`
30+ ) ;
2931 }
3032 } , [ sign ] ) ;
3133 const formated = `${ sign } ${ minutes . toString ( ) . padStart ( 2 , "0" ) } :${ seconds
0 commit comments