All files / publisher-admin/pages/Releases ReleasesTable.tsx

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

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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                          11x 11x   11x 13x                   11x                              
import { useState } from "react";
import { MainTable } from "@canonical/react-components";
import { generateReleaseChannelRows } from "../../utils/generateReleaseChannelRows";
 
type ReleasesTableProps = {
  releaseMap: ReleaseChannel[];
  arch: string;
};
 
export default function ReleasesTable({
  releaseMap,
  arch,
}: ReleasesTableProps) {
  const [expandedChannel, setExpandedChannel] = useState<string | null>(null);
  const [showAll, setShowAll] = useState<boolean>(false);
 
  const rows = releaseMap.flatMap((releaseChannel) =>
    generateReleaseChannelRows(
      releaseChannel,
      arch,
      expandedChannel,
      setExpandedChannel,
      showAll,
      setShowAll
    )
  );
 
  return (
    <MainTable
      role="table"
      className="u-table-layout--auto"
      headers={[
        { content: "Release Channel" },
        { content: "Revision" },
        { content: "Release Date" },
        { content: "Resources" },
        { content: "Platform" },
      ]}
      rows={rows}
    />
  );
}