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,
}
export interface CardItem {
readonly qry: string;
readonly data: CardData;
readonly type: CardType;
}
export interface CardIcons {
readonly words: string;
readonly passage: string;
@ -26,3 +20,12 @@ export interface CardIcons {
readonly note: 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();
// subscribe to autocomplete input control's changes
this.addSubscription(
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.
}
// 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) {
if (this.savedPagedLoaded) {
this.appService.getSavedPage(id);
return;
return; // you did it! stop trying.
}
// the saved page hasn't loaded yet, wait then try again.
setTimeout(() => {
this.onSavedPagedLoaded(id);
}, 100);

View File

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