Skip to content

Commit 120763b

Browse files
committed
New 'Calendar note Sections to Include' setting for DBW to test
1 parent be3f604 commit 120763b

File tree

5 files changed

+54
-9
lines changed

5 files changed

+54
-9
lines changed

jgclark.Dashboard/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ For more details see the [plugin's documentation](https://github.com/NotePlan/pl
1010
-->
1111
<!-- - ??? dev: check winowID throughout -->
1212

13+
## [2.4.0.b17] 2026-01-21
14+
### New
15+
- added new way to select items to show from Calendar sections: "Calendar note Sections to Include". There is already a way to exclude specific sections in a calendar note; this adds a way to only include specific sections. The matches are partial, so 'Home' will include 'Home' and 'The Home Areas' etc. If left blank, all sections are still included.
16+
1317
## [2.4.0.b16] 2026-01-20
1418
### Fixes
1519
- suppress "showing all 0 items" message when "nothing on this list" message also appears

jgclark.Dashboard/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"plugin.description": "A Dashboard for NotePlan, that in one place shows:\n- a compact list of open tasks and checklists from today's note\n- scheduled open tasks and checklists from other notes.\n- similarly for yesterday's note, tomorrow's note, and the weekly, monthly and quarterly notes too (if used)\n- all overdue tasks\n- all open tasks and checklists that contain particular @tags or #mentions of your choosing\n- the next notes ready to review (if you use the 'Projects and Reviews' plugin).\nIt includes many other ways of speeding up managing your tasks: see the website for more details.",
99
"plugin.author": "@jgclark",
1010
"plugin.comment": "TODO: On full release, change minAppVersion down to 3.7?",
11-
"plugin.version": "2.4.0.b16",
11+
"plugin.version": "2.4.0.b17",
1212
"plugin.releaseStatus": "beta",
1313
"plugin.hidden": false,
1414
"plugin.lastUpdateInfo": "2.4.0: new 'Spaces to Include' setting which controls which (Team)Spaces you wish to include, plus whether or not to include the Private 'Space' (all notes not in a Space)\n2.3.3: new 'Year' section available.\n2.3.2: fix display when there are no priority items shown.\n2.3.1: fix for possible loss of settings error when upgrading.\n2.3.0: Support for NotePlan (Team)Spaces. Can re-order display of Sections.New '/backupSettings' command. Added 'noteTags' feature. Speeded up Tag/Mention sections. Layout improvements. Lots of other small fixes and improvements.\n2.2.1: Add new sorting option for Tag and Overdue sections.\n2.2.0: Add 'Search' section. New keyboard shortcuts. Plus many small improvements, bug fixes and performance improvements. See documentation for details.\n2.1.10: More move-under-heading options. Bug fixes and performance improvements.\n2.1.9: performance improvements and better UI for iPhone users.\n2.1.8: various fixes and small improvements.\n2.1.7: various fixes and small improvements.\n2.1.6: allow all current timeblocks to be shown, not just the first. Add new @repeat()s if using the extended syntax from the Repeat Extensions plugin. Bug fixes.\n2.1.5: fixes to time blocks and scheduling items.\n2.1.4: fix to Interactive Processing, and Edit All Perspectives dialog now shows unsaved changes.",

jgclark.Dashboard/src/dashboardHelpers.js

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,17 +427,18 @@ export function getOpenItemParasForTimePeriod(
427427
const latestDate = todayHyphenated > theNoteDateHyphenated ? todayHyphenated : theNoteDateHyphenated
428428
// logDebug('getOpenItemPFCTP', `timeframe:${calendarPeriodName}: theNoteDateHyphenated: ${theNoteDateHyphenated}, todayHyphenated: ${todayHyphenated}, isToday: ${String(isToday)}`)
429429

430-
// Keep only non-empty open tasks (and checklists if wanted),
431-
// and now add in other timeblock lines (if wanted), other than checklists (if excluded)
430+
// Keep only non-empty open tasks and checklists,
431+
// and now add in other timeblock lines if wanted
432432
let openParas = alsoReturnTimeblockLines ? parasToUse.filter((p) => isOpen(p) || isActiveOrFutureTimeBlockPara(p, mustContainString)) : parasToUse.filter((p) => isOpen(p))
433433
logDebug('getOpenItemPFCTP', `- after initial pull: ${openParas.length} para(s):`)
434434

435+
// Filter out checklists, if requested
435436
if (dashboardSettings.ignoreChecklistItems) {
436437
openParas = openParas.filter((p) => !(p.type === 'checklist'))
437438
logDebug('getOpenItemPFCTP', `- after filtering out checklists: ${openParas.length} para(s)`)
438439
}
439440

440-
// Filter out checklists with timeblocks, if wanted
441+
// Filter out checklists with timeblocks, if requested
441442
if (dashboardSettings.excludeChecklistsWithTimeblocks) {
442443
openParas = openParas.filter((p) => !(p.type === 'checklist' && isActiveOrFutureTimeBlockPara(p, mustContainString)))
443444
}
@@ -459,7 +460,10 @@ export function getOpenItemParasForTimePeriod(
459460
// Filter out anything from 'ignoreItemsWithTerms' setting
460461
openParas = filterParasByIgnoreTerms(openParas, dashboardSettings, startTime, 'getOpenItemPFCTP')
461462

462-
// Additionally apply to calendar headings in this note
463+
// Filter out anything not matching 'includedCalendarSections' setting, if set
464+
openParas = filterParasByIncludedCalendarSections(openParas, dashboardSettings, startTime, 'getOpenItemPFCTP')
465+
466+
// Filter out anything matching 'ignoreItemsWithTerms' setting, if set
463467
openParas = filterParasByCalendarHeadingSections(openParas, dashboardSettings, startTime, 'getOpenItemPFCTP')
464468

465469
// -------------------------------------------------------------
@@ -670,6 +674,35 @@ export function filterParasByIgnoreTerms(
670674
return filteredParas
671675
}
672676

677+
/**
678+
* Filter paragraphs to only include those from included calendar sections.
679+
* @param {Array<TParagraph>} paras - paragraphs to filter
680+
* @param {TDashboardSettings} dashboardSettings - dashboard settings containing included calendar sections
681+
* @param {Date} startTime - timer start time for logging
682+
* @param {string} functionName - name of calling function for logging
683+
* @returns {Array<TParagraph>} filtered paragraphs
684+
*/
685+
export function filterParasByIncludedCalendarSections(
686+
paras: Array<TParagraph>,
687+
dashboardSettings: TDashboardSettings,
688+
startTime: Date,
689+
functionName: string
690+
): Array<TParagraph> {
691+
if (!dashboardSettings.includedCalendarSections) {
692+
return paras
693+
}
694+
695+
const filteredParas = paras.filter((p) => {
696+
// only apply to calendar notes
697+
if (p.note?.type !== 'Calendar') return true
698+
// Apply to all H4/H3/H2 headings in the hierarchy for this para
699+
const theseHeadings = getHeadingHierarchyForThisPara(p)
700+
return theseHeadings.some((h) => dashboardSettings.includedCalendarSections.includes(h))
701+
})
702+
logTimer(functionName, startTime, `- after filtering out calendar headings: ${filteredParas.length} paras`)
703+
return filteredParas
704+
}
705+
673706
/**
674707
* Filter paragraphs to exclude those with disallowed terms in calendar heading sections.
675708
* @param {Array<TParagraph>} paras - paragraphs to filter

jgclark.Dashboard/src/dashboardSettings.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ export const dashboardSettingDefs: Array<TSettingItem> = [
9999
key: 'includedFolders',
100100
label: 'Folders to Include',
101101
description:
102-
"Comma-separated list of folder(s) to include when searching for open or closed tasks/checklists. The matches are partial, so 'Home' will include 'Home' and 'The Home Areas' etc. If left blank, all folders are included. Note: Calendar notes are always included, where relevant.",
102+
"Comma-separated list of folder(s) to include when selecting open items to show. The matches are partial, so 'Home' will include 'Home' and 'The Home Areas' etc. If left blank, all folders are included. Note: Calendar notes are always included, where relevant.",
103+
type: 'input',
104+
default: '',
105+
compactDisplay: true,
106+
},
107+
{
108+
key: 'includedCalendarSections',
109+
label: 'Calendar note Sections to Include',
110+
description:
111+
"Comma-separated list of calendar note section headings to include when selecting open tasks/checklists to show. The matches are partial, so 'Home' will include 'Home' and 'The Home Areas' etc. If left blank, all sections are included.",
103112
type: 'input',
104113
default: '',
105114
compactDisplay: true,
@@ -108,13 +117,12 @@ export const dashboardSettingDefs: Array<TSettingItem> = [
108117
key: 'excludedFolders',
109118
label: 'Folders to Exclude',
110119
description:
111-
"Comma-separated list of folder(s) to ignore when searching for open or closed tasks/checklists. The matches are partial, so 'Work' will exclude 'Work' and 'Work/CompanyA' etc. To ignore notes at the top-level (not in a folder), include '/' in the list. (@Trash is always ignored, but other special folders need to be specified, e.g. @Archive, @Templates.)",
120+
"Comma-separated list of folder(s) to ignore when selecting open tasks/checklists to show. The matches are partial, so 'Work' will exclude 'Work' and 'Work/CompanyA' etc. To ignore notes at the top-level (not in a folder), include '/' in the list. (@Trash is always ignored, but other special folders need to be specified, e.g. @Archive, @Templates.)",
112121
type: 'input',
113122
default: '@Archive, @Templates, Saved Searches',
114123
compactDisplay: true,
115124
},
116125
{
117-
// Note: replaces earlier "ignoreTagMentionsWithPhrase" which applied only to the Tag/Mention section
118126
key: 'ignoreItemsWithTerms',
119127
label: 'Ignore items in notes with term(s)',
120128
description:

np.installer/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"name": "development install",
2222
"description": "Load a list of plugins and lets you install one, including hidden ones",
2323
"jsFunction": "installPluginsIncludingHidden"
24-
},
24+
}
2525
],
2626
"plugin.preferences": []
2727
}

0 commit comments

Comments
 (0)