Added more views and atlas APIs
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
max-width: 600px;
|
||||
|
||||
margin: 40px 20px;
|
||||
}
|
||||
Reference in New Issue
Block a user