aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/components/StatusCard.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-28 13:28:28 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-28 13:28:28 -0700
commitfac80024e0956d543b762296e0ee49cd72035b93 (patch)
tree41074dddc57d0c4fdb1b7162b1c3d74633e4ea31 /modern/src/common/components/StatusCard.js
parentef315b8e10329db80da1a97e96b3cc82481370ae (diff)
downloadtrackermap-web-fac80024e0956d543b762296e0ee49cd72035b93.tar.gz
trackermap-web-fac80024e0956d543b762296e0ee49cd72035b93.tar.bz2
trackermap-web-fac80024e0956d543b762296e0ee49cd72035b93.zip
Persist user preferences
Diffstat (limited to 'modern/src/common/components/StatusCard.js')
-rw-r--r--modern/src/common/components/StatusCard.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/modern/src/common/components/StatusCard.js b/modern/src/common/components/StatusCard.js
index c6ab1f51..7ff5769d 100644
--- a/modern/src/common/components/StatusCard.js
+++ b/modern/src/common/components/StatusCard.js
@@ -28,10 +28,10 @@ import { useTranslation } from './LocalizationProvider';
import RemoveDialog from './RemoveDialog';
import PositionValue from './PositionValue';
import { useDeviceReadonly, useRestriction } from '../util/permissions';
-import usePersistedState from '../util/usePersistedState';
import usePositionAttributes from '../attributes/usePositionAttributes';
import { devicesActions } from '../../store';
import { useCatch, useCatchCallback } from '../../reactHelper';
+import { useAttributePreference } from '../util/preferences';
const useStyles = makeStyles((theme) => ({
card: {
@@ -122,7 +122,7 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin
const deviceImage = device?.attributes?.deviceImage;
const positionAttributes = usePositionAttributes(t);
- const [positionItems] = usePersistedState('positionItems', ['speed', 'address', 'totalDistance', 'course']);
+ const positionItems = useAttributePreference('positionItems', 'speed,address,totalDistance,course');
const [anchorEl, setAnchorEl] = useState(null);
@@ -204,7 +204,7 @@ const StatusCard = ({ deviceId, position, onClose, disableActions, desktopPaddin
<CardContent className={classes.content}>
<Table size="small" classes={{ root: classes.table }}>
<TableBody>
- {positionItems.filter((key) => position.hasOwnProperty(key) || position.attributes.hasOwnProperty(key)).map((key) => (
+ {positionItems.split(',').filter((key) => position.hasOwnProperty(key) || position.attributes.hasOwnProperty(key)).map((key) => (
<StatusRow
key={key}
name={positionAttributes[key].name}