diff --git a/src/App.vue b/src/App.vue index 7d21b89..b1ced31 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,7 @@ {{ snackbar.text }} @@ -65,9 +65,9 @@ const AppProps = Vue.extend({ export default class App extends AppProps { propertiesToSyncWithLocalStorage = [ { key: "decks", defaultValue: [] }, - { key: "maxCardCount", defaultValue: "" } + { key: "cardLimit", defaultValue: "" } ] as SyncItem[]; - maxCardCount = ""; + cardLimit = ""; decks = [] as Deck[]; snackbar = { text: "", diff --git a/src/components/learn/Learn.vue b/src/components/learn/Learn.vue index a5d94eb..4bd6e80 100644 --- a/src/components/learn/Learn.vue +++ b/src/components/learn/Learn.vue @@ -51,7 +51,7 @@ const LearnProps = Vue.extend({ props: { decks: { type: Array as () => Deck[] }, numberOfSelectedDecks: Number, - maxCardCount: String + cardLimit: String } }); @@ -141,10 +141,10 @@ export default class Learn extends LearnProps { (this.learningSessionManager.learningSession.currentElementIndex === this.learningSessionManager.learningSession.elements.length - 1 && this.learningSessionManager.cardsToSelectFrom.length === 0) || - (this.maxCardCount === "0" + (this.cardLimit === "0" ? false : this.learningSessionManager.learningSession.currentElementIndex === - parseInt(this.maxCardCount) - 1); + parseInt(this.cardLimit) - 1); return endOfSession; } diff --git a/src/components/settings/CardLimit.vue b/src/components/settings/CardLimit.vue new file mode 100644 index 0000000..e5b9103 --- /dev/null +++ b/src/components/settings/CardLimit.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/src/components/settings/ClearLocalStorage.vue b/src/components/settings/ClearLocalStorage.vue index 47be942..97af96a 100644 --- a/src/components/settings/ClearLocalStorage.vue +++ b/src/components/settings/ClearLocalStorage.vue @@ -21,7 +21,7 @@ import Component from "vue-class-component"; import * as clearStorageDialogHelper from "../../helpers/clearStorageDialogHelper"; @Component -export default class MaxCardCount extends Vue { +export default class ClearLocalStorage extends Vue { clearLocalStorage() { clearStorageDialogHelper.clearLocalStorageDialog(this); } diff --git a/src/components/settings/MaxCardCountCard.vue b/src/components/settings/MaxCardCountCard.vue deleted file mode 100644 index f0bd7eb..0000000 --- a/src/components/settings/MaxCardCountCard.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - - - diff --git a/src/components/settings/Settings.vue b/src/components/settings/Settings.vue index 6b25594..19ac2a0 100644 --- a/src/components/settings/Settings.vue +++ b/src/components/settings/Settings.vue @@ -2,7 +2,7 @@
- + @@ -13,18 +13,18 @@ import Vue from "vue"; import Component from "vue-class-component"; -import MaxCardCount from "./MaxCardCountCard.vue"; +import CardLimit from "./CardLimit.vue"; import ClearLocalStorage from "./ClearLocalStorage.vue"; const SettingProps = Vue.extend({ props: { - maxCardCount: String + cardLimit: String } }); @Component({ components: { - MaxCardCount, + CardLimit, ClearLocalStorage } }) diff --git a/src/helpers/eventListener.ts b/src/helpers/eventListener.ts index 55e4343..c00552f 100644 --- a/src/helpers/eventListener.ts +++ b/src/helpers/eventListener.ts @@ -8,7 +8,6 @@ import { import { clearLocalStorage } from "./localStorageHelper"; import { addDecksFromJSON, addDecksFromFile } from "./addDecksHelper"; import { showSnackbar } from "./snackbarHelper"; -import { updateMaxCardCount } from "./updateMaxCardCount"; export function registerEventListenerForMainApp(context: any) { context.$eventHub.$on(Event.DELETE_SELECTED_DECKS, () => { @@ -47,7 +46,7 @@ export function registerEventListenerForMainApp(context: any) { } context.$router.replace("/"); }); - context.$eventHub.$on(Event.UPDATE_MAX_CARD_COUNT, (newValue: string) => { - updateMaxCardCount(context, newValue); + context.$eventHub.$on(Event.UPDATE_CARD_LIMIT, (newValue: string) => { + context.cardLimit = newValue; }); } diff --git a/src/helpers/updateMaxCardCount.ts b/src/helpers/updateMaxCardCount.ts deleted file mode 100644 index d7e7f7c..0000000 --- a/src/helpers/updateMaxCardCount.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { showSnackbar } from "./snackbarHelper"; - -export function updateMaxCardCount(context: any, newValue: string) { - context.maxCardCount = newValue; - newValue !== "0" - ? showSnackbar( - context, - "Successfully updated max card count to " + newValue + "." - ) - : showSnackbar(context, "Successfully deactivated max card count."); -} diff --git a/src/types/index.ts b/src/types/index.ts index 09e51fa..83bb6e1 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -117,7 +117,7 @@ export enum Event { DESELECT_ALL_DECKS = "deselectAllDecks", SWIPE_LEFT_IN_LEARN = "swipeLeftInLearn", SWIPE_RIGHT_IN_LEARN = "swipeRightInLearn", - UPDATE_MAX_CARD_COUNT = "updateMaxCardCount", + UPDATE_CARD_LIMIT = "updateCardLimit", } export interface NavBarConfigItem { diff --git a/src/views/Learn.vue b/src/views/Learn.vue index c76fe18..c01ea6e 100644 --- a/src/views/Learn.vue +++ b/src/views/Learn.vue @@ -4,7 +4,7 @@ :decks="decks" :numberOfSelectedDecks="numberOfSelectedDecks" :learningSession="learningSession" - :maxCardCount="maxCardCount" + :cardLimit="cardLimit" />
@@ -22,7 +22,7 @@ const LearnProps = Vue.extend({ decks: { type: Array as () => Deck[] }, learningSession: { type: Object as () => LearningSession }, numberOfSelectedDecks: Number, - maxCardCount: String + cardLimit: String } }); diff --git a/src/views/Settings.vue b/src/views/Settings.vue index f0f53fb..3d456cb 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -1,6 +1,6 @@ @@ -12,7 +12,7 @@ import SettingsComponent from "../components/settings/Settings.vue"; const SettingProps = Vue.extend({ props: { - maxCardCount: String + cardLimit: String } });