import type { ReactView } from "@ethicdevs/react-monolith";
import React from "react";
import { Organization } from "@prisma/client";
import type { CommonProps } from "../../types";
import { Layout, PageWrapper } from "../../components";
import RepositoryCreateForm from "../../islands/RepositoryCreateForm";
export interface RepositoryCreateViewProps extends CommonProps {
availableParentOrgs: Organization[];
errorMessage?: null | string;
initialValues?: {
parent_org_slug?: string;
repo_slug?: string;
repo_display_name?: string;
repo_short_description?: string;
repo_website_url?: string;
repo_keywords?: string[];
};
}
const RepositoryCreateView: ReactView<RepositoryCreateViewProps> = ({
availableParentOrgs,
commonProps,
errorMessage = undefined,
initialValues = undefined,
}) => {
return (
<Layout {...commonProps}>
<PageWrapper>
{errorMessage && (
<div className={"error_message"}>
<p>{errorMessage}</p>
</div>
)}
<form action={`/repo/new`} method={"POST"}>
<div data-islandid={`${RepositoryCreateForm.name}$$0`}>
<RepositoryCreateForm
availableParentOrgs={availableParentOrgs}
initialValues={initialValues}
/>
</div>
</form>
</PageWrapper>
</Layout>
);
};
RepositoryCreateView.displayName = "RepositoryCreateView";
export default RepositoryCreateView;