import { newProjectSpaces } from "@peppa/runner";
import { loadEnv } from "@peppa/shared";
import { Flash, PageHeader } from "@/components/common";
import { Hidden } from "@/components/cards";
import { Label, NativeSelect } from "@/components/ui/input";
import { ProjectBasics } from "@/components/ProjectBasics";
import { PendingButton } from "@/components/PendingButton";
import { Workspace } from "@/components/Workspace";
import { requireUser, words } from "@/lib/auth";
import { db } from "@/lib/db";
import { getT } from "@/lib/i18n";
import { createProjectAction } from "../../actions";
import { pageTitle } from "@/lib/title";
function Choice({ name, value, checked, children }: { name: string; value: string; checked?: boolean; children: React.ReactNode }) {
return (
);
}
// PEP-274: the browser tab says which page it is.
export async function generateMetadata() {
const t = await getT();
return pageTitle(t, t("Новый проект"));
}
export default async function NewProject({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
const user = await requireUser();
const t = await getT();
const { error } = await searchParams;
const w = await words();
const giteaUrl = loadEnv().GITEA_URL.replace(/^https?:\/\//, "");
// PEP-68: a local user has no Gitea account — the repo is created in peppa-bot's namespace.
// PEP-329: the same for an old Gitea access that no longer works (it cannot be renewed since
// PEP-71): the form says where the code will be kept instead of «войдите заново».
const { own, orgs, connect } = await newProjectSpaces(db, user);
const local = !own;
const botLogin = process.env.GITEA_BOT_USER ?? "peppa-bot";
return (
{t("Проект — это ваш продукт. Создайте его, а потом описывайте задачи словами: агенты будут их делать.")}