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

Method onOpen

src/settings/tabs/integrationsTab.ts:2721–2891  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2719 }
2720
2721 onOpen(): void {
2722 const { contentEl } = this;
2723 contentEl.empty();
2724 contentEl.addClass("tasknotes-webhook-modal");
2725
2726 // Modal header with icon
2727 const header = contentEl.createDiv({ cls: "tasknotes-webhook-modal-header" });
2728 const headerIcon = header.createSpan({ cls: "tasknotes-webhook-modal-icon" });
2729 setIcon(headerIcon, "webhook");
2730 header.createEl("h2", { text: "Add webhook", cls: "tasknotes-webhook-modal-title" });
2731
2732 // URL input section
2733 const urlSection = contentEl.createDiv({ cls: "tasknotes-webhook-modal-section" });
2734 new Setting(urlSection)
2735 .setName("Webhook URL")
2736 .setDesc("The endpoint where webhook payloads will be sent")
2737 .addText((text) => {
2738 text.inputEl.setAttribute("aria-label", "Webhook URL");
2739 return text
2740 .setPlaceholder("HTTPS://your-service.com/webhook")
2741 .setValue(this.url)
2742 .onChange((value) => {
2743 this.url = value;
2744 });
2745 });
2746
2747 // Events selection section
2748 const eventsSection = contentEl.createDiv({ cls: "tasknotes-webhook-modal-section" });
2749 const eventsHeader = eventsSection.createDiv({
2750 cls: "tasknotes-webhook-modal-subsection-header",
2751 });
2752 const eventsIcon = eventsHeader.createSpan();
2753 setIcon(eventsIcon, "zap");
2754 eventsHeader.createEl("h3", { text: "Events to subscribe to" });
2755
2756 const eventsGrid = eventsSection.createDiv({ cls: "tasknotes-webhook-events-list" });
2757
2758 WEBHOOK_EVENT_OPTIONS.forEach((event) => {
2759 new Setting(eventsGrid)
2760 .setName(event.label)
2761 .setDesc(event.desc)
2762 .addToggle((toggle) => {
2763 toggle.toggleEl.setAttribute(
2764 "aria-label",
2765 `Subscribe to ${event.label} events`
2766 );
2767 return toggle
2768 .setValue(this.selectedEvents.includes(event.id))
2769 .onChange((value) => {
2770 if (value) {
2771 this.selectedEvents.push(event.id);
2772 } else {
2773 const index = this.selectedEvents.indexOf(event.id);
2774 if (index > -1) {
2775 this.selectedEvents.splice(index, 1);
2776 }
2777 }
2778 });

Callers

nothing calls this directly

Calls 11

setIconFunction · 0.90
runAsyncSettingCallbackFunction · 0.90
setDescMethod · 0.80
setPlaceholderMethod · 0.80
addClassMethod · 0.65
setValueMethod · 0.65
closeMethod · 0.65
addTextMethod · 0.45
setNameMethod · 0.45
onChangeMethod · 0.45
addToggleMethod · 0.45

Tested by

no test coverage detected