mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-22 18:30:09 +00:00
fix(reminders): clear scheduled time when adding to today from dialog
When user clicks "Add to Today" in the reminder dialog, the task's scheduled time is now always cleared, even if it was originally scheduled for a specific time today (e.g., "2:30 PM today"). This ensures tasks become "sometime today" without a specific hour when added from the reminder dialog, while preserving the existing behavior for other flows (context menu, drag-drop). - Add isClearScheduledTime parameter to planTasksForToday action - Update reminder dialog to pass isClearScheduledTime: true - Update meta-reducer logic to clear dueWithTime when flag is set
This commit is contained in:
parent
ff1f656dc2
commit
853bbcf268
3 changed files with 14 additions and 5 deletions
|
|
@ -144,6 +144,7 @@ export class DialogViewTaskRemindersComponent implements OnDestroy {
|
|||
parentTaskMap: {
|
||||
[task.id]: task.parentId,
|
||||
},
|
||||
isClearScheduledTime: true,
|
||||
}),
|
||||
);
|
||||
this._removeTaskFromList(task.id);
|
||||
|
|
@ -261,6 +262,7 @@ export class DialogViewTaskRemindersComponent implements OnDestroy {
|
|||
return { ...acc, [next.id as string]: next.parentId };
|
||||
}, {}),
|
||||
isShowSnack: true,
|
||||
isClearScheduledTime: true,
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ const handlePlanTasksForToday = (
|
|||
state: RootState,
|
||||
taskIds: string[],
|
||||
parentTaskMap: Record<string, string | undefined>,
|
||||
isClearScheduledTime?: boolean,
|
||||
): RootState => {
|
||||
const todayTag = getTag(state, TODAY_TAG.id);
|
||||
const today = getDbDateStr();
|
||||
|
|
@ -194,7 +195,10 @@ const handlePlanTasksForToday = (
|
|||
|
||||
// Preserve dueWithTime if it matches today's date
|
||||
// Only clear it if the task has a time scheduled for a different day
|
||||
const shouldClearTime = task?.dueWithTime && !isToday(task.dueWithTime);
|
||||
// However, if isClearScheduledTime is true (from reminder dialog), always clear the time
|
||||
const shouldClearTime = isClearScheduledTime
|
||||
? !!task?.dueWithTime
|
||||
: task?.dueWithTime && !isToday(task.dueWithTime);
|
||||
|
||||
return {
|
||||
id: taskId,
|
||||
|
|
@ -303,10 +307,12 @@ const createActionHandlers = (state: RootState, action: Action): ActionHandlerMa
|
|||
return handleDismissReminderOnly(state, id);
|
||||
},
|
||||
[TaskSharedActions.planTasksForToday.type]: () => {
|
||||
const { taskIds, parentTaskMap = {} } = action as ReturnType<
|
||||
typeof TaskSharedActions.planTasksForToday
|
||||
>;
|
||||
return handlePlanTasksForToday(state, taskIds, parentTaskMap);
|
||||
const {
|
||||
taskIds,
|
||||
parentTaskMap = {},
|
||||
isClearScheduledTime,
|
||||
} = action as ReturnType<typeof TaskSharedActions.planTasksForToday>;
|
||||
return handlePlanTasksForToday(state, taskIds, parentTaskMap, isClearScheduledTime);
|
||||
},
|
||||
[TaskSharedActions.removeTasksFromTodayTag.type]: () => {
|
||||
const { taskIds } = action as ReturnType<
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@ export const TaskSharedActions = createActionGroup({
|
|||
parentTaskMap?: { [taskId: string]: string | undefined };
|
||||
isShowSnack?: boolean;
|
||||
isSkipRemoveReminder?: boolean;
|
||||
isClearScheduledTime?: boolean;
|
||||
}) => ({
|
||||
...taskProps,
|
||||
meta: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue