Skip to content

Commit

Permalink
Merge pull request #61 from nethesis/wrongAlertView
Browse files Browse the repository at this point in the history
Fix regression issues post v0.8.21

- Added safe list for unused Tailwind CSS classes
- Fixed view during call alerts
- Removed incorrect control in ringing function in Socket.tsx
  • Loading branch information
tonyco97 authored Nov 7, 2024
2 parents 629cb94 + 8c6dd2b commit 0ee4031
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 237 deletions.
15 changes: 2 additions & 13 deletions src/components/CallView/Timer.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
// Copyright (C) 2024 Nethesis S.r.l.
// SPDX-License-Identifier: AGPL-3.0-or-later

import React, { useState, useEffect, type FC } from 'react'
import React, { FC } from 'react'
import { useSelector } from 'react-redux'
import { RootState } from '../../store'
import { StyledTimer } from '../../styles/Island.styles'
import Moment from 'react-moment'

const Timer: FC<TimerProps> = ({ size = 'large', startTime, isHome }) => {
// Set timer negative differences
const [timerNegativeDifference, setTimerNegativeDifference] = useState<number>(0)
// Get isOpen from the island store
const { isOpen } = useSelector((state: RootState) => state.island)

useEffect(() => {
if (startTime) {
const difference = new Date().getTime() / 1000 - Number(startTime)
if (difference < 0) {
setTimerNegativeDifference(difference)
}
}
}, [startTime])

return (
<>
{startTime != null && (
<StyledTimer isOpen={isOpen} size={size}>
<Moment
date={Number(startTime) + timerNegativeDifference || new Date().getTime() / 1000}
date={Number(startTime)}
interval={1000}
format='h:mm:ss'
trim={false}
Expand Down
Loading

0 comments on commit 0ee4031

Please sign in to comment.