feat: initialize Next.js project with Prisma, authentication, and rankings page

This commit is contained in:
2026-03-27 14:50:00 -07:00
parent 96f7cb86d3
commit 66e4baa643
208 changed files with 8522 additions and 9035 deletions
+113
View File
@@ -0,0 +1,113 @@
"use client"
import { useSession, signOut } from "next-auth/react"
import Link from "next/link"
import { usePathname } from "next/navigation"
export default function Navigation() {
const { data: session, status } = useSession()
const pathname = usePathname()
const isActive = (path: string) => pathname === path
return (
<nav className="bg-green-800 text-white shadow-lg">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
{/* Logo */}
<div className="flex-shrink-0">
<Link href="/" className="text-xl font-bold">
EuchreCamp
</Link>
</div>
{/* Navigation Links */}
<div className="flex items-center space-x-4">
<Link
href="/rankings"
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
isActive("/rankings")
? "bg-green-900 text-white"
: "text-green-100 hover:bg-green-700 hover:text-white"
}`}
>
Rankings
</Link>
{status === "authenticated" && session?.user && (
<>
<Link
href={`/players/${session.user.playerId}/profile`}
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
isActive(`/players/${session.user.playerId}/profile`)
? "bg-green-900 text-white"
: "text-green-100 hover:bg-green-700 hover:text-white"
}`}
>
My Profile
</Link>
<Link
href={`/players/${session.user.playerId}/schedule`}
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
isActive(`/players/${session.user.playerId}/schedule`)
? "bg-green-900 text-white"
: "text-green-100 hover:bg-green-700 hover:text-white"
}`}
>
My Schedule
</Link>
{(session.user.role === "tournament_admin" ||
session.user.role === "club_admin") && (
<Link
href="/admin"
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
isActive("/admin")
? "bg-green-900 text-white"
: "text-green-100 hover:bg-green-700 hover:text-white"
}`}
>
Admin
</Link>
)}
</>
)}
</div>
{/* User Menu */}
<div className="flex items-center space-x-4">
{status === "loading" ? (
<span className="text-green-100">Loading...</span>
) : status === "authenticated" ? (
<>
<span className="text-green-100">
{session.user?.name || session.user?.email}
</span>
<button
onClick={() => signOut({ callbackUrl: "/" })}
className="px-3 py-2 rounded-md text-sm font-medium bg-green-700 text-white hover:bg-green-600 transition-colors"
>
Logout
</button>
</>
) : (
<>
<Link
href="/auth/login"
className="px-3 py-2 rounded-md text-sm font-medium bg-green-700 text-white hover:bg-green-600 transition-colors"
>
Login
</Link>
<Link
href="/auth/register"
className="px-3 py-2 rounded-md text-sm font-medium bg-green-600 text-white hover:bg-green-500 transition-colors"
>
Register
</Link>
</>
)}
</div>
</div>
</div>
</nav>
)
}