mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-28 09:59:50 -04:00
Clear cards setting option
This commit is contained in:
parent
d406a1554b
commit
6f1cd2c68a
@ -18,6 +18,10 @@
|
||||
<mat-icon matListIcon color="accenovert">note_add</mat-icon>
|
||||
Create a New Note
|
||||
</a>
|
||||
<a mat-list-item (click)="clearCurrentCard()">
|
||||
<mat-icon matListIcon color="accenovert">clear_all</mat-icon>
|
||||
Clear Cards
|
||||
</a>
|
||||
</mat-nav-list>
|
||||
|
||||
<mat-toolbar>Search Settings</mat-toolbar>
|
||||
|
@ -134,6 +134,11 @@ export class SettingsComponent extends SubscriberBase {
|
||||
});
|
||||
}
|
||||
|
||||
clearCurrentCard(){
|
||||
this.appService.clearCards();
|
||||
this.navService.closeSettings();
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Saved Page Settings
|
||||
|
@ -96,6 +96,12 @@ export class AppActionFactory {
|
||||
} as AppAction;
|
||||
}
|
||||
|
||||
static newClearCards(): AppAction {
|
||||
return {
|
||||
type: 'CLEAR_CARDS',
|
||||
} as AppAction;
|
||||
}
|
||||
|
||||
static newUpdateError(error: Error): AppAction {
|
||||
return {
|
||||
type: 'UPDATE_ERROR',
|
||||
@ -227,6 +233,9 @@ export type AppAction =
|
||||
type: 'REMOVE_CARD';
|
||||
card: CardItem;
|
||||
}
|
||||
| {
|
||||
type: 'CLEAR_CARDS';
|
||||
}
|
||||
| {
|
||||
type: 'MOVE_CARD';
|
||||
card: CardItem;
|
||||
|
@ -311,6 +311,15 @@ export function reducer(state: AppState, action: AppAction): AppState {
|
||||
};
|
||||
}
|
||||
|
||||
case 'CLEAR_CARDS': {
|
||||
// potentially remove card from a saved page.
|
||||
|
||||
return {
|
||||
...state,
|
||||
currentCards: new Storable([]),
|
||||
};
|
||||
}
|
||||
|
||||
case 'MOVE_CARD': {
|
||||
const cards = moveItemUpOrDown(state.currentCards.value, action.card, action.direction);
|
||||
|
||||
|
@ -170,6 +170,12 @@ export class AppService extends createStateService(reducer, initialState) {
|
||||
);
|
||||
}
|
||||
|
||||
async clearCards() {
|
||||
this.dispatch(
|
||||
AppActionFactory.newClearCards()
|
||||
);
|
||||
}
|
||||
|
||||
private async getCardByQuery(qry: string, type?: CardType): Promise<CardItem> {
|
||||
if (qry.startsWith('note:')) {
|
||||
const q = qry.toLocaleLowerCase().trim().replace('note:', '');
|
||||
|
Loading…
x
Reference in New Issue
Block a user