Skip to content

Commit aa9ab4a

Browse files
committed
Merge branch 'main' of https://github.com/NotePlan/plugins
2 parents 032e792 + 25e0fcd commit aa9ab4a

12 files changed

Lines changed: 40 additions & 36 deletions

File tree

helpers/headings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { clo, clof, JSP, logDebug, logError, logInfo, logTimer, logWarn } from '
1111
export function getHeadingHierarchyForThisPara(para) {
1212
let lineIndex = para.lineIndex
1313
const noteFilename = para.note?.filename ?? '?'
14-
logDebug('getHeadingHierarchyForThisPara', `Finding headings for line #${String(lineIndex)} in note ${noteFilename}:`)
14+
// logDebug('getHeadingHierarchyForThisPara', `Finding headings for line #${String(lineIndex)} in note ${noteFilename}:`)
1515
const thisNote = para.note
1616
const noteParas = thisNote?.paragraphs
1717
if (!noteParas || noteParas.length === 0) {
@@ -31,6 +31,6 @@ export function getHeadingHierarchyForThisPara(para) {
3131
}
3232
lineIndex--
3333
}
34-
logDebug('getHeadingHierarchyForThisPara', `-> ${String(theseHeadings.length)} headings found: [${String(theseHeadings)}]`)
34+
// logDebug('getHeadingHierarchyForThisPara', `-> ${String(theseHeadings.length)} headings found: [${String(theseHeadings)}]`)
3535
return theseHeadings
3636
}

jgclark.Dashboard/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# What's changed in 🎛 Dashboard plugin?
22
For more details see the [plugin's documentation](https://github.com/NotePlan/plugins/tree/main/jgclark.Dashboard/).
33

4+
## [2.1.8] 2025-01-31 (unreleased)
5+
### Changed
6+
- When clicking on a Section Title or note link, the note will be opened in the Editor window, and that will now be brought to the front.
7+
- The Edit All Perspectives table now has subtly shaded alternate rows
8+
- The window starts saying 'Generating' not 'Refreshing'
9+
410
## [2.1.7] 2025-01-30
511
### Changed
612
- Perspectives: if you have 'Apply to sections under headings in Calendar notes?' turned on, this now applies to all the preceding headings up the H5->H1 hierarchy for that line.

jgclark.Dashboard/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"plugin.name": "🎛 Dashboard",
66
"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).",
77
"plugin.author": "@jgclark",
8-
"plugin.version": "2.1.7",
8+
"plugin.version": "2.1.8",
99
"plugin.hidden": false,
10-
"plugin.lastUpdateInfo": "2.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.\n2.1.3: fixes to display of timeblocks, and checklist counts being wrong. Slightly smarter task dialog.\n2.1.2: fix bug - Today section not showing up; fix settings description for max items to show.\n2.1.1: fix bug - Tomorrow section not showing up.\n2.1.0: Add Perspectives; new 'Current Time Block' section; new 'Last Week' section; and many other improvements and fixes.\n2.0.6: tweak to rescheduling items, and other small bug fixes and tweaks.\n2.0.5: fix bug in 'Move all overdue to Today' command.\n2.0.4: add new 'Priority' section.\n2.0.3: layout improvements\n2.0.2: small improvements.\n2.0.1: removal of older settings system: it now only uses the quick-access menu.\n2.0.0: major new release -- see documentation for all the new features",
10+
"plugin.lastUpdateInfo": "2.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.\n2.1.3: fixes to display of timeblocks, and checklist counts being wrong. Slightly smarter task dialog.\n2.1.2: fix bug - Today section not showing up; fix settings description for max items to show.\n2.1.1: fix bug - Tomorrow section not showing up.\n2.1.0: Add Perspectives; new 'Current Time Block' section; new 'Last Week' section; and many other improvements and fixes.\n2.0.6: tweak to rescheduling items, and other small bug fixes and tweaks.\n2.0.5: fix bug in 'Move all overdue to Today' command.\n2.0.4: add new 'Priority' section.\n2.0.3: layout improvements\n2.0.2: small improvements.\n2.0.1: removal of older settings system: it now only uses the quick-access menu.\n2.0.0: major new release -- see documentation for all the new features",
1111
"plugin.dependencies": [],
1212
"plugin.requiredFiles": [
1313
"react.c.WebView.bundle.dev.js"

jgclark.Dashboard/src/clickHandlers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ export async function doShowNoteInEditorFromFilename(data: MessageDataObject): P
380380
const { filename, modifierKey } = data
381381
if (!filename) throw 'doShowNoteInEditorFromFilename: No filename: stopping'
382382
const note = await openNoteByFilename(filename, { newWindow: modifierKey === 'meta', splitView: modifierKey === 'alt' })
383+
Editor.focus()
383384
return handlerResult(note ? true : false)
384385
}
385386

@@ -391,6 +392,7 @@ export async function doShowNoteInEditorFromTitle(data: MessageDataObject): Prom
391392
const wantedTitle = filename
392393
const note = await Editor.openNoteByTitle(wantedTitle)
393394
if (note) {
395+
Editor.focus()
394396
logDebug('bridgeClickDashboardItem', `-> successful call to open title ${wantedTitle} in Editor`)
395397
return handlerResult(true)
396398
} else {

jgclark.Dashboard/src/countDoneTasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export function updateDoneCountsFromChangedNotes(reason: string = ''): number {
178178

179179
// Read current list from todaysChangedNoteList.json, and get time of it.
180180
// Note: can't get a timestamp from plugin files, so need to use a separate preference
181-
logInfo('updateDoneCountsFromChangedNotes', `Starting: ${reason}`)
181+
logDebug('updateDoneCountsFromChangedNotes', `Starting: ${reason}`)
182182
// logDebug('updateDoneCountsFromChangedNotes', `About to read ${changedNoteFile} ...`)
183183
if (DataStore.fileExists(changedNoteFile)) {
184184
const data = DataStore.loadData(changedNoteFile, true) ?? ''

jgclark.Dashboard/src/dataGeneration.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
isLineDisallowedByExcludedTerms,
2525
makeDashboardParas,
2626
} from './dashboardHelpers'
27-
import { getTimeBlockSectionData, getTodaySectionData, getYesterdaySectionData, getTomorrowSectionData } from './dataGenerationDays'
27+
import { getTodaySectionData, getYesterdaySectionData, getTomorrowSectionData } from './dataGenerationDays'
2828
import { getLastWeekSectionData, getThisWeekSectionData } from './dataGenerationWeeks'
2929
import { openMonthParas, refMonthParas, tagParasFromNote, nextProjectNoteItems } from './demoData'
3030
import { getTagSectionDetails } from './react/components/Section/sectionHelpers'
@@ -56,10 +56,10 @@ export async function getAllSectionsData(useDemoData: boolean = false, forceLoad
5656
// V2
5757
// Work out which sections to show
5858
const sectionsToShow: Array<TSectionCode> = forceLoadAll ? allSectionCodes : getListOfEnabledSections(config)
59-
logInfo('getAllSectionsData', `${String(sectionsToShow.length)} sections to show: ${String(sectionsToShow)}`)
59+
logDebug('getAllSectionsData', `>>>>> Starting with ${String(sectionsToShow.length)} sections to show: ${String(sectionsToShow)}`)
6060
const sections: Array<TSection> = await getSomeSectionsData(sectionsToShow, useDemoData, useEditorWherePossible)
61-
6261
// logDebug('getAllSectionsData', `=> sections ${getDisplayListOfSectionCodes(sections)} (unfiltered)`)
62+
logDebug('getAllSectionsData', `<<<<< Finished`)
6363

6464
return sections.filter((s) => s) //get rid of any nulls b/c some of the sections above could return null
6565
} catch (error) {
@@ -294,12 +294,6 @@ export function getThisMonthSectionData(config: TDashboardSettings, useDemoData:
294294
} else {
295295
// Get list of open tasks/checklists from current monthly note (if it exists)
296296
if (sortedRefParas.length > 0) {
297-
// // make a sectionItem for each item, and then make a section too.
298-
// sortedRefParas.map((p) => {
299-
// const thisID = `${sectionNumStr}-${itemCount}`
300-
// items.push(createSectionItemObject(thisID, p))
301-
// itemCount++
302-
// })
303297
// Iterate and write items for first (or combined) section
304298
items = createSectionOpenItemsFromParas(sortedRefParas, sectionNumStr)
305299
itemCount += items.length
@@ -497,12 +491,6 @@ export function getThisQuarterSectionData(config: TDashboardSettings, useDemoDat
497491
} else {
498492
// Get list of open tasks/checklists from current quarterly note (if it exists)
499493
if (sortedRefParas.length > 0) {
500-
// // make a sectionItem for each item, and then make a section too.
501-
// sortedRefParas.map((p) => {
502-
// const thisID = `${sectionNumStr}-${itemCount}`
503-
// items.push(createSectionItemObject(thisID, p))
504-
// itemCount++
505-
// })
506494
// Iterate and write items for this section
507495
items = createSectionOpenItemsFromParas(sortedRefParas, sectionNumStr)
508496
itemCount += items.length
@@ -691,8 +679,6 @@ export function getTaggedSectionData(config: TDashboardSettings, useDemoData: bo
691679
}
692680

693681
// Return section details, even if no items found
694-
// const tagSectionDescription =
695-
// totalCount > itemCount ? `first {count} from ${String(totalCount)} items ordered by ${config.overdueSortOrder}` : `{count} item{s} ordered by ${config.overdueSortOrder}`
696682
const tagSectionDescription = `{count} item{s} ordered by ${config.overdueSortOrder}`
697683
const section: TSection = {
698684
ID: sectionNumStr,

jgclark.Dashboard/src/react/components/Header/Header.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const Header = ({ lastFullRefresh }: Props): React$Node => {
164164
// ----------------------------------------------------------------------
165165
// Constants
166166
// ----------------------------------------------------------------------
167-
const { sections, logSettings } = pluginData
167+
const { sections, logSettings, firstRun } = pluginData
168168

169169
const visibleSectionCodes = getVisibleSectionCodes(dashboardSettings, sections)
170170

@@ -195,7 +195,7 @@ const Header = ({ lastFullRefresh }: Props): React$Node => {
195195

196196
{showRefreshButton && (
197197
<div className="refreshButtons">
198-
<RefreshControl refreshing={pluginData.refreshing === true} handleRefreshClick={handleRefreshClick(false)} />
198+
<RefreshControl refreshing={pluginData.refreshing === true} firstRun={firstRun} handleRefreshClick={handleRefreshClick(false)} />
199199
{showHardRefreshButton && (
200200
<button onClick={handleRefreshClick(true)} className="HAButton hardRefreshButton">
201201
<i className={'fa-regular fa-arrows-retweet'}></i>

jgclark.Dashboard/src/react/components/RefreshControl.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
//----------------------------------------------------------------------
33
// RefreshControl.jsx
44
// renders a refresh button or a refreshing spinner depending on refreshing state
5-
// Last updated 2024-09-18 for v2.1.0.a11 by @jgclark
5+
// Last updated 2025-01-31 for v2.1.8 by @jgclark
66
//----------------------------------------------------------------------
77

88
import React from 'react'
99
import Button from './Button.jsx'
10+
import { logDebug, logInfo } from '@helpers/dev'
1011

1112
type Props = {
1213
refreshing: boolean,
14+
firstRun: boolean,
1315
handleRefreshClick: () => void,
1416
}
1517

@@ -22,19 +24,19 @@ type Props = {
2224
* @returns {React$Node} - The spinner or button component based on the refreshing state.
2325
*/
2426
const RefreshControl = (props: Props): React$Node => {
25-
const { refreshing, handleRefreshClick } = props
27+
const { refreshing, firstRun, handleRefreshClick } = props
28+
logInfo('RefreshControl', `refreshing = ${String(refreshing)}, firstRun = ${String(firstRun)}`)
2629
return (
2730
<Button
2831
text={
2932
<>
30-
{/* <i className={refreshing ? "fa-spinner fa-spin" : "fa-regular fa-arrow-rotate-right"}></i> */}
3133
<i className={refreshing ? 'fa-regular fa-arrow-rotate-right fa-spin' : 'fa-regular fa-arrow-rotate-right'}></i>
3234
{/* <span className="pad-left">{refreshing ? 'Refreshing' : 'Refresh'}</span> */}
33-
<span className={refreshing ? "pad-left greyedText" : "pad-left"}>Refresh</span>
35+
<span className={refreshing || firstRun ? "pad-left greyedText" : "pad-left"}>{firstRun ? 'Generating' : 'Refresh'}</span>
3436
</>
3537
}
3638
clickHandler={handleRefreshClick}
37-
disabled={refreshing}
39+
disabled={refreshing || firstRun}
3840
className="HAButton refreshButton"
3941
/>
4042
)

jgclark.Dashboard/src/react/css/PerspectivesTable.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
border-right: none;
5555
}
5656

57+
/* Use slightly different style for every other row */
58+
tr:nth-child(even) {
59+
background-color: var(--bg-alt-color);
60+
}
61+
5762
/* Sticky header for perspective names */
5863
.sticky-header {
5964
position: sticky;

jgclark.Dashboard/src/reactMain.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,19 +360,19 @@ async function getDashboardSettingsFromPerspective(perspectiveSettings: TPerspec
360360
*/
361361
export async function getInitialDataForReactWindow(perspectiveName: string = '', useDemoData: boolean = false): Promise<PassedData> {
362362
try {
363+
logDebug('getInitialDataForReactWindow', `>>>>> Starting`)
363364
const startTime = new Date()
364365
let perspectiveSettings = await getPerspectiveSettings()
365366
// If a perspective is specified, then update the setting to point to it before opening the React Window
366367
let dashboardSettings: TDashboardSettings = await getDashboardSettings()
367368
if (perspectiveName) {
368-
logInfo('getInitialDataForReactWindow', `switching to perspective '${perspectiveName}'`)
369-
// perspectiveSettings = setActivePerspective(perspectiveName, perspectiveSettings)
369+
logDebug('getInitialDataForReactWindow', `will use perspective '${perspectiveName}'`)
370370
perspectiveSettings = (await switchToPerspective(perspectiveName, perspectiveSettings)) || perspectiveSettings
371371
dashboardSettings = await getDashboardSettingsFromPerspective(perspectiveSettings)
372372
}
373373
// clo(dashboardSettings, `getInitialDataForReactWindow: dashboardSettings=`)
374374
// get whatever pluginData you want the React window to start with and include it in the object below. This all gets passed to the React window
375-
const pluginData = await getPluginData(dashboardSettings, perspectiveSettings, useDemoData)
375+
const pluginData = await getPluginData(dashboardSettings, perspectiveSettings, useDemoData) // Note: the only time this is called.
376376
logDebug('getInitialDataForReactWindow', `lastFullRefresh = ${String(pluginData.lastFullRefresh)}`)
377377
clo(pluginData.dashboardSettings, `getInitialData pluginData.dashboardData`)
378378
const ENV_MODE = 'development' /* 'development' helps during development. set to 'production' when ready to release */
@@ -386,6 +386,7 @@ export async function getInitialDataForReactWindow(perspectiveName: string = '',
386386
startTime,
387387
windowID: WEBVIEW_WINDOW_ID,
388388
}
389+
logDebug('getInitialDataForReactWindow', `<<<<< Finished`)
389390
return dataToPass
390391
} catch (error) {
391392
logError(pluginJson, error.message)
@@ -497,14 +498,12 @@ export async function getPluginData(dashboardSettings: TDashboardSettings, persp
497498
perspectiveSettings: true,
498499
},
499500
totalDoneCount: 0,
501+
firstRun: true,
500502
}
503+
logDebug('getPluginData', `After forming initial pluginData, firstRun = false`)
501504

502505
// Calculate all done task counts (if the appropriate setting is on)
503506
if (NPSettings.doneDatesAvailable) {
504-
// V1 method
505-
// const totalDoneCounts = rollUpDoneCounts([getTotalDoneCountsFromSections(sections)], buildListOfDoneTasksToday())
506-
// pluginData.totalDoneCounts = totalDoneCounts
507-
// V2 method
508507
const totalDoneCount = updateDoneCountsFromChangedNotes('end of getPluginData')
509508
pluginData.totalDoneCount = totalDoneCount
510509
}

0 commit comments

Comments
 (0)