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.

544 B
Raw Blame
import type { ProjectWithTasks } from "@/types/project";
import type Task from "@/types/task";

export function scopeTasks(
  project: ProjectWithTasks | null | undefined,
  scope: "board" | "backlog" | "schedule",
): Task[] {
  if (!project) return [];
  const boardTasks = project.columns.flatMap((column) => column.tasks);
  if (scope === "board") return boardTasks;
  if (scope === "backlog") {
    return [...(project.plannedTasks ?? []), ...(project.archivedTasks ?? [])];
  }
  return [...boardTasks, ...(project.plannedTasks ?? [])];
}