diff --git a/src/App.vue b/src/App.vue index a3d4db70..c4e70b7a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,7 +71,7 @@ - + {{ snackbarText }} Close @@ -98,11 +98,16 @@ import { readSnackbarText, } from "./store"; +const SMALL_TIMEOUT = 1250; +const LARGE_TIMEOUT = 3000; + @Component({ name: "App" }) export default class extends Vue { private snackbarEnabled: boolean = false; private snackbarText: string = ""; private drawer: boolean = false; + private seenSnackbarTexts: { [x in string]: boolean } = {}; + private timeout: number = SMALL_TIMEOUT; public created() { this.$watch(() => this.snackbarEnabled, function(snackbarEnabled) { @@ -114,6 +119,13 @@ export default class extends Vue { if (snackbarText !== null) { this.snackbarEnabled = true; this.snackbarText = snackbarText; + + if (this.seenSnackbarTexts[snackbarText]) { + this.timeout = SMALL_TIMEOUT; + } else { + this.timeout = LARGE_TIMEOUT; + } + this.seenSnackbarTexts[snackbarText] = true; } else { this.snackbarEnabled = false; this.snackbarText = ""; diff --git a/src/views/Training.vue b/src/views/Training.vue index c1d73653..89646b50 100644 --- a/src/views/Training.vue +++ b/src/views/Training.vue @@ -235,7 +235,7 @@ export default class extends Vue { practiceSet, }); await dispatchSaveState(this.$store); - commitSnackbarText(this.$store, "Practice set recorded"); + commitSnackbarText(this.$store, "Practice set recorded."); } }