Only accept view/edit modes for building view

This commit is contained in:
Maciej Ziarkowski 2019-10-30 12:28:10 +00:00
parent 06eb4e53ed
commit 740b788246
3 changed files with 4 additions and 3 deletions

View File

@ -19,7 +19,7 @@ import { Building } from '../models/building';
interface BuildingViewProps { interface BuildingViewProps {
cat: string; cat: string;
mode: 'view' | 'edit' | 'multi-edit'; mode: 'view' | 'edit';
building: Building; building: Building;
building_like: boolean; building_like: boolean;
user: any; user: any;

View File

@ -20,7 +20,7 @@ interface DataContainerProps {
inactive?: boolean; inactive?: boolean;
user: User; user: User;
mode: 'view' | 'edit' | 'multi-edit'; mode: 'view' | 'edit';
building: Building; building: Building;
building_like: boolean; building_like: boolean;
selectBuilding: (building: Building) => void selectBuilding: (building: Building) => void

View File

@ -221,6 +221,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
render() { render() {
const mode = this.props.match.params.mode; const mode = this.props.match.params.mode;
const viewEditMode = mode === 'multi-edit' ? undefined : mode;
let category = this.state.category || 'age'; let category = this.state.category || 'age';
@ -246,7 +247,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
<Route exact path="/:mode/:cat/:building?"> <Route exact path="/:mode/:cat/:building?">
<Sidebar> <Sidebar>
<BuildingView <BuildingView
mode={mode} mode={viewEditMode}
cat={category} cat={category}
building={this.state.building} building={this.state.building}
building_like={this.state.building_like} building_like={this.state.building_like}