Help with 25+5 project

Hi!!
if you have some time can you pleas check my code on codepen and tell me what’s wrong with my code ,
i’ve been stuck on this project for more than 2 weeks ,i tried everything that came to my mind ,and wrote the whole thing few times,every time i solve a bug a new one appear ,maybe my logic is missed up.

here’s a sample of the code:

React.useEffect(() => {

  if(play){
    const interval = setInterval(() => {
      clearInterval(interval);
    if(sec === 0){
      if(min === 0){
        setData(prev => (
          {...prev,period: prev.period == "Session" ? "Break" : "Session"}));
        audioRef.current.play();
        setMin(data.period === "Session" ? (data.session) : (data.break));
        setSec(59);
        setMin(prev => prev -1)
      }
      else{
        setMin(prev => prev -1);
        setSec(59);
      }
      }
      else{
        setSec(prev => prev -1)
      }
      
  },1000)
  }
  
},[sec,play])

https://codepen.io/3xo13/pen/XWEMmME?editors=0010