From 6cfd5d325a2c665c100ed230bf1b9aebfc3c27dd Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Sun, 26 Apr 2026 16:37:46 -0700 Subject: [PATCH] chore: add new route pages and environment configuration --- .env.production | 11 ++ .gitignore | 2 + .../admin/tournaments/[id]/schedule/page.tsx | 74 ++++++++++++ src/app/auth/password-reset/page.tsx | 108 ++++++++++++++++++ src/app/wordmark-redirect/route.ts | 37 ++++++ 5 files changed, 232 insertions(+) create mode 100644 .env.production create mode 100644 src/app/admin/tournaments/[id]/schedule/page.tsx create mode 100644 src/app/auth/password-reset/page.tsx create mode 100644 src/app/wordmark-redirect/route.ts diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..da8a33c --- /dev/null +++ b/.env.production @@ -0,0 +1,11 @@ +# Test environment - use dev database +DATABASE_PROVIDER=postgresql +DATABASE_URL="postgresql://euchre_camp:LINGO5row_hiding@dhg.lol:5432/euchre_camp_dev" + +# Better Auth Configuration +BETTER_AUTH_SECRET="your-secret-key-change-in-production" +BETTER_AUTH_URL="http://localhost:3000" +TRUSTED_ORIGINS="http://localhost:3000" + +# Application configuration +NODE_ENV=production diff --git a/.gitignore b/.gitignore index 2b128b4..84b0682 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,5 @@ prisma/prisma/dev.db* playwright-report/ .env.development .env.dev + +cucumber-pretty diff --git a/src/app/admin/tournaments/[id]/schedule/page.tsx b/src/app/admin/tournaments/[id]/schedule/page.tsx new file mode 100644 index 0000000..0ea0a32 --- /dev/null +++ b/src/app/admin/tournaments/[id]/schedule/page.tsx @@ -0,0 +1,74 @@ +import { prisma } from "@/lib/prisma" +import Navigation from "@/components/Navigation" +import Link from "next/link" +import { notFound } from "next/navigation" + +interface PageProps { + params: Promise<{ + id: string + }> +} + +export const dynamic = "force-dynamic" + +export default async function TournamentSchedulePage({ params }: PageProps) { + const { id } = await params + const tournamentId = parseInt(id, 10) + + if (isNaN(tournamentId)) { + notFound() + } + + const tournament = await prisma.event.findUnique({ + where: { id: tournamentId }, + include: { + participants: { + include: { + player: true, + }, + }, + }, + }) + + if (!tournament) { + notFound() + } + + return ( +
+ + +
+
+
+ + ← Back to Tournament + +
+ +

+ Schedule - {tournament.name} +

+ +
+
+

+ Tournament Schedule +

+ +
+ +

+ No schedule has been generated yet. Click "Generate Schedule" to create round matchups. +

+
+
+
+
+ ) +} \ No newline at end of file diff --git a/src/app/auth/password-reset/page.tsx b/src/app/auth/password-reset/page.tsx new file mode 100644 index 0000000..87dee2b --- /dev/null +++ b/src/app/auth/password-reset/page.tsx @@ -0,0 +1,108 @@ +"use client" + +import Link from "next/link" +import { useState } from "react" + +export default function PasswordResetPage() { + const [email, setEmail] = useState("") + const [sent, setSent] = useState(false) + const [error, setError] = useState("") + const [loading, setLoading] = useState(false) + + async function handleSubmit(e: React.FormEvent) { + e.preventDefault() + setLoading(true) + setError("") + + try { + setSent(true) + } catch (err) { + console.error("Password reset error:", err) + setError("An unexpected error occurred") + } finally { + setLoading(false) + } + } + + if (sent) { + return ( +
+
+
+

+ Check your email +

+

+ If an account exists with that email, a password reset link will be sent. +

+
+
+ + Return to sign in + +
+
+
+ ) + } + + return ( +
+
+
+

+ Reset Password +

+

+ Enter your email address and we will send you a link to reset your password. +

+
+
+ {error && ( +
+
{error}
+
+ )} +
+ + setEmail(e.target.value)} + className="appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-green-500 focus:border-green-500 focus:z-10 sm:text-sm" + placeholder="Email address" + /> +
+ +
+ +
+ +
+ + Remember your password? Sign in + +
+
+
+
+ ) +} \ No newline at end of file diff --git a/src/app/wordmark-redirect/route.ts b/src/app/wordmark-redirect/route.ts new file mode 100644 index 0000000..c9d4876 --- /dev/null +++ b/src/app/wordmark-redirect/route.ts @@ -0,0 +1,37 @@ +import { prisma } from "@/lib/prisma" +import { redirect } from "next/navigation" +import { getSession } from "@/lib/auth-simple" + +export const dynamic = "force-dynamic" + +export async function GET() { + const session = await getSession() + + if (!session) { + redirect("/") + } + + const userId = session.user?.id || session.user?.userId + + if (!userId) { + redirect("/") + } + + const user = await prisma.user.findUnique({ + where: { id: userId } + }) + + if (!user) { + redirect("/") + } + + if (user.role === "club_admin" || user.role === "site_admin") { + redirect("/admin") + } + + if (user.playerId) { + redirect(`/players/${user.playerId}/profile`) + } + + redirect("/rankings") +} \ No newline at end of file