Skip to content

Commit

Permalink
re fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
amDeimos666 committed Jun 10, 2023
1 parent ccc5ea2 commit 9d2b860
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,38 @@ export const ExplorationConfig: FC = () => {
};

useEffect(() => {
let interval: any = null;
let interval: ReturnType<typeof setInterval> | undefined;
const intervalMs = 1000;
if (isTimerActive) {
interval = setInterval(() => {
setTimerDisplay(getTimeRemaining());
setTimeRemaining(timeRemaining - intervalMs);
}, intervalMs);
} else if (!isTimerActive && timeRemaining !== 0) {
clearInterval(interval);
if (interval !== undefined) {
clearInterval(interval);
}
setTimerDisplay('00:00');
}
return () => clearInterval(interval);
}, [isTimerActive, timeRemaining]);

const getTimeRemaining = () => {
const total = countDownDate - Date.now();
const getTimeRemaining = () => {
const total = countDownDate - Date.now();

const minutes = Math.floor((total % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((total % (1000 * 60)) / 1000);
const minutes = Math.floor((total % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((total % (1000 * 60)) / 1000);

const minutesDiplay = minutes < 10 ? '0' + minutes : minutes.toString();
const secondsDiplay = seconds < 10 ? '0' + seconds : seconds.toString();
const minutesDiplay =
minutes < 10 ? '0' + minutes.toString() : minutes.toString();
const secondsDiplay =
seconds < 10 ? '0' + seconds.toString() : seconds.toString();

if (total < 0) {
setIsTimerActive(false);
}
return `${minutesDiplay}:${secondsDiplay}`;
};
if (total < 0) {
setIsTimerActive(false);
}
return `${minutesDiplay}:${secondsDiplay}`;
};
return () => clearInterval(interval);
}, [isTimerActive, countDownDate, timeRemaining]);

const setRosExplorationTimer = () => {
rosClient
Expand Down

0 comments on commit 9d2b860

Please sign in to comment.