Commit cb3c0491 authored by Florent Chehab's avatar Florent Chehab
Browse files

UnivMap Reload button added

parent 91250689
...@@ -7,6 +7,7 @@ import { withStyles } from '@material-ui/core/styles'; ...@@ -7,6 +7,7 @@ import { withStyles } from '@material-ui/core/styles';
import CssBaseline from '@material-ui/core/CssBaseline'; import CssBaseline from '@material-ui/core/CssBaseline';
import Drawer from '@material-ui/core/Drawer'; import Drawer from '@material-ui/core/Drawer';
import List from '@material-ui/core/List'; import List from '@material-ui/core/List';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import Divider from '@material-ui/core/Divider'; import Divider from '@material-ui/core/Divider';
import IconButton from '@material-ui/core/IconButton'; import IconButton from '@material-ui/core/IconButton';
...@@ -14,11 +15,16 @@ import MenuIcon from '@material-ui/icons/Menu'; ...@@ -14,11 +15,16 @@ import MenuIcon from '@material-ui/icons/Menu';
import Chip from '@material-ui/core/Chip'; import Chip from '@material-ui/core/Chip';
import Avatar from '@material-ui/core/Avatar'; import Avatar from '@material-ui/core/Avatar';
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
import ScoolIcon from '@material-ui/icons/School'; import SchoolIcon from '@material-ui/icons/School';
import UnivMap from './UnivMap' import UnivMap from './UnivMap';
import UnivMapReloadButton from './UnivMapReloadButton';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import { mainListItems, secondaryListItems } from './listItems'; import { mainListItems, secondaryListItems } from './listItems';
import {
universitiesInvalidated
} from '../actions/universities';
const drawerWidth = 240; const drawerWidth = 240;
const styles = theme => ({ const styles = theme => ({
...@@ -35,7 +41,6 @@ const styles = theme => ({ ...@@ -35,7 +41,6 @@ const styles = theme => ({
padding: '0 8px', padding: '0 8px',
...theme.mixins.toolbar, ...theme.mixins.toolbar,
}, },
chip: { chip: {
margin: theme.spacing.unit, margin: theme.spacing.unit,
}, },
...@@ -115,7 +120,7 @@ class Dashboard extends React.Component { ...@@ -115,7 +120,7 @@ class Dashboard extends React.Component {
<div className={classNames(classes.toolbarIcon)}> <div className={classNames(classes.toolbarIcon)}>
<div className={(!this.state.open) && classes.hideIt}> <div className={(!this.state.open) && classes.hideIt}>
<Chip <Chip
avatar={<Avatar> <ScoolIcon /> </Avatar>} avatar={<Avatar> <SchoolIcon /> </Avatar>}
label="Outgoing REX" label="Outgoing REX"
className={classes.chip} className={classes.chip}
color="primary" color="primary"
...@@ -140,10 +145,18 @@ class Dashboard extends React.Component { ...@@ -140,10 +145,18 @@ class Dashboard extends React.Component {
</Drawer> </Drawer>
<main className={classes.content}> <main className={classes.content}>
<Paper className={classes.myPaper}> <Paper className={classes.myPaper}>
<Typography variant="display1" gutterBottom> <Grid container spacing={24}>
Exploration Cartographique <Grid item xs={11}>
</Typography> <Typography variant="display1" gutterBottom>
Exploration Cartographique
</Typography>
</Grid>
<Grid item xs={1}>
<UnivMapReloadButton/>
</Grid>
</Grid>
<UnivMap /> <UnivMap />
......
...@@ -86,7 +86,6 @@ class UnivMap extends Component { ...@@ -86,7 +86,6 @@ class UnivMap extends Component {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
console.log("ici", state)
return { return {
universities: state.universitiesFetched.universities, universities: state.universitiesFetched.universities,
fetchedAt: state.universitiesFetched.fetchedAt, fetchedAt: state.universitiesFetched.fetchedAt,
......
import React, { Component } from 'react';
import { connect } from "react-redux";
import CachedIcon from '@material-ui/icons/Cached';
import IconButton from '@material-ui/core/IconButton';
import { withStyles } from '@material-ui/core/styles';
import {
universitiesInvalidated
} from '../actions/universities';
const styles = theme => ({
floatRight: {
float: 'right'
}
});
class UnivMapReloadButton extends Component {
render() {
const { classes } = this.props;
return (
<IconButton
onClick={() => { this.props.invalidate() }}
className={classes.floatRight}
>
<CachedIcon />
</IconButton>
);
}
}
const mapStateToProps = (state) => {
console.log("ici", state)
return {
invalidated: state.universitiesInvalidated
};
};
const mapDispatchToProps = (dispatch) => {
return {
invalidate: () => dispatch(universitiesInvalidated(true))
};
};
export default withStyles(styles)(connect(mapStateToProps, mapDispatchToProps)(UnivMapReloadButton));
Supports Markdown
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