From 12c63b537369e6a93222aedd7f6e8b0b8baa15f8 Mon Sep 17 00:00:00 2001 From: Aron Helser Date: Tue, 10 Jul 2018 16:39:22 -0400 Subject: [PATCH] fix(CellEditor): add fuel handling. Also fix for an empty state for CoreEditor. --- src/simput/CellEditor.js | 6 ++++-- src/simput/CoreEditor.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/simput/CellEditor.js b/src/simput/CellEditor.js index 26ebe2f..9017460 100644 --- a/src/simput/CellEditor.js +++ b/src/simput/CellEditor.js @@ -141,7 +141,9 @@ export default class CellEditor extends React.Component { render() { const { data } = this.props; const viz = this.props.ui.domain; - const materialIds = viz.types.materials || []; + let materialIds = viz.types.fuels || []; + if (viz.types.materials) + materialIds = materialIds.concat(viz.types.materials); const materialOptions = materialIds.map((id) => { const color = toRGB(viz.colors[id]); @@ -162,7 +164,7 @@ export default class CellEditor extends React.Component { { key: 'material', dataKey: 'material', - label: 'Material', + label: 'Material / Fuel', render: (matId, item) => { const color = toRGB(viz.colors[matId]); return ( diff --git a/src/simput/CoreEditor.js b/src/simput/CoreEditor.js index 40f5128..bff7979 100644 --- a/src/simput/CoreEditor.js +++ b/src/simput/CoreEditor.js @@ -99,7 +99,8 @@ export default class CoreEditor extends React.Component { render() { const viz = this.props.ui.domain; const vizData = Object.assign({ selected: this.props.viewData.id }, viz); - const types = viz.core.types[this.props.viewData.id] || []; + const types = + (viz.core.types && viz.core.types[this.props.viewData.id]) || []; return (