diff --git a/lib/flux/app-state.ts b/lib/flux/app-state.ts index d38375014..d01cbd841 100644 --- a/lib/flux/app-state.ts +++ b/lib/flux/app-state.ts @@ -40,7 +40,6 @@ const initialState: AppState = { tags: [], revision: null, showTrash: false, - listTitle: 'All Notes', showNavigation: false, showNoteInfo: false, isViewingRevisions: false, @@ -96,7 +95,6 @@ export const actionMap = new ActionMap({ showNavigation: { $set: false }, editingTags: { $set: false }, showTrash: { $set: false }, - listTitle: { $set: 'All Notes' }, tag: { $set: null }, previousIndex: { $set: -1 }, }); @@ -107,7 +105,6 @@ export const actionMap = new ActionMap({ showNavigation: { $set: false }, editingTags: { $set: false }, showTrash: { $set: true }, - listTitle: { $set: 'Trash' }, tag: { $set: null }, previousIndex: { $set: -1 }, }); @@ -131,7 +128,6 @@ export const actionMap = new ActionMap({ showNavigation: { $set: false }, editingTags: { $set: false }, showTrash: { $set: false }, - listTitle: { $set: tag.data.name }, tag: { $set: tag }, previousIndex: { $set: -1 }, }); diff --git a/lib/search-field/index.tsx b/lib/search-field/index.tsx index bd6070016..880fba4f1 100644 --- a/lib/search-field/index.tsx +++ b/lib/search-field/index.tsx @@ -75,10 +75,10 @@ export class SearchField extends Component { } } -const mapStateToProps = ({ appState: state }: State) => ({ +const mapStateToProps = ({ appState: state, ui: { listTitle } }: State) => ({ filter: state.filter, isTagSelected: !!state.tag, - placeholder: state.listTitle, + placeholder: listTitle, searchFocus: state.searchFocus, }); diff --git a/lib/state/index.ts b/lib/state/index.ts index 0a9407217..0117f2fdb 100644 --- a/lib/state/index.ts +++ b/lib/state/index.ts @@ -32,7 +32,6 @@ export type AppState = { editingTags: boolean; filter: string; isViewingRevisions: boolean; - listTitle: T.TranslatableString; nextDialogKey: number; notes: T.NoteEntity[] | null; preferences?: T.Preferences; diff --git a/lib/state/ui/reducer.ts b/lib/state/ui/reducer.ts index 6e9ccd84e..99a9e85dc 100644 --- a/lib/state/ui/reducer.ts +++ b/lib/state/ui/reducer.ts @@ -11,6 +11,22 @@ const filteredNotes: A.Reducer = ( action ) => ('FILTER_NOTES' === action.type ? action.notes : state); +const listTitle: A.Reducer = ( + state = 'All Notes', + action +) => { + switch (action.type) { + case 'App.showAllNotes': + return 'All Notes'; + case 'App.selectTrash': + return 'Trash'; + case 'App.selectTag': + return action.tag.data.name; + default: + return state; + } +}; + const unsyncedNoteIds: A.Reducer = ( state = emptyList as T.EntityId[], action @@ -57,6 +73,7 @@ const note: A.Reducer = (state = null, action) => { export default combineReducers({ filteredNotes, + listTitle, note, simperiumConnected, unsyncedNoteIds,