diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-18 18:44:15 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-18 18:44:15 -0700 |
commit | 5c5648dea3a80b0135b579706f5e1ff1dedb47dd (patch) | |
tree | fb87e0b24e3b5e519ef55f685c274442a43b07ec /modern/src/common/components | |
parent | ef09d6ace123487692261c7b571f1dfe508b114a (diff) | |
download | trackermap-web-5c5648dea3a80b0135b579706f5e1ff1dedb47dd.tar.gz trackermap-web-5c5648dea3a80b0135b579706f5e1ff1dedb47dd.tar.bz2 trackermap-web-5c5648dea3a80b0135b579706f5e1ff1dedb47dd.zip |
Show media links
Diffstat (limited to 'modern/src/common/components')
-rw-r--r-- | modern/src/common/components/PositionValue.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modern/src/common/components/PositionValue.js b/modern/src/common/components/PositionValue.js index 7255c888..6dd1f50d 100644 --- a/modern/src/common/components/PositionValue.js +++ b/modern/src/common/components/PositionValue.js @@ -1,4 +1,5 @@ import React from 'react'; +import { useSelector } from 'react-redux'; import { Link } from '@mui/material'; import { Link as RouterLink } from 'react-router-dom'; import { @@ -14,6 +15,8 @@ const PositionValue = ({ position, property, attribute }) => { const admin = useAdministrator(); + const device = useSelector((state) => state.devices.items[position.deviceId]); + const key = property || attribute; const value = property ? position[property] : position.attributes[attribute]; @@ -59,6 +62,10 @@ const PositionValue = ({ position, property, attribute }) => { }; switch (key) { + case 'image': + case 'video': + case 'audio': + return (<Link href={`/api/media/${device.uniqueId}/${value}`} target="_blank">{value}</Link>); case 'totalDistance': case 'hours': return ( |