import React from 'react'; import Slot from './Slot'; import Persist from '../stores/Persist'; import { DamageKinetic, DamageThermal, DamageExplosive, MountFixed, MountGimballed, MountTurret, ListModifications, Modified } from './SvgIcons'; import { Modifications } from 'coriolis-data/dist'; import { stopCtxPropagation } from '../utils/UtilityFunctions'; /** * Hardpoint / Utility Slot */ export default class HardpointSlot extends Slot { /** * Get the CSS class name for the slot. * @return {string} CSS Class name */ _getClassNames() { return this.props.maxClass > 0 ? 'hardpoint' : null; } /** * Get the label for the slot * @param {Function} translate Translate function * @return {string} Label */ _getMaxClassLabel(translate) { return translate(['U','S','M','L','H'][this.props.maxClass]); } /** * 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 = `${m.class}${m.rating}${m.missile ? '/' + m.missile : ''}`; let { drag, drop } = this.props; let { termtip, tooltip } = this.context; let validMods = Modifications.validity[m.grp] || []; let showModuleResistances = Persist.showModuleResistances(); // Modifications tooltip shows blueprint and grade, if available let modTT = translate('modified'); if (m && m.blueprint) { modTT = translate(m.blueprint.name) + ' ' + translate('grade') + ' ' + m.blueprint.grade; } return