Added more views and atlas APIs

This commit is contained in:
Jori Lallo
2016-05-07 11:52:08 -07:00
parent 84ba65f72a
commit cbe9c0b6ee
22 changed files with 397 additions and 27 deletions

View File

@@ -1,37 +1,53 @@
import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { replace } from 'react-router-redux';
import { client } from 'utils/ApiClient';
import { fetchAtlasesAsync } from 'actions/AtlasActions';
import Layout from 'components/Layout';
import AtlasPreview from 'components/AtlasPreview';
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
import CenteredContent from 'components/CenteredContent';
import styles from './Dashboard.scss';
class Dashboard extends React.Component {
static propTypes = {
replace: React.PropTypes.func.isRequired,
}
componentDidMount = () => {
this.props.fetchAtlasesAsync(this.props.teamId);
}
render() {
return (
<Layout
header={<div>header!</div>}
>
<div className={ styles.content }>
<AtlasPreviewLoading />
</div>
<Layout>
<CenteredContent>
{ this.props.isLoading ? (
<AtlasPreviewLoading />
) : this.props.items.map((item) => {
return (<AtlasPreview data={ item } />);
}) }
</CenteredContent>
</Layout>
);
}
}
const mapStateToProps = (state) => {
return {
teamId: state.team ? state.team.id : null,
isLoading: state.atlases.isLoading,
items: state.atlases.items,
}
};
const mapDispatchToProps = (dispatch) => {
return bindActionCreators({ replace }, dispatch)
return bindActionCreators({
fetchAtlasesAsync,
}, dispatch)
}
export default connect(
null, mapDispatchToProps
mapStateToProps,
mapDispatchToProps
)(Dashboard);

View File

@@ -1,7 +0,0 @@
.content {
display: flex;
flex: 1;
max-width: 600px;
margin: 40px 20px;
}