Mes candidatures setup

This commit is contained in:
2019-06-21 16:09:34 +02:00
parent 54ea1f7ac5
commit 7e2886219f
+71
View File
@@ -0,0 +1,71 @@
import React from 'react';
import { connect } from "react-redux";
import PropTypes from 'prop-types';
import _ from "lodash"
import { withStyles } from '@material-ui/core/styles';
import { Typography } from '@material-ui/core';
import LayoutGrid from "../components/templates/LayoutGrid";
import Grid from "../components/templates/Grid"
import OffreRow from "../components/organisms/OffreRow"
import { fetchAdsRequest } from '../actions/ads'
import { AdsSelector } from '../reducers/ads'
const styles = theme => ({
root: {
position: 'relative',
textAlign: 'center',
paddingTop: theme.spacing(20),
justifyContent: 'center',
},
container: {
display: 'flex',
flexDirection: 'column',
height: '100%',
},
});
class Candidatures extends React.Component {
render() {
const { classes } = this.props;
return (
<LayoutGrid backLink="/">
{/* TODO */}
<Typography variant="h2" component="h3" align="center" gutterBottom>
Mes candidatures //TODO
</Typography>
<div className={classes.container}>
<Grid CustomRowComponent={OffreRow}
dataFetcher={this.props.fetchAdsRequest}
data={this.props.ads}
currentPage={this.props.currentPage}
recordCount={this.props.recordCount}
/>
</div>
</LayoutGrid>
);
}
}
Candidatures.propTypes = {
classes: PropTypes.object.isRequired,
};
function mapStateToProps(state) {
return {
ads: Object.keys(state.ads).length !== 0 && AdsSelector(state),
//ads: state.ads.data,
currentPage: _.toNumber(!!state.ads.meta && _.ceil((state.ads.meta.offset + 1) / state.ads.meta.limit)),
recordCount: _.toNumber(!!state.ads.meta && state.ads.meta.total_items)
};
}
export default withStyles(styles)(connect(mapStateToProps, { fetchAdsRequest })(Candidatures))