import t from './common/localization'
import React from 'react';
import { useSelector } from 'react-redux';
import { formatPosition } 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')}: {formatPosition(device.status, 'status')}
{t('sharedLocation')}: {formatPosition(position, 'latitude')} {formatPosition(position, 'longitude')}
{t('positionSpeed')}: {formatPosition(position.speed, 'speed')}
{t('positionCourse')}: {formatPosition(position.course, 'course')}
{t('positionDistance')}: {formatPosition(position.attributes.totalDistance, 'distance')}
{position.attributes.batteryLevel &&
<>{t('positionBattery')}: {formatPosition(position.attributes.batteryLevel, 'batteryLevel')}
>
}
>
);
};
export default StatusView;