.ts
TypeScript
(application/typescript)
// 1st-party
import type { ReactView } from "@ethicdevs/react-monolith";
// 3rd-party
import React from "react";
// generated via script[generate:prisma]
import type { Organization, PullRequest } from "@prisma/client";
// app
import type { CommonProps, RepositoryWithForkedFromRepo } from "../../types";
import { IslandWrapper, Layout, PageWrapper } from "../../components";
// app islands
import RepositoryHero from "../../islands/RepositoryHero";
import RepositoryPullRequestCreateForm, {
  RepositoryPullRequestCreateFormVariant,
} from "../../islands/RepositoryPullRequestCreateForm";

export interface RepositoryPullRequestCreateViewProps extends CommonProps {
  errorMessage?: string | null;
  initialValues?: PullRequest;
  parentOrg: Organization;
  repo: RepositoryWithForkedFromRepo;
  variant: RepositoryPullRequestCreateFormVariant;
}

const RepositoryPullRequestCreateView: ReactView<
  RepositoryPullRequestCreateViewProps
> = ({ commonProps, parentOrg, repo, variant }) => {
  return (
    <Layout
      {...commonProps}
      showDrawerPrimary
      orgSlug={parentOrg.slug}
      repoSlug={repo.slug}
    >
      <PageWrapper>
        <IslandWrapper data-islandid={`${RepositoryHero.name}$$0`}>
          <RepositoryHero
            themeScheme={commonProps.themeScheme}
            forkedFromRepo={repo.forkedFromRepo}
            forksCount={repo.forks.length}
            parentOrg={parentOrg}
            path={`Pull Requests / New`}
            repo={repo}
            showForkButton={false}
            showNewButton={false}
            // showSaveButton
            // onSaveButtonClick
          />
        </IslandWrapper>
        <IslandWrapper
          data-islandid={`${RepositoryPullRequestCreateForm.name}$$0`}
          style={{ marginTop: 24 }}
        >
          <RepositoryPullRequestCreateForm
            parentOrgSlug={parentOrg.slug}
            repoSlug={repo.slug}
            themeScheme={commonProps.themeScheme}
            variant={variant}
          />
        </IslandWrapper>
      </PageWrapper>
    </Layout>
  );
};

RepositoryPullRequestCreateView.displayName = "RepositoryPullRequestCreateView";
export default RepositoryPullRequestCreateView;