diff options
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/UpdateController.jsx | 22 | ||||
-rw-r--r-- | modern/src/login/LoginPage.jsx | 2 | ||||
-rw-r--r-- | modern/src/main/DeviceRow.jsx | 6 | ||||
-rw-r--r-- | modern/src/other/PositionPage.jsx | 1 | ||||
-rw-r--r-- | modern/src/reports/EventReportPage.jsx | 4 | ||||
-rw-r--r-- | modern/src/reports/LogsPage.jsx | 4 | ||||
-rw-r--r-- | modern/src/settings/UserPage.jsx | 3 | ||||
-rw-r--r-- | modern/src/settings/UsersPage.jsx | 8 |
8 files changed, 24 insertions, 26 deletions
diff --git a/modern/src/UpdateController.jsx b/modern/src/UpdateController.jsx index 0b2b7985..80ca6dc2 100644 --- a/modern/src/UpdateController.jsx +++ b/modern/src/UpdateController.jsx @@ -1,12 +1,12 @@ import { Snackbar, IconButton } from '@mui/material'; import RefreshIcon from '@mui/icons-material/Refresh'; -import React from 'react' +import React from 'react'; import { useSelector } from 'react-redux'; +import { useRegisterSW } from 'virtual:pwa-register/react'; import { useTranslation } from './common/components/LocalizationProvider'; -import { useRegisterSW } from 'virtual:pwa-register/react' // Based on https://vite-pwa-org.netlify.app/frameworks/react.html -function UpdateController() { +const UpdateController = () => { const t = useTranslation(); const swUpdateInterval = useSelector((state) => state.session.server.attributes.serviceWorkerUpdateInterval || 3600000); @@ -21,30 +21,30 @@ function UpdateController() { if (!(!swRegistration.installing && navigator)) { return; } - + if (('connection' in navigator) && !navigator.onLine) { return; } - + const newSW = await fetch(swUrl, { cache: 'no-store', headers: { - 'cache': 'no-store', + cache: 'no-store', 'cache-control': 'no-cache', }, }); - + if (newSW?.status === 200) { await swRegistration.update(); } }, swUpdateInterval); } - } + }, }); return ( - <Snackbar - open={needRefresh} + <Snackbar + open={needRefresh} message={t('settingsUpdateAvailable')} action={( <IconButton color="inherit" onClick={() => updateServiceWorker(true)}> @@ -53,6 +53,6 @@ function UpdateController() { )} /> ); -} +}; export default UpdateController; diff --git a/modern/src/login/LoginPage.jsx b/modern/src/login/LoginPage.jsx index 6cca2837..62aa4a6b 100644 --- a/modern/src/login/LoginPage.jsx +++ b/modern/src/login/LoginPage.jsx @@ -96,7 +96,7 @@ const LoginPage = () => { const query = `email=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`; const response = await fetch('/api/session', { method: 'POST', - body: new URLSearchParams(code.length ? query + `&code=${code}` : query), + body: new URLSearchParams(code.length ? `${query}&code=${code}` : query), }); if (response.ok) { const user = await response.json(); diff --git a/modern/src/main/DeviceRow.jsx b/modern/src/main/DeviceRow.jsx index 8d40e139..d9c1a189 100644 --- a/modern/src/main/DeviceRow.jsx +++ b/modern/src/main/DeviceRow.jsx @@ -119,15 +119,15 @@ const DeviceRow = ({ data, index, style }) => { {position.attributes.hasOwnProperty('batteryLevel') && ( <Tooltip title={`${t('positionBatteryLevel')}: ${formatPercentage(position.attributes.batteryLevel)}`}> <IconButton size="small"> - {position.attributes.batteryLevel > 70 ? ( + {(position.attributes.batteryLevel > 70 && ( position.attributes.charge ? (<BatteryChargingFullIcon fontSize="small" className={classes.success} />) : (<BatteryFullIcon fontSize="small" className={classes.success} />) - ) : position.attributes.batteryLevel > 30 ? ( + )) || (position.attributes.batteryLevel > 30 && ( position.attributes.charge ? (<BatteryCharging60Icon fontSize="small" className={classes.warning} />) : (<Battery60Icon fontSize="small" className={classes.warning} />) - ) : ( + )) || ( position.attributes.charge ? (<BatteryCharging20Icon fontSize="small" className={classes.error} />) : (<Battery20Icon fontSize="small" className={classes.error} />) diff --git a/modern/src/other/PositionPage.jsx b/modern/src/other/PositionPage.jsx index 3ed3498c..f253cd2c 100644 --- a/modern/src/other/PositionPage.jsx +++ b/modern/src/other/PositionPage.jsx @@ -8,7 +8,6 @@ import makeStyles from '@mui/styles/makeStyles'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import { useNavigate, useParams } from 'react-router-dom'; import { useEffectAsync } from '../reactHelper'; -import { prefixString } from '../common/util/stringUtils'; import { useTranslation } from '../common/components/LocalizationProvider'; import PositionValue from '../common/components/PositionValue'; import usePositionAttributes from '../common/attributes/usePositionAttributes'; diff --git a/modern/src/reports/EventReportPage.jsx b/modern/src/reports/EventReportPage.jsx index 10b539ab..5ffc8ac3 100644 --- a/modern/src/reports/EventReportPage.jsx +++ b/modern/src/reports/EventReportPage.jsx @@ -204,7 +204,7 @@ const EventReportPage = () => { {!loading ? items.map((item) => ( <TableRow key={item.id}> <TableCell className={classes.columnAction} padding="none"> - {item.positionId ? selectedItem === item ? ( + {(item.positionId && (selectedItem === item ? ( <IconButton size="small" onClick={() => setSelectedItem(null)}> <GpsFixedIcon fontSize="small" /> </IconButton> @@ -212,7 +212,7 @@ const EventReportPage = () => { <IconButton size="small" onClick={() => setSelectedItem(item)}> <LocationSearchingIcon fontSize="small" /> </IconButton> - ) : ''} + ))) || ''} </TableCell> {columns.map((key) => ( <TableCell key={key}> diff --git a/modern/src/reports/LogsPage.jsx b/modern/src/reports/LogsPage.jsx index 4b689944..7bdbd309 100644 --- a/modern/src/reports/LogsPage.jsx +++ b/modern/src/reports/LogsPage.jsx @@ -41,7 +41,7 @@ const LogsPage = () => { const registerDevice = (uniqueId) => { const query = new URLSearchParams({ uniqueId }); navigate(`/settings/device?${query.toString()}`); - } + }; return ( <PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'statisticsTitle']}> @@ -55,7 +55,7 @@ const LogsPage = () => { </TableRow> </TableHead> <TableBody> - {items.map((item, index) => ( + {items.map((item, index) => /* eslint-disable react/no-array-index-key */ ( <TableRow key={index}> <TableCell className={classes.columnAction} padding="none"> {item.deviceId ? ( diff --git a/modern/src/settings/UserPage.jsx b/modern/src/settings/UserPage.jsx index 02312a86..4e0cab2c 100644 --- a/modern/src/settings/UserPage.jsx +++ b/modern/src/settings/UserPage.jsx @@ -18,7 +18,6 @@ import { IconButton, OutlinedInput, } from '@mui/material'; -import makeStyles from '@mui/styles/makeStyles'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; import CachedIcon from '@mui/icons-material/Cached'; @@ -84,7 +83,7 @@ const UserPage = () => { const handleGenerateTotp = useCatch(async () => { const response = await fetch('/api/users/totp', { method: 'POST' }); if (response.ok) { - setItem({ ...item, totpKey: await response.text() }) + setItem({ ...item, totpKey: await response.text() }); } else { throw Error(await response.text()); } diff --git a/modern/src/settings/UsersPage.jsx b/modern/src/settings/UsersPage.jsx index e54ecc01..2941965b 100644 --- a/modern/src/settings/UsersPage.jsx +++ b/modern/src/settings/UsersPage.jsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { - Table, TableRow, TableCell, TableHead, TableBody, Switch, TableFooter, FormControlLabel, FormControl, FormGroup, Grid, + Table, TableRow, TableCell, TableHead, TableBody, Switch, TableFooter, FormControlLabel, } from '@mui/material'; import LoginIcon from '@mui/icons-material/Login'; import LinkIcon from '@mui/icons-material/Link'; @@ -81,7 +81,7 @@ const UsersPage = () => { <TableCell>{t('userAdmin')}</TableCell> <TableCell>{t('sharedDisabled')}</TableCell> <TableCell>{t('userExpirationTime')}</TableCell> - <TableCell className={classes.columnAction}></TableCell> + <TableCell className={classes.columnAction} /> </TableRow> </TableHead> <TableBody> @@ -108,13 +108,13 @@ const UsersPage = () => { <TableRow> <TableCell colSpan={6} align="right"> <FormControlLabel - control={ + control={( <Switch value={temporary} onChange={(e) => setTemporary(e.target.checked)} size="small" /> - } + )} label={t('userTemporary')} labelPlacement="start" /> |