Commit 95a4df69 authored by Matija Obreza's avatar Matija Obreza

Merge branch '759-map-bounds' into 'master'

Resolve "Map bounds"

Closes #759

See merge request genesys-pgr/genesys-ui!735
parents 04876416 6b09326a
......@@ -46,7 +46,9 @@ const store = composeEnhancers(applyMiddleware(thunk, routerMiddleware(history))
const SsrI18nProvider = withSSR()(I18nextProvider) as any;
const accessToken = cookies.get('access_token') || store.getState().applicationConfig.anonToken.access_token;
const accessToken = cookies.get('access_token')
|| (store.getState().applicationConfig.anonToken && store.getState().applicationConfig.anonToken.access_token)
|| null;
// Configure axios for client
reconfigureServiceAxios({
......
......@@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
import { WithTranslation, withTranslation } from 'react-i18next';
import { WithStyles, withStyles } from '@material-ui/core/styles';
import { isMobile } from 'is-mobile';
import { isNumber } from 'lodash';
import { bindActionCreators } from 'redux';
import {showSnackbar} from 'actions/snackbar';
import navigateTo from 'actions/navigation';
......@@ -561,9 +562,14 @@ class MapPage extends React.Component<IMapPageProps, any> {
return <ErrorMessage error={ mapInfo.error }/>;
}
if (mapInfo.data.bounds[0] && mapInfo.data.bounds[1] && mapInfo.data.bounds[0].length === 2 && mapInfo.data.bounds[1].length === 2) {
initialBounds = mapInfo.data.bounds;
}
if (mapInfo.data.bounds[0] && mapInfo.data.bounds[1] && mapInfo.data.bounds[0].length === 2 && mapInfo.data.bounds[1].length === 2) {
initialBounds = mapInfo.data.bounds.map((bound, i) => {
return [
isNumber(bound[0]) ? bound[0] : initialBounds[i][0],
isNumber(bound[1]) ? bound[1] : initialBounds[i][1],
];
});
}
const suggestionTerms = new Map();
if (suggestions) {
......
......@@ -10,9 +10,7 @@ import {checkActiveNavItem} from '@genesys/client/utilities/';
import Drawer from '@material-ui/core/Drawer';
import { NavLink } from 'react-router-dom';
import Close from '@material-ui/icons/Close';
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
import { Accordion, AccordionSummary, AccordionDetails } from '@material-ui/core'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
import Authorize from 'ui/common/authorized/Authorize';
......@@ -232,7 +230,7 @@ class MobileNavigation extends React.Component<IMobileNavigationProps & any, any
{ menuItems.map((path) => {
return (
<Authorize roles={ path.auth } key={ path.to }>
<ExpansionPanel
<Accordion
className={ `
${classes.panel}
${this.checkIsActive(path)(null, location) && classes.activePanel}
......@@ -241,7 +239,7 @@ class MobileNavigation extends React.Component<IMobileNavigationProps & any, any
onChange={ this.handleChange(path.to) }
classes={ { expanded: classes.expanded } }
>
<ExpansionPanelSummary
<AccordionSummary
className={ classes.panelSummary }
expandIcon={ path.subMenus && <ExpandMoreIcon/> }
classes={ { expandIcon: classes.expandIcon } }
......@@ -253,9 +251,9 @@ class MobileNavigation extends React.Component<IMobileNavigationProps & any, any
onClick={ this.props.closeMenu }>
{ typeof path.label === 'string' ? t(path.label) : path.label }
</NavLink>
</ExpansionPanelSummary>
</AccordionSummary>
{ path.subMenus && (
<ExpansionPanelDetails className={ classes.detail }>
<AccordionDetails className={ classes.detail }>
<div className={ classes.subMenu }>
{ path.subMenus.map((path) => {
return (
......@@ -273,27 +271,27 @@ class MobileNavigation extends React.Component<IMobileNavigationProps & any, any
})
}
</div>
</ExpansionPanelDetails>
</AccordionDetails>
) }
</ExpansionPanel>
</Accordion>
</Authorize>
);
})
}
<ExpansionPanel
<Accordion
className={ `${classes.panel} ` }
expanded={ expanded === 'lang' }
onChange={ this.handleChange('lang') }
classes={ { expanded: classes.expanded } }
>
<ExpansionPanelSummary
<AccordionSummary
className={ classes.panelSummary }
expandIcon={ <ExpandMoreIcon/> }
classes={ { expandIcon: classes.expandIcon } }
>
<div className={ classes.navRootLink }>{ currentLang }</div>
</ExpansionPanelSummary>
<ExpansionPanelDetails className={ classes.detail }>
</AccordionSummary>
<AccordionDetails className={ classes.detail }>
<div className={ classes.subMenu }>
{ languages.map((lang, index) => (
<a
......@@ -305,8 +303,8 @@ class MobileNavigation extends React.Component<IMobileNavigationProps & any, any
</a>
)) }
</div>
</ExpansionPanelDetails>
</ExpansionPanel>
</AccordionDetails>
</Accordion>
</nav>
</div>
</Drawer>
......
......@@ -31,11 +31,8 @@ import { Link } from 'react-router-dom';
import {ColumnChart, LineChart} from 'react-chartkick';
import KpiPieChartCard from 'ui/pages/dashboard/c/KpiPieChartCard';
import ObservationsTable from 'kpi/ui/admin/c/ObservationsTable';
import {Paper} from '@material-ui/core';
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
import { Accordion, AccordionSummary, AccordionDetails, Paper } from '@material-ui/core'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
import Authorize from 'ui/common/authorized/Authorize';
require('chart.js');
......@@ -465,20 +462,20 @@ class DashboardPage extends React.Component<IDashProps> {
<Grid item sm={ 4 } className="pl-0">
<Card>
{ partners.content.map((partner) => (
<ExpansionPanel
<Accordion
className={ `
${classes.panel}
` }
expanded={ partner === selectedPartner }
onChange={ () => this.selectPartner(partner) }
>
<ExpansionPanelSummary
<AccordionSummary
className={ `p-0 ${classes.panelSummary} ${partner === selectedPartner && classes.activePanel }` }
expandIcon={ <ExpandMoreIcon/> }
>
<span onClick={ () => this.selectPartner(partner) } className={ classes.partner }>{ partner.name }</span>
</ExpansionPanelSummary>
<ExpansionPanelDetails className={ classes.detail }>
</AccordionSummary>
<AccordionDetails className={ classes.detail }>
{ institutes && selectedPartner && selectedPartner.uuid === partner.uuid && institutes.length > 0
? institutes.map((institute) => (
<div key={institute.code}>
......@@ -487,8 +484,8 @@ class DashboardPage extends React.Component<IDashProps> {
) )
: <div className={ `${classes.noHover} ${classes.instCode}`}>{ t('dashboard.p.dashboard.noInstitutesAvailable') }</div>
}
</ExpansionPanelDetails>
</ExpansionPanel>
</AccordionDetails>
</Accordion>
) ) }
</Card>
</Grid>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment