Skip to content

Commit

Permalink
chore: clean up settings order
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-lednev committed Oct 15, 2024
1 parent e8d87e4 commit 8a0a8ef
Showing 1 changed file with 61 additions and 62 deletions.
123 changes: 61 additions & 62 deletions src/ui/settings-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,39 @@ export class DayPlannerSettingsTab extends PluginSettingTab {
}),
);

new Setting(containerEl)
.setName("Task Notification")
.setDesc("Display a notification when a new task is started")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings().showTaskNotification)
.onChange((value: boolean) => {
this.update({ showTaskNotification: value });
}),
);

new Setting(containerEl)
.setName("Center the Pointer in the Timeline View")
.setDesc(
"Should the pointer continuously get scrolled to the center of the view",
)
.addToggle((component) => {
component
.setValue(this.plugin.settings().centerNeedle)
.onChange((value) => {
this.update({ centerNeedle: value });
});
});

new Setting(containerEl)
.setName("Sort tasks in planner chronologically after edits")
.addToggle((component) => {
component
.setValue(this.plugin.settings().sortTasksInPlanAfterEdit)
.onChange((value) => {
this.update({ sortTasksInPlanAfterEdit: value });
});
});
new Setting(containerEl)
.setName("Event format on creation")
.addDropdown((dropdown) => {
Expand All @@ -51,6 +84,21 @@ export class DayPlannerSettingsTab extends PluginSettingTab {
});
});

new Setting(containerEl)
.setName("Timeline Zoom Level")
.setDesc(
"The zoom level to display the timeline. The higher the number, the more vertical space each task will take up.",
)
.addSlider((slider) =>
slider
.setLimits(1, 5, 1)
.setValue(Number(this.plugin.settings().zoomLevel) ?? 4)
.setDynamicTooltip()
.onChange((value: number) => {
this.update({ zoomLevel: value });
}),
);

if (this.plugin.settings().eventFormatOnCreation === "task") {
new Setting(containerEl)
.setName("Default task status on creation")
Expand All @@ -74,45 +122,6 @@ export class DayPlannerSettingsTab extends PluginSettingTab {
);
}

new Setting(containerEl)
.setName("Round time to minutes")
.setDesc("While editing, tasks are going to get rounded to this number")
.addSlider((slider) =>
slider
.setLimits(5, 20, 5)
.setValue(this.plugin.settings().snapStepMinutes)
.setDynamicTooltip()
.onChange((value: number) => {
this.update({ snapStepMinutes: value });
}),
);

new Setting(containerEl)
.setName("Task Notification")
.setDesc("Display a notification when a new task is started")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings().showTaskNotification)
.onChange((value: boolean) => {
this.update({ showTaskNotification: value });
}),
);

new Setting(containerEl)
.setName("Timeline Zoom Level")
.setDesc(
"The zoom level to display the timeline. The higher the number, the more vertical space each task will take up.",
)
.addSlider((slider) =>
slider
.setLimits(1, 5, 1)
.setValue(Number(this.plugin.settings().zoomLevel) ?? 4)
.setDynamicTooltip()
.onChange((value: number) => {
this.update({ zoomLevel: value });
}),
);

new Setting(containerEl)
.setName("Timeline Icon")
.setDesc(
Expand Down Expand Up @@ -175,29 +184,6 @@ export class DayPlannerSettingsTab extends PluginSettingTab {
}),
);

new Setting(containerEl)
.setName("Center the Pointer in the Timeline View")
.setDesc(
"Should the pointer continuously get scrolled to the center of the view",
)
.addToggle((component) => {
component
.setValue(this.plugin.settings().centerNeedle)
.onChange((value) => {
this.update({ centerNeedle: value });
});
});

new Setting(containerEl)
.setName("Sort tasks in planner chronologically after edits")
.addToggle((component) => {
component
.setValue(this.plugin.settings().sortTasksInPlanAfterEdit)
.onChange((value) => {
this.update({ sortTasksInPlanAfterEdit: value });
});
});

containerEl.createEl("h2", { text: "Remote calendars" });

this.plugin.settings().icals.map((ical, index) => {
Expand Down Expand Up @@ -497,6 +483,19 @@ export class DayPlannerSettingsTab extends PluginSettingTab {
});
});

new Setting(containerEl)
.setName("Round time to minutes")
.setDesc("While editing, tasks are going to get rounded to this number")
.addSlider((slider) =>
slider
.setLimits(5, 20, 5)
.setValue(this.plugin.settings().snapStepMinutes)
.setDynamicTooltip()
.onChange((value: number) => {
this.update({ snapStepMinutes: value });
}),
);

new Setting(containerEl)
.setName("Default task duration")
.setDesc(
Expand Down

0 comments on commit 8a0a8ef

Please sign in to comment.