import React, { Fragment } from 'react';
import { NavLink, Redirect } from 'react-router-dom';
import Sidebar from './sidebar';
import { EditIcon } from './icons';
import CONFIG from './fields-config.json';
const Overview = (props) => {
var data_layer = 'age'; // always default
if (props.match && props.match.params && props.match.params.cat) {
data_layer = props.match.params.cat;
}
if (props.mode === 'edit' && !props.user){
return
}
let title = (props.mode === 'view')? 'View maps' : 'Add or edit data';
let back = (props.mode === 'edit')? `/view/${data_layer}.html` : undefined;
return (
{
CONFIG.map((data_group) => (
))
}
);
}
const OverviewSection = (props) => {
const match = props.data_layer === 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
}
)
};
export default Overview;