added default project name when creating neon project
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled

This commit is contained in:
Zai Shi 2025-01-07 14:30:13 -08:00
parent 8f7e3c54d5
commit 8cb4f01782
2 changed files with 14 additions and 8 deletions

View File

@ -18,23 +18,25 @@ export const projectFormSchema = yup.object({
.defined("At least one sign-in method is required"),
});
export type ProjectFormValues = yup.InferType<typeof projectFormSchema>
export const defaultValues: Partial<ProjectFormValues> = {
displayName: "",
signInMethods: ["credential", "google", "github"],
};
type ProjectFormValues = yup.InferType<typeof projectFormSchema>
export default function PageClient () {
const user = useUser({ or: 'redirect', projectIdMustMatch: "internal" });
const [loading, setLoading] = useState(false);
const router = useRouter();
const searchParams = useSearchParams();
const displayName = searchParams.get("display_name");
const defaultValues: Partial<ProjectFormValues> = {
displayName: displayName || "",
signInMethods: ["credential", "google", "github"],
};
const form = useForm<ProjectFormValues>({
resolver: yupResolver<ProjectFormValues>(projectFormSchema),
defaultValues,
mode: "onChange",
});
const router = useRouter();
const searchParams = useSearchParams();
const mockProject = {
id: "id",

View File

@ -75,6 +75,10 @@ export default function NeonConfirmCard(props: { onContinue: (options: { project
if (p === "create-new") {
const createSearchParams = new URLSearchParams();
createSearchParams.set("redirect_to_neon_confirm_with", searchParams.toString());
const neonDisplayName = searchParams.get("neon_project_display_name");
if (neonDisplayName) {
createSearchParams.set("display_name", neonDisplayName);
}
window.location.href = '/new-project?' + createSearchParams.toString();
} else {
setSelectedProject(projects.find((project) => project.id === p) ?? null);