Added "Create new" buttons to the header. Closes #49

Note that this is temp solution UI-wise since it won't scale.
This commit is contained in:
Andrey Okonetchnikov
2016-09-15 11:12:33 +02:00
parent 52ff3c415f
commit 5409cc1022
3 changed files with 32 additions and 5 deletions

View File

@ -10,14 +10,18 @@ export function run(commandName, payload) {
return { type: RUN_COMMAND, command: commandName, payload };
}
export function createNewEntryInCollection(collectionName) {
return runCommand(CREATE_COLLECTION, { collectionName });
}
export function runCommand(commandName, payload) {
return (dispatch, getState) => {
return dispatch => {
switch (commandName) {
case SHOW_COLLECTION:
history.push(`/collections/${payload.collectionName}`);
break;
case CREATE_COLLECTION:
window.alert(`Create a new ${payload.collectionName} - not supported yet`);
history.push(`/collections/${payload.collectionName}/entries/new`);
break;
case HELP:
window.alert('Find Bar Help (PLACEHOLDER)\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.');