aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/NotificationPage.js
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
commit1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (patch)
tree8989ce8c6c5bb1d2a748ffe91895fe929c99dd5e /modern/src/settings/NotificationPage.js
parentefe18c504a834760242937572b369530c552e589 (diff)
downloadtrackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.gz
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.bz2
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.zip
Fixed linting
Diffstat (limited to 'modern/src/settings/NotificationPage.js')
-rw-r--r--modern/src/settings/NotificationPage.js56
1 files changed, 32 insertions, 24 deletions
diff --git a/modern/src/settings/NotificationPage.js b/modern/src/settings/NotificationPage.js
index 33904e7f..11c427fe 100644
--- a/modern/src/settings/NotificationPage.js
+++ b/modern/src/settings/NotificationPage.js
@@ -1,9 +1,11 @@
import React, { useState } from 'react';
+import {
+ Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControlLabel, Checkbox,
+} from '@material-ui/core';
+import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import t, { findStringKeys } from '../common/localization';
import EditItemView from '../EditItemView';
-import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, FormControlLabel, Checkbox } from '@material-ui/core';
-import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { prefixString, unprefixString } from '../common/stringUtils';
import SelectField from '../form/SelectField';
@@ -18,14 +20,15 @@ const NotificationPage = () => {
const [item, setItem] = useState();
- const alarms = findStringKeys(it => it.startsWith('alarm')).map(it => ({
+ const alarms = findStringKeys((it) => it.startsWith('alarm')).map((it) => ({
key: unprefixString('alarm', it),
name: t(it),
}));
return (
<EditItemView endpoint="notifications" item={item} setItem={setItem}>
- {item &&
+ {item
+ && (
<>
<Accordion defaultExpanded>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
@@ -38,47 +41,52 @@ const NotificationPage = () => {
margin="normal"
value={item.type || 'alarm'}
emptyValue={null}
- onChange={e => setItem({...item, type: e.target.value})}
+ onChange={(e) => setItem({ ...item, type: e.target.value })}
endpoint="/api/notifications/types"
- keyGetter={it => it.type}
- titleGetter={it => t(prefixString('event', it.type))}
+ keyGetter={(it) => it.type}
+ titleGetter={(it) => t(prefixString('event', it.type))}
label={t('sharedType')}
- variant="filled" />
+ variant="filled"
+ />
<SelectField
multiple
margin="normal"
value={item.notificators ? item.notificators.split(/[, ]+/) : []}
- onChange={e => setItem({...item, notificators: e.target.value.join()})}
+ onChange={(e) => setItem({ ...item, notificators: e.target.value.join() })}
endpoint="/api/notifications/notificators"
- keyGetter={it => it.type}
- titleGetter={it => t(prefixString('notificator', it.type))}
+ keyGetter={(it) => it.type}
+ titleGetter={(it) => t(prefixString('notificator', it.type))}
label={t('notificationNotificators')}
- variant="filled" />
- {(!item.type || item.type === 'alarm') &&
+ variant="filled"
+ />
+ {(!item.type || item.type === 'alarm')
+ && (
<SelectField
multiple
margin="normal"
value={item.attributes && item.attributes.alarms ? item.attributes.alarms.split(/[, ]+/) : []}
- onChange={e => setItem({...item, attributes: {...item.attributes, alarms: e.target.value.join()}})}
+ onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, alarms: e.target.value.join() } })}
data={alarms}
- keyGetter={it => it.key}
+ keyGetter={(it) => it.key}
label={t('sharedAlarms')}
- variant="filled" />
- }
+ variant="filled"
+ />
+ )}
<FormControlLabel
- control={
+ control={(
<Checkbox
checked={item.always}
- onChange={event => setItem({...item, always: event.target.checked})}
- />
- }
- label={t('notificationAlways')} />
+ onChange={(event) => setItem({ ...item, always: event.target.checked })}
+ />
+ )}
+ label={t('notificationAlways')}
+ />
</AccordionDetails>
</Accordion>
</>
- }
+ )}
</EditItemView>
);
-}
+};
export default NotificationPage;