MCPcopy
hub / github.com/callumalpass/tasknotes / createPriorityClickHandler

Function createPriorityClickHandler

src/ui/taskCardActions.ts:85–113  ·  view source on GitHub ↗
(
	task: TaskInfo,
	plugin: TaskNotesPlugin
)

Source from the content-addressed store, hash-verified

83 * Creates a click handler for priority indicators.
84 */
85export function createPriorityClickHandler(
86 task: TaskInfo,
87 plugin: TaskNotesPlugin
88): (e: MouseEvent) => void {
89 return (e: MouseEvent) => {
90 e.stopPropagation();
91 const menu = new PriorityContextMenu({
92 currentValue: task.priority,
93 onSelect: (newPriority) => {
94 void (async () => {
95 const logger = getTaskCardActionLogger(plugin);
96 try {
97 await plugin.updateTaskProperty(task, "priority", newPriority);
98 } catch (error) {
99 logger.error("Error updating priority", {
100 category: "persistence",
101 operation: "update-priority",
102 details: { taskPath: task.path, newPriority },
103 error,
104 });
105 new Notice("Failed to update priority");
106 }
107 })();
108 },
109 plugin,
110 });
111 menu.show(e);
112 };
113}
114
115/**
116 * Creates a click handler for recurrence indicators.

Callers 3

createTaskCardFunction · 0.90
updateTaskCardFunction · 0.90

Calls 4

showMethod · 0.95
getTaskCardActionLoggerFunction · 0.85
updateTaskPropertyMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected