chore(views/board): prepare to group by attribute

This commit is contained in:
Elian Doran 2025-07-19 18:34:59 +03:00
parent 11547ecaa3
commit 951b5384a3
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,23 @@
import FNote from "../../../entities/fnote";
import froca from "../../../services/froca";
export async function getBoardData(noteIds: string[], groupByColumn: string) {
const notes = await froca.getNotes(noteIds);
const byColumn: Map<string, FNote[]> = new Map();
for (const note of notes) {
const group = note.getLabelValue(groupByColumn);
if (!group) {
continue;
}
if (!byColumn.has(group)) {
byColumn.set(group, []);
}
byColumn.get(group)!.push(note);
}
return {
byColumn
};
}

View File

@ -1,4 +1,5 @@
import ViewMode, { ViewModeArgs } from "../view_mode";
import { getBoardData } from "./data";
const TPL = /*html*/`
<div class="board-view">
@ -45,7 +46,8 @@ export default class BoardView extends ViewMode<StateInfo> {
}
private async renderBoard(el: HTMLElement) {
const data = await getBoardData(this.noteIds, "status");
console.log("Board data:", data);
}
}