Skip to content

Fixes #1813 #1863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2021
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)
);