52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
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("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) {
|
|
new Setting(containerEl)
|
|
.setName("Daily note path")
|
|
.setDesc("Path to your daily notes folder (e.g., 'Daily Notes' or leave empty for root)")
|
|
.addText(text => text
|
|
.setPlaceholder("Daily Notes")
|
|
.setValue(this.plugin.settings.dailyNotePath)
|
|
.onChange(async (value) => {
|
|
this.plugin.settings.dailyNotePath = value;
|
|
await this.plugin.saveSettings();
|
|
}));
|
|
|
|
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();
|
|
}));
|
|
}
|
|
}
|
|
}
|