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

export interface RepositoryBrowserViewProps extends CommonProps {
  currentUser: null | User;
  fileContent: RepositoryFileContent;
  parentOrg: Organization;
  path: string;
  ref: string;
  repo: Repository;
}

const RepositoryBrowserView: ReactView<RepositoryBrowserViewProps> = ({
  commonProps,
  fileContent,
  parentOrg,
  path,
  ref,
  repo,
}) => {
  return (
    <Layout {...commonProps} showSideMenu={false}>
      <PageWrapper>
        <h1>
          {parentOrg.displayName || parentOrg.slug}
          {" / "}
          {repo.displayName || repo.slug}
          {" / "}
          {ref}
          {" / "}
          {path}
        </h1>
        <div>
          <code>
            <pre>{fileContent.content}</pre>
          </code>
        </div>
      </PageWrapper>
    </Layout>
  );
};

RepositoryBrowserView.displayName = "RepositoryBrowserView";
export default RepositoryBrowserView;