diff --git a/app/src/frontend/app.tsx b/app/src/frontend/app.tsx index e78a5dbe..4b210c6a 100644 --- a/app/src/frontend/app.tsx +++ b/app/src/frontend/app.tsx @@ -11,7 +11,7 @@ import BuildingView from './building/building-view'; import ColouringMap from './map/map'; import Header from './header'; import MultiEdit from './building/multi-edit'; -import Overview from './building/overview'; +import Categories from './building/categories'; import AboutPage from './pages/about'; import ContributorAgreementPage from './pages/contributor-agreement'; @@ -195,6 +195,9 @@ class App extends React.Component { // TODO: add proper types } render() { + const building_id = (this.state.building)? + this.state.building.building_id + : 2503371 // Default to UCL main building. TODO use last selected if any return (
@@ -203,18 +206,18 @@ class App extends React.Component { // TODO: add proper types - ( - + - ) } /> - ( - + + - ) } /> + ( ( + + + + + + + + + + + + + + +) + +Categories.propTypes = { + mode: PropTypes.string, + building_id: PropTypes.number +} + +const Category = (props) => ( +
+
+ +

{props.title}

+
+ +
+
+) + +Category.propTypes = { + title: PropTypes.string, + slug: PropTypes.string, + help: PropTypes.string, + inactive: PropTypes.bool, + mode: PropTypes.string, + building_id: PropTypes.number +} + +export default Categories; diff --git a/app/src/frontend/building/overview.tsx b/app/src/frontend/building/overview.tsx deleted file mode 100644 index 8500d435..00000000 --- a/app/src/frontend/building/overview.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import React, { Fragment } from 'react'; -import { NavLink, Redirect } from 'react-router-dom'; -import PropTypes from 'prop-types'; - -import Sidebar from './sidebar'; -import { EditIcon } from '../components/icons'; -import CONFIG from './fields-config.json'; - -const Overview = (props) => { - var dataLayer = 'age'; // always default - if (props.match && props.match.params && props.match.params.cat) { - dataLayer = props.match.params.cat; - } - - if (props.mode === 'edit' && !props.user){ - return - } - - const title = (props.mode === 'view')? 'View maps' : 'Add or edit data'; - const back = (props.mode === 'edit')? `/view/${dataLayer}.html` : undefined; - - return ( - - { - CONFIG.map((dataGroup) => ( - - )) - } - - ); -} - -Overview.propTypes = { - match: PropTypes.object, - mode: PropTypes.string, - user: PropTypes.object -} - -const OverviewSection = (props) => { - const match = props.dataLayer === props.slug; - const inactive = props.inactive; - - return ( -
-
- match} - title={(inactive)? 'Coming soon… Click the ? for more info.' : - (match)? '' : 'Show on map'}> -

{props.title}

-
- -
- { - (match && props.intro)? - ( - -

{props.intro}

-
    - { - props.fields.map((field) => { - return (
  • {field.title}
  • ) - }) - } -
-
- ) - : null - } -
- ) -}; - -OverviewSection.propTypes = { - title: PropTypes.string, - slug: PropTypes.string, - intro: PropTypes.string, - help: PropTypes.string, - dataLayer: PropTypes.string, - mode: PropTypes.string, - inactive: PropTypes.bool, - fields: PropTypes.arrayOf(PropTypes.shape({ - title: PropTypes.string, - slug: PropTypes.string - })) -} - -export default Overview; diff --git a/app/src/frontend/building/sidebar.css b/app/src/frontend/building/sidebar.css index 4c9411f3..2c63e677 100644 --- a/app/src/frontend/building/sidebar.css +++ b/app/src/frontend/building/sidebar.css @@ -53,24 +53,6 @@ /** * Sidebar main header */ -.sidebar-header { - border-bottom: 6px solid; - border-image: linear-gradient( - to right, - #edc40b 0%, #edc40b 8.3%, - #f0ee0c 8.3%, #f0ee0c 16.6%, - #ff9100 16.6%, #ff9100 25%, - #ee5f63 25%, #ee5f63 33.3%, - #ee91bf 33.3%, #ee91bf 41.6%, - #aa7fa7 41.6%, #aa7fa7 50%, - #6f879c 50%, #6f879c 58.3%, - #5ec232 58.3%, #5ec232 66.6%, - #6dbb8b 66.6%, #6dbb8b 75%, - #65b7ff 75%, #65b7ff 83.3%, - #a1a3a9 83.3%, #a1a3a9 91.6%, - #9c896d 91.6%, #9c896d 100% - ) 1; -} .sidebar-header h2 { margin: 0.45rem 0 0.6rem; display: inline-block; diff --git a/app/src/frontend/building/sidebar.tsx b/app/src/frontend/building/sidebar.tsx index 15c76046..cd93c493 100644 --- a/app/src/frontend/building/sidebar.tsx +++ b/app/src/frontend/building/sidebar.tsx @@ -6,18 +6,24 @@ import './sidebar.css'; import { BackIcon } from '../components/icons'; const Sidebar = (props) => ( -
-
- { - props.back? - - - - : null - } -

{props.title}

-
- {props.children} + ); diff --git a/app/src/frontend/header.tsx b/app/src/frontend/header.tsx index 76b28d40..7b8ba663 100644 --- a/app/src/frontend/header.tsx +++ b/app/src/frontend/header.tsx @@ -51,13 +51,8 @@ class Header extends React.Component { // TODO: add proper types
  • - - View Maps - -
  • -
  • - - Add/Edit Data + + View/Edit Maps
  • diff --git a/app/src/frontend/pages/welcome.tsx b/app/src/frontend/pages/welcome.tsx index 3a28be4e..26a2c2ad 100644 --- a/app/src/frontend/pages/welcome.tsx +++ b/app/src/frontend/pages/welcome.tsx @@ -17,7 +17,7 @@ const Welcome = () => ( volunteers of all ages and abilities to test and provide feedback on the site as we build it.

    - Start Colouring Here!