import React from 'react'; import PropTypes from 'prop-types'; import TranslatedComponent from './TranslatedComponent'; /** * Movement */ export default class Movement extends TranslatedComponent { static propTypes = { marker: PropTypes.string.isRequired, ship: PropTypes.object.isRequired, boost: PropTypes.bool.isRequired, eng: PropTypes.number.isRequired, fuel: PropTypes.number.isRequired, cargo: PropTypes.number.isRequired }; /** * Constructor * @param {Object} props React Component properties */ constructor(props) { super(props); } /** * Render movement * @return {React.Component} contents */ render() { const { ship, boost, eng, cargo, fuel } = this.props; const { language } = this.context; const { formats, translate, units } = language; return ( // Axes // End Arrow // Axes arcs and arrows // Speed {ship.canThrust(cargo, fuel) ? formats.int(ship.calcSpeed(eng, fuel, cargo, boost)) + 'm/s' : '-'} // Pitch {ship.canThrust(cargo, fuel) ? formats.int(ship.calcPitch(eng, fuel, cargo, boost)) + '°/s' : '-'} // Roll {ship.canThrust(cargo, fuel) ? formats.int(ship.calcRoll(eng, fuel, cargo, boost)) + '°/s' : '-'} // Yaw {ship.canThrust(cargo, fuel) ? formats.int(ship.calcYaw(eng, fuel, cargo, boost)) + '°/s' : '-'} ); } }