( task: TaskInfo, dateType: "due" | "scheduled" | undefined, event: MouseEvent )
| 2637 | } |
| 2638 | |
| 2639 | private async openDateContextMenu( |
| 2640 | task: TaskInfo, |
| 2641 | dateType: "due" | "scheduled" | undefined, |
| 2642 | event: MouseEvent |
| 2643 | ): Promise<void> { |
| 2644 | if (!dateType) return; |
| 2645 | const currentValue = dateType === "due" ? task.due : task.scheduled; |
| 2646 | const menu = new DateContextMenu({ |
| 2647 | currentValue: getDatePart(currentValue || ""), |
| 2648 | currentTime: getTimePart(currentValue || ""), |
| 2649 | onSelect: (dateValue, timeValue) => { |
| 2650 | void (async () => { |
| 2651 | try { |
| 2652 | let finalValue: string | undefined; |
| 2653 | if (!dateValue) { |
| 2654 | finalValue = undefined; |
| 2655 | } else if (timeValue) { |
| 2656 | finalValue = `${dateValue}T${timeValue}`; |
| 2657 | } else { |
| 2658 | finalValue = dateValue; |
| 2659 | } |
| 2660 | await this.plugin.updateTaskProperty(task, dateType, finalValue); |
| 2661 | } catch (error) { |
| 2662 | const message = error instanceof Error ? error.message : String(error); |
| 2663 | tasknotesLogger.error("[TaskNotes][TaskListView] Failed to update date", { |
| 2664 | category: "validation", |
| 2665 | operation: "update-date", |
| 2666 | details: { taskPath: task.path, dateType }, |
| 2667 | error: message, |
| 2668 | }); |
| 2669 | new Notice(`Failed to update ${dateType} date: ${message}`); |
| 2670 | } |
| 2671 | })(); |
| 2672 | }, |
| 2673 | dateRole: dateType, |
| 2674 | plugin: this.plugin, |
| 2675 | app: this.app || this.plugin.app, |
| 2676 | }); |
| 2677 | menu.show(event); |
| 2678 | } |
| 2679 | |
| 2680 | private async handleCardClick(task: TaskInfo, event: MouseEvent): Promise<void> { |
| 2681 | // Check if this is a selection click (shift/ctrl/cmd or in selection mode) |
no test coverage detected