mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-25 08:53:50 +00:00
feat(reminder): add snooze until tomorrow to list items
This commit is contained in:
parent
275ddec740
commit
f1f6af930f
3 changed files with 22 additions and 4 deletions
|
|
@ -62,6 +62,12 @@
|
|||
<mat-icon>snooze</mat-icon>
|
||||
{{T.G.MINUTES|translate:{m: 60} }}
|
||||
</button>
|
||||
<button (click)="snoozeUntilTomorrow(task)"
|
||||
[disabled]="isDisableControls"
|
||||
mat-menu-item>
|
||||
<mat-icon>snooze</mat-icon>
|
||||
{{T.F.TASK.D_REMINDER_VIEW.SNOOZE_UNTIL_TOMORROW|translate}}
|
||||
</button>
|
||||
<button (click)="dismiss(task)"
|
||||
mat-menu-item>
|
||||
<mat-icon>alarm_off</mat-icon>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { AddTaskReminderInterface } from '../dialog-add-task-reminder/add-task-r
|
|||
import { TODAY_TAG } from '../../tag/tag.const';
|
||||
import { standardListAnimation } from '../../../ui/animations/standard-list.ani';
|
||||
import { unique } from '../../../util/unique';
|
||||
import { getTomorrow } from '../../../util/get-tomorrow';
|
||||
|
||||
const M = 1000 * 60;
|
||||
|
||||
|
|
@ -95,6 +96,13 @@ export class DialogViewTaskRemindersComponent implements OnDestroy {
|
|||
this._removeFromList(task.reminderId as string);
|
||||
}
|
||||
|
||||
snoozeUntilTomorrow(task: TaskWithReminderData) {
|
||||
this._reminderService.updateReminder(task.reminderData.id, {
|
||||
remindAt: getTomorrow().getTime()
|
||||
});
|
||||
this._removeFromList(task.reminderId as string);
|
||||
}
|
||||
|
||||
editReminder(task: TaskWithReminderData, isCloseAfter: boolean = false) {
|
||||
this._subs.add(this._matDialog.open(DialogAddTaskReminderComponent, {
|
||||
restoreFocus: true,
|
||||
|
|
@ -125,12 +133,10 @@ export class DialogViewTaskRemindersComponent implements OnDestroy {
|
|||
|
||||
snoozeAllUntilTomorrow() {
|
||||
this.isDisableControls = true;
|
||||
const date = new Date();
|
||||
date.setHours(9, 0, 0, 0);
|
||||
date.setDate(date.getDate() + 1);
|
||||
const tomorrow = getTomorrow().getTime();
|
||||
this.reminders$.getValue().forEach((reminder) => {
|
||||
this._reminderService.updateReminder(reminder.id, {
|
||||
remindAt: date.getTime()
|
||||
remindAt: tomorrow
|
||||
});
|
||||
});
|
||||
this._close();
|
||||
|
|
|
|||
6
src/app/util/get-tomorrow.ts
Normal file
6
src/app/util/get-tomorrow.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export const getTomorrow = (hour = 9): Date => {
|
||||
const date = new Date();
|
||||
date.setHours(hour, 0, 0, 0);
|
||||
date.setDate(date.getDate() + 1);
|
||||
return date;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue