aboutsummaryrefslogtreecommitdiff
path: root/modern/src/PositionPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-07-10 15:24:10 -0700
commit0512964d71a25c172735f2149ef60c3a8b20f683 (patch)
treef47b42326a7e6a0eaa2715ca8066cb3ca7e7bb90 /modern/src/PositionPage.js
parent627cf95d59f625dcb0544bfd4c067d99dee4bb93 (diff)
downloadtrackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.gz
trackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.tar.bz2
trackermap-web-0512964d71a25c172735f2149ef60c3a8b20f683.zip
Use modified airbnb eslint
Diffstat (limited to 'modern/src/PositionPage.js')
-rw-r--r--modern/src/PositionPage.js31
1 files changed, 16 insertions, 15 deletions
diff --git a/modern/src/PositionPage.js b/modern/src/PositionPage.js
index a91a7a15..ce4c4ac2 100644
--- a/modern/src/PositionPage.js
+++ b/modern/src/PositionPage.js
@@ -1,14 +1,16 @@
import React, { Fragment, useState } from 'react';
-import t from './common/localization';
-import { makeStyles, Typography, ListItem, ListItemText, ListItemSecondaryAction, List, Container, Paper, Divider } from '@material-ui/core';
+import {
+ makeStyles, Typography, ListItem, ListItemText, ListItemSecondaryAction, List, Container, Paper, Divider,
+} from '@material-ui/core';
import { useParams } from 'react-router-dom';
+import t from './common/localization';
import { useEffectAsync } from './reactHelper';
import MainToolbar from './MainToolbar';
import { formatPosition } from './common/formatter';
import { prefixString } from './common/stringUtils';
-const useStyles = makeStyles(theme => ({
+const useStyles = makeStyles((theme) => ({
root: {
marginTop: theme.spacing(2),
marginBottom: theme.spacing(2),
@@ -26,7 +28,7 @@ const PositionPage = () => {
if (id) {
const response = await fetch(`/api/positions?id=${id}`, {
headers: {
- 'Accept': 'application/json'
+ Accept: 'application/json',
},
});
if (response.ok) {
@@ -38,28 +40,27 @@ const PositionPage = () => {
}
}, [id]);
- const formatKey = (key) => {
- return t(prefixString('position', key)) || `${t('sharedAttribute')} "${key}"`;
- };
+ const formatKey = (key) => t(prefixString('position', key)) || `${t('sharedAttribute')} "${key}"`;
const attributesList = () => {
- const combinedList = {...item, ...item.attributes};
- return Object.entries(combinedList).filter(([_, value]) => typeof value !== 'object');
- }
+ const combinedList = { ...item, ...item.attributes };
+ return Object.entries(combinedList).filter(([, value]) => typeof value !== 'object');
+ };
return (
<>
<MainToolbar />
- <Container maxWidth='sm' className={classes.root}>
+ <Container maxWidth="sm" className={classes.root}>
<Paper>
- {item &&
+ {item
+ && (
<List>
{attributesList().map(([key, value], index, list) => (
<Fragment key={key}>
<ListItem>
<ListItemText
primary={formatKey(key)}
- />
+ />
<ListItemSecondaryAction>
<Typography variant="body2">
{formatPosition(value, key)}
@@ -70,11 +71,11 @@ const PositionPage = () => {
</Fragment>
))}
</List>
- }
+ )}
</Paper>
</Container>
</>
);
-}
+};
export default PositionPage;