diff --git a/client/components/modals/SleepTimerModal.vue b/client/components/modals/SleepTimerModal.vue index 84e1d7bb..60193050 100644 --- a/client/components/modals/SleepTimerModal.vue +++ b/client/components/modals/SleepTimerModal.vue @@ -9,10 +9,14 @@
+
+ + Set +
@@ -48,19 +52,28 @@ export default { }, data() { return { + customTime: null, sleepTimes: [ - { - seconds: 10, - text: '10 seconds' - }, { seconds: 60 * 5, text: '5 minutes' }, + { + seconds: 60 * 15, + text: '15 minutes' + }, + { + seconds: 60 * 20, + text: '20 minutes' + }, { seconds: 60 * 30, text: '30 minutes' }, + { + seconds: 60 * 45, + text: '45 minutes' + }, { seconds: 60 * 60, text: '60 minutes' @@ -72,10 +85,6 @@ export default { { seconds: 60 * 120, text: '2 hours' - }, - { - seconds: 60 * 180, - text: '3 hours' } ] } @@ -97,8 +106,17 @@ export default { } }, methods: { - setTime(time) { - this.$emit('set', time.seconds) + submitCustomTime() { + if (!this.customTime || isNaN(this.customTime) || Number(this.customTime) <= 0) { + this.customTime = null + return + } + + const timeInSeconds = Math.round(Number(this.customTime) * 60) + this.setTime(timeInSeconds) + }, + setTime(seconds) { + this.$emit('set', seconds) }, increment(amount) { this.$emit('increment', amount) diff --git a/client/components/ui/TextInput.vue b/client/components/ui/TextInput.vue index 9fcb1572..c347eea3 100644 --- a/client/components/ui/TextInput.vue +++ b/client/components/ui/TextInput.vue @@ -1,6 +1,6 @@