Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions client/modules/User/pages/DashboardView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import AssetList from '../../IDE/components/AssetList';
import AssetSize from '../../IDE/components/AssetSize';
import CollectionList from '../../IDE/components/CollectionList';
import SketchList from '../../IDE/components/SketchList';
import * as ProjectActions from '../../IDE/actions/project';
import {
CollectionSearchbar,
SketchSearchbar
Expand All @@ -29,6 +30,7 @@ class DashboardView extends React.Component {
constructor(props) {
super(props);
this.closeAccountPage = this.closeAccountPage.bind(this);
this.createNewSketch = this.createNewSketch.bind(this);
this.gotoHomePage = this.gotoHomePage.bind(this);
this.toggleCollectionCreate = this.toggleCollectionCreate.bind(this);
this.state = {
Expand All @@ -44,6 +46,10 @@ class DashboardView extends React.Component {
browserHistory.push(this.props.previousPath);
}

createNewSketch() {
this.props.newProject();
}

gotoHomePage() {
browserHistory.push('/');
}
Expand Down Expand Up @@ -98,7 +104,9 @@ class DashboardView extends React.Component {
return (
<React.Fragment>
{this.isOwner() && (
<Button to="/">{t('DashboardView.NewSketch')}</Button>
<Button onClick={this.createNewSketch}>
{t('DashboardView.NewSketch')}
</Button>
)}
<SketchSearchbar />
</React.Fragment>
Expand Down Expand Up @@ -170,7 +178,12 @@ function mapStateToProps(state) {
};
}

const mapDispatchToProps = {
...ProjectActions
};

DashboardView.propTypes = {
newProject: PropTypes.func.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string.isRequired
}).isRequired,
Expand All @@ -185,4 +198,6 @@ DashboardView.propTypes = {
t: PropTypes.func.isRequired
};

export default withTranslation()(connect(mapStateToProps)(DashboardView));
export default withTranslation()(
connect(mapStateToProps, mapDispatchToProps)(DashboardView)
);