From b5ceb782f40fc1e402d1e58bc1ced2e4038fd787 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 6 Mar 2021 17:10:15 +0100 Subject: adding project CRUD editor --- .../app/views/project/containers/project.index.js | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 animism-align/frontend/app/views/project/containers/project.index.js (limited to 'animism-align/frontend/app/views/project/containers/project.index.js') diff --git a/animism-align/frontend/app/views/project/containers/project.index.js b/animism-align/frontend/app/views/project/containers/project.index.js new file mode 100644 index 0000000..cf36970 --- /dev/null +++ b/animism-align/frontend/app/views/project/containers/project.index.js @@ -0,0 +1,71 @@ +import React, { Component } from 'react' +import { Link } from 'react-router-dom' +import { connect } from 'react-redux' + +import { Loader } from 'app/common' +import actions from 'app/actions' + +import ProjectMenu from '../components/project.menu' + +// const { result, collectionLookup } = this.props + +class ProjectIndex extends Component { + componentDidMount() { + this.fetch() + } + + fetch() { + actions.project.index() + } + + render() { + const { loading, lookup, order } = this.props.project.index + if (loading) { + return ( +
+ +
+ ) + } + if (!lookup || !order.length) { + return ( +
+
+ +
+

Projects

+

+ {"No projects"} +

+
+
+
+ ) + } + return ( +
+
+ +
+

Projects

+ {order.map(id => ( +
+ {lookup[id].title}{': '} + + {lookup[id].title} + +
+ ))} +
+
+ {order.length >= 50 && } +
+ ) + } +} + +const mapStateToProps = state => ({ + project: state.project, +}) + +export default connect(mapStateToProps)(ProjectIndex) -- cgit v1.2.3-70-g09d2