import { App, PluginSettingTab, Setting } from "obsidian"; import TaskWeaverPlugin from "./main"; export class TaskWeaverSettingTab extends PluginSettingTab { plugin: TaskWeaverPlugin; constructor(app: App, plugin: TaskWeaverPlugin) { super(app, plugin); this.plugin = plugin; } display(): void { const { containerEl } = this; containerEl.empty(); new Setting(containerEl) .setName("Clear completed tasks") .setDesc("Automatically remove completed tasks after a specified period") .addDropdown(dropdown => dropdown .addOption("never", "Never") .addOption("1day", "After 24 hours") .addOption("7days", "After 7 days") .addOption("30days", "After 30 days") .setValue(this.plugin.settings.completedTaskRetention) .onChange(async (value) => { this.plugin.settings.completedTaskRetention = value as any; await this.plugin.saveSettings(); })); new Setting(containerEl) .setName("Enable daily note logging") .setDesc("Log completed tasks to your daily note") .addToggle(toggle => toggle .setValue(this.plugin.settings.enableDailyNoteLogging) .onChange(async (value) => { this.plugin.settings.enableDailyNoteLogging = value; await this.plugin.saveSettings(); this.display(); })); if (this.plugin.settings.enableDailyNoteLogging) { containerEl.createEl("p", { text: "Tasks will be logged to your daily note using the Daily Notes core plugin settings.", cls: "setting-item-description" }); new Setting(containerEl) .setName("Daily note format") .setDesc("Format for logging tasks. Available placeholders: {{title}}, {{duration}}, {{emoji}}, {{category}}") .addTextArea(text => text .setPlaceholder("- [x] {{title}} ({{duration}}) {{emoji}}") .setValue(this.plugin.settings.dailyNoteFormat) .onChange(async (value) => { this.plugin.settings.dailyNoteFormat = value; await this.plugin.saveSettings(); })); } } }