diff --git a/client/constants.js b/client/constants.js index 0ef97b4e..803d652e 100644 --- a/client/constants.js +++ b/client/constants.js @@ -104,3 +104,4 @@ export const RESET_JUST_OPENED_PROJECT = 'RESET_JUST_OPENED_PROJECT'; export const SET_PROJECT_SAVED_TIME = 'SET_PROJECT_SAVED_TIME'; export const RESET_PROJECT_SAVED_TIME = 'RESET_PROJECT_SAVED_TIME'; +export const SET_PREVIOUS_PATH = 'SET_PREVIOUS_PATH'; diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js index 8696e42b..3266aca6 100644 --- a/client/modules/IDE/actions/ide.js +++ b/client/modules/IDE/actions/ide.js @@ -220,3 +220,10 @@ export function resetProjectSavedTime() { type: ActionTypes.RESET_PROJECT_SAVED_TIME, }; } + +export function setPreviousPath(path) { + return { + type: ActionTypes.SET_PREVIOUS_PATH, + path + }; +} diff --git a/client/modules/IDE/actions/projects.js b/client/modules/IDE/actions/projects.js index 4595d759..2b613dc9 100644 --- a/client/modules/IDE/actions/projects.js +++ b/client/modules/IDE/actions/projects.js @@ -1,5 +1,4 @@ import * as ActionTypes from '../../../constants'; -import { browserHistory } from 'react-router'; import axios from 'axios'; const ROOT_URL = location.href.indexOf('localhost') > 0 ? 'http://localhost:8000/api' : '/api'; @@ -26,10 +25,6 @@ export function getProjects(username) { }; } -export function closeSketchList() { - browserHistory.goBack(); -} - export function deleteProject(id) { return (dispatch) => { axios.delete(`${ROOT_URL}/projects/${id}`, { withCredentials: true }) diff --git a/client/modules/IDE/components/About.jsx b/client/modules/IDE/components/About.jsx index 534c6642..d09a00c6 100644 --- a/client/modules/IDE/components/About.jsx +++ b/client/modules/IDE/components/About.jsx @@ -1,15 +1,20 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; import InlineSVG from 'react-inlinesvg'; const exitUrl = require('../../../images/exit.svg'); import { browserHistory } from 'react-router'; class About extends React.Component { + constructor(props) { + super(props); + this.closeAboutModal = this.closeAboutModal.bind(this); + } + componentDidMount() { this.refs.about.focus(); } closeAboutModal() { - browserHistory.goBack(); + browserHistory.push(this.props.previousPath); } render() { @@ -42,4 +47,8 @@ class About extends React.Component { } } +About.propTypes = { + previousPath: PropTypes.string.isRequired +}; + export default About; diff --git a/client/modules/IDE/components/LoginForm.jsx b/client/modules/IDE/components/LoginForm.jsx index 4f872c81..b6e2602d 100644 --- a/client/modules/IDE/components/LoginForm.jsx +++ b/client/modules/IDE/components/LoginForm.jsx @@ -3,7 +3,7 @@ import React, { PropTypes } from 'react'; function LoginForm(props) { const { fields: { email, password }, handleSubmit, submitting, pristine } = props; return ( -