import { onMount } from "solid-js";
import { useNavigate } from "@solidjs/router";
import { BookraCharacter } from "../components/bookra-character";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../components/ui";

export function AuthCallbackRoute() {
  const navigate = useNavigate();

  onMount(() => {
    window.setTimeout(() => navigate("/dashboard", { replace: true }), 250);
  });

  return (
    <section class="section-container py-16">
      <Card class="surface-elevated mx-auto max-w-xl text-center">
        <CardHeader>
          <div class="mb-4 flex justify-center">
            <BookraCharacter pose="hello" size="lg" animate />
          </div>
          <CardTitle>Finishing sign-in</CardTitle>
          <CardDescription>Redirecting you to your dashboard.</CardDescription>
        </CardHeader>
        <CardContent />
      </Card>
    </section>
  );
}
