formatting and comments

This commit is contained in:
Jason Wall 2020-08-19 10:59:31 -04:00
parent 8d1a21eceb
commit b37eed2781
3 changed files with 19 additions and 8 deletions

View File

@ -13,12 +13,6 @@ export enum CardType {
Error, Error,
} }
export interface CardItem {
readonly qry: string;
readonly data: CardData;
readonly type: CardType;
}
export interface CardIcons { export interface CardIcons {
readonly words: string; readonly words: string;
readonly passage: string; readonly passage: string;
@ -26,3 +20,12 @@ export interface CardIcons {
readonly note: string; readonly note: string;
readonly savedPage: string; readonly savedPage: string;
} }
export interface DataReference {
readonly qry: string;
readonly type: CardType;
}
export interface CardItem extends DataReference {
readonly data: CardData;
}

View File

@ -58,6 +58,7 @@ export class SearchPage extends SubscriberBase implements OnInit {
); );
this.init(); this.init();
// subscribe to autocomplete input control's changes // subscribe to autocomplete input control's changes
this.addSubscription( this.addSubscription(
this.searchControl.valueChanges.subscribe((value: string) => this.appService.getAutoComplete(value.toLowerCase())) this.searchControl.valueChanges.subscribe((value: string) => this.appService.getAutoComplete(value.toLowerCase()))
@ -77,12 +78,14 @@ export class SearchPage extends SubscriberBase implements OnInit {
this.navService.closeNav(); // close the nav immediately. this.navService.closeNav(); // close the nav immediately.
} }
// monitor the saved paged loaded property, and fire the action once it turns true, then stop. // monitor the saved paged loaded property,
// and fire the action once it turns true, then stop.
onSavedPagedLoaded(id: string) { onSavedPagedLoaded(id: string) {
if (this.savedPagedLoaded) { if (this.savedPagedLoaded) {
this.appService.getSavedPage(id); this.appService.getSavedPage(id);
return; return; // you did it! stop trying.
} }
// the saved page hasn't loaded yet, wait then try again.
setTimeout(() => { setTimeout(() => {
this.onSavedPagedLoaded(id); this.onSavedPagedLoaded(id);
}, 100); }, 100);

View File

@ -240,6 +240,8 @@ export function reducer(state: AppState, action: AppAction): AppState {
//#endregion //#endregion
//#region Cards
case 'ADD_CARD': { case 'ADD_CARD': {
let cards = []; let cards = [];
@ -315,6 +317,9 @@ export function reducer(state: AppState, action: AppAction): AppState {
cards, cards,
}; };
} }
//#endregion
case 'SET_USER': { case 'SET_USER': {
return { return {
...state, ...state,