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 (
<>
{t('deviceStatus')}: {formatter(device.status, 'status')}
{t('sharedLocation')}: {formatter(position, 'latitude')} {formatter(position, 'longitude')}
{t('positionSpeed')}: {formatter(position.speed, 'speed')}
{t('positionCourse')}: {formatter(position.course, 'course')}
{t('positionDistance')}: {formatter(position.attributes.totalDistance, 'distance')}
{position.attributes.batteryLevel &&
<>{t('positionBattery')}: {formatter(position.attributes.batteryLevel, 'batteryLevel')}
>
}
>
);
};
export default StatusView;