aboutsummaryrefslogtreecommitdiff
path: root/modern/src/StatusView.js
blob: ed0149ef2d362fdcb12e24d51f61683a9c4842cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import t from './common/localization'
import React from 'react';
import { useSelector } from 'react-redux';
import formatter from './common/formatter';

const StatusView = (props) => {
  const device = useSelector(state => state.devices.items[props.deviceId]);
  const position = useSelector(state => state.positions.items[props.deviceId]);

  return (
    <>
      <b>{t('deviceStatus')}:</b> {formatter(device.status, 'status')}<br />
      <b>{t('positionSpeed')}:</b> {formatter(position.speed, 'speed')}<br />
      <b>{t('positionCourse')}:</b> {formatter(position.course, 'course')}<br />
      <b>{t('positionDistance')}:</b> {formatter(position.attributes.totalDistance, 'distance')}<br />
    </>
  );
};

export default StatusView;