import { ResetPasswordForm } from "./ResetPasswordForm";

export const metadata = {
  title: "Reset Password | Cellar Labels",
};

export default async function ResetPasswordPage({
  searchParams,
}: {
  searchParams: Promise<{ token?: string }>;
}) {
  const { token } = await searchParams;

  if (!token) {
    return (
      <main className="mx-auto max-w-md px-6 py-16">
        <h1 className="font-heading text-4xl font-semibold text-terracotta">
          Reset Password
        </h1>
        <p className="mt-4 text-charcoal/70">
          This reset link is missing its token. Request a new one from the{" "}
          <a href="/forgot-password" className="text-terracotta hover:underline">
            forgot password
          </a>{" "}
          page.
        </p>
      </main>
    );
  }

  return (
    <main className="mx-auto max-w-md px-6 py-16">
      <h1 className="font-heading text-4xl font-semibold text-terracotta">
        Reset Password
      </h1>
      <ResetPasswordForm token={token} />
    </main>
  );
}
