import { db } from '@/lib/db'
import { LoginForms } from './forms'

// Reads the student list from the database on every request; there is nothing
// here to prerender.
export const dynamic = 'force-dynamic'

export default async function LoginPage() {
  const students = await db.student.findMany({
    select: { slug: true, name: true },
    orderBy: { grade: 'desc' },
  })
  return (
    <main className="mx-auto flex min-h-screen max-w-md flex-col justify-center px-6 py-12">
      <h1 className="mb-1 text-2xl font-semibold">Learn</h1>
      <p className="mb-8 text-sm text-[var(--color-muted)]">
        Practice sets, made for you.
      </p>
      <LoginForms students={students} />
    </main>
  )
}
