diff --git a/app/src/frontend/building/building-edit.tsx b/app/src/frontend/building/building-edit.tsx index f3a0e65f..7743a16a 100644 --- a/app/src/frontend/building/building-edit.tsx +++ b/app/src/frontend/building/building-edit.tsx @@ -6,7 +6,7 @@ import ErrorBox from '../components/error-box'; import InfoBox from '../components/info-box'; import Sidebar from './sidebar'; import Tooltip from '../components/tooltip'; -import { SaveIcon } from '../components/icons'; +import { BackIcon, SaveIcon } from '../components/icons'; import CONFIG from './fields-config.json'; @@ -15,28 +15,27 @@ const BuildingEdit = (props) => { return } const cat = props.match.params.cat; - if (!props.building_id){ + const sections = CONFIG.filter((d) => d.slug === cat) + + if (!props.building_id || sections.length !== 1){ return ( - +
- Back to maps + Back to maps
); } + + const section = sections[0]; return ( - - { - CONFIG.map((section) => { - return - }) - } + + ); } @@ -237,6 +236,9 @@ class EditForm extends Component { // TODO: add proper types return (
+ + + { - if (!props.building_id){ + const cat = props.match.params.cat; + const sections = CONFIG.filter((d) => d.slug === cat) + + if (!props.building_id || sections.length !== 1){ return ( - +
- Back to maps + Back to categories
); } - const cat = props.match.params.cat; + + const section = sections[0]; return ( - - { - CONFIG.map(section => ( - - )) - } + + ); } @@ -102,6 +105,9 @@ class DataSection extends React.Component { // TODO: add proper types return (
+ + +