mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Add code props variable as ship hash to update changes
This commit is contained in:
@@ -32,6 +32,7 @@ function getClass(selected, relDraw) {
|
||||
export default class PowerBands extends TranslatedComponent {
|
||||
static propTypes = {
|
||||
ship: PropTypes.instanceOf(Ship).isRequired,
|
||||
code: PropTypes.string.isRequired,
|
||||
width: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ function getPowerIcon(enabled) {
|
||||
export default class PowerManagement extends TranslatedComponent {
|
||||
static propTypes = {
|
||||
ship: PropTypes.instanceOf(Ship).isRequired,
|
||||
code: PropTypes.string.isRequired,
|
||||
onChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
@@ -215,7 +216,7 @@ export default class PowerManagement extends TranslatedComponent {
|
||||
* @return {React.Component} contents
|
||||
*/
|
||||
render() {
|
||||
let { ship } = this.props;
|
||||
let { ship, code } = this.props;
|
||||
let { translate, formats } = this.context.language;
|
||||
let pp = ship.getPowerPlant();
|
||||
|
||||
@@ -248,7 +249,7 @@ export default class PowerManagement extends TranslatedComponent {
|
||||
{this._renderPowerRows(ship, translate, formats.f2, formats.pct1)}
|
||||
</tbody>
|
||||
</table>
|
||||
<PowerBands width={this.state.width} ship={ship} available={pp.get('powercapacity')} />
|
||||
<PowerBands width={this.state.width} ship={ship} code={code} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ const {
|
||||
ARMOUR_METRICS, CARGO_CAPACITY, FUEL_CAPACITY, UNLADEN_MASS, MAXIMUM_MASS,
|
||||
MODULE_PROTECTION_METRICS
|
||||
} = ShipProps;
|
||||
import { OBJECT_EVENT } from 'ed-forge/lib/Ship';
|
||||
|
||||
/**
|
||||
* Ship Summary Table / Stats
|
||||
@@ -19,6 +18,7 @@ import { OBJECT_EVENT } from 'ed-forge/lib/Ship';
|
||||
export default class ShipSummaryTable extends TranslatedComponent {
|
||||
static propTypes = {
|
||||
ship: PropTypes.object.isRequired,
|
||||
code: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -33,18 +33,6 @@ export default class ShipSummaryTable extends TranslatedComponent {
|
||||
};
|
||||
}
|
||||
|
||||
_onChange() {
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.props.ship.on(OBJECT_EVENT, this._onChange);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.ship.removeListener(OBJECT_EVENT, this._onChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the table
|
||||
* @return {React.Component} Summary table
|
||||
|
||||
@@ -15,6 +15,7 @@ const browser = require('detect-browser');
|
||||
export default class SlotSection extends TranslatedComponent {
|
||||
static propTypes = {
|
||||
ship: PropTypes.instanceOf(Ship),
|
||||
code: PropTypes.string.isRequired,
|
||||
togglePwr: PropTypes.func,
|
||||
};
|
||||
|
||||
|
||||
@@ -631,11 +631,11 @@ export default class OutfittingPage extends Page {
|
||||
</div>
|
||||
|
||||
{/* Main tables */}
|
||||
<ShipSummaryTable ship={ship} />
|
||||
<StandardSlotSection ship={ship} currentMenu={menu} />
|
||||
<InternalSlotSection ship={ship} currentMenu={menu} />
|
||||
<HardpointSlotSection ship={ship} currentMenu={menu} />
|
||||
<UtilitySlotSection ship={ship} currentMenu={menu} />
|
||||
<ShipSummaryTable ship={ship} code={code} />
|
||||
<StandardSlotSection ship={ship} code={code} currentMenu={menu} />
|
||||
<InternalSlotSection ship={ship} code={code} currentMenu={menu} />
|
||||
<HardpointSlotSection ship={ship} code={code} currentMenu={menu} />
|
||||
<UtilitySlotSection ship={ship} code={code} currentMenu={menu} />
|
||||
|
||||
{/* Control of ship and opponent */}
|
||||
{/* <div className="group quarter">
|
||||
|
||||
Reference in New Issue
Block a user