fix: default calendar to system indicators

Use coloured system markers by default, preserve configured colours through settings migration, expose all template fields through native vault-path autocomplete, and remove the redundant Calendar heading.
This commit is contained in:
2026-09-07 21:52:34 -04:00
parent 069456799e
commit 72a61e49ee
4 changed files with 54 additions and 28 deletions
+18 -18
View File
File diff suppressed because one or more lines are too long
+35 -8
View File
@@ -129,14 +129,20 @@ export class WaypointSettingTab extends PluginSettingTab {
// ═══════════════════════════════
private renderPeriodicTab(container: HTMLElement): void {
this.addPeriodNoteSettings(container, 'Daily', this.settings.daily);
this.addPeriodNoteSettings(container, 'Weekly', this.settings.weekly);
this.addPeriodNoteSettings(container, 'Monthly', this.settings.monthly);
this.addPeriodNoteSettings(container, 'Quarterly', this.settings.quarterly);
this.addPeriodNoteSettings(container, 'Yearly', this.settings.yearly);
const templateSuggestionsId = this.createTemplateSuggestions(container);
this.addPeriodNoteSettings(container, 'Daily', this.settings.daily, templateSuggestionsId);
this.addPeriodNoteSettings(container, 'Weekly', this.settings.weekly, templateSuggestionsId);
this.addPeriodNoteSettings(container, 'Monthly', this.settings.monthly, templateSuggestionsId);
this.addPeriodNoteSettings(container, 'Quarterly', this.settings.quarterly, templateSuggestionsId);
this.addPeriodNoteSettings(container, 'Yearly', this.settings.yearly, templateSuggestionsId);
}
private addPeriodNoteSettings(container: HTMLElement, label: string, period: PeriodNoteSettings): void {
private addPeriodNoteSettings(
container: HTMLElement,
label: string,
period: PeriodNoteSettings,
templateSuggestionsId: string,
): void {
new Setting(container).setHeading().setName(label);
new Setting(container)
@@ -165,10 +171,11 @@ export class WaypointSettingTab extends PluginSettingTab {
new Setting(container)
.setName('Template file')
.setDesc(`Path to the template file (without .md extension).`)
.setDesc('Path to the template file. The .md extension is optional.')
.addText((text) => {
text.setPlaceholder('Templates/Daily note');
text.setValue(period.templateFile);
text.inputEl.setAttr('list', templateSuggestionsId);
text.onChange((value) => {
period.templateFile = value;
this.saveAndRefresh();
@@ -204,6 +211,8 @@ export class WaypointSettingTab extends PluginSettingTab {
.setName('Date systems')
.setDesc(intro);
const templateSuggestionsId = this.createTemplateSuggestions(container);
this.settings.dateSystems.forEach((system, i, arr) => {
new Setting(container)
.setHeading()
@@ -270,7 +279,7 @@ export class WaypointSettingTab extends PluginSettingTab {
this.addSystemTextSetting(container,
'Template file', 'Path to the template file. The .md extension is optional.',
system, 'templateFile', 'resources/template/journal',
system, 'templateFile', 'resources/template/journal', templateSuggestionsId,
);
this.addSystemTextSetting(container,
'Type property', `Fallback value for the 'type' frontmatter property, used when no template is found.`,
@@ -318,6 +327,7 @@ export class WaypointSettingTab extends PluginSettingTab {
obj: Record<K, string>,
key: K,
placeholder: string,
templateSuggestionsId?: string,
): Setting {
return new Setting(container)
.setName(name)
@@ -325,6 +335,7 @@ export class WaypointSettingTab extends PluginSettingTab {
.addText((text) => {
text.setPlaceholder(placeholder);
text.setValue(obj[key]);
if (templateSuggestionsId) text.inputEl.setAttr('list', templateSuggestionsId);
text.onChange((value) => {
obj[key] = value;
this.saveAndRefresh();
@@ -332,6 +343,22 @@ export class WaypointSettingTab extends PluginSettingTab {
});
}
/**
* Native datalist keeps template paths searchable without another custom
* modal, and accepts templates stored anywhere in the vault.
*/
private createTemplateSuggestions(container: HTMLElement): string {
const id = 'waypoint-template-suggestions';
const list = container.createEl('datalist', { attr: { id } });
const paths = this.app.vault.getMarkdownFiles()
.map(file => file.path.replace(/\.md$/, ''))
.sort((a, b) => a.localeCompare(b));
for (const path of paths) {
list.createEl('option', { value: path });
}
return id;
}
// ═══════════════════════════════
// Recent Files tab
// ═══════════════════════════════
+1 -1
View File
@@ -85,7 +85,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
calendar: {
firstDayOfWeek: 1, // Monday
showNoteIndicators: true,
indicatorMode: 'any',
indicatorMode: 'systems',
dailyIndicatorColor: '#3b82f6',
},
daily: {
-1
View File
@@ -91,7 +91,6 @@ export class WaypointView extends ItemView {
private renderCalendar(): void {
const section = this.contentEl.createDiv({ cls: 'waypoint-section' });
section.createDiv({ cls: 'waypoint-section-header', text: 'Calendar' });
const cal = section.createDiv({ cls: 'waypoint-calendar' });