mirror of
https://github.com/arthur-pbty/binouz.git
synced 2026-06-04 15:56:33 +02:00
feat: add authentication and user management features
- Implemented AuthButton component for Discord sign-in and sign-out functionality. - Created CopyButton component for copying server IP addresses. - Developed EventCard and GradeCard components for displaying events and grades. - Added Footer and Navbar components for site navigation and information. - Introduced PurchaseButton for handling grade purchases with Stripe integration. - Created SectionHeader component for consistent section titles. - Implemented session management with SessionProvider for NextAuth. - Set up PostgreSQL database with Docker and Prisma for data management. - Added admin guard functionality to restrict access to certain routes. - Configured NextAuth with Discord provider for user authentication. - Defined Prisma schema for user, admin, grade, event, and purchase models. - Seeded database with initial grades and events data. - Added SVG hero image for the landing page. - Extended NextAuth types to include additional user properties.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
.git
|
||||
.next
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.env*
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
FROM node:20-bookworm-slim AS deps
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM deps AS builder
|
||||
COPY . .
|
||||
ENV DATABASE_URL=postgresql://user:password@db:5432/binouz
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-bookworm-slim AS runner
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
@@ -1,36 +1,77 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# BinouzUHC
|
||||
|
||||
## Getting Started
|
||||
Modern Minecraft UHC landing page with Discord authentication, admin panel, and a ready-to-docker stack.
|
||||
|
||||
First, run the development server:
|
||||
## Stack
|
||||
|
||||
- Next.js (App Router) + TypeScript
|
||||
- Tailwind CSS
|
||||
- Prisma + PostgreSQL
|
||||
- NextAuth (Discord OAuth)
|
||||
- Docker / docker-compose
|
||||
|
||||
## Quick start (Docker)
|
||||
|
||||
1. Copy env file:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
2. Fill the values in `.env`:
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
```txt
|
||||
NEXTAUTH_SECRET=
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
DISCORD_CLIENT_ID=
|
||||
DISCORD_CLIENT_SECRET=
|
||||
|
||||
## Learn More
|
||||
DATABASE_URL=postgresql://user:password@db:5432/binouz
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
ADMIN_DISCORD_ID=
|
||||
```
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
3. Build and run:
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
## Deploy on Vercel
|
||||
4. (Optional) Seed initial grades/events:
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
```bash
|
||||
docker compose exec app npm run db:seed
|
||||
```
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
Open http://localhost:3000.
|
||||
|
||||
## Admin access
|
||||
|
||||
- Set `ADMIN_DISCORD_ID` in `.env` to the Discord user ID that should be admin.
|
||||
- First sign-in will automatically register the user and grant admin access.
|
||||
- Admin panel: `/admin`.
|
||||
|
||||
## Local development (no Docker)
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run prisma:migrate
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
app/ App Router pages, layouts, API routes
|
||||
components/ UI and dashboard components
|
||||
lib/ Auth, db, helpers
|
||||
prisma/ Prisma schema and seed
|
||||
docker/ Docker notes and future overrides
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The purchase flow is mocked and ready for Stripe integration.
|
||||
- Discord profile data is stored on sign-in (id, username, avatar).
|
||||
- Environment variables are required for OAuth and database access.
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import { getServerSession } from "next-auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import AdminDashboard from "@/components/admin/admin-dashboard";
|
||||
import Footer from "@/components/footer";
|
||||
import Navbar from "@/components/navbar";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
type AdminWithUser = {
|
||||
id: string;
|
||||
discordId: string;
|
||||
user: {
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
discordUsername?: string | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
type GradeRecord = {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description: string;
|
||||
};
|
||||
|
||||
type EventRecord = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
eventDate: Date;
|
||||
};
|
||||
|
||||
export default async function AdminPage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
const discordId = session?.user?.discordId;
|
||||
|
||||
if (!discordId) {
|
||||
redirect("/auth/signin");
|
||||
}
|
||||
|
||||
const envAdmin = process.env.ADMIN_DISCORD_ID;
|
||||
const adminRecord = envAdmin && envAdmin === discordId
|
||||
? null
|
||||
: await db.admin.findUnique({ where: { discordId } });
|
||||
|
||||
if (!adminRecord && (!envAdmin || envAdmin !== discordId)) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const [grades, events, admins] = await Promise.all([
|
||||
db.grade.findMany({ orderBy: { price: "asc" } }),
|
||||
db.event.findMany({ orderBy: { eventDate: "asc" } }),
|
||||
db.admin.findMany({
|
||||
orderBy: { createdAt: "desc" },
|
||||
include: { user: true },
|
||||
}),
|
||||
] as const);
|
||||
|
||||
const adminUsers = admins as AdminWithUser[];
|
||||
const gradeRecords = grades as GradeRecord[];
|
||||
const eventRecords = events as EventRecord[];
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<Navbar />
|
||||
<main className="mx-auto w-full max-w-6xl flex-1 px-6 py-16">
|
||||
<div className="mb-10">
|
||||
<p className="text-xs uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
Admin panel
|
||||
</p>
|
||||
<h1 className="mt-4 text-3xl font-semibold text-white md:text-4xl">
|
||||
Control center
|
||||
</h1>
|
||||
<p className="mt-3 text-sm text-slate-300">
|
||||
Manage admins, grades, and events for BinouzUHC.
|
||||
</p>
|
||||
</div>
|
||||
<AdminDashboard
|
||||
initialAdmins={adminUsers.map((admin) => ({
|
||||
id: admin.id,
|
||||
discordId: admin.discordId,
|
||||
user: admin.user
|
||||
? {
|
||||
name: admin.user.name,
|
||||
email: admin.user.email,
|
||||
discordUsername: admin.user.discordUsername,
|
||||
}
|
||||
: null,
|
||||
}))}
|
||||
initialGrades={gradeRecords}
|
||||
initialEvents={eventRecords.map((event) => ({
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
eventDate: event.eventDate.toISOString(),
|
||||
}))}
|
||||
/>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const { id } = await params;
|
||||
await db.admin.delete({ where: { id } });
|
||||
return Response.json({ ok: true });
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
type AdminWithUser = {
|
||||
id: string;
|
||||
discordId: string;
|
||||
user: {
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
discordUsername?: string | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export async function GET() {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const admins = await db.admin.findMany({
|
||||
orderBy: { createdAt: "desc" },
|
||||
include: { user: true },
|
||||
});
|
||||
|
||||
const adminUsers = admins as AdminWithUser[];
|
||||
|
||||
return Response.json(
|
||||
adminUsers.map((admin) => ({
|
||||
id: admin.id,
|
||||
discordId: admin.discordId,
|
||||
user: admin.user
|
||||
? {
|
||||
name: admin.user.name,
|
||||
email: admin.user.email,
|
||||
discordUsername: admin.user.discordUsername,
|
||||
}
|
||||
: null,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const body = await request.json();
|
||||
const discordId = body?.discordId?.toString().trim();
|
||||
|
||||
if (!discordId) {
|
||||
return Response.json({ error: "Discord ID required" }, { status: 400 });
|
||||
}
|
||||
|
||||
const user = await db.user.findUnique({ where: { discordId } });
|
||||
if (!user) {
|
||||
return Response.json({ error: "User not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const admin = await db.admin.upsert({
|
||||
where: { discordId },
|
||||
update: {},
|
||||
create: { discordId, userId: user.id },
|
||||
});
|
||||
|
||||
return Response.json({
|
||||
id: admin.id,
|
||||
discordId: admin.discordId,
|
||||
user: {
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
discordUsername: user.discordUsername,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const { id } = await params;
|
||||
|
||||
const body = await request.json();
|
||||
const title = body?.title?.toString().trim();
|
||||
const description = body?.description?.toString().trim();
|
||||
const eventDateValue = body?.eventDate?.toString();
|
||||
const eventDate = eventDateValue ? new Date(eventDateValue) : null;
|
||||
|
||||
if (!title || !description || !eventDate || Number.isNaN(eventDate.getTime())) {
|
||||
return Response.json({ error: "Invalid payload" }, { status: 400 });
|
||||
}
|
||||
|
||||
const event = await db.event.update({
|
||||
where: { id },
|
||||
data: { title, description, eventDate },
|
||||
});
|
||||
|
||||
return Response.json({
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
eventDate: event.eventDate.toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const { id } = await params;
|
||||
await db.event.delete({ where: { id } });
|
||||
return Response.json({ ok: true });
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET() {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const events = await db.event.findMany({ orderBy: { eventDate: "asc" } });
|
||||
return Response.json(events);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const body = await request.json();
|
||||
const title = body?.title?.toString().trim();
|
||||
const description = body?.description?.toString().trim();
|
||||
const eventDateValue = body?.eventDate?.toString();
|
||||
const eventDate = eventDateValue ? new Date(eventDateValue) : null;
|
||||
|
||||
if (!title || !description || !eventDate || Number.isNaN(eventDate.getTime())) {
|
||||
return Response.json({ error: "Invalid payload" }, { status: 400 });
|
||||
}
|
||||
|
||||
const event = await db.event.create({
|
||||
data: { title, description, eventDate },
|
||||
});
|
||||
|
||||
return Response.json({
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
eventDate: event.eventDate.toISOString(),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const { id } = await params;
|
||||
|
||||
const body = await request.json();
|
||||
const name = body?.name?.toString().trim();
|
||||
const price = Number(body?.price);
|
||||
const description = body?.description?.toString().trim();
|
||||
|
||||
if (!name || Number.isNaN(price) || !description) {
|
||||
return Response.json({ error: "Invalid payload" }, { status: 400 });
|
||||
}
|
||||
|
||||
const grade = await db.grade.update({
|
||||
where: { id },
|
||||
data: { name, price, description },
|
||||
});
|
||||
|
||||
return Response.json(grade);
|
||||
}
|
||||
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const { id } = await params;
|
||||
await db.grade.delete({ where: { id } });
|
||||
return Response.json({ ok: true });
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET() {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const grades = await db.grade.findMany({ orderBy: { price: "asc" } });
|
||||
return Response.json(grades);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const guard = await requireAdmin();
|
||||
if (!guard.ok) return guard.response;
|
||||
|
||||
const body = await request.json();
|
||||
const name = body?.name?.toString().trim();
|
||||
const price = Number(body?.price);
|
||||
const description = body?.description?.toString().trim();
|
||||
|
||||
if (!name || Number.isNaN(price) || !description) {
|
||||
return Response.json({ error: "Invalid payload" }, { status: 400 });
|
||||
}
|
||||
|
||||
const grade = await db.grade.create({
|
||||
data: { name, price, description },
|
||||
});
|
||||
|
||||
return Response.json(grade);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import NextAuth from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
@@ -0,0 +1,97 @@
|
||||
import Stripe from "stripe";
|
||||
import { db } from "@/lib/db";
|
||||
import { fallbackGrades } from "@/lib/site";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const stripeSecretKey = process.env.STRIPE_SECRET_KEY;
|
||||
const stripe = stripeSecretKey
|
||||
? new Stripe(stripeSecretKey, {
|
||||
apiVersion: "2023-10-16",
|
||||
})
|
||||
: null;
|
||||
|
||||
const minecraftNameRegex = /^[A-Za-z0-9_]{3,16}$/;
|
||||
|
||||
type GradeInfo = {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const getGradeById = async (gradeId: string): Promise<GradeInfo | null> => {
|
||||
try {
|
||||
const grade = await db.grade.findUnique({ where: { id: gradeId } });
|
||||
if (grade) {
|
||||
return {
|
||||
id: grade.id,
|
||||
name: grade.name,
|
||||
price: grade.price,
|
||||
description: grade.description,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// ignore db errors and fall back to static data
|
||||
}
|
||||
|
||||
return fallbackGrades.find((grade) => grade.id === gradeId) ?? null;
|
||||
};
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const body = await request.json().catch(() => ({}));
|
||||
const gradeId = body?.gradeId?.toString();
|
||||
const minecraftUsername = body?.minecraftUsername?.toString().trim();
|
||||
|
||||
if (!gradeId || !minecraftUsername) {
|
||||
return Response.json({ error: "Missing checkout details." }, { status: 400 });
|
||||
}
|
||||
|
||||
if (!minecraftNameRegex.test(minecraftUsername)) {
|
||||
return Response.json(
|
||||
{ error: "Invalid Minecraft username." },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const grade = await getGradeById(gradeId);
|
||||
if (!grade) {
|
||||
return Response.json({ error: "Grade not found." }, { status: 404 });
|
||||
}
|
||||
|
||||
if (!stripe) {
|
||||
return Response.json({ error: "Stripe not configured." }, { status: 500 });
|
||||
}
|
||||
|
||||
const baseUrl = process.env.NEXTAUTH_URL ?? "http://localhost:3000";
|
||||
const session = await stripe.checkout.sessions.create({
|
||||
mode: "payment",
|
||||
payment_method_types: ["card"],
|
||||
success_url: `${baseUrl}/?checkout=success`,
|
||||
cancel_url: `${baseUrl}/?checkout=cancel`,
|
||||
line_items: [
|
||||
{
|
||||
price_data: {
|
||||
currency: "eur",
|
||||
unit_amount: Math.round(grade.price * 100),
|
||||
product_data: {
|
||||
name: grade.name,
|
||||
description: grade.description,
|
||||
},
|
||||
},
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
metadata: {
|
||||
gradeId: grade.id,
|
||||
minecraftUsername,
|
||||
},
|
||||
client_reference_id: minecraftUsername,
|
||||
});
|
||||
|
||||
if (!session.url) {
|
||||
return Response.json({ error: "Stripe session failed." }, { status: 500 });
|
||||
}
|
||||
|
||||
return Response.json({ url: session.url });
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET() {
|
||||
const events = await db.event.findMany({ orderBy: { eventDate: "asc" } });
|
||||
return Response.json(events);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET() {
|
||||
const grades = await db.grade.findMany({ orderBy: { price: "asc" } });
|
||||
return Response.json(grades);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.id) {
|
||||
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
const gradeId = body?.gradeId as string | undefined;
|
||||
if (!gradeId) {
|
||||
return Response.json({ error: "Grade id required" }, { status: 400 });
|
||||
}
|
||||
|
||||
const grade = await db.grade.findUnique({ where: { id: gradeId } });
|
||||
if (!grade) {
|
||||
return Response.json({ error: "Grade not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const purchase = await db.purchase.create({
|
||||
data: {
|
||||
userId: session.user.id,
|
||||
gradeId: grade.id,
|
||||
amount: grade.price,
|
||||
status: "PENDING",
|
||||
},
|
||||
});
|
||||
|
||||
return Response.json({
|
||||
id: purchase.id,
|
||||
status: purchase.status,
|
||||
message: "Mock purchase queued",
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import AuthButton from "@/components/auth-button";
|
||||
import Footer from "@/components/footer";
|
||||
import Navbar from "@/components/navbar";
|
||||
|
||||
export default function SignInPage() {
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<Navbar />
|
||||
<main className="flex flex-1 items-center justify-center px-6 py-16">
|
||||
<div className="w-full max-w-lg rounded-3xl border border-white/10 bg-white/5 p-10 text-center backdrop-blur">
|
||||
<p className="text-xs uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
Auth required
|
||||
</p>
|
||||
<h1 className="mt-4 text-3xl font-semibold text-white">
|
||||
Connect your Discord account
|
||||
</h1>
|
||||
<p className="mt-3 text-sm text-slate-300">
|
||||
Unlock your profile, purchases, and admin access if your Discord ID
|
||||
is whitelisted.
|
||||
</p>
|
||||
<div className="mt-6 flex justify-center">
|
||||
<AuthButton label="Se connecter avec Discord" />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+71
-14
@@ -1,26 +1,83 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
--bg-950: #05070d;
|
||||
--bg-900: #0b1020;
|
||||
--bg-800: #10172c;
|
||||
--text-100: #e5e7eb;
|
||||
--text-200: #cbd5f5;
|
||||
--accent-500: #7c3aed;
|
||||
--accent-400: #60a5fa;
|
||||
--accent-300: #22d3ee;
|
||||
--glass: rgba(15, 23, 42, 0.6);
|
||||
--glass-border: rgba(148, 163, 184, 0.2);
|
||||
--shadow-strong: 0 30px 80px rgba(2, 6, 23, 0.6);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-background: var(--bg-950);
|
||||
--color-foreground: var(--text-100);
|
||||
--font-sans: var(--font-display);
|
||||
--font-mono: var(--font-code);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background:
|
||||
radial-gradient(1200px 700px at 20% 10%, rgba(124, 58, 237, 0.25),
|
||||
transparent 60%),
|
||||
radial-gradient(900px 600px at 80% 15%, rgba(96, 165, 250, 0.25),
|
||||
transparent 55%),
|
||||
var(--bg-950);
|
||||
color: var(--text-100);
|
||||
font-family: var(--font-display), "Space Grotesk", sans-serif;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: rgba(124, 58, 237, 0.55);
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0% {
|
||||
transform: translateY(0px);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes glow {
|
||||
0% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-11
@@ -1,33 +1,59 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import { JetBrains_Mono, Space_Grotesk } from "next/font/google";
|
||||
import { getServerSession } from "next-auth";
|
||||
import "./globals.css";
|
||||
import SessionProvider from "@/components/session-provider";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
const displayFont = Space_Grotesk({
|
||||
variable: "--font-display",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
const monoFont = JetBrains_Mono({
|
||||
variable: "--font-code",
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "600"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
title: {
|
||||
default: "BinouzUHC - UHC PvP",
|
||||
template: "%s | BinouzUHC",
|
||||
},
|
||||
description:
|
||||
"Serveur UHC competitif et immersif. PvP nerveux, events reguliers et communaute engagee.",
|
||||
keywords: ["Minecraft", "UHC", "PvP", "BinouzUHC", "1.8.X"],
|
||||
openGraph: {
|
||||
title: "BinouzUHC - UHC PvP",
|
||||
description:
|
||||
"Rejoignez BinouzUHC pour une experience UHC premium, events reguliers et rewards exclusifs.",
|
||||
type: "website",
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title: "BinouzUHC - UHC PvP",
|
||||
description:
|
||||
"Serveur UHC competitif et immersif. PvP nerveux, events reguliers et communaute engagee.",
|
||||
},
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
lang="fr"
|
||||
className={`${displayFont.variable} ${monoFont.variable} h-full scroll-smooth`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<body className="min-h-full bg-slate-950 text-slate-100 antialiased">
|
||||
<SessionProvider session={session}>{children}</SessionProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
+154
-58
@@ -1,65 +1,161 @@
|
||||
import Image from "next/image";
|
||||
import EventCard from "@/components/event-card";
|
||||
import Footer from "@/components/footer";
|
||||
import GradeCard from "@/components/grade-card";
|
||||
import Hero from "@/components/hero";
|
||||
import Navbar from "@/components/navbar";
|
||||
import SectionHeader from "@/components/section-header";
|
||||
import { db } from "@/lib/db";
|
||||
import { fallbackEvents, fallbackGrades, siteConfig } from "@/lib/site";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
type Grade = {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description: string;
|
||||
};
|
||||
|
||||
type Event = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
eventDate: Date;
|
||||
};
|
||||
|
||||
const getGrades = async (): Promise<Grade[]> => {
|
||||
try {
|
||||
const grades = await db.grade.findMany({ orderBy: { price: "asc" } });
|
||||
return grades.length > 0 ? grades : fallbackGrades;
|
||||
} catch {
|
||||
return fallbackGrades;
|
||||
}
|
||||
};
|
||||
|
||||
const getEvents = async (): Promise<Event[]> => {
|
||||
try {
|
||||
const events = await db.event.findMany({ orderBy: { eventDate: "asc" } });
|
||||
return events.length > 0 ? events : fallbackEvents;
|
||||
} catch {
|
||||
return fallbackEvents;
|
||||
}
|
||||
};
|
||||
|
||||
export default async function Home() {
|
||||
const [grades, events] = await Promise.all([getGrades(), getEvents()]);
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
<div className="flex min-h-screen flex-col">
|
||||
<Navbar />
|
||||
<main className="flex-1">
|
||||
<Hero />
|
||||
|
||||
<section id="presentation" className="py-20">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<SectionHeader
|
||||
eyebrow="Presentation"
|
||||
title="UHC designed for competitive squads"
|
||||
description="Balance, clarity, and tension. BinouzUHC delivers a premium UHC loop with PvP-first tuning."
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
<div className="grid gap-6 md:grid-cols-3">
|
||||
{[
|
||||
{
|
||||
title: "Precision combat",
|
||||
description:
|
||||
"Hits register fast, clean hitboxes, and optimized knockback for UHC duels.",
|
||||
},
|
||||
{
|
||||
title: "Event experience",
|
||||
description:
|
||||
"Weekly tournaments, bracket nights, and events built for squads.",
|
||||
},
|
||||
{
|
||||
title: "Community core",
|
||||
description:
|
||||
"Active moderation, high signal Discord, and competitive rankings.",
|
||||
},
|
||||
].map((item) => (
|
||||
<div
|
||||
key={item.title}
|
||||
className="rounded-3xl border border-white/10 bg-white/5 p-6 text-sm text-slate-300 backdrop-blur"
|
||||
>
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-cyan-200/80">
|
||||
{item.title}
|
||||
</p>
|
||||
<p className="mt-4 text-base text-white">{item.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="grades" className="py-20">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<SectionHeader
|
||||
eyebrow="Boutique"
|
||||
title="Grades premium"
|
||||
description="Unlock cosmetics, priority access, and competitive advantages."
|
||||
/>
|
||||
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{grades.map((grade) => (
|
||||
<GradeCard key={grade.id} grade={grade} />
|
||||
))}
|
||||
</div>
|
||||
<p className="mt-6 text-xs uppercase tracking-[0.3em] text-slate-500">
|
||||
{siteConfig.shopDisclaimer}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="events" className="py-20">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<SectionHeader
|
||||
eyebrow="Events"
|
||||
title="Upcoming challenges"
|
||||
description="Competitive formats tailored for UHC players and squad leaders."
|
||||
/>
|
||||
<div className="grid gap-6 md:grid-cols-2">
|
||||
{events.map((event) => (
|
||||
<EventCard key={event.id} event={event} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="discord" className="py-20">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<div className="rounded-3xl border border-white/10 bg-linear-to-r from-violet-600/20 via-indigo-500/20 to-cyan-400/20 p-10 text-center backdrop-blur">
|
||||
<p className="text-xs uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
Discord
|
||||
</p>
|
||||
<h2 className="mt-4 text-3xl font-semibold text-white">
|
||||
Join the BinouzUHC squad
|
||||
</h2>
|
||||
<p className="mt-3 text-sm text-slate-300">
|
||||
News, tournaments, and admin contact. Stay synced with the
|
||||
community.
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap justify-center gap-4">
|
||||
<a
|
||||
href={siteConfig.discordInviteUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex items-center justify-center rounded-full border border-white/15 bg-white/10 px-6 py-3 text-xs font-semibold uppercase tracking-[0.3em] text-white transition hover:bg-white/20"
|
||||
>
|
||||
Connect Discord
|
||||
</a>
|
||||
<a
|
||||
href="#presentation"
|
||||
className="inline-flex items-center justify-center rounded-full border border-white/15 px-6 py-3 text-xs font-semibold uppercase tracking-[0.3em] text-white/80 transition hover:text-white"
|
||||
>
|
||||
Learn more
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,535 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useTransition } from "react";
|
||||
|
||||
type AdminUser = {
|
||||
id: string;
|
||||
discordId: string;
|
||||
user?: {
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
discordUsername?: string | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
type Grade = {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description: string;
|
||||
};
|
||||
|
||||
type Event = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
eventDate: string;
|
||||
};
|
||||
|
||||
type AdminDashboardProps = {
|
||||
initialAdmins: AdminUser[];
|
||||
initialGrades: Grade[];
|
||||
initialEvents: Event[];
|
||||
};
|
||||
|
||||
const requestJson = async <T,>(
|
||||
url: string,
|
||||
options: RequestInit
|
||||
): Promise<T> => {
|
||||
const res = await fetch(url, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
...options,
|
||||
});
|
||||
const data = (await res.json().catch(() => ({}))) as T & {
|
||||
error?: string;
|
||||
};
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(data.error ?? "Request failed");
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
const toInputDate = (iso: string) => {
|
||||
return new Date(iso).toISOString().slice(0, 16);
|
||||
};
|
||||
|
||||
export default function AdminDashboard({
|
||||
initialAdmins,
|
||||
initialGrades,
|
||||
initialEvents,
|
||||
}: AdminDashboardProps) {
|
||||
const [admins, setAdmins] = useState<AdminUser[]>(initialAdmins);
|
||||
const [grades, setGrades] = useState<Grade[]>(initialGrades);
|
||||
const [events, setEvents] = useState<Event[]>(initialEvents);
|
||||
const [notice, setNotice] = useState<string | null>(null);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleAddAdmin = (form: FormData) => {
|
||||
const discordId = form.get("discordId")?.toString().trim();
|
||||
if (!discordId) return;
|
||||
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const admin = await requestJson<AdminUser>("/api/admin/admins", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ discordId }),
|
||||
});
|
||||
setAdmins((prev) => [admin, ...prev]);
|
||||
setNotice("Admin added");
|
||||
} catch (error) {
|
||||
setNotice((error as Error).message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleAddGrade = (form: FormData) => {
|
||||
const name = form.get("name")?.toString().trim();
|
||||
const price = Number(form.get("price"));
|
||||
const description = form.get("description")?.toString().trim();
|
||||
|
||||
if (!name || Number.isNaN(price) || !description) return;
|
||||
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const grade = await requestJson<Grade>("/api/admin/grades", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ name, price, description }),
|
||||
});
|
||||
setGrades((prev) => [...prev, grade]);
|
||||
setNotice("Grade added");
|
||||
} catch (error) {
|
||||
setNotice((error as Error).message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleAddEvent = (form: FormData) => {
|
||||
const title = form.get("title")?.toString().trim();
|
||||
const description = form.get("description")?.toString().trim();
|
||||
const eventDate = form.get("eventDate")?.toString();
|
||||
|
||||
if (!title || !description || !eventDate) return;
|
||||
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const event = await requestJson<Event>("/api/admin/events", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
title,
|
||||
description,
|
||||
eventDate: new Date(eventDate).toISOString(),
|
||||
}),
|
||||
});
|
||||
setEvents((prev) => [...prev, event]);
|
||||
setNotice("Event added");
|
||||
} catch (error) {
|
||||
setNotice((error as Error).message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-10">
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h2 className="text-lg font-semibold text-white">Admin access</h2>
|
||||
<p className="mt-2 text-sm text-slate-300">
|
||||
Manage admins, grades, and events. Changes are applied live.
|
||||
</p>
|
||||
{notice ? (
|
||||
<div className="mt-4 rounded-2xl border border-white/10 bg-white/10 px-4 py-3 text-xs text-cyan-200">
|
||||
{notice}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<section className="grid gap-6 lg:grid-cols-[1.1fr_0.9fr]">
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h3 className="text-base font-semibold text-white">Admins</h3>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
handleAddAdmin(new FormData(event.currentTarget));
|
||||
event.currentTarget.reset();
|
||||
}}
|
||||
className="mt-4 flex flex-col gap-3 md:flex-row"
|
||||
>
|
||||
<input
|
||||
name="discordId"
|
||||
placeholder="Discord ID"
|
||||
className="flex-1 rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="rounded-2xl border border-white/10 bg-white/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-white"
|
||||
disabled={isPending}
|
||||
>
|
||||
Add admin
|
||||
</button>
|
||||
</form>
|
||||
<div className="mt-4 space-y-3">
|
||||
{admins.map((admin) => (
|
||||
<AdminRow
|
||||
key={admin.id}
|
||||
admin={admin}
|
||||
onDelete={(id) =>
|
||||
setAdmins((prev) => prev.filter((item) => item.id !== id))
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h3 className="text-base font-semibold text-white">Create grade</h3>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
handleAddGrade(new FormData(event.currentTarget));
|
||||
event.currentTarget.reset();
|
||||
}}
|
||||
className="mt-4 space-y-3"
|
||||
>
|
||||
<input
|
||||
name="name"
|
||||
placeholder="Name"
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<input
|
||||
name="price"
|
||||
type="number"
|
||||
placeholder="Price"
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<textarea
|
||||
name="description"
|
||||
placeholder="Description"
|
||||
className="min-h-30 w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full rounded-2xl border border-white/10 bg-white/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-white"
|
||||
disabled={isPending}
|
||||
>
|
||||
Add grade
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h3 className="text-base font-semibold text-white">Grades</h3>
|
||||
<div className="mt-4 space-y-4">
|
||||
{grades.map((grade) => (
|
||||
<GradeRow
|
||||
key={grade.id}
|
||||
grade={grade}
|
||||
onUpdate={(updated) =>
|
||||
setGrades((prev) =>
|
||||
prev.map((item) =>
|
||||
item.id === updated.id ? updated : item
|
||||
)
|
||||
)
|
||||
}
|
||||
onDelete={(id) =>
|
||||
setGrades((prev) => prev.filter((item) => item.id !== id))
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="grid gap-6 lg:grid-cols-[1fr_1.1fr]">
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h3 className="text-base font-semibold text-white">Create event</h3>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
handleAddEvent(new FormData(event.currentTarget));
|
||||
event.currentTarget.reset();
|
||||
}}
|
||||
className="mt-4 space-y-3"
|
||||
>
|
||||
<input
|
||||
name="title"
|
||||
placeholder="Title"
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<input
|
||||
name="eventDate"
|
||||
type="datetime-local"
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<textarea
|
||||
name="description"
|
||||
placeholder="Description"
|
||||
className="min-h-30 w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full rounded-2xl border border-white/10 bg-white/10 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-white"
|
||||
disabled={isPending}
|
||||
>
|
||||
Add event
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<h3 className="text-base font-semibold text-white">Events</h3>
|
||||
<div className="mt-4 space-y-4">
|
||||
{events.map((event) => (
|
||||
<EventRow
|
||||
key={event.id}
|
||||
event={event}
|
||||
onUpdate={(updated) =>
|
||||
setEvents((prev) =>
|
||||
prev.map((item) =>
|
||||
item.id === updated.id ? updated : item
|
||||
)
|
||||
)
|
||||
}
|
||||
onDelete={(id) =>
|
||||
setEvents((prev) => prev.filter((item) => item.id !== id))
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AdminRow({
|
||||
admin,
|
||||
onDelete,
|
||||
}: {
|
||||
admin: AdminUser;
|
||||
onDelete: (id: string) => void;
|
||||
}) {
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleDelete = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
await requestJson<{ ok: boolean }>(`/api/admin/admins/${admin.id}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
onDelete(admin.id);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3 rounded-2xl border border-white/10 bg-slate-950/40 p-4 md:flex-row md:items-center md:justify-between">
|
||||
<div>
|
||||
<p className="text-sm font-semibold text-white">
|
||||
{admin.user?.discordUsername ?? admin.user?.name ?? "Unknown"}
|
||||
</p>
|
||||
<p className="text-xs text-slate-400">{admin.discordId}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleDelete}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.3em] text-white/80"
|
||||
disabled={isPending}
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GradeRow({
|
||||
grade,
|
||||
onUpdate,
|
||||
onDelete,
|
||||
}: {
|
||||
grade: Grade;
|
||||
onUpdate: (grade: Grade) => void;
|
||||
onDelete: (id: string) => void;
|
||||
}) {
|
||||
const [draft, setDraft] = useState(grade);
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleSave = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const updated = await requestJson<Grade>(
|
||||
`/api/admin/grades/${grade.id}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({
|
||||
name: draft.name,
|
||||
price: draft.price,
|
||||
description: draft.description,
|
||||
}),
|
||||
}
|
||||
);
|
||||
onUpdate(updated);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
await requestJson<{ ok: boolean }>(`/api/admin/grades/${grade.id}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
onDelete(grade.id);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-white/10 bg-slate-950/40 p-4">
|
||||
<div className="grid gap-3 md:grid-cols-[1fr_160px]">
|
||||
<input
|
||||
value={draft.name}
|
||||
onChange={(event) =>
|
||||
setDraft((prev) => ({ ...prev, name: event.target.value }))
|
||||
}
|
||||
className="rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
value={draft.price}
|
||||
onChange={(event) =>
|
||||
setDraft((prev) => ({
|
||||
...prev,
|
||||
price: Number(event.target.value),
|
||||
}))
|
||||
}
|
||||
className="rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
</div>
|
||||
<textarea
|
||||
value={draft.description}
|
||||
onChange={(event) =>
|
||||
setDraft((prev) => ({ ...prev, description: event.target.value }))
|
||||
}
|
||||
className="mt-3 min-h-25 w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<div className="mt-3 flex flex-wrap gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleSave}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.3em] text-white/80"
|
||||
disabled={isPending}
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleDelete}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.3em] text-white/80"
|
||||
disabled={isPending}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EventRow({
|
||||
event,
|
||||
onUpdate,
|
||||
onDelete,
|
||||
}: {
|
||||
event: Event;
|
||||
onUpdate: (event: Event) => void;
|
||||
onDelete: (id: string) => void;
|
||||
}) {
|
||||
const [draft, setDraft] = useState({
|
||||
...event,
|
||||
eventDate: toInputDate(event.eventDate),
|
||||
});
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleSave = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
const updated = await requestJson<Event>(
|
||||
`/api/admin/events/${event.id}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({
|
||||
title: draft.title,
|
||||
description: draft.description,
|
||||
eventDate: new Date(draft.eventDate).toISOString(),
|
||||
}),
|
||||
}
|
||||
);
|
||||
onUpdate(updated);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
startTransition(async () => {
|
||||
try {
|
||||
await requestJson<{ ok: boolean }>(`/api/admin/events/${event.id}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
onDelete(event.id);
|
||||
} catch {
|
||||
// no-op
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-white/10 bg-slate-950/40 p-4">
|
||||
<input
|
||||
value={draft.title}
|
||||
onChange={(eventValue) =>
|
||||
setDraft((prev) => ({ ...prev, title: eventValue.target.value }))
|
||||
}
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<input
|
||||
type="datetime-local"
|
||||
value={draft.eventDate}
|
||||
onChange={(eventValue) =>
|
||||
setDraft((prev) => ({ ...prev, eventDate: eventValue.target.value }))
|
||||
}
|
||||
className="mt-3 w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<textarea
|
||||
value={draft.description}
|
||||
onChange={(eventValue) =>
|
||||
setDraft((prev) => ({ ...prev, description: eventValue.target.value }))
|
||||
}
|
||||
className="mt-3 min-h-25 w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-2 text-sm text-white"
|
||||
/>
|
||||
<div className="mt-3 flex flex-wrap gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleSave}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.3em] text-white/80"
|
||||
disabled={isPending}
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleDelete}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.3em] text-white/80"
|
||||
disabled={isPending}
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { signIn, signOut, useSession } from "next-auth/react";
|
||||
|
||||
type AuthButtonProps = {
|
||||
className?: string;
|
||||
label?: string;
|
||||
compact?: boolean;
|
||||
};
|
||||
|
||||
export default function AuthButton({
|
||||
className = "",
|
||||
label = "Se connecter avec Discord",
|
||||
compact = false,
|
||||
}: AuthButtonProps) {
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
if (status === "loading") {
|
||||
return (
|
||||
<div
|
||||
className={`inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-4 py-2 text-xs text-slate-200 ${className}`}
|
||||
>
|
||||
<span className="h-2 w-2 animate-pulse rounded-full bg-cyan-300" />
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!session?.user) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => signIn("discord", { callbackUrl: "/" })}
|
||||
className={`inline-flex items-center justify-center gap-2 rounded-full border border-white/15 bg-white/5 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-white transition hover:bg-white/10 ${className}`}
|
||||
>
|
||||
<span className="h-2 w-2 rounded-full bg-cyan-300" />
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
const avatarUrl = session.user.discordAvatar && session.user.discordId
|
||||
? `https://cdn.discordapp.com/avatars/${session.user.discordId}/${session.user.discordAvatar}.png`
|
||||
: session.user.image ?? "";
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center gap-2 ${compact ? "" : "rounded-full border border-white/10 bg-white/5 px-3 py-2"} ${className}`}
|
||||
>
|
||||
{avatarUrl ? (
|
||||
<img
|
||||
src={avatarUrl}
|
||||
alt={session.user.discordUsername ?? "Discord avatar"}
|
||||
className="h-8 w-8 rounded-full border border-white/20 object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="h-8 w-8 rounded-full border border-white/20 bg-white/10" />
|
||||
)}
|
||||
<div className="hidden sm:flex sm:flex-col">
|
||||
<span className="text-xs font-semibold text-white">
|
||||
{session.user.discordUsername ?? session.user.name ?? "Player"}
|
||||
</span>
|
||||
<span className="text-[10px] uppercase tracking-[0.2em] text-slate-400">
|
||||
{session.user.isAdmin ? "Admin" : "Connected"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{session.user.isAdmin ? (
|
||||
<Link
|
||||
href="/admin"
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.25em] text-cyan-200/90 transition hover:border-cyan-300/40"
|
||||
>
|
||||
Admin
|
||||
</Link>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => signOut({ callbackUrl: "/" })}
|
||||
className="rounded-full border border-white/10 px-3 py-1 text-[10px] uppercase tracking-[0.25em] text-white/80 transition hover:border-white/30"
|
||||
>
|
||||
Sign out
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
type CopyButtonProps = {
|
||||
value: string;
|
||||
label?: string;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export default function CopyButton({
|
||||
value,
|
||||
label = "Copy IP",
|
||||
className = "",
|
||||
}: CopyButtonProps) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const handleCopy = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(value);
|
||||
setCopied(true);
|
||||
window.setTimeout(() => setCopied(false), 2000);
|
||||
} catch {
|
||||
setCopied(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
className={`group inline-flex items-center justify-center gap-2 rounded-full border border-white/15 bg-white/5 px-4 py-2 text-sm font-semibold text-white backdrop-blur transition hover:border-white/30 hover:bg-white/10 ${className}`}
|
||||
aria-label="Copy server IP"
|
||||
>
|
||||
<span className="font-mono text-xs tracking-[0.3em] text-white/70">
|
||||
{value}
|
||||
</span>
|
||||
<span className="text-xs text-cyan-200/90">
|
||||
{copied ? "Copied" : label}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { formatEventDate } from "@/lib/format";
|
||||
|
||||
type EventCardProps = {
|
||||
event: {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
eventDate: Date;
|
||||
};
|
||||
};
|
||||
|
||||
export default function EventCard({ event }: EventCardProps) {
|
||||
return (
|
||||
<div className="rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-cyan-200/80">
|
||||
{formatEventDate(event.eventDate)}
|
||||
</p>
|
||||
<h3 className="mt-3 text-xl font-semibold text-white">{event.title}</h3>
|
||||
<p className="mt-3 text-sm text-slate-300">{event.description}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { siteConfig } from "@/lib/site";
|
||||
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className="border-t border-white/5 bg-slate-950/90">
|
||||
<div className="mx-auto flex w-full max-w-6xl flex-col gap-6 px-6 py-10 text-sm text-slate-400 md:flex-row md:items-center md:justify-between">
|
||||
<div className="space-y-2">
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-slate-500">
|
||||
BinouzUHC
|
||||
</p>
|
||||
<p className="text-sm text-slate-300">
|
||||
{siteConfig.serverAddress} - Minecraft {siteConfig.version}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-4 text-xs uppercase tracking-[0.2em]">
|
||||
<a href="#presentation" className="transition hover:text-white">
|
||||
Presentation
|
||||
</a>
|
||||
<a href="#grades" className="transition hover:text-white">
|
||||
Grades
|
||||
</a>
|
||||
<a href="#events" className="transition hover:text-white">
|
||||
Events
|
||||
</a>
|
||||
<a href="#discord" className="transition hover:text-white">
|
||||
Discord
|
||||
</a>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500">
|
||||
(c) 2026 BinouzUHC. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import PurchaseButton from "@/components/purchase-button";
|
||||
import { formatPrice } from "@/lib/format";
|
||||
|
||||
type GradeCardProps = {
|
||||
grade: {
|
||||
id: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description: string;
|
||||
};
|
||||
};
|
||||
|
||||
export default function GradeCard({ grade }: GradeCardProps) {
|
||||
return (
|
||||
<div className="flex h-full flex-col justify-between rounded-3xl border border-white/10 bg-white/5 p-6 backdrop-blur">
|
||||
<div>
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-cyan-200/80">
|
||||
{grade.name}
|
||||
</p>
|
||||
<p className="mt-4 text-3xl font-semibold text-white">
|
||||
{formatPrice(grade.price)}
|
||||
</p>
|
||||
<p className="mt-3 text-sm text-slate-300">{grade.description}</p>
|
||||
</div>
|
||||
<div className="mt-6 flex items-center justify-between">
|
||||
<span className="text-[10px] uppercase tracking-[0.3em] text-slate-400">
|
||||
Instant access
|
||||
</span>
|
||||
<PurchaseButton gradeId={grade.id} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import CopyButton from "@/components/copy-button";
|
||||
import { siteConfig } from "@/lib/site";
|
||||
|
||||
const quickStats = [
|
||||
{
|
||||
title: "Competitive UHC",
|
||||
detail: "UHC 1.8.X, PvP focus",
|
||||
},
|
||||
{
|
||||
title: "Events weekly",
|
||||
detail: "Tournaments and rush",
|
||||
},
|
||||
{
|
||||
title: "Premium rewards",
|
||||
detail: "Grades, cosmetics, perks",
|
||||
},
|
||||
];
|
||||
|
||||
export default function Hero() {
|
||||
return (
|
||||
<section className="relative overflow-hidden pb-20 pt-16 md:pb-28">
|
||||
<div className="absolute inset-0 bg-[url('/hero.svg')] bg-cover bg-center opacity-80" />
|
||||
<div className="absolute inset-0 bg-linear-to-b from-slate-950/30 via-slate-950/70 to-slate-950" />
|
||||
<div className="absolute left-1/2 top-16 h-64 w-130 -translate-x-1/2 rounded-full bg-violet-600/20 blur-[120px]" />
|
||||
<div className="relative mx-auto flex w-full max-w-6xl flex-col gap-10 px-6 md:flex-row md:items-center">
|
||||
<div className="max-w-xl space-y-6">
|
||||
<div className="inline-flex items-center gap-2 rounded-full border border-white/15 bg-white/5 px-4 py-2 text-[10px] uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
BinouzUHC - Minecraft 1.8.X
|
||||
</div>
|
||||
<h1 className="text-4xl font-semibold text-white md:text-6xl">
|
||||
Immerse yourself in elite UHC PvP.
|
||||
</h1>
|
||||
<p className="text-base text-slate-300">
|
||||
{siteConfig.description}
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<CopyButton value={siteConfig.serverAddress} label="Copy" />
|
||||
<a
|
||||
href="#grades"
|
||||
className="inline-flex items-center justify-center rounded-full border border-white/15 bg-white/10 px-5 py-2 text-xs font-semibold uppercase tracking-[0.3em] text-white transition hover:bg-white/20"
|
||||
>
|
||||
Voir les grades
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-6 text-xs uppercase tracking-[0.3em] text-slate-400">
|
||||
<span>{siteConfig.serverAddress}</span>
|
||||
<span>1.8.X</span>
|
||||
<span>Discord ready</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid w-full gap-4 md:max-w-md">
|
||||
{quickStats.map((item) => (
|
||||
<div
|
||||
key={item.title}
|
||||
className="rounded-2xl border border-white/10 bg-white/5 p-6 text-sm text-slate-200 backdrop-blur"
|
||||
>
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-cyan-200/80">
|
||||
{item.title}
|
||||
</p>
|
||||
<p className="mt-3 text-base text-white">{item.detail}</p>
|
||||
</div>
|
||||
))}
|
||||
<div className="rounded-2xl border border-white/10 bg-linear-to-br from-violet-600/30 via-indigo-500/20 to-cyan-400/20 p-6 text-sm text-slate-200 backdrop-blur">
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-cyan-200/80">
|
||||
Drop in
|
||||
</p>
|
||||
<p className="mt-3 text-base text-white">
|
||||
Ranked, balanced, and tuned for competitive squads.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import Link from "next/link";
|
||||
import AuthButton from "@/components/auth-button";
|
||||
|
||||
const navLinks = [
|
||||
{ label: "Presentation", href: "#presentation" },
|
||||
{ label: "Grades", href: "#grades" },
|
||||
{ label: "Events", href: "#events" },
|
||||
{ label: "Discord", href: "#discord" },
|
||||
];
|
||||
|
||||
export default function Navbar() {
|
||||
return (
|
||||
<header className="sticky top-0 z-40 w-full border-b border-white/5 bg-slate-950/70 backdrop-blur">
|
||||
<div className="mx-auto flex w-full max-w-6xl items-center justify-between px-6 py-4">
|
||||
<Link href="/" className="flex items-center gap-3">
|
||||
<span className="flex h-9 w-9 items-center justify-center rounded-2xl bg-linear-to-br from-violet-600 via-indigo-500 to-cyan-400 text-sm font-bold text-slate-950 shadow-[0_12px_30px_rgba(59,130,246,0.4)]">
|
||||
BU
|
||||
</span>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-semibold uppercase tracking-[0.3em] text-white">
|
||||
BinouzUHC
|
||||
</span>
|
||||
<span className="text-xs text-slate-400">UHC PvP 1.8.X</span>
|
||||
</div>
|
||||
</Link>
|
||||
<nav className="hidden items-center gap-6 text-xs uppercase tracking-[0.25em] text-slate-300 md:flex">
|
||||
{navLinks.map((link) => (
|
||||
<a
|
||||
key={link.href}
|
||||
href={link.href}
|
||||
className="transition hover:text-white"
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
<div className="flex items-center gap-3">
|
||||
<a
|
||||
href="#grades"
|
||||
className="hidden rounded-full border border-white/10 px-4 py-2 text-[10px] uppercase tracking-[0.3em] text-slate-300 transition hover:border-white/30 hover:text-white lg:inline-flex"
|
||||
>
|
||||
Boutique
|
||||
</a>
|
||||
<AuthButton compact />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
type PurchaseButtonProps = {
|
||||
gradeId: string;
|
||||
};
|
||||
|
||||
type PurchaseState = "idle" | "loading" | "error";
|
||||
|
||||
const minecraftNameRegex = /^[A-Za-z0-9_]{3,16}$/;
|
||||
|
||||
export default function PurchaseButton({ gradeId }: PurchaseButtonProps) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [username, setUsername] = useState("");
|
||||
const [state, setState] = useState<PurchaseState>("idle");
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const openModal = () => {
|
||||
setIsOpen(true);
|
||||
setError(null);
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
setIsOpen(false);
|
||||
setState("idle");
|
||||
setError(null);
|
||||
};
|
||||
|
||||
const handleCheckout = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
const trimmed = username.trim();
|
||||
|
||||
if (!minecraftNameRegex.test(trimmed)) {
|
||||
setError("Enter a valid Minecraft username (3-16, letters, numbers, _).");
|
||||
return;
|
||||
}
|
||||
|
||||
setState("loading");
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const res = await fetch("/api/checkout", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ gradeId, minecraftUsername: trimmed }),
|
||||
});
|
||||
|
||||
const data = (await res.json().catch(() => ({}))) as {
|
||||
url?: string;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
if (!res.ok || !data.url) {
|
||||
setState("error");
|
||||
setError(data.error ?? "Checkout failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.href = data.url;
|
||||
} catch {
|
||||
setState("error");
|
||||
setError("Checkout failed.");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={openModal}
|
||||
className="inline-flex items-center justify-center gap-2 rounded-full bg-linear-to-r from-violet-600 via-indigo-500 to-cyan-400 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-slate-950 transition hover:brightness-110"
|
||||
aria-label="Open checkout"
|
||||
>
|
||||
<span>Acheter</span>
|
||||
</button>
|
||||
|
||||
{isOpen ? (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/80 px-6"
|
||||
onClick={closeModal}
|
||||
>
|
||||
<div
|
||||
className="w-full max-w-md rounded-3xl border border-white/10 bg-slate-950/90 p-6 text-white shadow-[0_30px_80px_rgba(2,6,23,0.6)]"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
<p className="text-xs uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
Checkout
|
||||
</p>
|
||||
<h3 className="mt-3 text-2xl font-semibold">
|
||||
Enter Minecraft username
|
||||
</h3>
|
||||
<p className="mt-2 text-sm text-slate-300">
|
||||
No account needed. We will send you to Stripe.
|
||||
</p>
|
||||
<form onSubmit={handleCheckout} className="mt-5 space-y-4">
|
||||
<input
|
||||
value={username}
|
||||
onChange={(event) => setUsername(event.target.value)}
|
||||
placeholder="Minecraft username"
|
||||
className="w-full rounded-2xl border border-white/10 bg-slate-950/60 px-4 py-3 text-sm text-white"
|
||||
/>
|
||||
{error ? (
|
||||
<p className="text-xs text-rose-300">{error}</p>
|
||||
) : null}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<button
|
||||
type="submit"
|
||||
className="flex-1 rounded-2xl bg-linear-to-r from-violet-600 via-indigo-500 to-cyan-400 px-4 py-3 text-xs font-semibold uppercase tracking-[0.2em] text-slate-950"
|
||||
disabled={state === "loading"}
|
||||
>
|
||||
{state === "loading" ? "Redirecting" : "Go to Stripe"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={closeModal}
|
||||
className="rounded-2xl border border-white/10 px-4 py-3 text-xs font-semibold uppercase tracking-[0.2em] text-white/80"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
type SectionHeaderProps = {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export default function SectionHeader({
|
||||
eyebrow,
|
||||
title,
|
||||
description,
|
||||
}: SectionHeaderProps) {
|
||||
return (
|
||||
<div className="mx-auto mb-10 max-w-2xl text-center">
|
||||
<p className="text-xs uppercase tracking-[0.4em] text-cyan-200/80">
|
||||
{eyebrow}
|
||||
</p>
|
||||
<h2 className="mt-4 text-3xl font-semibold text-white md:text-4xl">
|
||||
{title}
|
||||
</h2>
|
||||
{description ? (
|
||||
<p className="mt-3 text-sm text-slate-300">{description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
import type { Session } from "next-auth";
|
||||
|
||||
type SessionProviderProps = {
|
||||
children: React.ReactNode;
|
||||
session: Session | null;
|
||||
};
|
||||
|
||||
export default function AppSessionProvider({
|
||||
children,
|
||||
session,
|
||||
}: SessionProviderProps) {
|
||||
return <SessionProvider session={session}>{children}</SessionProvider>;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
healthcheck:
|
||||
test:
|
||||
["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
DATABASE_URL: ${DATABASE_URL}
|
||||
ports:
|
||||
- "${WEB_PORT}:3000"
|
||||
command: sh -c "npx prisma db push && npx prisma db seed && npm run start"
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
@@ -0,0 +1,4 @@
|
||||
Docker notes
|
||||
|
||||
- This folder is reserved for docker assets or overrides.
|
||||
- Default setup uses the root Dockerfile and docker-compose.yml.
|
||||
@@ -0,0 +1,40 @@
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
export type AdminGuardResult =
|
||||
| {
|
||||
ok: true;
|
||||
discordId: string;
|
||||
}
|
||||
| {
|
||||
ok: false;
|
||||
response: Response;
|
||||
};
|
||||
|
||||
export const requireAdmin = async (): Promise<AdminGuardResult> => {
|
||||
const session = await getServerSession(authOptions);
|
||||
const discordId = session?.user?.discordId;
|
||||
|
||||
if (!discordId) {
|
||||
return {
|
||||
ok: false,
|
||||
response: Response.json({ error: "Unauthorized" }, { status: 401 }),
|
||||
};
|
||||
}
|
||||
|
||||
const envAdmin = process.env.ADMIN_DISCORD_ID;
|
||||
if (envAdmin && envAdmin === discordId) {
|
||||
return { ok: true, discordId };
|
||||
}
|
||||
|
||||
const admin = await db.admin.findUnique({ where: { discordId } });
|
||||
if (!admin) {
|
||||
return {
|
||||
ok: false,
|
||||
response: Response.json({ error: "Forbidden" }, { status: 403 }),
|
||||
};
|
||||
}
|
||||
|
||||
return { ok: true, discordId };
|
||||
};
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
import type { NextAuthOptions } from "next-auth";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import { db } from "@/lib/db";
|
||||
|
||||
const adminDiscordId = process.env.ADMIN_DISCORD_ID;
|
||||
const discordRedirectUrl = process.env.DISCORD_REDIRECT_URL;
|
||||
|
||||
const resolveAdmin = async (discordId?: string) => {
|
||||
if (!discordId) return false;
|
||||
if (adminDiscordId && discordId === adminDiscordId) return true;
|
||||
const admin = await db.admin.findUnique({ where: { discordId } });
|
||||
return Boolean(admin);
|
||||
};
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
adapter: PrismaAdapter(db),
|
||||
session: {
|
||||
strategy: "jwt",
|
||||
},
|
||||
providers: [
|
||||
DiscordProvider({
|
||||
clientId: process.env.DISCORD_CLIENT_ID ?? "",
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET ?? "",
|
||||
authorization: {
|
||||
params: {
|
||||
scope: "identify email",
|
||||
...(discordRedirectUrl
|
||||
? { redirect_uri: discordRedirectUrl }
|
||||
: {}),
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
async jwt({ token, account, profile }) {
|
||||
if (account && profile) {
|
||||
const discordProfile = profile as {
|
||||
id?: string;
|
||||
username?: string;
|
||||
avatar?: string;
|
||||
};
|
||||
token.discordId = discordProfile.id;
|
||||
token.discordUsername = discordProfile.username;
|
||||
token.discordAvatar = discordProfile.avatar;
|
||||
}
|
||||
|
||||
token.isAdmin = await resolveAdmin(token.discordId as string | undefined);
|
||||
|
||||
return token;
|
||||
},
|
||||
async session({ session, token }) {
|
||||
if (session.user) {
|
||||
session.user.id = token.sub ?? "";
|
||||
session.user.discordId = (token.discordId as string | undefined) ?? "";
|
||||
session.user.discordUsername =
|
||||
(token.discordUsername as string | undefined) ?? "";
|
||||
session.user.discordAvatar =
|
||||
(token.discordAvatar as string | undefined) ?? "";
|
||||
session.user.isAdmin = token.isAdmin === true;
|
||||
}
|
||||
return session;
|
||||
},
|
||||
},
|
||||
events: {
|
||||
async signIn({ user, account, profile }) {
|
||||
if (!account || account.provider !== "discord" || !profile) return;
|
||||
|
||||
const discordId = (profile as { id?: string }).id;
|
||||
const discordUsername = (profile as { username?: string }).username;
|
||||
const discordAvatar = (profile as { avatar?: string }).avatar;
|
||||
|
||||
if (!discordId) return;
|
||||
|
||||
await db.user.update({
|
||||
where: { id: user.id },
|
||||
data: {
|
||||
discordId,
|
||||
discordUsername,
|
||||
discordAvatar,
|
||||
},
|
||||
});
|
||||
|
||||
if (adminDiscordId && discordId === adminDiscordId) {
|
||||
await db.admin.upsert({
|
||||
where: { discordId },
|
||||
update: {},
|
||||
create: {
|
||||
discordId,
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
signIn: "/auth/signin",
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
type PrismaGlobal = typeof globalThis & {
|
||||
prisma?: PrismaClient;
|
||||
};
|
||||
|
||||
const globalForPrisma = globalThis as PrismaGlobal;
|
||||
|
||||
export const db =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
log:
|
||||
process.env.NODE_ENV === "development" ? ["warn", "error"] : ["error"],
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalForPrisma.prisma = db;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
export const formatEventDate = (value: Date) => {
|
||||
return new Intl.DateTimeFormat("en-GB", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short",
|
||||
}).format(value);
|
||||
};
|
||||
|
||||
export const formatPrice = (value: number) => {
|
||||
return new Intl.NumberFormat("en-GB", {
|
||||
style: "currency",
|
||||
currency: "EUR",
|
||||
maximumFractionDigits: 0,
|
||||
}).format(value);
|
||||
};
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
export const siteConfig = {
|
||||
name: "BinouzUHC",
|
||||
description:
|
||||
"Serveur UHC competitif et immersif. PvP nerveux, events reguliers et communaute engagee.",
|
||||
serverAddress: "play.binouzuhc.eu",
|
||||
version: "1.8.X",
|
||||
discordInviteUrl: "https://discord.gg/binouz",
|
||||
shopDisclaimer:
|
||||
"Paiement Stripe a venir. Les achats sont simules pour l'instant.",
|
||||
} as const;
|
||||
|
||||
export const fallbackGrades = [
|
||||
{
|
||||
id: "starter",
|
||||
name: "Eclaireur",
|
||||
price: 9,
|
||||
description:
|
||||
"Acces prioritaire, prefix colore, particules discretes et slots reserves.",
|
||||
},
|
||||
{
|
||||
id: "elite",
|
||||
name: "Gladiateur",
|
||||
price: 19,
|
||||
description:
|
||||
"Kit cosmetique PvP, tags exclusifs, bonus d'events et loot personnalise.",
|
||||
},
|
||||
{
|
||||
id: "legend",
|
||||
name: "Titan",
|
||||
price: 39,
|
||||
description:
|
||||
"Rang ultime, aura lumineuse, salons prives et avantages boutique VIP.",
|
||||
},
|
||||
];
|
||||
|
||||
export const fallbackEvents = [
|
||||
{
|
||||
id: "uhc-arena",
|
||||
title: "UHC Arena - Duel Night",
|
||||
description:
|
||||
"Tournoi 1v1 avec bracket rapide. Score bonus pour les eliminations propres.",
|
||||
eventDate: new Date("2026-05-18T19:00:00Z"),
|
||||
},
|
||||
{
|
||||
id: "rush",
|
||||
title: "Rush 2v2 - Full PvP",
|
||||
description:
|
||||
"Arches, potions, clutchs. Inscription par equipe sur Discord.",
|
||||
eventDate: new Date("2026-05-25T19:00:00Z"),
|
||||
},
|
||||
{
|
||||
id: "uhc-royale",
|
||||
title: "UHC Royale",
|
||||
description:
|
||||
"Format 50 joueurs, shrink progressif, recompenses exclusives.",
|
||||
eventDate: new Date("2026-06-01T19:00:00Z"),
|
||||
},
|
||||
];
|
||||
Generated
+314
-21
@@ -8,9 +8,13 @@
|
||||
"name": "binouz",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@next-auth/prisma-adapter": "^1.0.7",
|
||||
"@prisma/client": "^5.22.0",
|
||||
"next": "16.2.4",
|
||||
"next-auth": "^4.24.7",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
"react-dom": "19.2.4",
|
||||
"stripe": "^14.25.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
@@ -19,6 +23,7 @@
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.2.4",
|
||||
"prisma": "^5.22.0",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
@@ -229,6 +234,15 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.29.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
|
||||
"integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",
|
||||
@@ -1049,6 +1063,16 @@
|
||||
"@tybys/wasm-util": "^0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@next-auth/prisma-adapter": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@next-auth/prisma-adapter/-/prisma-adapter-1.0.7.tgz",
|
||||
"integrity": "sha512-Cdko4KfcmKjsyHFrWwZ//lfLUbcLqlyFqjd/nYE2m3aZ7tjMNUjpks47iw7NTCnXf+5UWz5Ypyt1dSs1EP5QJw==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"@prisma/client": ">=2.26.0 || >=3",
|
||||
"next-auth": "^4"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "16.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-16.2.4.tgz",
|
||||
@@ -1241,6 +1265,84 @@
|
||||
"node": ">=12.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@panva/hkdf": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@panva/hkdf/-/hkdf-1.2.1.tgz",
|
||||
"integrity": "sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/panva"
|
||||
}
|
||||
},
|
||||
"node_modules/@prisma/client": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.22.0.tgz",
|
||||
"integrity": "sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=16.13"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"prisma": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"prisma": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@prisma/debug": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz",
|
||||
"integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@prisma/engines": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.22.0.tgz",
|
||||
"integrity": "sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==",
|
||||
"devOptional": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@prisma/debug": "5.22.0",
|
||||
"@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||
"@prisma/fetch-engine": "5.22.0",
|
||||
"@prisma/get-platform": "5.22.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@prisma/engines-version": {
|
||||
"version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz",
|
||||
"integrity": "sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@prisma/fetch-engine": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz",
|
||||
"integrity": "sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@prisma/debug": "5.22.0",
|
||||
"@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
|
||||
"@prisma/get-platform": "5.22.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@prisma/get-platform": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.22.0.tgz",
|
||||
"integrity": "sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@prisma/debug": "5.22.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rtsao/scc": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
|
||||
@@ -1564,7 +1666,6 @@
|
||||
"version": "20.19.39",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.39.tgz",
|
||||
"integrity": "sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.21.0"
|
||||
@@ -2544,7 +2645,6 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
@@ -2558,7 +2658,6 @@
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
@@ -2658,6 +2757,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@@ -2829,7 +2937,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
@@ -2941,7 +3048,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -2951,7 +3057,6 @@
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -2989,7 +3094,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
@@ -3260,6 +3364,7 @@
|
||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@rtsao/scc": "^1.1.0",
|
||||
"array-includes": "^3.1.9",
|
||||
@@ -3616,11 +3721,25 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
@@ -3681,7 +3800,6 @@
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
@@ -3706,7 +3824,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
@@ -3794,7 +3911,6 @@
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -3866,7 +3982,6 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -3895,7 +4010,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
|
||||
"integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
@@ -4430,6 +4544,15 @@
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/jose": {
|
||||
"version": "4.15.9",
|
||||
"resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz",
|
||||
"integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/panva"
|
||||
}
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
@@ -4878,7 +5001,6 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -5032,6 +5154,39 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next-auth": {
|
||||
"version": "4.24.14",
|
||||
"resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.24.14.tgz",
|
||||
"integrity": "sha512-YRz6xFDXKUwiXSMMChbrBEWyFktZ1qZXEgeSHQQ3nsy08B4c/xLk6REeutRsIFwkjY/1+ShHnu07DN3JeJguig==",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.13",
|
||||
"@panva/hkdf": "^1.0.2",
|
||||
"cookie": "^0.7.0",
|
||||
"jose": "^4.15.5",
|
||||
"oauth": "^0.9.15",
|
||||
"openid-client": "^5.4.0",
|
||||
"preact": "^10.6.3",
|
||||
"preact-render-to-string": "^5.1.19",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@auth/core": "0.34.3",
|
||||
"next": "^12.2.5 || ^13 || ^14 || ^15 || ^16",
|
||||
"nodemailer": "^7.0.7",
|
||||
"react": "^17.0.2 || ^18 || ^19",
|
||||
"react-dom": "^17.0.2 || ^18 || ^19"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@auth/core": {
|
||||
"optional": true
|
||||
},
|
||||
"nodemailer": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next/node_modules/postcss": {
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
@@ -5086,6 +5241,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/oauth": {
|
||||
"version": "0.9.15",
|
||||
"resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",
|
||||
"integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
@@ -5096,11 +5257,19 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/object-hash": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",
|
||||
"integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -5209,6 +5378,48 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/oidc-token-hash": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.2.0.tgz",
|
||||
"integrity": "sha512-6gj2m8cJZ+iSW8bm0FXdGF0YhIQbKrfP4yWTNzxc31U6MOjfEmB1rHvlYvxI1B7t7BCi1F2vYTT6YhtQRG4hxw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^10.13.0 || >=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/openid-client": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.7.1.tgz",
|
||||
"integrity": "sha512-jDBPgSVfTnkIh71Hg9pRvtJc6wTwqjRkN88+gCFtYWrlP4Yx2Dsrow8uPi3qLr/aeymPF3o2+dS+wOpglK04ew==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jose": "^4.15.9",
|
||||
"lru-cache": "^6.0.0",
|
||||
"object-hash": "^2.2.0",
|
||||
"oidc-token-hash": "^5.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/panva"
|
||||
}
|
||||
},
|
||||
"node_modules/openid-client/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/openid-client/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||
@@ -5375,6 +5586,29 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/preact": {
|
||||
"version": "10.29.1",
|
||||
"resolved": "https://registry.npmjs.org/preact/-/preact-10.29.1.tgz",
|
||||
"integrity": "sha512-gQCLc/vWroE8lIpleXtdJhTFDogTdZG9AjMUpVkDf2iTCNwYNWA+u16dL41TqUDJO4gm2IgrcMv3uTpjd4Pwmg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/preact"
|
||||
}
|
||||
},
|
||||
"node_modules/preact-render-to-string": {
|
||||
"version": "5.2.6",
|
||||
"resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-5.2.6.tgz",
|
||||
"integrity": "sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pretty-format": "^3.8.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"preact": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
@@ -5385,6 +5619,33 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-format": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",
|
||||
"integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/prisma": {
|
||||
"version": "5.22.0",
|
||||
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz",
|
||||
"integrity": "sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==",
|
||||
"devOptional": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@prisma/engines": "5.22.0"
|
||||
},
|
||||
"bin": {
|
||||
"prisma": "build/index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.13"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "2.3.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
@@ -5407,6 +5668,21 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.1.tgz",
|
||||
"integrity": "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
@@ -5786,7 +6062,6 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
@@ -5806,7 +6081,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
@@ -5823,7 +6097,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
@@ -5842,7 +6115,6 @@
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
@@ -6024,6 +6296,19 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/stripe": {
|
||||
"version": "14.25.0",
|
||||
"resolved": "https://registry.npmjs.org/stripe/-/stripe-14.25.0.tgz",
|
||||
"integrity": "sha512-wQS3GNMofCXwH8TSje8E1SE8zr6ODiGtHQgPtO95p9Mb4FhKC9jvXR2NUTpZ9ZINlckJcFidCmaTFV4P6vsb9g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": ">=8.1.0",
|
||||
"qs": "^6.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.*"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-jsx": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz",
|
||||
@@ -6354,7 +6639,6 @@
|
||||
"version": "6.21.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/unrs-resolver": {
|
||||
@@ -6433,6 +6717,15 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
+14
-1
@@ -6,10 +6,22 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
"lint": "eslint",
|
||||
"prisma:generate": "prisma generate",
|
||||
"prisma:migrate": "prisma migrate dev",
|
||||
"prisma:deploy": "prisma migrate deploy",
|
||||
"db:push": "prisma db push",
|
||||
"db:seed": "prisma db seed"
|
||||
},
|
||||
"prisma": {
|
||||
"seed": "node prisma/seed.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "16.2.4",
|
||||
"next-auth": "^4.24.7",
|
||||
"@next-auth/prisma-adapter": "^1.0.7",
|
||||
"@prisma/client": "^5.22.0",
|
||||
"stripe": "^14.25.0",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
},
|
||||
@@ -20,6 +32,7 @@
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.2.4",
|
||||
"prisma": "^5.22.0",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
discordId String? @unique
|
||||
discordUsername String?
|
||||
discordAvatar String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
purchases Purchase[]
|
||||
admin Admin?
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String? @db.Text
|
||||
access_token String? @db.Text
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? @db.Text
|
||||
session_state String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
|
||||
model Admin {
|
||||
id String @id @default(cuid())
|
||||
userId String @unique
|
||||
discordId String @unique
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Grade {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
price Int
|
||||
description String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
purchases Purchase[]
|
||||
}
|
||||
|
||||
model Event {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
description String
|
||||
eventDate DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
enum PurchaseStatus {
|
||||
PENDING
|
||||
PAID
|
||||
FAILED
|
||||
REFUNDED
|
||||
}
|
||||
|
||||
model Purchase {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
gradeId String
|
||||
amount Int
|
||||
status PurchaseStatus @default(PENDING)
|
||||
stripeSessionId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
grade Grade @relation(fields: [gradeId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const db = new PrismaClient();
|
||||
|
||||
const grades = [
|
||||
{
|
||||
name: "Eclaireur",
|
||||
price: 9,
|
||||
description:
|
||||
"Acces prioritaire, prefix colore, particules discretes et slots reserves.",
|
||||
},
|
||||
{
|
||||
name: "Gladiateur",
|
||||
price: 19,
|
||||
description:
|
||||
"Kit cosmetique PvP, tags exclusifs, bonus d'events et loot personnalise.",
|
||||
},
|
||||
{
|
||||
name: "Titan",
|
||||
price: 39,
|
||||
description:
|
||||
"Rang ultime, aura lumineuse, salons prives et avantages boutique VIP.",
|
||||
},
|
||||
];
|
||||
|
||||
const events = [
|
||||
{
|
||||
title: "UHC Arena - Duel Night",
|
||||
description:
|
||||
"Tournoi 1v1 avec bracket rapide. Score bonus pour les eliminations propres.",
|
||||
eventDate: new Date("2026-05-18T19:00:00Z"),
|
||||
},
|
||||
{
|
||||
title: "Rush 2v2 - Full PvP",
|
||||
description:
|
||||
"Arches, potions, clutchs. Inscription par equipe sur Discord.",
|
||||
eventDate: new Date("2026-05-25T19:00:00Z"),
|
||||
},
|
||||
{
|
||||
title: "UHC Royale",
|
||||
description:
|
||||
"Format 50 joueurs, shrink progressif, recompenses exclusives.",
|
||||
eventDate: new Date("2026-06-01T19:00:00Z"),
|
||||
},
|
||||
];
|
||||
|
||||
const main = async () => {
|
||||
for (const grade of grades) {
|
||||
const existing = await db.grade.findFirst({
|
||||
where: { name: grade.name },
|
||||
});
|
||||
if (!existing) {
|
||||
await db.grade.create({ data: grade });
|
||||
}
|
||||
}
|
||||
|
||||
for (const event of events) {
|
||||
const existing = await db.event.findFirst({
|
||||
where: { title: event.title },
|
||||
});
|
||||
if (!existing) {
|
||||
await db.event.create({ data: event });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
main()
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await db.$disconnect();
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
<svg width="1600" height="900" viewBox="0 0 1600 900" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#0f172a" />
|
||||
<stop offset="0.6" stop-color="#111827" />
|
||||
<stop offset="1" stop-color="#0b1020" />
|
||||
</linearGradient>
|
||||
<linearGradient id="glow" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#7c3aed" stop-opacity="0.55" />
|
||||
<stop offset="1" stop-color="#22d3ee" stop-opacity="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="1600" height="900" fill="url(#sky)" />
|
||||
<circle cx="1220" cy="170" r="160" fill="#1e293b" opacity="0.55" />
|
||||
<rect y="520" width="1600" height="380" fill="#0b1324" />
|
||||
<rect y="560" width="1600" height="340" fill="#0a0f1f" />
|
||||
<rect y="590" width="1600" height="4" fill="#1f2937" opacity="0.6" />
|
||||
<rect y="640" width="1600" height="4" fill="#111827" opacity="0.6" />
|
||||
<rect y="700" width="1600" height="200" fill="#05070d" opacity="0.7" />
|
||||
<g opacity="0.85">
|
||||
<rect x="120" y="430" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="210" y="430" width="80" height="80" fill="#334155" />
|
||||
<rect x="300" y="430" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="390" y="430" width="80" height="80" fill="#0f172a" />
|
||||
<rect x="520" y="400" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="610" y="400" width="80" height="80" fill="#334155" />
|
||||
<rect x="700" y="400" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="980" y="420" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="1070" y="420" width="80" height="80" fill="#334155" />
|
||||
<rect x="1160" y="420" width="80" height="80" fill="#1f2937" />
|
||||
<rect x="1250" y="420" width="80" height="80" fill="#0f172a" />
|
||||
</g>
|
||||
<rect width="1600" height="900" fill="url(#glow)" opacity="0.25" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import "next-auth";
|
||||
|
||||
declare module "next-auth" {
|
||||
interface Session {
|
||||
user: {
|
||||
id: string;
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
image?: string | null;
|
||||
discordId?: string;
|
||||
discordUsername?: string;
|
||||
discordAvatar?: string;
|
||||
isAdmin?: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare module "next-auth/jwt" {
|
||||
interface JWT {
|
||||
discordId?: string;
|
||||
discordUsername?: string;
|
||||
discordAvatar?: string;
|
||||
isAdmin?: boolean;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user