import { comp } from "@thi.ng/transducers/comp" ; import { iterator } from "@thi.ng/transducers/iterator" ; import { map } from "@thi.ng/transducers/map" ; import { mapIndexed } from "@thi.ng/transducers/map-indexed" ; import { partitionBy } from "@thi.ng/transducers/partition-by" ; import { repeat } from "@thi.ng/transducers/repeat" ; import type { AppContext , Commit } from "../api" ; import { commitLink } from "./commit-link" ; import { table } from "./table" ; param _ param commits export const repoTable = ( _ , commits ) => [ table , [ "15%" , "15%" , "55%" , "5%" , "5%" , "5%" ] , [ "Date" , "Author" , "Description" , "Files" , "Adds" , "Dels" ] , iterator ( comp ( map ( ( x ) => [ x . date . substr ( 0 , 10 ) , x . author , [ commitLink , x . sha , x . msg ] , x . files , x . add ? [ "span.green" , `+${ x . add }` ] : null , x . del ? [ "span.red" , `-${ x . del }` ] : null , ] ) , partitionBy ( ( row ) => row [ 0 ] . split ( "-" ) [ 1 ] ) , mapIndexed ( ( i , month ) => [ i > 0 ? [ month [ 0 ] [ 0 ] . substr ( 0 , 7 ) , ... repeat ( "" , 5 ) ] : null , month , ] ) ) , commits ) , ] ;