.ts
TypeScript
(application/typescript)
// 1st-party
import type { ReactView } from "@ethicdevs/react-monolith";
// 3rd-party
import React from "react";
// generated via script[prisma:generate]
import type { Artefact, Pipeline } from "@prisma/client";
// app
import type { CommonProps } from "../../types";
// import { AppRoute } from "../../routes.defs";

export interface PipelineArtefactsViewProps extends CommonProps {
  artefacts: Artefact[];
  pipeline: Pipeline;
  orgSlug: string;
  repoSlug: string;
}

const PipelineArtefactsView: ReactView<PipelineArtefactsViewProps> = ({
  // commonProps,
  artefacts,
  pipeline,
  // orgSlug,
  // repoSlug,
}) => {
  return (
    <div>
      <h2>Artefacts for pipeline {pipeline.name ?? pipeline.id}</h2>
      {artefacts.length === 0 ? (
        <p>No artefacts found.</p>
      ) : (
        <ul>
          {artefacts.map((artefact) => (
            <li key={artefact.id}>
              <span>{artefact.name ?? `Artefact ${artefact.id}`}</span>
              {" - "}
              <span>size: {artefact.size ?? ""}</span>
            </li>
          ))}
        </ul>
      )}
    </div>
  );
};

PipelineArtefactsView.displayName = "PipelineArtefactsView";
export default PipelineArtefactsView;