feat: add last snoozed time as a snooze option

This commit is contained in:
Vishnu Narayanan
2025-08-20 17:48:13 +05:30
parent 7fe94dc1a2
commit 1fed175e65
9 changed files with 134 additions and 3 deletions
@@ -1,6 +1,8 @@
<script>
import DatePicker from 'vue-datepicker-next';
import NextButton from 'dashboard/components-next/button/Button.vue';
import { getUnixTime } from 'date-fns';
import { saveLastCustomSnoozeTime } from 'dashboard/helper/customSnoozeStorage';
export default {
components: {
@@ -25,7 +27,12 @@ export default {
this.$emit('close');
},
chooseTime() {
this.$emit('chooseTime', this.snoozeTime);
if (this.snoozeTime) {
const unixTimestamp = getUnixTime(this.snoozeTime);
// Save the custom time to localStorage for future use
saveLastCustomSnoozeTime(unixTimestamp);
this.$emit('chooseTime', this.snoozeTime);
}
},
disabledDate(date) {
// Disable all the previous dates
@@ -1,6 +1,7 @@
<script>
import { getUnixTime } from 'date-fns';
import { findSnoozeTime } from 'dashboard/helper/snoozeHelpers';
import { getLastCustomSnoozeTime } from 'dashboard/helper/customSnoozeStorage';
import { emitter } from 'shared/helpers/mitt';
import wootConstants from 'dashboard/constants/globals';
import {
@@ -100,6 +101,17 @@ export default {
onCmdSnoozeConversation(snoozeType) {
if (snoozeType === wootConstants.SNOOZE_OPTIONS.UNTIL_CUSTOM_TIME) {
this.showCustomTimeSnoozeModal = true;
} else if (
snoozeType === wootConstants.SNOOZE_OPTIONS.UNTIL_LAST_CUSTOM_TIME
) {
// Use the saved custom time
const lastCustomTime = getLastCustomSnoozeTime();
if (lastCustomTime) {
this.updateConversations('snoozed', lastCustomTime);
} else {
// Fallback to showing custom modal if no saved time exists
this.showCustomTimeSnoozeModal = true;
}
} else {
this.updateConversations('snoozed', findSnoozeTime(snoozeType) || null);
}