From 47f7968dc4029d67fe27ddaae8181c274a10263c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 15 Nov 2025 10:15:11 +0200 Subject: [PATCH] feat(board/relation): group by relation --- apps/client/src/entities/fnote.ts | 10 ++++++++++ apps/client/src/widgets/collections/board/data.ts | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.ts index 230c4783c..425742ee3 100644 --- a/apps/client/src/entities/fnote.ts +++ b/apps/client/src/entities/fnote.ts @@ -804,6 +804,16 @@ export default class FNote { return this.getAttributeValue(LABEL, name); } + getLabelOrRelation(nameWithPrefix: string) { + if (nameWithPrefix.startsWith("#")) { + return this.getLabelValue(nameWithPrefix.substring(1)); + } else if (nameWithPrefix.startsWith("~")) { + return this.getRelationValue(nameWithPrefix.substring(1)); + } else { + return this.getLabelValue(nameWithPrefix); + } + } + /** * @param name - relation name * @returns relation value if relation exists, null otherwise diff --git a/apps/client/src/widgets/collections/board/data.ts b/apps/client/src/widgets/collections/board/data.ts index f283e2dc7..a37487ec9 100644 --- a/apps/client/src/widgets/collections/board/data.ts +++ b/apps/client/src/widgets/collections/board/data.ts @@ -57,7 +57,8 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per return { byColumn, - newPersistedData + newPersistedData, + isInRelationMode: groupByColumn.startsWith("~") }; } @@ -70,7 +71,7 @@ async function recursiveGroupBy(branches: FBranch[], byColumn: ColumnMap, groupB await recursiveGroupBy(note.getChildBranches(), byColumn, groupByColumn, includeArchived, seenNoteIds); } - const group = note.getLabelValue(groupByColumn); + const group = note.getLabelOrRelation(groupByColumn); if (!group || seenNoteIds.has(note.noteId)) { continue; }