Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 9x 9x 17x 17x 17x 15x 15x 9x 9x 9x 8x 8x 15x 12x 12x 3x 3x 3x 3x 8x 9x | // Pure helpers extracted from HoMoodBoardsDal to reduce class file size.
type SlotItem = { entityType: "project" | "room"; entityId: string };
/**
* Slot preview items from a flat list into per-board arrays, capped at
* `perBoardCap`. Items arrive ordered by (boardId, sortOrder) so the first
* ones we see for each board are the ones with lowest sort order.
*/
export function slotItemsByBoard(
previewItems: Array<{
boardId: string;
entityType: string;
entityId: string;
}>,
perBoardCap: number,
): Map<string, SlotItem[]> {
const itemsByBoard = new Map<string, SlotItem[]>();
for (const item of previewItems) {
Iif (item.entityType !== "project" && item.entityType !== "room") continue;
const existing = itemsByBoard.get(item.boardId) ?? [];
if (existing.length >= perBoardCap) continue;
existing.push({
entityType: item.entityType as "project" | "room",
entityId: item.entityId,
});
itemsByBoard.set(item.boardId, existing);
}
return itemsByBoard;
}
/**
* Build per-board thumbnail arrays by resolving entity IDs against pre-fetched
* cover maps. Returns only storage keys (non-null covers).
*/
export function buildThumbsFromMaps(
itemsByBoard: Map<string, SlotItem[]>,
projectCoverMap: Map<string, string | null>,
roomCoverMap: Map<number, string>,
): Map<string, string[]> {
const thumbsMap = new Map<string, string[]>();
for (const [boardId, items] of itemsByBoard.entries()) {
const thumbs: string[] = [];
for (const it of items) {
if (it.entityType === "project") {
const cover = projectCoverMap.get(it.entityId) ?? null;
if (cover) thumbs.push(cover);
} else {
const n = Number.parseInt(it.entityId, 10);
Iif (!Number.isFinite(n)) continue;
const cover = roomCoverMap.get(n);
Eif (cover) thumbs.push(cover);
}
}
thumbsMap.set(boardId, thumbs);
}
return thumbsMap;
}
|