Skip to content

Commit

Permalink
added default project name when creating neon project
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Jan 7, 2025
1 parent 8f7e3c5 commit 8cb4f01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8cb4f01

Please sign in to comment.