make prettier happy

This commit is contained in:
nikk gitanes
2024-02-16 22:03:20 +03:00
parent cbf7764d08
commit 913c067b87
3 changed files with 26 additions and 21 deletions

View File

@@ -6,6 +6,7 @@ import { shutdownHost } from 'utils/Hosts'
import { useTranslation } from 'react-i18next'
import { isStandaloneApp } from 'utils/Utils'
import useOnStandaloneAppOutsideClick from 'utils/useOnStandaloneAppOutsideClick'
import UnsafeButton from './UnsafeButton'
export default function CloseServer({ isOffline, isLoading }) {

View File

@@ -6,6 +6,7 @@ import DeleteIcon from '@material-ui/icons/Delete'
import { useState } from 'react'
import { torrentsHost } from 'utils/Hosts'
import { useTranslation } from 'react-i18next'
import UnsafeButton from './UnsafeButton'
const fnRemoveAll = () => {

View File

@@ -1,5 +1,5 @@
import { Button } from '@material-ui/core';
import { useEffect, useRef, useState } from 'react';
import { Button } from '@material-ui/core'
import { useEffect, useState } from 'react'
export default function UnsafeButton({ timeout, children, disabled, ...props }) {
const [timeLeft, setTimeLeft] = useState(timeout || 7)
@@ -11,11 +11,14 @@ export default function UnsafeButton({ timeout, children, disabled, ...props })
setButtonDisabled(disabled)
}
}
const getTimerText = () => !disabled && timeLeft > 0 ? ` (${timeLeft})` : ''
const getTimerText = () => (!disabled && timeLeft > 0 ? ` (${timeLeft})` : '')
useEffect(() => {
if (disabled || !timeLeft) { return }
if (disabled || !timeLeft) {
return
}
const intervalId = setInterval(handleTimerTick, 1000)
return () => clearInterval(intervalId)
// eslint-disable-next-line
}, [timeLeft])
return (