import { App, PluginSettingTab, Setting } from "obsidian"; import LimitlessPlugin from "./main.ts"; export interface LimitlessPluginSettings { syncAtStart: boolean; apiKey: string; lifelogsDir: string; latestLog?: string; } export const DEFAULT_SETTINGS: LimitlessPluginSettings = { syncAtStart: false, apiKey: "", lifelogsDir: "", latestLog: undefined, }; export class LimitlessSettingTab extends PluginSettingTab { plugin: LimitlessPlugin; constructor(app: App, plugin: LimitlessPlugin) { super(app, plugin); this.plugin = plugin; } display(): void { const { containerEl } = this; containerEl.empty(); containerEl.createEl("h1", { text: "Unofficial Limitless Plugin" }); containerEl.createEl("p", { text: "Please note that you must own a Limitless Pendant to use this plugin, for now.", }); new Setting(containerEl) .setName("API Key") .setDesc("Retrieve this from your Developer settings on desktop or web") .addText((text) => { text.inputEl.type = "password"; return text .setPlaceholder("Enter your secret") .setValue(this.plugin.settings.apiKey) .onChange(async (value) => { this.plugin.settings.apiKey = value; await this.plugin.saveSettings(); }); }); containerEl.createEl("h2", { text: "Lifelogs" }); new Setting(containerEl) .setName("Sync at Start") .setDesc("Whether or not to sync lifelogs when Obsidian opens") .addToggle((toggle) => { return toggle .setValue(this.plugin.settings.syncAtStart) .onChange(async (value) => { this.plugin.settings.syncAtStart = value; await this.plugin.saveSettings(); }); }); new Setting(containerEl) .setName("Lifelogs Directory") .setDesc("The directory where you want Lifelogs placed") .addText((text) => { return text .setPlaceholder("Lifelogs") .setValue(this.plugin.settings.lifelogsDir) .onChange(async (value) => { this.plugin.settings.lifelogsDir = value; await this.plugin.saveSettings(); }); }); } }