All files / apps/developer-portal/layers/workflows/shared projectCard.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

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                      41x                 41x 15x  
import type { ProjectView } from "./types/ProjectView.ts";
 
export interface ProjectCard {
    id: string;
    title: string;
    templateTitle: string;
    percent: number;
    done: string;
}
 
/** What a project's card on the Workflows page and the Overview says. */
export const projectCard = ({ project, template, progress }: ProjectView): ProjectCard => ({
    id: project.id,
    title: project.title,
    templateTitle: template.title,
    percent: progress.percent,
    done: `${progress.done} of ${progress.total} done`,
});
 
/** The projects with blocks still to finish. */
export const activeProjects = (projects: ProjectView[]): ProjectView[] =>
    projects.filter(({ progress }) => progress.percent < 100);