File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
client/modules/IDE/reducers Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ const defaultCSS =
32
32
}
33
33
` ;
34
34
35
- function initialState ( ) {
35
+ const initialState = ( ) => {
36
36
const a = objectID ( ) . toHexString ( ) ;
37
37
const b = objectID ( ) . toHexString ( ) ;
38
38
const c = objectID ( ) . toHexString ( ) ;
@@ -70,7 +70,7 @@ function initialState() {
70
70
fileType : 'file' ,
71
71
children : [ ]
72
72
} ] ;
73
- }
73
+ } ;
74
74
75
75
function getAllDescendantIds ( state , nodeId ) {
76
76
return state . find ( file => file . id === nodeId ) . children
Original file line number Diff line number Diff line change 1
1
import * as ActionTypes from '../../../constants' ;
2
+ import generate from 'project-name-generator' ;
2
3
3
- const initialState = {
4
- name : 'Hello p5.js'
4
+ const initialState = ( ) => {
5
+ const generatedString = generate ( { words : 2 } ) . spaced ;
6
+ const generatedName = generatedString . charAt ( 0 ) . toUpperCase ( ) + generatedString . slice ( 1 ) ;
7
+ return {
8
+ name : generatedName
9
+ } ;
5
10
} ;
6
11
7
- const project = ( state = initialState , action ) => {
12
+ const project = ( state , action ) => {
13
+ if ( state === undefined ) {
14
+ state = initialState ( ) ; // eslint-disable-line
15
+ }
8
16
switch ( action . type ) {
9
17
case ActionTypes . SET_PROJECT_NAME :
10
18
return Object . assign ( { } , { ...state } , { name : action . name } ) ;
@@ -21,7 +29,7 @@ const project = (state = initialState, action) => {
21
29
owner : action . owner
22
30
} ;
23
31
case ActionTypes . RESET_PROJECT :
24
- return initialState ;
32
+ return initialState ( ) ;
25
33
case ActionTypes . SHOW_EDIT_PROJECT_NAME :
26
34
return Object . assign ( { } , state , { isEditingName : true } ) ;
27
35
case ActionTypes . HIDE_EDIT_PROJECT_NAME :
Original file line number Diff line number Diff line change 94
94
"passport" : " ^0.3.2" ,
95
95
"passport-github" : " ^1.1.0" ,
96
96
"passport-local" : " ^1.0.0" ,
97
+ "project-name-generator" : " ^2.1.3" ,
97
98
"react" : " ^15.1.0" ,
98
99
"react-dom" : " ^15.1.0" ,
99
100
"react-inlinesvg" : " ^0.4.2" ,
You can’t perform that action at this time.
0 commit comments