diff --git a/src/app/components/HardpointSlotSection.jsx b/src/app/components/HardpointSlotSection.jsx index 5f152f5d..ef901949 100644 --- a/src/app/components/HardpointSlotSection.jsx +++ b/src/app/components/HardpointSlotSection.jsx @@ -1,6 +1,6 @@ import React from 'react'; import SlotSection from './SlotSection'; -import InternalSlot from './InternalSlot'; +import Slot from './Slot'; import { MountFixed, MountGimballed, MountTurret } from '../components/SvgIcons'; import { stopCtxPropagation } from '../utils/UtilityFunctions'; @@ -70,7 +70,7 @@ export default class HardpointSlotSection extends SlotSection { let slots = []; for (let h of ship.getHardpoints(undefined, true)) { - slots.push( ; } - } diff --git a/src/app/components/InternalSlot.jsx b/src/app/components/InternalSlot.jsx deleted file mode 100644 index c9b5186b..00000000 --- a/src/app/components/InternalSlot.jsx +++ /dev/null @@ -1,133 +0,0 @@ -import React from 'react'; -import cn from 'classnames'; -import Slot from './Slot'; -import Persist from '../stores/Persist'; -import { ListModifications, Modified } from './SvgIcons'; -import { Modifications } from 'coriolis-data/dist'; -import { stopCtxPropagation } from '../utils/UtilityFunctions'; -import { blueprintTooltip } from '../utils/BlueprintFunctions'; - -/** - * Internal Slot - */ -export default class InternalSlot extends Slot { - /** - * Generate the slot contents - * @param {Object} m Mounted Module - * @param {Function} translate Translate function - * @param {Object} formats Localized Formats map - * @param {Object} u Localized Units Map - * @return {React.Component} Slot contents - */ - _getSlotDetails(m, translate, formats, u) { - if (m) { - let classRating = String(m.getSize()) + m.getRating(); - let { drag, drop, ship } = this.props; - let { termtip, tooltip } = this.context; - let showModuleResistances = Persist.showModuleResistances(); - - // Modifications tooltip shows blueprint and grade, if available - // let modTT = translate('modified'); - // const blueprint = m.getBlueprint(); - // const experimental = m.getExperimental(); - // const grade = m.getGrade(); - // if (blueprint) { - // modTT = translate(blueprint) + ' ' + translate('grade') + ' ' + grade; - // if (experimental) { - // modTT += ', ' + translate(experimental); - // } - // modTT = ( - //
- //
{modTT}
- // {blueprintTooltip(translate, m.blueprint.grades[m.blueprint.grade], m)} - //
- // ); - // } - - let mass = m.get('mass') || m.get('cargo') || m.get('fuel') || 0; - const enabled = m.isEnabled(); - - const className = cn('details', enabled ? '' : 'disabled'); - return ( -
-
-
- {classRating} {translate(m.readMeta('type'))} - {m.mods && Object.keys(m.mods).length > 0 ? ( - - - - ) : ( - '' - )} -
-
- {formats.round(mass)} - {u.T} -
-
-
- {/* { m.getOptMass() ?
{translate('optmass', 'sg')}: {formats.int(m.getOptMass())}{u.T}
: null } - { m.getMaxMass() ?
{translate('maxmass', 'sg')}: {formats.int(m.getMaxMass())}{u.T}
: null } - { m.bins ?
{m.bins} {translate('bins')}
: null } - { m.bays ?
{translate('bays')}: {m.bays}
: null } - { m.rebuildsperbay ?
{translate('rebuildsperbay')}: {m.rebuildsperbay}
: null } - { m.rate ?
{translate('rate')}: {m.rate}{u.kgs}   {translate('refuel time')}: {formats.time(this.props.fuel * 1000 / m.rate)}
: null } - { m.getAmmo() && m.grp !== 'scb' ?
{translate('ammunition')}: {formats.gen(m.getAmmo())}
: null } - { m.getSpinup() ?
{translate('spinup')}: {formats.f1(m.getSpinup())}{u.s}
: null } - { m.getDuration() ?
{translate('duration')}: {formats.f1(m.getDuration())}{u.s}
: null } - { m.grp === 'scb' ?
{translate('cells')}: {formats.int(m.getAmmo() + 1)}
: null } - { m.grp === 'gsrp' ?
{translate('shield addition')}: {formats.f1(m.getShieldAddition())}{u.MJ}
: null } - { m.grp === 'gfsb' ?
{translate('jump addition')}: {formats.f1(m.getJumpBoost())}{u.LY}
: null } - { m.grp === 'gs' ?
{translate('shield addition')}: {formats.f1(m.getShieldAddition())}{u.MJ}
: null } - { m.getShieldReinforcement() ?
{translate('shieldreinforcement')}: {formats.f1(m.getDuration() * m.getShieldReinforcement())}{u.MJ}
: null } - { m.getShieldReinforcement() ?
{translate('total')}: {formats.int((m.getAmmo() + 1) * (m.getDuration() * m.getShieldReinforcement()))}{u.MJ}
: null } - { m.repair ?
{translate('repair')}: {m.repair}
: null } - { m.getFacingLimit() ?
{translate('facinglimit')} {formats.f1(m.getFacingLimit())}°
: null } - { m.getRange() ?
{translate('range')} {formats.f2(m.getRange())}{u.km}
: null } - { m.getRangeT() ?
{translate('ranget')} {formats.f1(m.getRangeT())}{u.s}
: null } - { m.getTime() ?
{translate('time')}: {formats.time(m.getTime())}
: null } - { m.getHackTime() ?
{translate('hacktime')}: {formats.time(m.getHackTime())}
: null } - { m.maximum ?
{translate('max')}: {(m.maximum)}
: null } - { m.rangeLS ?
{translate('range')}: {m.rangeLS}{u.Ls}
: null } - { m.rangeLS === null ?
∞{u.Ls}
: null } - { m.rangeRating ?
{translate('range')}: {m.rangeRating}
: null } - { m.passengers ?
{translate('passengers')}: {m.passengers}
: null } - { m.getRegenerationRate() ?
{translate('regen')}: {formats.round1(m.getRegenerationRate())}{u.ps}
: null } - { m.getBrokenRegenerationRate() ?
{translate('brokenregen')}: {formats.round1(m.getBrokenRegenerationRate())}{u.ps}
: null } - { showModuleResistances && m.getExplosiveResistance() ?
{translate('explres')}: {formats.pct(m.getExplosiveResistance())}
: null } - { showModuleResistances && m.getKineticResistance() ?
{translate('kinres')}: {formats.pct(m.getKineticResistance())}
: null } - { showModuleResistances && m.getThermalResistance() ?
{translate('thermres')}: {formats.pct(m.getThermalResistance())}
: null } - { showModuleResistances && m.getCausticResistance() ?
{translate('causres')}: {formats.pct(m.getCausticResistance())}
: null } - { m.getHullReinforcement() ?
{translate('armour')}: {formats.int(m.getHullReinforcement() + ship.baseArmour * m.getModValue('hullboost') / 10000)}
: null } - { m.getProtection() ?
{translate('protection')}: {formats.rPct(m.getProtection())}
: null } - { m.getIntegrity() ?
{translate('integrity')}: {formats.int(m.getIntegrity())}
: null } */} - {(m.getApplicableBlueprints() || []).length > 0 ? ( -
(this.modButton = modButton)} - > - -
- ) : null} -
-
- ); - } else { - return
{translate('empty')}
; - } - } -} diff --git a/src/app/components/InternalSlotSection.jsx b/src/app/components/InternalSlotSection.jsx index c1f4799b..cd404307 100644 --- a/src/app/components/InternalSlotSection.jsx +++ b/src/app/components/InternalSlotSection.jsx @@ -1,6 +1,6 @@ import React from 'react'; import SlotSection from './SlotSection'; -import InternalSlot from './InternalSlot'; +import Slot from './Slot'; import * as ModuleUtils from '../shipyard/ModuleUtils'; import { stopCtxPropagation } from '../utils/UtilityFunctions'; import { canMount } from '../utils/SlotFunctions'; @@ -223,7 +223,7 @@ export default class InternalSlotSection extends SlotSection { let { fuelCapacity } = ship; for (const slot of ship.getInternals(undefined, true)) { - slots.push( + //
{modTT}
+ // {blueprintTooltip(translate, m.blueprint.grades[m.blueprint.grade], m)} + // + // ); + // } + + let mass = m.get('mass') || m.get('cargo') || m.get('fuel') || 0; + const enabled = m.isEnabled(); + + const className = cn('details', enabled ? '' : 'disabled'); + return ( +
+
+
+ {classRating} {translate(m.readMeta('type'))} + {m.mods && Object.keys(m.mods).length > 0 ? ( + + + + ) : ( + '' + )} +
+
+ {formats.round(mass)} + {u.T} +
+
+
+ {/* { m.getOptMass() ?
{translate('optmass', 'sg')}: {formats.int(m.getOptMass())}{u.T}
: null } + { m.getMaxMass() ?
{translate('maxmass', 'sg')}: {formats.int(m.getMaxMass())}{u.T}
: null } + { m.bins ?
{m.bins} {translate('bins')}
: null } + { m.bays ?
{translate('bays')}: {m.bays}
: null } + { m.rebuildsperbay ?
{translate('rebuildsperbay')}: {m.rebuildsperbay}
: null } + { m.rate ?
{translate('rate')}: {m.rate}{u.kgs}   {translate('refuel time')}: {formats.time(this.props.fuel * 1000 / m.rate)}
: null } + { m.getAmmo() && m.grp !== 'scb' ?
{translate('ammunition')}: {formats.gen(m.getAmmo())}
: null } + { m.getSpinup() ?
{translate('spinup')}: {formats.f1(m.getSpinup())}{u.s}
: null } + { m.getDuration() ?
{translate('duration')}: {formats.f1(m.getDuration())}{u.s}
: null } + { m.grp === 'scb' ?
{translate('cells')}: {formats.int(m.getAmmo() + 1)}
: null } + { m.grp === 'gsrp' ?
{translate('shield addition')}: {formats.f1(m.getShieldAddition())}{u.MJ}
: null } + { m.grp === 'gfsb' ?
{translate('jump addition')}: {formats.f1(m.getJumpBoost())}{u.LY}
: null } + { m.grp === 'gs' ?
{translate('shield addition')}: {formats.f1(m.getShieldAddition())}{u.MJ}
: null } + { m.getShieldReinforcement() ?
{translate('shieldreinforcement')}: {formats.f1(m.getDuration() * m.getShieldReinforcement())}{u.MJ}
: null } + { m.getShieldReinforcement() ?
{translate('total')}: {formats.int((m.getAmmo() + 1) * (m.getDuration() * m.getShieldReinforcement()))}{u.MJ}
: null } + { m.repair ?
{translate('repair')}: {m.repair}
: null } + { m.getFacingLimit() ?
{translate('facinglimit')} {formats.f1(m.getFacingLimit())}°
: null } + { m.getRange() ?
{translate('range')} {formats.f2(m.getRange())}{u.km}
: null } + { m.getRangeT() ?
{translate('ranget')} {formats.f1(m.getRangeT())}{u.s}
: null } + { m.getTime() ?
{translate('time')}: {formats.time(m.getTime())}
: null } + { m.getHackTime() ?
{translate('hacktime')}: {formats.time(m.getHackTime())}
: null } + { m.maximum ?
{translate('max')}: {(m.maximum)}
: null } + { m.rangeLS ?
{translate('range')}: {m.rangeLS}{u.Ls}
: null } + { m.rangeLS === null ?
∞{u.Ls}
: null } + { m.rangeRating ?
{translate('range')}: {m.rangeRating}
: null } + { m.passengers ?
{translate('passengers')}: {m.passengers}
: null } + { m.getRegenerationRate() ?
{translate('regen')}: {formats.round1(m.getRegenerationRate())}{u.ps}
: null } + { m.getBrokenRegenerationRate() ?
{translate('brokenregen')}: {formats.round1(m.getBrokenRegenerationRate())}{u.ps}
: null } + { showModuleResistances && m.getExplosiveResistance() ?
{translate('explres')}: {formats.pct(m.getExplosiveResistance())}
: null } + { showModuleResistances && m.getKineticResistance() ?
{translate('kinres')}: {formats.pct(m.getKineticResistance())}
: null } + { showModuleResistances && m.getThermalResistance() ?
{translate('thermres')}: {formats.pct(m.getThermalResistance())}
: null } + { showModuleResistances && m.getCausticResistance() ?
{translate('causres')}: {formats.pct(m.getCausticResistance())}
: null } + { m.getHullReinforcement() ?
{translate('armour')}: {formats.int(m.getHullReinforcement() + ship.baseArmour * m.getModValue('hullboost') / 10000)}
: null } + { m.getProtection() ?
{translate('protection')}: {formats.rPct(m.getProtection())}
: null } + { m.getIntegrity() ?
{translate('integrity')}: {formats.int(m.getIntegrity())}
: null } */} + {(m.getApplicableBlueprints() || []).length > 0 ? ( +
(this.modButton = modButton)} + > + +
+ ) : null} +
+
+ ); + } else { + return
{translate('empty')}
; + } + } /** * Get the CSS class name for the slot. Can/should be overriden @@ -90,22 +208,6 @@ export default class Slot extends TranslatedComponent { this.props.onSelect(null,null); } - /** Key Down handler - * @param {SyntheticEvent} event Event - * ToDo: see if this can be moved up - * we do more or less the same thing - * in every section when Enter key is pressed - * on a focusable item - * - */ - _keyDown(event) { - if (event.key == 'Enter') { - if(event.target.className == 'r') { - this._toggleModifications(); - } - this.props.onOpen(event); - } - } /** * Render the slot * @return {React.Component} The slot @@ -148,7 +250,6 @@ export default class Slot extends TranslatedComponent { onSelect={onSelect} warning={warning} diffDetails={diffDetails.bind(ship, this.context.language)} - slotDiv = {this.slotDiv} />; } } @@ -157,9 +258,9 @@ export default class Slot extends TranslatedComponent { return (
this.slotDiv = slotDiv}> + >
{this._getMaxClassLabel(translate)}
{slotDetails} diff --git a/src/app/components/StandardSlotSection.jsx b/src/app/components/StandardSlotSection.jsx index b8827766..4fd21e19 100644 --- a/src/app/components/StandardSlotSection.jsx +++ b/src/app/components/StandardSlotSection.jsx @@ -1,7 +1,7 @@ import React from 'react'; import cn from 'classnames'; import SlotSection from './SlotSection'; -import InternalSlot from './InternalSlot'; +import Slot from './Slot'; import Module from '../shipyard/Module'; import * as ShipRoles from '../shipyard/ShipRoles'; import { stopCtxPropagation } from '../utils/UtilityFunctions'; @@ -131,7 +131,7 @@ export default class StandardSlotSection extends SlotSection { // let bh = ship.bulkheads; let armour = ship.getAlloys(); - slots[0] = ; const powerPlant = ship.getPowerPlant(); - slots[1] = ; const thrusters = ship.getThrusters(); - slots[2] = ; const lifeSupport = ship.getLifeSupport(); - slots[4] = ; const powerDistributor = ship.getPowerDistributor(); - slots[5] = ; const sensors = ship.getSensors(); - slots[6] = ; const fuelTank = ship.getCoreFuelTank(); - slots[7] =