colouring-montreal/app/src/frontend/building/building-view.tsx

133 lines
4.8 KiB
TypeScript
Raw Normal View History

import React from 'react';
2018-09-11 15:59:59 -04:00
2019-11-07 02:39:26 -05:00
import { Building } from '../models/building';
2019-08-14 06:36:38 -04:00
2019-11-07 02:39:26 -05:00
import BuildingNotFound from './building-not-found';
import AgeContainer from './data-containers/age';
import CommunityContainer from './data-containers/community';
2019-11-07 02:39:26 -05:00
import ConstructionContainer from './data-containers/construction';
import DynamicsContainer from './data-containers/dynamics';
2019-11-07 02:39:26 -05:00
import LocationContainer from './data-containers/location';
import PlanningContainer from './data-containers/planning';
import SizeContainer from './data-containers/size';
import StreetscapeContainer from './data-containers/streetscape';
import SustainabilityContainer from './data-containers/sustainability';
import TeamContainer from './data-containers/team';
import TypeContainer from './data-containers/type';
import UseContainer from './data-containers/use';
interface BuildingViewProps {
cat: string;
mode: 'view' | 'edit';
building?: Building;
building_like?: boolean;
user?: any;
2019-11-07 03:13:30 -05:00
selectBuilding: (building: Building) => void;
}
2019-08-14 06:36:38 -04:00
/**
* Top-level container for building view/edit form
*
* @param props
*/
const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
switch (props.cat) {
case 'location':
return <LocationContainer
2019-08-14 06:36:38 -04:00
{...props}
title="Location"
help="https://pages.colouring.london/location"
intro="Where are the buildings? Address, location and cross-references."
2019-11-07 03:13:30 -05:00
/>;
case 'use':
return <UseContainer
{...props}
inactive={false}
title="Land Use"
intro="How are buildings used, and how does use change over time? Coming soon…"
help="https://pages.colouring.london/use"
2019-11-07 03:13:30 -05:00
/>;
case 'type':
return <TypeContainer
{...props}
inactive={false}
title="Type"
intro="How were buildings previously used?"
help="https://www.pages.colouring.london/buildingtypology"
2019-11-07 03:13:30 -05:00
/>;
case 'age':
return <AgeContainer
{...props}
title="Age"
help="https://pages.colouring.london/age"
intro="Building age data can support energy analysis and help predict long-term change."
2019-11-07 03:13:30 -05:00
/>;
case 'size':
return <SizeContainer
{...props}
title="Size &amp; Shape"
intro="How big are buildings?"
help="https://pages.colouring.london/shapeandsize"
2019-11-07 03:13:30 -05:00
/>;
case 'construction':
return <ConstructionContainer
{...props}
title="Construction"
intro="How are buildings built? Coming soon…"
help="https://pages.colouring.london/construction"
inactive={true}
2019-11-07 03:13:30 -05:00
/>;
case 'team':
return <TeamContainer
{...props}
title="Team"
intro="Who built the buildings? Coming soon…"
help="https://pages.colouring.london/team"
inactive={true}
2019-11-07 03:13:30 -05:00
/>;
case 'sustainability':
return <SustainabilityContainer
{...props}
title="Sustainability"
intro="Are buildings energy efficient?"
help="https://pages.colouring.london/sustainability"
inactive={false}
2019-11-07 03:13:30 -05:00
/>;
2019-09-10 10:05:35 -04:00
case 'streetscape':
return <StreetscapeContainer
{...props}
2019-09-10 10:05:35 -04:00
title="Streetscape"
intro="What's the building's context? Coming soon…"
help="https://pages.colouring.london/streetscape"
inactive={true}
2019-11-07 03:13:30 -05:00
/>;
case 'community':
return <CommunityContainer
{...props}
title="Community"
intro="How does this building work for the local community?"
help="https://pages.colouring.london/community"
2019-11-07 03:13:30 -05:00
/>;
case 'planning':
return <PlanningContainer
{...props}
title="Planning"
intro="Planning controls relating to protection and reuse."
help="https://pages.colouring.london/planning"
2019-11-07 03:13:30 -05:00
/>;
case 'dynamics':
return <DynamicsContainer
{...props}
title="Dynamics"
intro="How has the site of this building changed over time?"
help="https://pages.colouring.london/buildingcategories"
inactive={true}
2019-11-07 03:13:30 -05:00
/>;
default:
2019-11-07 03:13:30 -05:00
return <BuildingNotFound mode="view" />;
}
2019-11-07 03:13:30 -05:00
};
export default BuildingView;