| 46 | * Context menu for batch operations on multiple selected tasks. |
| 47 | */ |
| 48 | export class BatchContextMenu { |
| 49 | private menu: ContextMenu; |
| 50 | private options: BatchContextMenuOptions; |
| 51 | |
| 52 | constructor(options: BatchContextMenuOptions) { |
| 53 | this.menu = new ContextMenu(); |
| 54 | this.options = options; |
| 55 | this.buildMenu(); |
| 56 | } |
| 57 | |
| 58 | private t(key: string, params?: Record<string, string | number>): string { |
| 59 | return this.options.plugin.i18n.translate(key, params); |
| 60 | } |
| 61 | |
| 62 | private buildMenu(): void { |
| 63 | const { selectedPaths } = this.options; |
| 64 | const count = selectedPaths.length; |
| 65 | |
| 66 | // Header showing selection count |
| 67 | this.menu.addItem((item) => { |
| 68 | item.setTitle(`${count} tasks selected`); |
| 69 | item.setIcon("check-square"); |
| 70 | item.setDisabled(true); |
| 71 | }); |
| 72 | |
| 73 | this.menu.addSeparator(); |
| 74 | |
| 75 | // Status submenu |
| 76 | this.menu.addItem((item) => { |
| 77 | item.setTitle(this.t("contextMenus.task.status")); |
| 78 | item.setIcon("circle"); |
| 79 | |
| 80 | const submenu = getSubmenu(item); |
| 81 | this.addStatusOptions(submenu); |
| 82 | }); |
| 83 | |
| 84 | // Priority submenu |
| 85 | this.menu.addItem((item) => { |
| 86 | item.setTitle(this.t("contextMenus.task.priority")); |
| 87 | item.setIcon("star"); |
| 88 | |
| 89 | const submenu = getSubmenu(item); |
| 90 | this.addPriorityOptions(submenu); |
| 91 | }); |
| 92 | |
| 93 | this.menu.addItem((item) => { |
| 94 | item.setTitle(this.t("contextMenus.task.tags")); |
| 95 | item.setIcon("tags"); |
| 96 | |
| 97 | const submenu = getSubmenu(item); |
| 98 | this.addTagOptions(submenu); |
| 99 | }); |
| 100 | |
| 101 | this.menu.addSeparator(); |
| 102 | |
| 103 | // Due Date submenu |
| 104 | this.menu.addItem((item) => { |
| 105 | item.setTitle(this.t("contextMenus.task.dueDate")); |
nothing calls this directly
no outgoing calls
no test coverage detected