update sidebar styling, add new entry links (#276)

* udpate sidebar styling, add new entry links

* make sidebar new entry links always visible

* simplify app bar implementation, findbar
This commit is contained in:
Shawn Erquhart
2017-03-15 14:32:41 -04:00
committed by David Calavera
parent e7dc2c4e84
commit 705e348138
16 changed files with 217 additions and 639 deletions

View File

@ -1,13 +1,32 @@
import history from '../routing/history';
import { SEARCH } from '../components/FindBar/FindBar';
import { getCollectionUrl, getNewEntryUrl } from '../lib/urlHelper';
export const RUN_COMMAND = 'RUN_COMMAND';
export const SHOW_COLLECTION = 'SHOW_COLLECTION';
export const CREATE_COLLECTION = 'CREATE_COLLECTION';
export const HELP = 'HELP';
export function run(commandName, payload) {
return { type: RUN_COMMAND, command: commandName, payload };
export function runCommand(command, payload) {
return (dispatch) => {
switch (command) {
case SHOW_COLLECTION:
history.push(getCollectionUrl(payload.collectionName));
break;
case CREATE_COLLECTION:
history.push(getNewEntryUrl(payload.collectionName));
break;
case HELP:
window.alert('Find Bar Help (PLACEHOLDER)\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.');
break;
case SEARCH:
history.push(`/search/${ payload.searchTerm }`);
break;
default:
break;
}
dispatch({ type: RUN_COMMAND, command, payload });
};
}
export function navigateToCollection(collectionName) {
@ -17,23 +36,3 @@ export function navigateToCollection(collectionName) {
export function createNewEntryInCollection(collectionName) {
return runCommand(CREATE_COLLECTION, { collectionName });
}
export function runCommand(commandName, payload) {
return dispatch => {
switch (commandName) {
case SHOW_COLLECTION:
history.push(`/collections/${payload.collectionName}`);
break;
case CREATE_COLLECTION:
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.');
break;
case SEARCH:
history.push(`/search/${payload.searchTerm}`);
break;
}
dispatch(run(commandName, payload));
};
}