diff --git a/src/src/app/components/settings/settings.component.html b/src/src/app/components/settings/settings.component.html
index 73cd19af..34a07edc 100644
--- a/src/src/app/components/settings/settings.component.html
+++ b/src/src/app/components/settings/settings.component.html
@@ -18,6 +18,10 @@
note_add
Create a New Note
+
+ clear_all
+ Clear Cards
+
Search Settings
diff --git a/src/src/app/components/settings/settings.component.ts b/src/src/app/components/settings/settings.component.ts
index 68c55790..bce8375a 100644
--- a/src/src/app/components/settings/settings.component.ts
+++ b/src/src/app/components/settings/settings.component.ts
@@ -134,6 +134,11 @@ export class SettingsComponent extends SubscriberBase {
});
}
+ clearCurrentCard(){
+ this.appService.clearCards();
+ this.navService.closeSettings();
+ }
+
//#endregion
//#region Saved Page Settings
diff --git a/src/src/app/services/app-state-actions.ts b/src/src/app/services/app-state-actions.ts
index c6741191..91b89303 100644
--- a/src/src/app/services/app-state-actions.ts
+++ b/src/src/app/services/app-state-actions.ts
@@ -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;
diff --git a/src/src/app/services/app-state-reducer.ts b/src/src/app/services/app-state-reducer.ts
index 034a2cf0..c1458d9e 100644
--- a/src/src/app/services/app-state-reducer.ts
+++ b/src/src/app/services/app-state-reducer.ts
@@ -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);
diff --git a/src/src/app/services/app.service.ts b/src/src/app/services/app.service.ts
index fbe56ab5..497322fc 100644
--- a/src/src/app/services/app.service.ts
+++ b/src/src/app/services/app.service.ts
@@ -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 {
if (qry.startsWith('note:')) {
const q = qry.toLocaleLowerCase().trim().replace('note:', '');