From 54f8fc0b79eeb404dce444b34b25fb0c56bc4701 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 14:46:51 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Refactor=20RaindropFetchModal=20?= =?UTF-8?q?onOpen=20to=20use=20helper=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: frostmute <989225+frostmute@users.noreply.github.com> --- src/modals.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/modals.ts b/src/modals.ts index 25b9d45..5682e61 100644 --- a/src/modals.ts +++ b/src/modals.ts @@ -30,6 +30,7 @@ export class RaindropFetchModal extends Modal { this.vaultPath = this.plugin.settings.defaultFolder; } + onOpen() { const { contentEl } = this; contentEl.empty(); @@ -37,7 +38,16 @@ export class RaindropFetchModal extends Modal { new Setting(contentEl).setName('Fetch options').setHeading(); - // --- Fetch criteria Section --- + this.buildFetchCriteriaSection(contentEl); + this.buildNoteOptionsSection(contentEl); + this.buildTemplateOptionsSection(contentEl); + + contentEl.createEl('hr'); + + this.buildActionButtons(contentEl); + } + + private buildFetchCriteriaSection(contentEl: HTMLElement) { new Setting(contentEl).setName('Fetch criteria').setHeading(); new Setting(contentEl) @@ -188,8 +198,9 @@ export class RaindropFetchModal extends Modal { this.filterType = value as RaindropType | 'all'; }); }); + } - // --- Note Options Section --- + private buildNoteOptionsSection(contentEl: HTMLElement) { new Setting(contentEl).setName('Note options').setHeading(); const appendTagsSetting = new Setting(contentEl) @@ -276,8 +287,9 @@ export class RaindropFetchModal extends Modal { } }); }); + } - // --- Template Options Section --- + private buildTemplateOptionsSection(contentEl: HTMLElement) { if (this.plugin.settings.isTemplateSystemEnabled) { new Setting(contentEl).setName('Template overrides (optional)').setHeading(); @@ -316,10 +328,9 @@ export class RaindropFetchModal extends Modal { cls: 'setting-item-description' }); } + } - contentEl.createEl('hr'); - - // --- Action Buttons --- + private buildActionButtons(contentEl: HTMLElement) { const buttonsEl = contentEl.createDiv({ cls: 'modal-button-container' }); new ButtonComponent(buttonsEl) .setButtonText('Fetch raindrops')