import { createFileRoute, redirect } from '@tanstack/react-router'
import { LoginForm } from '@/components/forms/login-form'

export const Route = createFileRoute('/(auth)/login/')({
  beforeLoad: async ({ context }) => {
    const { token } = context.auth
    if (token) throw redirect({ to: '/' })
  },
  component: LoginPage,
})

function LoginPage() {
  return (
    <div className="flex items-center justify-center min-h-screen bg-gradient-to-br from-background to-muted/20">
      <LoginForm className="w-full max-w-md" />
    </div>
  )
}
