diff --git a/client/constants.js b/client/constants.js index f71c2317..cabaa570 100644 --- a/client/constants.js +++ b/client/constants.js @@ -27,6 +27,8 @@ export const PROJECT_SAVE_SUCCESS = 'PROJECT_SAVE_SUCCESS'; export const PROJECT_SAVE_FAIL = 'PROJECT_SAVE_FAIL'; export const NEW_PROJECT = 'NEW_PROJECT'; export const RESET_PROJECT = 'RESET_PROJECT'; +export const SHOW_EDIT_PROJECT_NAME = 'SHOW_EDIT_PROJECT_NAME'; +export const HIDE_EDIT_PROJECT_NAME = 'HIDE_EDIT_PROJECT_NAME'; export const SET_PROJECT = 'SET_PROJECT'; export const SET_PROJECTS = 'SET_PROJECTS'; diff --git a/client/modules/IDE/actions/project.js b/client/modules/IDE/actions/project.js index d541a49f..926b88b9 100644 --- a/client/modules/IDE/actions/project.js +++ b/client/modules/IDE/actions/project.js @@ -41,8 +41,7 @@ export function getProject(id) { }; } -export function setProjectName(event) { - const name = event.target.textContent; +export function setProjectName(name) { return { type: ActionTypes.SET_PROJECT_NAME, name @@ -171,3 +170,15 @@ export function cloneProject() { }; } +export function showEditProjectName() { + return { + type: ActionTypes.SHOW_EDIT_PROJECT_NAME + }; +} + +export function hideEditProjectName() { + return { + type: ActionTypes.HIDE_EDIT_PROJECT_NAME + }; +} + diff --git a/client/modules/IDE/components/SidebarItem.js b/client/modules/IDE/components/SidebarItem.js index 4d58377a..f68e0706 100644 --- a/client/modules/IDE/components/SidebarItem.js +++ b/client/modules/IDE/components/SidebarItem.js @@ -16,7 +16,6 @@ class SidebarItem extends React.Component { } handleKeyPress(event) { - console.log(event.key); if (event.key === 'Enter') { this.props.hideEditFileName(this.props.file.id); } diff --git a/client/modules/IDE/components/Toolbar.js b/client/modules/IDE/components/Toolbar.js index c69f04c5..463c2045 100644 --- a/client/modules/IDE/components/Toolbar.js +++ b/client/modules/IDE/components/Toolbar.js @@ -6,57 +6,96 @@ const stopUrl = require('../../../images/stop.svg'); const preferencesUrl = require('../../../images/preferences.svg'); import classNames from 'classnames'; -function Toolbar(props) { - let playButtonClass = classNames({ - 'toolbar__play-button': true, - 'toolbar__play-button--selected': props.isPlaying - }); - let stopButtonClass = classNames({ - 'toolbar__stop-button': true, - 'toolbar__stop-button--selected': !props.isPlaying - }); - let preferencesButtonClass = classNames({ - 'toolbar__preferences-button': true, - 'toolbar__preferences-button--selected': props.preferencesIsVisible - }); +class Toolbar extends React.Component { + constructor(props) { + super(props); + this.handleKeyPress = this.handleKeyPress.bind(this); + this.handleProjectNameChange = this.handleProjectNameChange.bind(this); + } - return ( -
by {this.props.owner.username}
+ ); + } + })()} +by {props.owner.username}
- ); - } - })()} +