Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

753 B
Raw Blame
import type { RelatedTaskJson } from "../relations/group-relations.js";
import { renderTable } from "../render/table.js";
import type { Ui } from "../render/ui.js";
import { relatedTaskColumns } from "./related-task-columns.js";
import { sectionTitle } from "./section-title.js";

export function renderSubtasks(
  ui: Ui,
  subtasks: ReadonlyArray<RelatedTaskJson>,
): string[] {
  if (subtasks.length === 0) return [];
  const done = subtasks.filter((task) => task.completed).length;
  return [
    sectionTitle(ui, "Subtasks", `${done} of ${subtasks.length} done`),
    ...renderTable(
      ui,
      subtasks,
      relatedTaskColumns(ui, (task: RelatedTaskJson) => task),
      { width: ui.caps.columns, indent: 4, gap: 2 },
    ),
    "",
  ];
}