B2B-29: Create register-company form

This commit is contained in:
Danel Kungla
2025-06-03 17:33:46 +03:00
parent 657a36a298
commit 19c1bf756a
37 changed files with 2430 additions and 90 deletions

View File

@@ -0,0 +1,38 @@
import FetchDataSteps from "@/components/tutorial/fetch-data-steps";
import { createClient } from "@/utils/supabase/server";
import { InfoIcon } from "lucide-react";
import { redirect } from "next/navigation";
export default async function ProtectedPage() {
const supabase = await createClient();
const {
data: { user },
} = await supabase.auth.getUser();
if (!user) {
return redirect("/example/sign-in");
}
return (
<div className="flex-1 w-full flex flex-col gap-12">
<div className="w-full">
<div className="bg-accent text-sm p-3 px-5 rounded-md text-foreground flex gap-3 items-center">
<InfoIcon size="16" strokeWidth={2} />
This is a protected page that you can only see as an authenticated
user
</div>
</div>
<div className="flex flex-col gap-2 items-start">
<h2 className="font-bold text-2xl mb-4">Your user details</h2>
<pre className="text-xs font-mono p-3 rounded border max-h-32 overflow-auto">
{JSON.stringify(user, null, 2)}
</pre>
</div>
<div>
<h2 className="font-bold text-2xl mb-4">Next steps</h2>
<FetchDataSteps />
</div>
</div>
);
}

View File

@@ -0,0 +1,37 @@
import { resetPasswordAction } from "@/app/example/actions";
import { FormMessage, Message } from "@/components/form-message";
import { SubmitButton } from "@/components/submit-button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
export default async function ResetPassword(props: {
searchParams: Promise<Message>;
}) {
const searchParams = await props.searchParams;
return (
<form className="flex flex-col w-full max-w-md p-4 gap-2 [&>input]:mb-4">
<h1 className="text-2xl font-medium">Reset password</h1>
<p className="text-sm text-foreground/60">
Please enter your new password below.
</p>
<Label htmlFor="password">New password</Label>
<Input
type="password"
name="password"
placeholder="New password"
required
/>
<Label htmlFor="confirmPassword">Confirm password</Label>
<Input
type="password"
name="confirmPassword"
placeholder="Confirm password"
required
/>
<SubmitButton formAction={resetPasswordAction}>
Reset password
</SubmitButton>
<FormMessage message={searchParams} />
</form>
);
}