-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into cerealize
- Loading branch information
Showing
40 changed files
with
587 additions
and
745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
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 navigateToCollection(collectionName) { | ||
return runCommand(SHOW_COLLECTION, { collectionName }); | ||
} | ||
|
||
export function createNewEntryInCollection(collectionName) { | ||
return runCommand(CREATE_COLLECTION, { collectionName }); | ||
} | ||
|
||
export function runCommand(commandName, payload) { | ||
return dispatch => { | ||
switch (commandName) { | ||
export function runCommand(command, payload) { | ||
return (dispatch) => { | ||
switch (command) { | ||
case SHOW_COLLECTION: | ||
history.push(`/collections/${payload.collectionName}`); | ||
history.push(getCollectionUrl(payload.collectionName)); | ||
break; | ||
case CREATE_COLLECTION: | ||
history.push(`/collections/${payload.collectionName}/entries/new`); | ||
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}`); | ||
history.push(`/search/${ payload.searchTerm }`); | ||
break; | ||
default: | ||
break; | ||
} | ||
dispatch(run(commandName, payload)); | ||
dispatch({ type: RUN_COMMAND, command, payload }); | ||
}; | ||
} | ||
|
||
export function navigateToCollection(collectionName) { | ||
return runCommand(SHOW_COLLECTION, { collectionName }); | ||
} | ||
|
||
export function createNewEntryInCollection(collectionName) { | ||
return runCommand(CREATE_COLLECTION, { collectionName }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.