mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Add key to property header in ModificationsMenu
This commit is contained in:
@@ -146,6 +146,7 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
* Create a modification component
|
* Create a modification component
|
||||||
*/
|
*/
|
||||||
_mkModification(property, highlight) {
|
_mkModification(property, highlight) {
|
||||||
|
const { translate } = this.context.language;
|
||||||
const { m, propsToShow, onPropToggle } = this.props;
|
const { m, propsToShow, onPropToggle } = this.props;
|
||||||
|
|
||||||
let onSet = m.set.bind(m);
|
let onSet = m.set.bind(m);
|
||||||
@@ -156,9 +157,16 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
onSet = mapped.setter.bind(undefined, m);
|
onSet = mapped.setter.bind(undefined, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Modification key={property} m={m} property={property}
|
return [
|
||||||
onSet={onSet} highlight={highlight} showProp={propsToShow[property]}
|
<tr key={`th-${property}`}>
|
||||||
onPropToggle={onPropToggle} />;
|
<th colSpan="4">
|
||||||
|
<span className="cb">{translate(property)}</span>
|
||||||
|
</th>
|
||||||
|
</tr>,
|
||||||
|
<Modification key={property} m={m} property={property}
|
||||||
|
onSet={onSet} highlight={highlight} showProp={propsToShow[property]}
|
||||||
|
onPropToggle={onPropToggle} />
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,33 +175,18 @@ export default class ModificationsMenu extends TranslatedComponent {
|
|||||||
*/
|
*/
|
||||||
_renderModifications() {
|
_renderModifications() {
|
||||||
const { m } = this.props;
|
const { m } = this.props;
|
||||||
const { translate } = this.context.language;
|
|
||||||
|
|
||||||
const blueprintFeatures = getBlueprintInfo(m.getBlueprint()).features[
|
const blueprintFeatures = getBlueprintInfo(m.getBlueprint()).features[
|
||||||
m.getBlueprintGrade()
|
m.getBlueprintGrade()
|
||||||
];
|
];
|
||||||
const blueprintModifications = chain(keys(blueprintFeatures))
|
const blueprintModifications = chain(keys(blueprintFeatures))
|
||||||
.map((feature) => [
|
.map((feature) => this._mkModification(feature, true))
|
||||||
<tr>
|
|
||||||
<th colSpan="4">
|
|
||||||
<span className="cb">{translate(feature)}</span>
|
|
||||||
</th>
|
|
||||||
</tr>,
|
|
||||||
this._mkModification(feature, true),
|
|
||||||
])
|
|
||||||
.filter(([_, mod]) => Boolean(mod))
|
.filter(([_, mod]) => Boolean(mod))
|
||||||
.flatMap()
|
.flatMap()
|
||||||
.value();
|
.value();
|
||||||
const moduleModifications = chain(keys(getModuleInfo(m.getItem()).props))
|
const moduleModifications = chain(keys(getModuleInfo(m.getItem()).props))
|
||||||
.filter((prop) => !blueprintFeatures[prop])
|
.filter((prop) => !blueprintFeatures[prop])
|
||||||
.map((prop) => [
|
.map((prop) => this._mkModification(prop, false))
|
||||||
<tr>
|
|
||||||
<th colSpan="4">
|
|
||||||
<span className="cb">{translate(prop)}</span>
|
|
||||||
</th>
|
|
||||||
</tr>,
|
|
||||||
this._mkModification(prop, false),
|
|
||||||
])
|
|
||||||
.flatMap()
|
.flatMap()
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user