MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / renderQuickActions

Method renderQuickActions

src/modals/ReminderModal.ts:278–316  ·  view source on GitHub ↗
(section: HTMLElement)

Source from the content-addressed store, hash-verified

276 }
277
278 private renderQuickActions(section: HTMLElement): void {
279 // Only show quick actions if task has due/scheduled dates
280 const hasDates = this.task.due || this.task.scheduled;
281 if (!hasDates) return;
282
283 const quickActions = section.createDiv({ cls: "reminder-modal__quick-actions" });
284
285 const buttonsContainer = quickActions.createDiv({ cls: "reminder-modal__quick-buttons" });
286
287 const commonReminders = [
288 { label: "5m", fullLabel: "5 minutes before", offset: "-PT5M", icon: "clock" },
289 { label: "15m", fullLabel: "15 minutes before", offset: "-PT15M", icon: "clock" },
290 { label: "1h", fullLabel: "1 hour before", offset: "-PT1H", icon: "clock" },
291 { label: "1d", fullLabel: "1 day before", offset: "-P1D", icon: "calendar" },
292 ];
293
294 commonReminders.forEach(({ label, fullLabel, offset, icon }) => {
295 const anchor = this.task.due ? "due" : "scheduled";
296
297 const quickBtn = buttonsContainer.createEl("button", {
298 cls: "reminder-modal__quick-btn",
299 });
300
301 const iconEl = quickBtn.createSpan({ cls: "reminder-modal__quick-btn-icon" });
302 setIcon(iconEl, icon);
303
304 quickBtn.createSpan({
305 cls: "reminder-modal__quick-btn-label",
306 text: label,
307 });
308
309 // Use Obsidian's native tooltip
310 setTooltip(quickBtn, `Add reminder ${fullLabel} ${anchor} date`);
311
312 quickBtn.onclick = async () => {
313 await this.addQuickReminder(anchor, offset, fullLabel);
314 };
315 });
316 }
317
318 private async addQuickReminder(
319 anchor: "due" | "scheduled",

Callers 1

renderAddReminderFormMethod · 0.95

Calls 3

addQuickReminderMethod · 0.95
setIconFunction · 0.90
setTooltipFunction · 0.90

Tested by

no test coverage detected