MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / buildTaskListSubPropertyRenderItems

Function buildTaskListSubPropertyRenderItems

src/bases/taskListGrouping.ts:244–271  ·  view source on GitHub ↗
(
	groupedTasks: ReadonlyMap<string, readonly TaskInfo[]>,
	collapsedGroups: ReadonlySet<string>
)

Source from the content-addressed store, hash-verified

242}
243
244export function buildTaskListSubPropertyRenderItems(
245 groupedTasks: ReadonlyMap<string, readonly TaskInfo[]>,
246 collapsedGroups: ReadonlySet<string>
247): TaskListRenderItem[] {
248 const items: TaskListRenderItem[] = [];
249
250 for (const [groupKey, tasks] of groupedTasks) {
251 if (tasks.length === 0) continue;
252
253 const isCollapsed = collapsedGroups.has(groupKey);
254 items.push({
255 type: "primary-header",
256 groupKey,
257 groupTitle: groupKey,
258 taskCount: tasks.length,
259 groupEntries: [],
260 isCollapsed,
261 });
262
263 if (!isCollapsed) {
264 for (const task of tasks) {
265 items.push({ type: "task", task, groupKey });
266 }
267 }
268 }
269
270 return items;
271}

Callers 3

refreshGroupedViewMethod · 0.90

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected