From 4bfee1050844bde4eeba1fc08444abe4154a0fa7 Mon Sep 17 00:00:00 2001 From: Maciej Ziarkowski Date: Mon, 9 Sep 2019 01:10:52 +0100 Subject: [PATCH] Allow no selection in categories/building-view --- app/src/frontend/building/building-view.tsx | 28 +++--- app/src/frontend/building/categories.tsx | 13 ++- .../frontend/building/container-header.tsx | 12 +-- app/src/frontend/building/data-container.tsx | 92 +++++++++---------- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/app/src/frontend/building/building-view.tsx b/app/src/frontend/building/building-view.tsx index 480f5645..1aaab34a 100644 --- a/app/src/frontend/building/building-view.tsx +++ b/app/src/frontend/building/building-view.tsx @@ -21,15 +21,11 @@ import LikeContainer from './data-containers/like'; * @param props */ const BuildingView = (props) => { - if (typeof(props.building) === "undefined"){ - return - } - switch (props.cat) { case 'location': return { case 'use': return { case 'type': return { case 'age': return { case 'size': return { case 'construction': return { case 'team': return { case 'sustainability': return { case 'greenery': return { case 'community': return { case 'planning': return { case 'like': return ( @@ -124,11 +122,15 @@ Categories.propTypes = { building_id: PropTypes.number } -const Category = (props) => ( +const Category = (props) => { + let categoryLink = `/${props.mode}/${props.slug}`; + if (props.building_id != undefined) categoryLink += `/${props.building_id}`; + + return (
  • ( More
  • -) + ); +} Category.propTypes = { title: PropTypes.string, diff --git a/app/src/frontend/building/container-header.tsx b/app/src/frontend/building/container-header.tsx index 184bc47e..2696ceea 100644 --- a/app/src/frontend/building/container-header.tsx +++ b/app/src/frontend/building/container-header.tsx @@ -6,17 +6,17 @@ import { BackIcon, EditIcon, ViewIcon }from '../components/icons'; const ContainerHeader: React.FunctionComponent = (props) => (
    - +

    {props.title}