2016-06-22 19:58:23 +00:00
|
|
|
import * as ActionTypes from '../../../constants';
|
2016-06-16 20:07:38 +00:00
|
|
|
|
|
|
|
const initialState = {
|
2016-06-23 22:29:55 +00:00
|
|
|
name: 'Hello p5.js'
|
|
|
|
};
|
2016-06-16 20:07:38 +00:00
|
|
|
|
|
|
|
const project = (state = initialState, action) => {
|
2016-06-23 22:29:55 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.SET_PROJECT_NAME:
|
|
|
|
return {
|
|
|
|
name: action.name
|
|
|
|
};
|
|
|
|
case ActionTypes.NEW_PROJECT:
|
|
|
|
return {
|
|
|
|
id: action.id,
|
|
|
|
name: action.name
|
|
|
|
};
|
|
|
|
case ActionTypes.SET_PROJECT:
|
|
|
|
return {
|
|
|
|
id: action.project.id,
|
|
|
|
name: action.project.name,
|
|
|
|
file: {
|
|
|
|
name: action.project.file.name,
|
|
|
|
content: action.project.file.content
|
|
|
|
}
|
|
|
|
};
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
2016-06-16 20:07:38 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
export default project;
|