Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/i18n/resources/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@ export const en: TranslationTree = {
name: "Show expandable subtasks",
description: "Allow expanding/collapsing subtask sections in task cards",
},
hideRootSubtasks: {
name: "Hide subtasks in list root",
description:
"In task list views, hide tasks that belong to a parent project from the root level. Subtasks remain visible when their parent is expanded.",
},
expandSubtasksByDefault: {
name: "Expand subtasks by default",
description: "Show project subtasks expanded when task cards are rendered",
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export default class TaskNotesPlugin extends Plugin {
});

await this.loadSettings();
document.body.classList.toggle("tasknotes-hide-root-subtasks", this.settings.hideRootSubtasks);
this.performanceProfiler = createTaskNotesPerformanceProfiler({
isEnabled: () => this.settings?.enableDebugLogging === true,
logger: createTaskNotesLogger({
Expand Down Expand Up @@ -590,6 +591,7 @@ export default class TaskNotesPlugin extends Plugin {
}

onunload() {
document.body.classList.remove("tasknotes-hide-root-subtasks");
void cleanupPluginRuntime(this);
}

Expand Down
1 change: 1 addition & 0 deletions src/settings/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export const DEFAULT_SETTINGS: TaskNotesSettings = {
// Task card expandable subtasks defaults
showExpandableSubtasks: true,
expandSubtasksByDefault: false,
hideRootSubtasks: false,
// Subtask chevron position default
subtaskChevronPosition: "right",
// Filter toolbar layout defaults
Expand Down
13 changes: 13 additions & 0 deletions src/settings/tabs/appearanceTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,19 @@ export function renderAppearanceTab(
);
}

group.addSetting((setting) =>
void configureToggleSetting(setting, {
name: translate("settings.appearance.uiElements.hideRootSubtasks.name"),
desc: translate("settings.appearance.uiElements.hideRootSubtasks.description"),
getValue: () => plugin.settings.hideRootSubtasks,
setValue: async (value: boolean) => {
plugin.settings.hideRootSubtasks = value;
document.body.classList.toggle("tasknotes-hide-root-subtasks", value);
save();
},
})
);

group.addSetting((setting) =>
void configureDropdownSetting(setting, {
name: translate("settings.appearance.uiElements.viewsButtonAlignment.name"),
Expand Down
2 changes: 2 additions & 0 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export interface TaskNotesSettings {
showExpandableSubtasks: boolean;
// Expand project subtasks by default when task cards render
expandSubtasksByDefault: boolean;
// Hide subtasks from root of task list views (only show under expanded parent)
hideRootSubtasks: boolean;
// Subtask chevron position in task cards
subtaskChevronPosition: "left" | "right";
// Filter toolbar layout
Expand Down