react-logo/frontend/src/pages/DashBoardClient.js

97 lines
2.7 KiB
JavaScript
Raw Normal View History

2020-02-19 11:53:32 +01:00
import React, { useEffect } from 'react'
import { connect } from 'react-redux'
import Page from './page';
import ProjectList from '../components/ProjectList';
import { projectUserListRequest } from '../actions/project';
const DashBoardClient = ({ projects = [], ...props }) => {
useEffect(() => {
props.dispatch(projectUserListRequest())
}, [])
projects = [
{
id: 1,
name: 'mon premier projet',
requests: [
{
id: 1,
title: 'Demande num 1',
author: 'Gael Peltey',
status: {
id: 1,
slug: 'en-attente'
},
createdAt: 'le 20 juillet 2019'
},
{
id: 2,
title: 'Demande num 2',
author: 'Jean Guy',
status: {
id: 2,
slug: 'pris-en-compte'
},
createdAt: 'le 20 juillet 2020'
},
{
id: 3,
title: 'Demande num 3',
author: 'Gael Peltey',
status: {
id: 3,
slug: 'en-cours-de-traitement'
},
createdAt: 'le 20 juillet 2021'
}
]
},
{
id: 2,
name: 'mon deuxième projet',
},
{
id: 3,
name: 'mon troisième projet',
requests: [
{
id: 4,
title: 'Demande num 4',
author: 'David Pujadas',
status: {
id: 4,
slug: 'traite'
},
createdAt: 'le 20 juillet 2022'
},
{
id: 5,
title: 'Demande num 5',
author: 'Jean Mi',
status: {
id: 5,
slug: 'clos'
},
createdAt: 'le 20 juillet 2023'
}
]
},
]
return (
<Page title="dashBoard client">
<div className="notification">
<h1>Mon dashboard</h1>
</div>
<ProjectList projects={projects} withRequest />
</Page>
);
}
const mapStateToProps = ({ project }) => ({
projects: project.items,
})
export default connect(mapStateToProps)(DashBoardClient)