"use client"; import { useState, Suspense } from "react"; import { useRouter, useSearchParams } from "next/navigation"; import { authClient } from "~/lib/auth-client"; import { Card, CardContent } from "~/components/ui/card"; import { Input } from "~/components/ui/input"; import { Button } from "~/components/ui/button"; import { Label } from "~/components/ui/label"; import { toast } from "sonner"; import { Logo } from "~/components/branding/logo"; import { LegalModal } from "~/components/ui/legal-modal"; import { Mail, Lock, ArrowRight, Users, FileText, TrendingUp, Shield, } from "lucide-react"; function SignInForm() { const router = useRouter(); const searchParams = useSearchParams(); const callbackUrl = searchParams.get("callbackUrl") ?? "/dashboard"; const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); async function handleSignIn(e: React.FormEvent) { e.preventDefault(); setLoading(true); const { error } = await authClient.signIn.email({ email, password, }); setLoading(false); if (error) { toast.error(error.message ?? "Invalid email or password"); } else { toast.success("Signed in successfully!"); router.push(callbackUrl); router.refresh(); } } async function handleSocialSignIn() { setLoading(true); try { await authClient.signIn.oauth2({ providerId: "authentik", callbackURL: callbackUrl, }); // The signIn.sso method will automatically redirect to the SSO provider } catch (error) { console.error("[SSO Error]", error); setLoading(false); } } return (
{/* Blob Background */}
{/* Hero Section - Hidden on mobile */}

Welcome back to your invoicing workspace

Continue managing your clients and creating professional invoices that get you paid faster.

Client Management

Organize and track all your clients in one place

Professional Invoices

Beautiful templates that get you paid faster

Payment Tracking

Monitor your income with real-time insights

{/* Sign In Form */}
{/* Mobile Logo */}

Sign In

Enter your credentials to access your account

Or continue with
setEmail(e.target.value)} required autoFocus className="h-11 pl-10 bg-background/50 border-border/60 focus:bg-background transition-all" placeholder="m@example.com" />
setPassword(e.target.value)} required className="h-11 pl-10 bg-background/50 border-border/60 focus:bg-background transition-all" placeholder="Enter your password" />
Don't have an account?{" "} Sign up
By signing in, you agree to our{" "} Terms of Service } />{" "} and{" "} Privacy Policy } /> .
); } export default function SignInPage() { return ( Loading...}> ); }