diff --git a/apps/client/src/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts index e4cb03f17..65de14e4e 100644 --- a/apps/client/src/widgets/view_widgets/calendar_view.ts +++ b/apps/client/src/widgets/view_widgets/calendar_view.ts @@ -401,9 +401,14 @@ export default class CalendarView extends ViewMode<{}> { return true; } + // Refresh on note title change. + if (loadResults.getNoteIds().some(noteId => this.noteIds.includes(noteId))) { + this.calendar?.refetchEvents(); + } + // Refresh dataset on subnote change. - if (this.calendar && loadResults.getAttributeRows().some((a) => this.noteIds.includes(a.noteId ?? ""))) { - this.calendar.refetchEvents(); + if (loadResults.getAttributeRows().some((a) => this.noteIds.includes(a.noteId ?? ""))) { + this.calendar?.refetchEvents(); } } diff --git a/apps/client/src/widgets/view_widgets/table_view/formatters.ts b/apps/client/src/widgets/view_widgets/table_view/formatters.ts index de1e8793f..a333742e9 100644 --- a/apps/client/src/widgets/view_widgets/table_view/formatters.ts +++ b/apps/client/src/widgets/view_widgets/table_view/formatters.ts @@ -20,9 +20,7 @@ export function NoteFormatter(cell: CellComponent, _formatterParams, onRendered) const iconClass = note.getIcon(); const title = note.title; - const { $noteRef } = buildNoteLink(noteId); - $noteRef.text(title); - $noteRef.prepend($("").addClass(iconClass)); + const { $noteRef } = buildNoteLink(noteId, title, iconClass, note.getColorClass()); return $noteRef[0]; } @@ -53,15 +51,12 @@ export function NoteFormatter(cell: CellComponent, _formatterParams, onRendered) * Custom formatter for the note title that is quite similar to {@link NoteFormatter}, but where the title and icons are read from separate fields. */ export function NoteTitleFormatter(cell: CellComponent) { - const { noteId, iconClass } = cell.getRow().getData(); + const { noteId, iconClass, colorClass } = cell.getRow().getData(); if (!noteId) { return ""; } - const { $noteRef } = buildNoteLink(noteId); - $noteRef.text(cell.getValue()); - $noteRef.prepend($("").addClass(iconClass)); - + const { $noteRef } = buildNoteLink(noteId, cell.getValue(), iconClass, colorClass); return $noteRef[0].outerHTML; } @@ -80,10 +75,15 @@ export function MonospaceFormatter(cell: CellComponent) { return `${cell.getValue()}`; } -function buildNoteLink(noteId: string) { +function buildNoteLink(noteId: string, title: string, iconClass: string, colorClass?: string) { const $noteRef = $(""); const href = `#root/${noteId}`; $noteRef.addClass("reference-link"); $noteRef.attr("data-href", href); + $noteRef.text(title); + $noteRef.prepend($("").addClass(iconClass)); + if (colorClass) { + $noteRef.addClass(colorClass); + } return { $noteRef, href }; } diff --git a/apps/client/src/widgets/view_widgets/table_view/rows.ts b/apps/client/src/widgets/view_widgets/table_view/rows.ts index a3efca0c6..460f169ac 100644 --- a/apps/client/src/widgets/view_widgets/table_view/rows.ts +++ b/apps/client/src/widgets/view_widgets/table_view/rows.ts @@ -9,6 +9,7 @@ export type TableData = { labels: Record; relations: Record; branchId: string; + colorClass: string | undefined; _children?: TableData[]; }; @@ -41,6 +42,7 @@ export async function buildRowDefinitions(parentNote: FNote, infos: AttributeDef labels, relations, branchId: branch.branchId, + colorClass: note.getColorClass() } if (note.hasChildren() && (maxDepth < 0 || currentDepth < maxDepth)) {