.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 { Pipeline, Stage } from "@prisma/client";
// app
import type { CommonProps } from "../../types";
import { Layout } from "../../components/Layout";
import { PageWrapper } from "../../components/PageWrapper";

export interface PipelineStagesViewProps extends CommonProps {
  pipeline: Pipeline;
  stages: Stage[];
  orgSlug: string;
  repoSlug: string;
}

const PipelineStagesView: ReactView<PipelineStagesViewProps> = ({
  commonProps,
  pipeline,
  stages,
  orgSlug,
  repoSlug,
}) => {
  return (
    <Layout {...commonProps} orgSlug={orgSlug} repoSlug={repoSlug}>
      <PageWrapper>
        <h2>Stages for pipeline {pipeline.name ?? pipeline.id}</h2>
        <ul>
          {stages.map((s) => (
            <li key={s.id}>
              {s.name ?? s.id} - status: {s.status ?? "unknown"}
            </li>
          ))}
        </ul>
      </PageWrapper>
    </Layout>
  );
};

PipelineStagesView.displayName = "PipelineStagesView";
export default PipelineStagesView;