Skip to content

Commit 6a66355

Browse files
committed
Improve display of Teamspace part of note links in displayed tasks
1 parent 2f73446 commit 6a66355

4 files changed

Lines changed: 26 additions & 15 deletions

File tree

jgclark.Dashboard/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ For more details see the [plugin's documentation](https://github.com/NotePlan/pl
1111

1212
## [2.4.0.b1] 2025-12-05
1313
- 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). This is applied per Perspective.
14+
- Improved display of Teamspace part of note links in displayed items
1415

1516
## [2.3.3] 2025-12-04
1617
- new 'Year' section available

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ const DialogForTaskItems = ({ details: detailsMessageObject, onClose, positionDi
438438
item={item}
439439
thisSection={sectionCodes}
440440
alwaysShowNoteTitle={true}
441+
suppressTeamspaceName={false}
441442
/>
442443
</div>
443444
</TooltipOnKeyPress>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,15 @@ function ItemContent({ item /*, children */, thisSection }: Props): React$Node {
7878
})
7979
}
8080

81-
// Note: This how to remove tag/mention, if they match the item's sectionCode. Decided not to keep this, as it is doesn't suit some use cases for tags/mentions.
81+
// Note: This is how to remove tag/mention, if they match the item's sectionCode. Decided not to keep this, as it is doesn't suit some use cases for tags/mentions.
8282
// if (thisSection.sectionCode === 'TAG') {
8383
// const sectionTagOrMention = thisSection.name
8484
// mainContent = mainContent.replace(sectionTagOrMention, '')
8585
// }
8686

87+
// If dashboardSettings reveals that we only have 1 teamspace active, and it is not the private space, then suppress the Teamspace name in the note link
88+
const suppressTeamspaceName = dashboardSettings.includedTeamspaces.length === 1 && dashboardSettings.includedTeamspaces[0] !== 'private'
89+
8790
// If hasChild, then set suitable display indicator
8891
// (Earlier options had used 'fa-arrow-down-from-line' and 'fa-block-quote' icons. But switched to ellipsis to match what main Editor added in 3.15.2)
8992
const possParentIcon = dashboardSettings.parentChildMarkersEnabled && item.para?.hasChild ? <i className="fa-solid fa-ellipsis parentMarkerIcon"></i> : ''
@@ -132,6 +135,7 @@ function ItemContent({ item /*, children */, thisSection }: Props): React$Node {
132135
item={item}
133136
thisSection={thisSection}
134137
alwaysShowNoteTitle={false}
138+
suppressTeamspaceName={suppressTeamspaceName}
135139
/>}
136140
</div>
137141
)

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
// @flow
22
//--------------------------------------------------------------------------
33
// Dashboard React component to show Note Links after main item content
4-
// Last updated 2025-11-16 for v2.3.0 by @jgclark
4+
// Last updated 2025-12-05 for v2.4.0 by @jgclark
55
//--------------------------------------------------------------------------
66
import React from 'react'
77
import type { TSection, TSectionItem } from '../../types.js'
88
import { useAppContext } from './AppContext.jsx'
99
import TooltipOnKeyPress from './ToolTipOnModifierPress.jsx'
1010
import { isDailyDateStr, isWeeklyDateStr, isMonthlyDateStr, isQuarterlyDateStr } from '@helpers/dateTime'
1111
import { parseTeamspaceFilename, TEAMSPACE_FA_ICON } from '@helpers/teamspace'
12-
import { logDebug, clo } from '@helpers/react/reactDev'
12+
import { clo, logDebug, logError, logInfo, logWarn } from '@helpers/react/reactDev'
1313
import { extractModifierKeys } from '@helpers/react/reactMouseKeyboard.js'
1414

1515
//-----------------------------------------------------------
1616

1717
type Props = {
1818
item: TSectionItem,
1919
thisSection: TSection,
20-
alwaysShowNoteTitle: boolean
20+
alwaysShowNoteTitle: boolean,
21+
suppressTeamspaceName?: boolean
2122
}
2223

2324
//-----------------------------------------------------------
2425

2526
/**
2627
* Represents the main content for a single item within a section
2728
*/
28-
function ItemNoteLink({ item, thisSection, alwaysShowNoteTitle = false }: Props): React$Node {
29+
function ItemNoteLink({ item, thisSection, alwaysShowNoteTitle = false, suppressTeamspaceName = false }: Props): React$Node {
2930

3031
// ------ COMPUTED VALUES --------------------------------
3132

@@ -48,20 +49,24 @@ function ItemNoteLink({ item, thisSection, alwaysShowNoteTitle = false }: Props)
4849
const parsedTeamspace = parseTeamspaceFilename(filename)
4950
const isFromTeamspace = parsedTeamspace.isTeamspace
5051
const filenameWithoutTeamspacePrefix = parsedTeamspace.filename
51-
// FIXME: this is still returning '/' for Teamspace calendar notes
52-
const folderNamePart = (parsedTeamspace.filepath !== '/') ? `${parsedTeamspace.filepath} /` : ''
53-
// logDebug(`ItemNoteLink`, `noteIconToUse:${noteIconToUse} with filenameWithoutTeamspacePrefix:${filenameWithoutTeamspacePrefix}`)
52+
const trimmedFilePath = parsedTeamspace.filepath.trim()
53+
// For Teamspace calendar notes, filepath can be '/', so we need to check for both empty and '/'
54+
let folderNamePart = (trimmedFilePath !== '/' && trimmedFilePath !== '') ? `${trimmedFilePath} /` : ''
55+
// logDebug(`ItemNoteLink`, `initial filePath:${parsedTeamspace.filepath} with folderNamePart:${folderNamePart}`)
5456
const showNoteTitle = alwaysShowNoteTitle || item.para?.noteType === 'Notes' || filenameWithoutTeamspacePrefix !== thisSection.sectionFilename
5557

5658
// Show Teamspace indicator and name, if this is a Teamspace note
57-
let teamspaceIndicator = null
58-
if (isFromTeamspace) {
59+
let teamspaceName = null
60+
if (isFromTeamspace && !suppressTeamspaceName) {
5961
const teamspaceTitle = item.teamspaceTitle && item.teamspaceTitle !== 'Unknown Teamspace' ? item.teamspaceTitle : ''
60-
teamspaceIndicator = (
61-
<span className='pad-left teamspaceName pad-right-larger'>
62+
teamspaceName = (
63+
<span className='pad-left teamspaceName pad-right'>
6264
<i className={`${TEAMSPACE_FA_ICON} pad-right`}></i>{teamspaceTitle}
6365
</span>
6466
)
67+
if (folderNamePart !== '' && !folderNamePart.endsWith('/')) {
68+
folderNamePart = `/ ${folderNamePart}`
69+
}
6570
}
6671

6772
// ------ HANDLERS ---------------------------------------
@@ -85,10 +90,10 @@ function ItemNoteLink({ item, thisSection, alwaysShowNoteTitle = false }: Props)
8590
metaKey={{ text: 'Open in Floating Window' }}
8691
label={`${item.itemType}_${item.ID}_Open Note Link`}
8792
enabled={!reactSettings?.dialogData?.isOpen}>
88-
{folderNamePart && <span className={`folderName pad-right`}>{folderNamePart}</span>}
93+
{/* If it's a teamspace note prepend that icon + title */}
94+
{isFromTeamspace && teamspaceName}
95+
{folderNamePart && <span className={`folderName`}>{folderNamePart}</span>}
8996
<a className={`noteTitle`} onClick={handleLinkClick}>
90-
{/* If it's a teamspace note prepend that icon + title */}
91-
{isFromTeamspace && teamspaceIndicator}
9297
{/* Show note title if wanted */}
9398
{showNoteTitle && (
9499
<>

0 commit comments

Comments
 (0)