feat: mise à jour sécurité CVE-2025-55182 (Next.js 15.5.7, React 19.1.2)

This commit is contained in:
jessy-david-dev
2026-02-08 17:24:48 +01:00
commit b9a9d687b6
64 changed files with 15638 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
+3
View File
@@ -0,0 +1,3 @@
{
"WillLuke.nextjs.hasPrompted": true
}
+83
View File
@@ -0,0 +1,83 @@
```
aystone
├─ app
│ ├─ a-propos
│ │ └─ page.tsx
│ ├─ ads
│ │ └─ page.tsx
│ ├─ api
│ │ ├─ auth
│ │ │ └─ [...nextauth]
│ │ │ └─ route.ts
│ │ └─ planning
│ │ └─ route.ts
│ ├─ dashboard
│ │ ├─ Sidebar.tsx
│ │ ├─ StatCard.tsx
│ │ ├─ actions.ts
│ │ ├─ ajouter
│ │ │ ├─ AddProjectForm.tsx
│ │ │ └─ page.tsx
│ │ ├─ layout.tsx
│ │ ├─ page.tsx
│ │ ├─ profil
│ │ │ └─ page.tsx
│ │ └─ projets
│ │ ├─ [id]
│ │ │ ├─ EditProjectForm.tsx
│ │ │ └─ page.tsx
│ │ └─ page.tsx
│ ├─ globals.css
│ ├─ layout.tsx
│ ├─ login
│ │ └─ page.tsx
│ ├─ maps
│ │ └─ page.tsx
│ ├─ page.tsx
│ └─ providers.tsx
├─ auth.ts
├─ components
│ ├─ AdsGalleryClient.tsx
│ ├─ AdsSideBanners.tsx
│ ├─ AvailabilityPlanner.tsx
│ ├─ Banner.tsx
│ ├─ Footer.tsx
│ ├─ MapsClient.tsx
│ ├─ McSplash.tsx
│ ├─ MotionHeading.tsx
│ ├─ Navbar.tsx
│ ├─ ProjectsTable.tsx
│ └─ RedstoneParticles.tsx
├─ eslint.config.mjs
├─ lib
│ ├─ getAds.ts
│ └─ prisma.ts
├─ middleware.ts
├─ next.config.ts
├─ package-lock.json
├─ package.json
├─ postcss.config.mjs
├─ prisma
│ ├─ migrations
│ │ ├─ 20250727013821_init
│ │ │ └─ migration.sql
│ │ ├─ 20250727025700_add_mcname
│ │ │ └─ migration.sql
│ │ ├─ 20250727031005_project
│ │ │ └─ migration.sql
│ │ ├─ 20250727203115_add_availability_model
│ │ │ └─ migration.sql
│ │ └─ migration_lock.toml
│ └─ schema.prisma
├─ public
│ ├─ ads
│ │ ├─ riseofkinkdom.jpeg
│ │ └─ voat.png
│ ├─ aystone-saison2.png
│ └─ aystone.png
├─ tsconfig.json
└─ types
└─ next-auth.d.ts
```
+87
View File
@@ -0,0 +1,87 @@
'use client';
import { motion } from 'framer-motion';
const TAGS = [
{ id: 'spawn', label: 'Spawn', cls: 'bg-purple-700/30 text-purple-300' },
{ id: 'build', label: 'Build', cls: 'bg-emerald-600/25 text-emerald-300' },
{ id: 'usine', label: 'Usine', cls: 'bg-orange-600/20 text-orange-300' },
];
export default function AProposPage() {
return (
<main className="flex min-h-screen flex-col bg-[#0e0e10]">
<section className="mx-auto w-full max-w-4xl flex-1 px-4 py-16 text-gray-200">
<motion.h1
className="relative mb-10 text-4xl font-extrabold tracking-tight text-red-600"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: .6 }}
>
À&nbsp;propos
</motion.h1>
<motion.div
className="space-y-6 leading-relaxed text-lg"
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: .15, duration: .6 }}
>
<p>
Cette application&nbsp;web permet à la communauté du serveur&nbsp;
<strong className="text-red-600">Aystone</strong> de référencer, suivre
et partager ses projets&nbsp;Minecraft dans les différents mondes&nbsp;:
<span className="ml-1 rounded-full bg-emerald-600/25 px-2 py-0.5 text-xs font-semibold text-emerald-300">Overworld</span>,
<span className="mx-1 rounded-full bg-red-700/25 px-2 py-0.5 text-xs font-semibold text-red-300">Nether</span>,
<span className="rounded-full bg-purple-700/30 px-2 py-0.5 text-xs font-semibold text-purple-300">End</span>.
</p>
<p>
Le tableau liste&nbsp;: joueur, état, monde, nom, description,
coordonnées et tags personnalisés. Linterface responsive et
épurée garantit une expérience fluide sur mobile comme sur desktop.
</p>
<p>
Sous le capot&nbsp;: <strong>Next&nbsp;15</strong>, <strong>React&nbsp;19</strong>,
<strong> Tailwind&nbsp;4</strong> et <strong>Framer&nbsp;Motion</strong> pour les
animations. Aucune donnée sensible nest stockée : on se connecte
simplement via discord&nbsp;.
<br />
Sur le dashboard, vous pouvez ajouter votre pseudo Minecraft dans la section <strong>Infos du compte</strong>
</p>
<section>
<h2 className="mb-3 text-2xl font-semibold">Légende des tags</h2>
<div className="flex flex-wrap gap-3">
{TAGS.map(t => (
<span
key={t.id}
className={`${t.cls} inline-block rounded-full px-3 py-1 text-sm font-semibold`}
>
{t.label}
</span>
))}
</div>
</section>
<section>
<h2 className="mb-3 text-2xl font-semibold">Code source</h2>
<p>
Le projet est entièrement open-source&nbsp;:{" "}
<a
href="https://github.com/UltraLionfr/aystone-manager"
target="_blank"
rel="noopener noreferrer"
className="text-orange-400 underline hover:text-orange-500"
>
dépôt&nbsp;GitHub
</a>.
Déployé sur&nbsp;<strong>Coolify</strong>.
</p>
</section>
</motion.div>
</section>
</main>
);
}
+11
View File
@@ -0,0 +1,11 @@
import AdsGalleryClient from "@/components/AdsGalleryClient";
import { getAdFiles } from "@/lib/getAds";
export const metadata = {
title: "Galerie des publicités Aystone",
};
export default async function AdsGalleryPage() {
const files = await getAdFiles();
return <AdsGalleryClient files={files} />;
}
+3
View File
@@ -0,0 +1,3 @@
import { handlers } from "@/auth";
export const { GET, POST } = handlers;
+26
View File
@@ -0,0 +1,26 @@
import { Palette } from "lucide-react";
import Image from "next/image";
export const metadata = {
title: "Charte des couleurs Minecraft",
};
export default function CouleursPage() {
return (
<div className="min-h-screen bg-[#0e0e10] text-amber-50 px-4 py-12 flex flex-col items-center">
<h1 className="text-4xl font-bold mb-6 text-center flex items-center justify-center gap-2">
<Palette className="w-8 h-8 text-amber-50" />
Charte des couleurs Minecraft
</h1>
<div className="w-full max-w-4xl">
<Image
src="/charte-couleurs.png"
alt="Charte des couleurs Minecraft"
width={1000}
height={563}
className="rounded-xl shadow-xl w-full h-auto"
/>
</div>
</div>
);
}
+63
View File
@@ -0,0 +1,63 @@
"use client";
import {
LayoutDashboard,
PlusCircle,
TableProperties,
User
} from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
const LINKS = [
{ name: "Tableau", href: "/dashboard", icon: LayoutDashboard },
{ name: "Profil", href: "/dashboard/profil", icon: User },
{ name: "Ajouter", href: "/dashboard/ajouter", icon: PlusCircle },
{ name: "Mes Projets", href: "/dashboard/projets", icon: TableProperties },
];
export default function Sidebar() {
const pathname = usePathname();
return (
<aside className="flex flex-col w-56 bg-[#0e0e10]/80 backdrop-blur-lg border-r border-white/10">
{/* Liens de navigation */}
<nav className="flex-1 px-4 py-6 space-y-1">
{LINKS.map(({ name, href, icon: Icon }) => {
const active = pathname === href;
return (
<Link
key={href}
href={href}
className={`
group flex items-center gap-3 px-3 py-2 text-sm rounded-lg transition
${active
? "bg-white/10 border-l-4 border-red-500"
: "hover:bg-white/10"}
`}
>
<Icon
size={18}
className={`
flex-shrink-0 transition
${active
? "text-red-500"
: "text-amber-50/60 group-hover:text-amber-50"}
`}
/>
<span
className={`transition ${
active
? "text-red-500"
: "text-amber-50/60 group-hover:text-amber-50"
}`}
>
{name}
</span>
</Link>
);
})}
</nav>
</aside>
);
}
+28
View File
@@ -0,0 +1,28 @@
"use client";
import { motion } from "framer-motion";
import { ReactNode } from "react";
type Props = {
title: string;
value: string | number;
icon?: ReactNode;
};
export default function StatCard({ title, value, icon }: Props) {
return (
<motion.div
whileHover={{ translateY: -4, boxShadow: "0 8px 24px rgba(0,0,0,0.4)" }}
className="relative rounded-lg bg-white/5 p-6 backdrop-blur
ring-1 ring-white/10 transition"
>
{icon && (
<div className="absolute -top-4 right-4 text-4xl opacity-20">
{icon}
</div>
)}
<h3 className="text-sm font-medium text-amber-50/70">{title}</h3>
<p className="mt-2 text-3xl font-semibold text-amber-50">{value}</p>
</motion.div>
);
}
+103
View File
@@ -0,0 +1,103 @@
"use server";
import { auth } from "@/auth";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
export async function createProject(form: FormData) {
const session = await auth();
if (!session) throw new Error("unauth");
const currentUser = await prisma.user.findUnique({
where: { email: session.user!.email! },
});
const joueur =
(form.get("joueur") as string | null)?.trim() ||
currentUser?.mcName ||
session.user!.name!;
const coords = form.get("coords")?.toString().trim();
const tagsRaw = form.get("tags")?.toString() ?? "";
const data = {
joueur,
etat: (form.get("etat") as string) ?? "En cours",
monde: (form.get("monde") as string) ?? "Overworld",
projet: (form.get("projet") as string).trim(),
description: (form.get("description") as string).trim(),
coords: coords && coords.length > 0 ? coords : null,
tags: tagsRaw
.split(",")
.map((t) => t.trim())
.filter(Boolean),
};
await prisma.project.create({ data });
revalidatePath("/dashboard");
redirect("/dashboard");
}
export async function updateProject(projectId: string, form: FormData) {
const session = await auth();
if (!session) throw new Error("unauth");
const coords = form.get("coords")?.toString().trim();
const tagsRaw = form.get("tags")?.toString() ?? "";
const data = {
etat: (form.get("etat") as string),
monde: (form.get("monde") as string),
projet: (form.get("projet") as string).trim(),
description: (form.get("description") as string).trim(),
coords: coords && coords.length > 0 ? coords : null,
tags: tagsRaw
.split(",")
.map((t) => t.trim())
.filter(Boolean),
};
await prisma.project.update({
where: { id: projectId },
data,
});
revalidatePath("/dashboard");
redirect("/dashboard");
}
export async function updateMinecraftName(form: FormData) {
const session = await auth();
if (!session) throw new Error("unauth");
const mcName = (form.get("mcName") as string).trim();
if (!/^[A-Za-z0-9_]{3,16}$/.test(mcName)) throw new Error("invalid");
const user = await prisma.user.findUnique({
where: { email: session.user!.email! },
});
if (!user) {
await prisma.user.create({
data: {
email: session.user!.email!,
name: session.user!.name,
image: session.user!.image,
mcName,
},
});
} else {
if (user.mcName) {
throw new Error("Le pseudo Minecraft ne peut pas être modifié après avoir été défini.");
}
await prisma.user.update({
where: { email: session.user!.email! },
data: { mcName },
});
}
revalidatePath("/dashboard");
revalidatePath("/");
}
+192
View File
@@ -0,0 +1,192 @@
"use client";
import { motion } from "framer-motion";
import { Layers3, MapPin, Plus, Tags, User, X } from "lucide-react";
import { useSession } from "next-auth/react";
import { useState } from "react";
import { createProject } from "../actions";
const PREDEF = ["build", "usine", "spawn"] as const;
type TagColor = (typeof PREDEF)[number];
const palette: Record<TagColor, string> = {
build: "bg-emerald-600/90",
usine: "bg-orange-600/90",
spawn: "bg-fuchsia-700/90",
};
const isValidCoord = (value: string) => /^-?\d*$/.test(value);
export default function AddProjectForm() {
const { data: session } = useSession();
const [tags, setTags] = useState<string[]>([]);
const [tagInput, setInput] = useState("");
const [x, setX] = useState("");
const [y, setY] = useState("");
const [z, setZ] = useState("");
const addTag = (t: string) => {
const val = t.trim().toLowerCase();
if (!val || tags.includes(val) || tags.length >= 5) return;
setTags([...tags, val]);
};
const del = (t: string) => setTags(tags.filter((x) => x !== t));
const getTagClass = (t: string) => {
return palette[t as TagColor] ?? "bg-gray-600";
};
return (
<motion.form
action={createProject}
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
className="max-w-xl mx-auto bg-gray-800/60 rounded-xl shadow-lg p-6 space-y-6"
>
{/* nom */}
<div className="relative">
<Layers3 className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" size={18} />
<input
name="projet"
placeholder="Nom du projet"
required
className="w-full rounded-lg bg-gray-700 py-2 pl-10 pr-3 text-amber-50 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
/>
</div>
{/* joueur */}
{session?.user?.email === "ultralionfr@gmail.com" && (
<div className="relative">
<User className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" size={18} />
<input
name="joueur"
placeholder="Pseudo Minecraft"
required
className="w-full rounded-lg bg-gray-700 py-2 pl-10 pr-3 text-amber-50 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
/>
</div>
)}
{/* coords */}
<div className="grid grid-cols-3 gap-3">
{[
{ name: "x", value: x, setValue: setX },
{ name: "y", value: y, setValue: setY },
{ name: "z", value: z, setValue: setZ },
].map(({ name, value, setValue }) => (
<div className="relative" key={name}>
<MapPin className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" size={16} />
<input
name={name}
placeholder={name.toUpperCase()}
value={value}
onChange={(e) => {
if (isValidCoord(e.target.value)) setValue(e.target.value);
}}
className="w-full rounded-lg bg-gray-700 py-2 pl-9 pr-3 text-amber-50 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
/>
</div>
))}
</div>
{/* Tags */}
<div className="space-y-2">
<label className="flex items-center gap-1 text-sm text-gray-300">
<Tags size={16} /> Tags <span className="text-xs text-gray-400">(max 5)</span>
</label>
<div className="flex flex-wrap gap-2">
{tags.map((t) => (
<button
key={t}
type="button"
onClick={() => del(t)}
className={`rounded-full px-3 py-1 text-xs ${getTagClass(t)} text-amber-50 flex items-center gap-1 hover:opacity-80`}
>
{t} <X size={12} />
</button>
))}
</div>
<div className="flex flex-col sm:flex-row gap-3">
<select
onChange={(e) => {
addTag(e.target.value);
e.target.value = "";
}}
className="w-full sm:w-1/2 rounded-lg bg-gray-700 py-2 px-3 text-amber-50 focus:outline-none focus:ring-2 focus:ring-indigo-500"
defaultValue=""
>
<option value="">Choisir un tag pré-défini</option>
{PREDEF.map((t) => (
<option key={t}>{t}</option>
))}
</select>
<div className="relative flex-1">
<input
value={tagInput}
onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) =>
e.key === "Enter" && (e.preventDefault(), addTag(tagInput), setInput(""))
}
placeholder="Ajouter un tag personnalisé"
className="w-full rounded-lg bg-gray-700 py-2 pl-3 pr-12 text-amber-50 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
/>
<button
type="button"
onClick={() => {
addTag(tagInput);
setInput("");
}}
className="absolute right-1 top-1 rounded-lg bg-indigo-500 hover:bg-indigo-600 p-1"
>
<Plus size={16} className="text-amber-50" />
</button>
</div>
</div>
</div>
{/* description */}
<textarea
name="description"
rows={4}
placeholder="Description du projet"
className="w-full rounded-lg bg-gray-700 p-3 text-amber-50 placeholder-gray-400 resize-y focus:outline-none focus:ring-2 focus:ring-indigo-500"
/>
{/* état + monde */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
<select name="etat" className="input-style bg-gray-700 text-amber-50">
<option>En cours</option>
<option>Terminé</option>
<option>Pause</option>
</select>
<select name="monde" className="input-style bg-gray-700 text-amber-50">
<option>Overworld</option>
<option>Nether</option>
<option>End</option>
</select>
</div>
{/* hidden */}
<input type="hidden" name="tags" value={tags.join(",")} />
<input type="hidden" name="coords" id="coordsField" value="" />
{/* submit */}
<button
type="submit"
className="cursor-pointer w-full rounded-lg bg-gradient-to-r from-green-500 to-emerald-500 py-3 text-amber-50 font-semibold shadow-md hover:shadow-lg transition duration-300"
onClick={(e) => {
const form = (e.target as HTMLButtonElement).form!;
const coordsField = form.coords as HTMLInputElement;
coordsField.value = [form.x.value, form.y.value, form.z.value].filter(Boolean).join(" ");
}}
>
Ajouter le projet
</button>
</motion.form>
);
}
+22
View File
@@ -0,0 +1,22 @@
import { auth } from "@/auth";
import { redirect } from "next/navigation";
import AddProjectForm from "./AddProjectForm";
export const dynamic = "force-dynamic";
export const metadata = { title: "Ajouter un projet | Dashboard" };
export default async function AddProjectPage() {
const session = await auth();
if (!session) redirect("/");
return (
<section className="mx-auto max-w-xl px-4 py-10">
<div className="">
<h1 className="text-xl font-semibold text-red-400">
Ajouter un projet
</h1><br />
<AddProjectForm />
</div>
</section>
);
}
+19
View File
@@ -0,0 +1,19 @@
import Providers from "@/app/providers";
import Sidebar from "./Sidebar";
export const metadata = { title: "Dashboard | Aystone" };
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<Providers>
<div className="flex min-h-screen bg-[#0e0e10] text-amber-50">
<Sidebar />
<main className="flex-1 p-6">{children}</main>
</div>
</Providers>
);
}
+48
View File
@@ -0,0 +1,48 @@
import { auth } from "@/auth";
import { prisma } from "@/lib/prisma";
import { Info } from "lucide-react";
import { redirect } from "next/navigation";
import StatCard from "./StatCard";
export const dynamic = "force-dynamic";
export const revalidate = 0;
export default async function DashboardHome() {
const session = await auth();
if (!session) return redirect("/");
const user = await prisma.user.findUnique({
where: { email: session.user!.email! },
});
const joueur = user?.mcName ?? session.user!.name!;
const [projectCount, userCount] = await Promise.all([
prisma.project.count({ where: { joueur } }),
prisma.user.count(),
]);
return (
<div className="p-6 space-y-8">
<h1 className="text-4xl font-bold tracking-tight">Tableau de bord</h1>
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start gap-3">
<Info className="h-6 w-6 text-blue-600" />
<div>
<h2 className="font-semibold text-blue-800">Important</h2>
<p className="text-blue-700">
Pensez à compléter votre profil avec votre pseudo Minecraft pour pouvoir créer et associer vos projets à votre compte.
</p>
<p className="text-blue-700">
Vous pouvez mettre qu&apos;une seul fois votre pseudo Minecraft et pas le changer par la suite.
</p>
</div>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
<StatCard title="Mes projets" value={projectCount} />
<StatCard title="Membres inscrits" value={userCount} />
</div>
</div>
);
}
+79
View File
@@ -0,0 +1,79 @@
import { auth } from "@/auth";
import { prisma } from "@/lib/prisma";
import Image from "next/image";
import { redirect } from "next/navigation";
import { updateMinecraftName } from "../actions";
export const dynamic = "force-dynamic";
export const metadata = { title: "Profil | Dashboard" };
export default async function ProfilPage() {
const session = await auth();
if (!session) redirect("/");
const user = await prisma.user.findUnique({
where: { email: session.user!.email! },
});
return (
<section className="mx-auto max-w-lg px-4 py-10">
<h1 className="mb-6 text-2xl font-bold">Profil</h1>
<div className="card space-y-8">
{/* avatar Discord */}
<div className="flex items-center gap-4">
<Image
src={session.user?.image ?? ""}
alt=""
width={56}
height={56}
className="rounded-full"
/>
<div>
<p className="text-lg font-semibold">{session.user?.name}</p>
<p className="text-sm text-white/60">{session.user?.email}</p>
</div>
</div>
{/* pseudo Minecraft */}
<form action={updateMinecraftName} className="space-y-4">
<label className="mb-1 block text-sm text-white/70">
Pseudo Minecraft
</label>
<div className="relative w-full max-w-md">
{user?.mcName && (
<Image
src={`https://mc-heads.net/avatar/${user.mcName}/28`}
alt=""
width={28}
height={28}
className="absolute left-2 top-1/2 -translate-y-1/2 rounded"
unoptimized
/>
)}
{/* padding-left 48 px pour laisser la place à lavatar */}
<input
name="mcName"
defaultValue={user?.mcName ?? ""}
placeholder="Pseudo MC"
required
pattern="[A-Za-z0-9_]{3,16}"
disabled={Boolean(user?.mcName)}
className="input pl-12 disabled:opacity-60"
/>
</div>
<button
type="submit"
disabled={Boolean(user?.mcName)}
className="rounded bg-indigo-600 px-4 py-2 text-sm font-medium hover:bg-indigo-700 disabled:opacity-50"
>
Enregistrer
</button>
</form>
</div>
</section>
);
}
+106
View File
@@ -0,0 +1,106 @@
"use client";
import { SafeProject } from "@/lib/validators/project";
import { motion } from "framer-motion";
import {
BadgeCheck,
FileText,
Globe,
MapPin,
Pencil,
Tag,
} from "lucide-react";
import Link from "next/link";
export default function UserProjectsTable({ projects }: { projects: SafeProject[] }) {
const headers = [
{ label: "Projet", icon: FileText },
{ label: "État", icon: BadgeCheck },
{ label: "Monde", icon: Globe },
{ label: "Coordonnées", icon: MapPin },
{ label: "Tags", icon: Tag },
{ label: "Actions", icon: Pencil },
];
return (
<section className="mx-auto max-w-6xl px-4 py-10">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
className="flex items-center justify-between mb-6"
>
<h1 className="text-2xl font-bold text-amber-50">Mes projets</h1>
<Link
href="/dashboard/ajouter"
className="inline-flex items-center gap-2 rounded bg-green-600 px-3 py-1.5 text-sm font-medium hover:bg-green-700"
>
Ajouter un projet
</Link>
</motion.div>
{projects.length === 0 ? (
<p className="mt-6 text-center text-amber-50/60">Vous navez encore créé aucun projet.</p>
) : (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, delay: 0.1 }}
className="overflow-x-auto rounded-t-2xl"
>
<table className="w-full border-collapse text-left text-[13px]">
<thead>
<tr className="bg-slate-800 text-amber-50 [&>th:first-child]:rounded-tl-xl [&>th:last-child]:rounded-tr-xl">
{headers.map(({ label, icon: Icon }) => (
<th key={label} className="px-3 py-2 font-semibold">
<div className="flex items-center gap-1">
<Icon size={14} className="opacity-70" />
{label}
</div>
</th>
))}
</tr>
</thead>
<tbody>
{projects.map((p) => (
<tr key={p.id} className="bg-[#0f111c]">
<td className="px-3 py-2">{p.projet}</td>
<td className="px-3 py-2">
<span className={`rounded-full px-2 py-0.5 text-[11px] font-medium ${
p.etat === "En cours" ? "bg-yellow-400/90 text-black" :
p.etat === "Terminé" ? "bg-green-600/90" : "bg-red-600/90"
}`}>{p.etat}</span>
</td>
<td className="px-3 py-2">
<span className={`rounded-full px-2 py-0.5 text-[11px] ${
p.monde === "Overworld" ? "bg-emerald-700/80" :
p.monde === "Nether" ? "bg-red-700/80" : "bg-violet-800/90"
}`}>{p.monde}</span>
</td>
<td className="px-3 py-2 font-mono tabular-nums">{p.coords ?? "—"}</td>
<td className="px-3 py-2">
<div className="flex flex-wrap gap-1">
{p.tags.map((t, i) => (
<span key={t + i} className="rounded-full bg-white/10 px-2 py-0.5 text-xs">
{t}
</span>
))}
</div>
</td>
<td className="px-3 py-2">
<Link
href={`/dashboard/projets/${p.id}`}
className="inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-indigo-400 hover:bg-white/10"
>
<Pencil size={12} /> Modifier
</Link>
</td>
</tr>
))}
</tbody>
</table>
</motion.div>
)}
</section>
);
}
@@ -0,0 +1,165 @@
"use client";
import { motion } from "framer-motion";
import { Layers3, MapPin, Tags } from "lucide-react";
import { useState } from "react";
import { Project } from "../../../../components/ProjectsTable";
import { updateProject } from "../../actions";
type Props = {
project: Project;
};
/** Formulaire client pour éditer un projet existant */
export default function EditProjectForm({ project }: Props) {
const [tags, setTags] = useState<string[]>(project.tags ?? []);
const [customTag, setCustomTag] = useState("");
const PREDEF = ["build", "usine", "spawn"] as const;
const addTag = (t: string) => {
const val = t.trim().toLowerCase();
if (!val || tags.includes(val) || tags.length >= 5) return;
setTags([...tags, val]);
};
const removeTag = (t: string) => {
setTags(tags.filter((x) => x !== t));
};
const coordsParts = (project.coords ?? "").split(" ");
return (
<motion.form
action={(formData: FormData) => updateProject(project.id!, formData)}
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
className="space-y-6"
>
{/* Titre du projet */}
<div className="relative">
<Layers3 size={18} className="absolute left-3 top-3 text-amber-50/40" />
<input
name="projet"
defaultValue={project.projet}
placeholder="Titre du projet"
required
className="input pl-10"
/>
</div>
{/* Coordonnées X Y Z */}
<div className="grid grid-cols-3 gap-4">
{["X", "Y", "Z"].map((axis, idx) => (
<div key={axis} className="relative">
<MapPin size={16} className="absolute left-3 top-3 text-amber-50/40" />
<input
name={axis.toLowerCase()}
defaultValue={coordsParts[idx] ?? ""}
placeholder={axis}
className="input pl-10"
/>
</div>
))}
</div>
{/* Description */}
<textarea
name="description"
defaultValue={project.description}
rows={4}
placeholder="Description détaillée"
className="input w-full resize-y"
/>
{/* État & Monde */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<select name="etat" defaultValue={project.etat} className="input">
<option>En cours</option>
<option>Terminé</option>
<option>Pause</option>
</select>
<select name="monde" defaultValue={project.monde} className="input">
<option>Overworld</option>
<option>Nether</option>
<option>End</option>
</select>
</div>
{/* Tags */}
<div className="space-y-2">
<label className="flex items-center gap-2 text-sm text-amber-50/70">
<Tags size={16} /> Tags (max 5)
</label>
<div className="flex flex-wrap gap-2">
{tags.map((t) => (
<button
key={t}
type="button"
onClick={() => removeTag(t)}
className="rounded-full bg-slate-700/70 px-2 py-0.5 text-xs hover:bg-red-600/80"
>
{t}
</button>
))}
</div>
<div className="flex gap-2">
<select
onChange={(e) => {
addTag(e.target.value);
e.target.value = "";
}}
className="input flex-1"
defaultValue=""
>
<option value="">Tag prédéfini</option>
{PREDEF.map((t) => (
<option key={t}>{t}</option>
))}
</select>
<input
value={customTag}
onChange={(e) => setCustomTag(e.target.value)}
onKeyDown={(e) =>
e.key === "Enter" &&
(e.preventDefault(), addTag(customTag), setCustomTag(""))
}
placeholder="Ajouter tag..."
className="input flex-1"
/>
<button
type="button"
onClick={() => {
addTag(customTag);
setCustomTag("");
}}
className="rounded bg-indigo-600 px-4 py-2 text-sm hover:bg-indigo-700"
>
Ajouter
</button>
</div>
</div>
{/* Champs cachés */}
<input type="hidden" name="tags" value={tags.join(",")} />
<input type="hidden" name="coords" value="" />
{/* Bouton de soumission */}
<button
type="submit"
className="w-full rounded-full bg-gradient-to-r from-green-500 to-emerald-600 py-2.5 font-semibold shadow hover:brightness-110"
onClick={(e) => {
const f = (e.target as HTMLButtonElement).form!;
const x = (f.x as HTMLInputElement).value;
const y = (f.y as HTMLInputElement).value;
const z = (f.z as HTMLInputElement).value;
(f.coords as HTMLInputElement).value = [x, y, z]
.filter(Boolean)
.join(" ");
}}
>
Mettre à jour le projet
</button>
</motion.form>
);
}
+41
View File
@@ -0,0 +1,41 @@
import { auth } from "@/auth";
import { prisma } from "@/lib/prisma";
import { notFound, redirect } from "next/navigation";
import { z } from "zod";
import EditProjectForm from "./EditProjectForm";
type Props = { params: { id: string } };
// Définition stricte du schéma
const ProjectSchema = z.object({
id: z.string(),
joueur: z.string(),
projet: z.string(),
description: z.string(),
coords: z.string().nullable().transform((val) => val ?? ""),
tags: z.string().array(),
etat: z.enum(["En cours", "Terminé", "Pause"]),
monde: z.enum(["Overworld", "Nether", "End"]),
createdAt: z.date(),
});
export default async function EditProjectPage({ params }: Props) {
const session = await auth();
if (!session) redirect("/");
const data = await prisma.project.findUnique({
where: { id: params.id },
});
if (!data) notFound();
// ✅ Cast via zod
const project = ProjectSchema.parse(data);
return (
<section className="mx-auto max-w-xl px-4 py-10">
<h1 className="text-2xl font-bold mb-6">Modifier le projet</h1>
<EditProjectForm project={project} />
</section>
);
}
+41
View File
@@ -0,0 +1,41 @@
import { auth } from "@/auth";
import { prisma } from "@/lib/prisma";
import { redirect } from "next/navigation";
import { z } from "zod";
import UserProjectsTable from "./UserProjectsTable";
// Définition stricte du schéma
const ProjectSchema = z.object({
id: z.string(),
joueur: z.string(),
projet: z.string(),
description: z.string(),
coords: z.string().nullable(),
tags: z.string().array(),
etat: z.enum(["En cours", "Terminé", "Pause"]),
monde: z.enum(["Overworld", "Nether", "End"]),
createdAt: z.date(),
});
export const dynamic = "force-dynamic";
export default async function UserProjectsPage() {
const session = await auth();
if (!session) redirect("/");
const user = await prisma.user.findUnique({
where: { email: session.user.email! },
});
const joueur = user?.mcName ?? session.user.name!;
const projectsRaw = await prisma.project.findMany({
where: { joueur },
orderBy: { createdAt: "desc" },
});
// ✅ Valide les projets pour forcer le bon typage
const projects = projectsRaw.map((p) => ProjectSchema.parse(p));
return <UserProjectsTable projects={projects} />;
}
+11
View File
@@ -0,0 +1,11 @@
@import "tailwindcss";
.input {
@apply w-full rounded-md bg-[#20222e] px-10 py-2.5 text-sm text-white
placeholder-white/40 ring-1 ring-white/10 outline-none
focus:ring-2 focus:ring-indigo-500 transition;
}
.card {
@apply rounded-2xl bg-[#111320]/70 p-8 ring-1 ring-white/10 backdrop-blur
shadow-[0_6px_20px_rgba(0,0,0,0.45)];
}
+33
View File
@@ -0,0 +1,33 @@
import Providers from "@/app/providers";
import AdsSideBanners from "@/components/AdsSideBanners";
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import type { Metadata } from "next";
import "./globals.css";
export const metadata: Metadata = {
title: "AyStone Instance Cobble",
description: "Ce petit site est une application de gestion de projets Minecraft, pensée spécialement pour la communauté du serveur Aystone.",
icons: {
icon: "/aystone.png",
},
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="fr">
<body className="bg-[#0e0e10] text-amber-50 antialiased">
<AdsSideBanners />
<Providers>
<Navbar />
<main className="min-h-screen">{children}</main>
<Footer />
</Providers>
</body>
</html>
);
}
+14
View File
@@ -0,0 +1,14 @@
"use client";
import { signIn, useSession } from "next-auth/react";
import { useEffect } from "react";
export default function LoginPage() {
const { data: session } = useSession();
useEffect(() => {
if (session) window.location.replace("/dashboard");
else signIn("discord", { callbackUrl: "/dashboard" });
}, [session]);
return <p className="p-8 text-center">Redirection vers Discord</p>;
}
+9
View File
@@ -0,0 +1,9 @@
import MapsClient from "@/components/MapsClient";
export const metadata = {
title: "Carte dynamique | Aystone",
};
export default function MapsPage() {
return <MapsClient />;
}
+32
View File
@@ -0,0 +1,32 @@
"use client";
import { motion } from "framer-motion";
import { Frown } from "lucide-react";
import Link from "next/link";
export default function NotFound() {
return (
<div className="min-h-screen flex items-center justify-center bg-[#0f1117] px-4">
<motion.div
initial={{ opacity: 0, y: 15 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, ease: "easeOut" }}
className="text-center max-w-md"
>
<div className="mb-4 flex justify-center">
<Frown className="h-12 w-12 text-red-500" />
</div>
<h1 className="text-3xl font-bold text-amber-50 mb-2">404 Page introuvable</h1>
<p className="text-amber-50/70 mb-6">
La page que tu cherches n&apos;existe pas ou a é déplacée.
</p>
<Link
href="/"
className="inline-block rounded-lg bg-red-500 px-4 py-2 text-sm font-semibold text-amber-50 transition hover:bg-red-600"
>
Retour à l&apos;accueil
</Link>
</motion.div>
</div>
);
}
+10
View File
@@ -0,0 +1,10 @@
import OutilsPage from "@/components/OutilsPage";
import { Metadata } from "next";
export const metadata: Metadata = {
title: "Outils | Aystone",
};
export default function Page() {
return <OutilsPage />;
}
+31
View File
@@ -0,0 +1,31 @@
import Banner from "@/components/Banner";
import ProjectsTable, { Project } from "@/components/ProjectsTable";
import { prisma } from "@/lib/prisma";
import MotionHeading from "../components/MotionHeading";
export const dynamic = "force-dynamic";
export default async function Home() {
const rawProjects = await prisma.project.findMany({
orderBy: { createdAt: "desc" },
});
const projects: Project[] = rawProjects.map((p) => ({
id: p.id,
joueur: p.joueur,
etat: p.etat as Project["etat"],
monde: p.monde as Project["monde"],
projet: p.projet,
description: p.description,
coords: p.coords ?? "",
tags: p.tags,
}));
return (
<>
<Banner />
<MotionHeading />
<ProjectsTable data={projects} />
</>
);
}
+7
View File
@@ -0,0 +1,7 @@
"use client";
import { SessionProvider } from "next-auth/react";
import { ReactNode } from "react";
export default function Providers({ children }: { children: ReactNode }) {
return <SessionProvider>{children}</SessionProvider>;
}
+48
View File
@@ -0,0 +1,48 @@
import Banner from "@/components/Banner";
import ProjectsTable, { Project } from "@/components/ProjectsTable";
import { prisma } from "@/lib/prisma";
import { notFound } from "next/navigation";
type Props = {
params: { username: string };
};
export default async function UserProfilePage({ params }: Props) {
const username = params.username;
const user = await prisma.user.findUnique({
where: { mcName: username },
});
if (!user) return notFound();
const rawProjects = await prisma.project.findMany({
where: { joueur: username },
orderBy: { createdAt: "desc" },
});
const projects: Project[] = rawProjects.map((p) => ({
id: p.id,
joueur: p.joueur,
etat: p.etat as Project["etat"],
monde: p.monde as Project["monde"],
projet: p.projet,
description: p.description,
coords: p.coords ?? "",
tags: p.tags,
}));
return (
<section className="p-4">
<Banner />
<h1 className="text-2xl font-bold text-amber-50 text-center">
Projets de <span className="text-yellow-300">{username}</span>
</h1>
{projects.length === 0 ? (
<p className="mt-4 text-amber-50/60">Aucun projet enregistré.</p>
) : (
<ProjectsTable data={projects} hidePlayerFilter />
)}
</section>
);
}
+23
View File
@@ -0,0 +1,23 @@
import NextAuth, { type NextAuthConfig, type Session } from "next-auth";
import { type JWT } from "next-auth/jwt";
import Discord from "next-auth/providers/discord";
export const authConfig: NextAuthConfig = {
providers: [
Discord({
clientId: process.env.DISCORD_CLIENT_ID!,
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
}),
],
callbacks: {
async session({ session, token }: { session: Session; token: JWT }) {
if (token?.sub) {
session.user.id = token.sub;
}
return session;
},
},
trustHost: true,
};
export const { auth, handlers } = NextAuth(authConfig);
+171
View File
@@ -0,0 +1,171 @@
"use client";
import { AnimatePresence, motion } from "framer-motion";
import Image from "next/image";
import { useCallback, useEffect, useState } from "react";
// Mapping des textes associés à chaque visuel
const ADS_COPY: Record<string, { title: string; subtitle: string }> = {
"riseofkinkdom.jpeg": {
title: "Atteignez 50 Millions dImpuissance !",
subtitle: "Rejoignez « Rise of Kink Doms » et dominez vos adversaires.",
},
"voat.png": {
title: "Aymeric Pierre vend votre voiture !",
subtitle: "Offre exclusive : 69,42 BTC, garantie World PvP Champion.",
},
};
export default function AdsGalleryClient({ files }: { files: string[] }) {
// \u2714 État qui détermine l'image agrandie actuellement affichée
const [selected, setSelected] = useState<string | null>(null);
/**
* Gestion du clavier : ␛ pour fermer la light-box
* On utilise le « KeyboardEvent » natif du DOM, plus compatible
*/
const handleKey = useCallback((e: KeyboardEvent) => {
if (e.key === "Escape") setSelected(null);
}, []);
useEffect(() => {
if (!selected) return; // rien à faire si aucune image n'est ouverte
// ➜ attache l'écouteur
window.addEventListener("keydown", handleKey);
document.body.style.overflow = "hidden"; // bloque le scroll arrière-plan
// ➜ cleanup à la fermeture / unmount
return () => {
window.removeEventListener("keydown", handleKey);
document.body.style.overflow = "";
};
}, [selected, handleKey]);
return (
<main className="flex min-h-screen flex-col bg-[#0e0e10]">
<section className="mx-auto w-full max-w-6xl flex-1 px-4 py-12">
{/* Titre */}
<motion.h1
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, ease: "easeOut" }}
className="mb-10 text-3xl font-extrabold text-red-600"
>
Galerie des publicités
</motion.h1>
{/* Message si aucun fichier */}
{files.length === 0 ? (
<motion.p
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.2 }}
className="text-gray-400"
>
Aucune bannière trouvée dans <code className="text-sm">/public/ads</code>.
</motion.p>
) : (
<motion.ul
initial="hidden"
animate="visible"
variants={{
hidden: {},
visible: { transition: { staggerChildren: 0.1 } },
}}
className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3"
>
{files.map((file) => {
const copy = ADS_COPY[file];
return (
<motion.li
key={file}
variants={{ hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0 } }}
className="cursor-pointer overflow-hidden rounded-xl border border-[#1c2536] bg-[#0b1320] shadow"
onClick={() => setSelected(file)}
>
{/* Vignette */}
<div className="relative h-42 w-full">
<Image
src={`/ads/${file}`}
alt={file}
fill
className="object-cover transition-transform duration-200 hover:scale-105"
sizes="(min-width:1024px) 33vw, (min-width:640px) 50vw, 100vw"
priority
/>
</div>
{/* Texte associé */}
{copy && (
<div className="px-4 py-3 text-center">
<h2 className="text-[15px] font-bold leading-snug text-amber-100">
{copy.title.split(/(50 Millions)/).map((part, i) =>
part === "50 Millions" ? (
<span key={i} className="text-red-500">
{part}
</span>
) : (
part
)
)}
</h2>
<p className="mt-1 text-sm text-gray-300">{copy.subtitle}</p>
</div>
)}
{/* Nom de fichier */}
<p className="truncate bg-[#0b1320] px-3 py-2 text-center text-xs text-gray-500">
{file}
</p>
</motion.li>
);
})}
</motion.ul>
)}
</section>
{/* ---- Light-box plein écran ---- */}
<AnimatePresence>
{selected && (
<motion.div
key="overlay"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.25 }}
className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-md"
onClick={(e) => {
// Ferme si on clique en dehors de l'image
if (e.target === e.currentTarget) setSelected(null);
}}
>
<motion.div
initial={{ scale: 0.9, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.9, opacity: 0 }}
className="relative max-h-[90vh] max-w-[90vw]"
>
<Image
src={`/ads/${selected}`}
alt={selected}
width={1200}
height={800}
className="h-auto w-auto rounded-lg shadow-xl"
priority
/>
{/* Bouton de fermeture */}
<button
aria-label="Fermer"
className="absolute right-2 top-2 rounded-full bg-black/60 p-1 text-white hover:bg-black/80 focus:outline-none"
onClick={() => setSelected(null)}
>
</button>
</motion.div>
</motion.div>
)}
</AnimatePresence>
</main>
);
}
+50
View File
@@ -0,0 +1,50 @@
'use client';
import { X } from 'lucide-react';
import Image from 'next/image';
import { useEffect, useState } from 'react';
const ADS_IMAGES = [
'/ads/riseofkinkdom.jpeg',
'/ads/voat.png'
];
export default function PopupAd() {
const [visible, setVisible] = useState(false);
const [src, setSrc] = useState<string>(ADS_IMAGES[0]);
/* choix aléatoire + délai dapparition */
useEffect(() => {
setSrc(ADS_IMAGES[Math.floor(Math.random() * ADS_IMAGES.length)]);
const id = setTimeout(() => setVisible(true), 5000); // 5 s
return () => clearTimeout(id);
}, []);
if (!visible) return null;
return (
<div className="fixed bottom-6 right-6 hidden md:block z-50 animate-in fade-in slide-in-from-bottom-4">
<div className="relative w-[420px] rounded-lg overflow-hidden shadow-2xl ring-1 ring-black/20">
{/* bouton fermer */}
<button
onClick={() => setVisible(false)}
aria-label="Fermer la pub"
className="absolute right-2 top-2 z-10 rounded-full bg-black/40 p-1 hover:bg-black/60"
>
<X className="h-4 w-4 text-amber-50" />
</button>
{/* image de la pub */}
<Image
src={src}
alt="Publicité fictive"
width={420}
height={1080}
priority
className="object-cover select-none"
unoptimized
/>
</div>
</div>
);
}
+29
View File
@@ -0,0 +1,29 @@
"use client";
import { motion } from "framer-motion";
import Image from "next/image";
export default function Banner() {
return (
<section className="w-full bg-[#0e0e10] flex justify-center py-4">
<motion.div
initial={{ y: -20, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.4, ease: "easeOut" }}
className="relative w-full max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg"
>
<div className="transition-transform duration-300 hover:scale-105">
<Image
src="/aystone-saison2.png"
alt="Aystone Saison 2"
priority
className="w-full h-auto select-none"
sizes="(max-width: 640px) 90vw, (max-width: 768px) 384px, (max-width: 1024px) 448px, 512px"
width={512}
height={200}
/>
</div>
</motion.div>
</section>
);
}
+30
View File
@@ -0,0 +1,30 @@
"use client";
import { motion } from "framer-motion";
import { Heart } from "lucide-react";
import Link from "next/link";
export default function Footer() {
return (
<motion.footer
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.6, ease: "easeOut" }}
className="w-full bg-[#18181b] py-6 text-center text-sm text-amber-50/80"
>
<div className="mx-auto flex max-w-7xl flex-col items-center gap-2 px-4">
<p>
© 2025 Aystone Instance Cobble Projet non affilié à Mojang/Microsoft
</p>
<p className="flex items-center gap-1">
Réalisé avec
<Heart size={14} className="text-red-500" aria-label="coeur" />
par
<Link href="https://ultralion.xyz" className="font-semibold text-indigo-400 hover:underline">
UltraLion
</Link>
</p>
</div>
</motion.footer>
);
}
+59
View File
@@ -0,0 +1,59 @@
"use client";
import { motion } from "framer-motion";
import Link from "next/link";
export default function MapsClient() {
return (
<section className="mx-auto max-w-7xl px-4 py-10">
<motion.h1
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
className="text-3xl font-bold text-red-500"
>
Carte dynamique de linstance
</motion.h1>
<motion.p
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.2 }}
className="mt-2 text-amber-50/80"
>
Explore la carte interactive ci-dessous ou ouvre-la dans un nouvel onglet.
</motion.p>
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4 }}
className="mt-6 flex justify-end"
>
<Link
href="https://maps.aystone.fr/cobble"
target="_blank"
rel="noopener noreferrer"
className="inline-block rounded bg-indigo-600 px-4 py-2 text-sm font-medium hover:bg-indigo-700 transition"
>
Ouvrir la carte dans un nouvel onglet
</Link>
</motion.div>
<motion.div
initial={{ opacity: 0, scale: 0.98 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: 0.6, duration: 0.4 }}
className="mt-4 relative w-full pb-[56.25%] overflow-hidden rounded-2xl border border-white/10"
>
<iframe
src="https://maps.aystone.fr/cobble"
className="absolute top-0 left-0 w-full h-full"
allowFullScreen
loading="lazy"
title="Carte Aystone Cobble"
/>
</motion.div>
</section>
);
}
+23
View File
@@ -0,0 +1,23 @@
"use client";
import { motion } from "framer-motion";
export default function McSplash() {
return (
<motion.span
initial={{ scale: 0, rotate: -15 }}
animate={{ scale: 1, rotate: -15 }}
transition={{ type: "spring", stiffness: 220, damping: 12, delay: 0.3 }}
className="
pointer-events-none absolute left-4
top-1/2 -translate-y-1/2
-rotate-[3deg]
select-none whitespace-nowrap
text-[clamp(12px,3vw,18px)] font-extrabold italic
text-yellow-300 drop-shadow-[2px_2px_0_#000]
"
>
Instance&nbsp;Cobble
</motion.span>
);
}
+26
View File
@@ -0,0 +1,26 @@
"use client";
import RedstoneParticles from "@/components/RedstoneParticles";
import { motion } from "framer-motion";
export default function MotionHeading() {
return (
<motion.section
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.35, ease: "easeOut", delay: 0.2 }}
className="flex justify-center py-8"
>
<span className="relative inline-block">
<h2
className="text-4xl sm:text-5xl font-extrabold leading-snug pb-1
bg-gradient-to-r from-red-600 via-orange-500 to-red-600
bg-clip-text text-transparent"
>
Tableau des projets
</h2>
<RedstoneParticles className="absolute inset-0" density={15} maxRadius={2} />
</span>
</motion.section>
);
}
+186
View File
@@ -0,0 +1,186 @@
/* components/Navbar.tsx */
"use client";
import McSplash from "@/components/McSplash";
import RedstoneParticles from "@/components/RedstoneParticles";
import { AnimatePresence, motion } from "framer-motion";
import {
BookOpen,
Home,
Info,
MapPin,
Megaphone,
Menu,
X,
} from "lucide-react";
import { signIn, signOut, useSession } from "next-auth/react";
import Image from "next/image";
import Link from "next/link";
import { useEffect, useState } from "react";
const navLinks = [
{ name: "Accueil", href: "/", Icon: Home },
{ name: "Wiki Aystone", href: "https://wiki.aystone.fr", Icon: BookOpen },
{ name: "BlueMap", href: "/maps", Icon: MapPin },
{ name: "Espace Publicitaire", href: "/ads", Icon: Megaphone },
{ name: "Outils", href: "/outils", Icon: Info },
{ name: "À Propos", href: "/a-propos", Icon: Info },
];
export default function Navbar() {
const { data: session } = useSession();
const [open, setOpen] = useState(false);
const [scrolled, setScrolled] = useState(false);
useEffect(() => {
const onScroll = () => {
setScrolled(window.scrollY > 10);
};
window.addEventListener("scroll", onScroll);
return () => window.removeEventListener("scroll", onScroll);
}, []);
return (
<header
className={`sticky top-0 z-50 text-amber-50 transition-all duration-300 ${
scrolled
? "bg-[#18181b]/80 backdrop-blur-md shadow-md"
: "bg-[#18181b]"
}`}
>
<nav className="mx-auto flex max-w-7xl items-center justify-between px-4 py-3">
<div className="min-w-[130px]">
<McSplash />
</div>
<Link href="/" className="flex items-center gap-2 relative">
<Image
src="/aystone.png"
alt="Logo Aystone"
width={32}
height={32}
priority
/>
<span className="text-red-600 relative font-extrabold text-lg flex items-center gap-1">
Aystone
<RedstoneParticles
className="absolute -left-1 top-0 h-full w-full z-0"
density={15}
maxRadius={2}
/>
</span>
</Link>
<ul className="hidden md:flex items-center gap-6 text-sm">
{navLinks.map(({ name, href, Icon }) => (
<li key={name} className="flex items-center gap-1">
<Icon size={14} aria-hidden="true" />
<Link href={href} className="hover:text-red-400">
{name}
</Link>
</li>
))}
</ul>
{!session ? (
<button
onClick={() => signIn("discord", { callbackUrl: "/dashboard" })}
className="rounded-full bg-gradient-to-r from-indigo-500 to-violet-600 px-4 py-2 text-sm font-medium shadow hover:opacity-90"
>
Se connecter
</button>
) : (
<div className="hidden md:flex items-center gap-3">
{session.user?.image && (
<Image
src={session.user.image}
alt={session.user.name ?? "avatar"}
width={32}
height={32}
className="rounded-full"
/>
)}
<Link
href="/dashboard"
className="rounded-full bg-green-600 px-4 py-2 text-sm font-medium hover:bg-green-700"
>
Dashboard
</Link>
<button
onClick={() => signOut({ callbackUrl: "/" })}
className="rounded-full bg-red-600 px-3 py-2 text-sm font-medium hover:bg-red-700"
>
Déconnexion
</button>
</div>
)}
<button
className="md:hidden flex items-center"
onClick={() => setOpen((p) => !p)}
>
{open ? <X size={24} /> : <Menu size={24} />}
</button>
</nav>
<AnimatePresence>
{open && (
<motion.ul
initial={{ y: -10, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: -10, opacity: 0 }}
transition={{ duration: 0.25 }}
className="md:hidden flex flex-col gap-4 bg-[#0e0e10] px-6 pb-6"
>
{navLinks.map(({ name, href, Icon }) => (
<li
key={name}
className="flex items-center gap-2 border-b border-white/10 py-2"
>
<Icon size={16} aria-hidden="true" />
<Link href={href} onClick={() => setOpen(false)}>
{name}
</Link>
</li>
))}
{!session ? (
<li>
<button
onClick={() =>
signIn("discord", { callbackUrl: "/dashboard" })
}
className="w-full rounded-md bg-indigo-600 py-2 text-sm font-medium"
>
Se connecter
</button>
</li>
) : (
<>
<li>
<Link
href="/dashboard"
onClick={() => setOpen(false)}
className="block w-full rounded-md bg-green-600 py-2 text-center text-sm font-medium"
>
Dashboard
</Link>
</li>
<li>
<button
onClick={() => signOut({ callbackUrl: "/" })}
className="w-full rounded-md bg-red-600 py-2 text-sm font-medium"
>
Déconnexion
</button>
</li>
</>
)}
</motion.ul>
)}
</AnimatePresence>
</header>
);
}
+84
View File
@@ -0,0 +1,84 @@
"use client";
import { motion } from "framer-motion";
import { BookText, ExternalLink, Map, Users, Wrench } from "lucide-react";
const outils = [
{
label: "Wiki Aystone",
href: "https://wiki.aystone.fr/",
icon: Map,
description: "Wiki du serveur Minecraft Aystone.",
},
{
label: "DynMap",
href: "/maps",
icon: Map,
description: "Carte dynamique de l'instance Cobble.",
},
{
label: "Liste Colorants Minecraft",
href: "/couleurs",
icon: BookText,
description: "Charte des couleurs Minecraft pour les colorants.",
},
{
label: "Dashboard",
href: "/dashboard",
icon: BookText,
description: "Tableau de bord pour gérer vos projets.",
},
{
label: "Discord d'Aypierre",
href: "https://discord.gg/aypierre",
icon: Users,
description: "Rejoignez la communauté d'aypierre pour discuter avec nous ! :)",
},
{
label: "Espace Publicitaire",
href: "/ads",
icon: Users,
description: "Espace des publicités (Merci Terrone1 pour les pubs :p)",
},
];
export default function OutilsPage() {
return (
<div className="min-h-screen bg-[#0e0e10] text-amber-50 px-4 sm:px-8 py-12">
<motion.div
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
>
<h1 className="text-center text-4xl sm:text-5xl font-extrabold mb-14 flex items-center justify-center gap-3 text-amber-50">
<Wrench className="text-red-500" size={36} />
Outils & Liens Utiles
</h1>
</motion.div>
<div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto">
{outils.map((outil, i) => (
<motion.a
key={outil.label}
href={outil.href}
target={outil.href.startsWith("http") ? "_blank" : "_self"}
rel="noopener noreferrer"
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: i * 0.1, duration: 0.4 }}
className="bg-[#1a1c2a] hover:bg-[#252735] border border-white/10 hover:border-red-500 transition-colors rounded-2xl p-5 flex flex-col gap-3 shadow-lg group"
>
<div className="flex items-center gap-2 text-red-400">
<outil.icon size={22} className="group-hover:text-red-400 transition" />
<span className="text-lg font-semibold text-blue-400 group-hover:underline flex items-center gap-1">
{outil.label}
<ExternalLink size={14} />
</span>
</div>
<p className="text-sm text-amber-50/70">{outil.description}</p>
</motion.a>
))}
</div>
</div>
);
}
+255
View File
@@ -0,0 +1,255 @@
"use client";
import { motion } from "framer-motion";
import {
AlignLeft,
BadgeCheck,
Check,
Copy,
FileText,
Globe,
MapPin,
Tag,
User,
} from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useMemo, useState } from "react";
export type Project = {
id?: string;
joueur: string;
etat: "En cours" | "Terminé" | "Pause";
monde: "Overworld" | "Nether" | "End";
projet: string;
description: string;
coords: string;
tags: string[];
};
export default function ProjectTable({
data,
hidePlayerFilter = false,
}: {
data: Project[];
hidePlayerFilter?: boolean;
}) {
const [copied, setCopied] = useState<number | null>(null);
const [search, setSearch] = useState("");
const [etat, setEtat] = useState("");
const [monde, setMonde] = useState("");
const [joueur, setJoueur] = useState("");
const filtered = useMemo(() => {
return data.filter((p) => {
const matchesSearch = p.projet.toLowerCase().includes(search.toLowerCase());
const matchesEtat = etat ? p.etat === etat : true;
const matchesMonde = monde ? p.monde === monde : true;
const matchesJoueur = hidePlayerFilter ? true : joueur ? p.joueur === joueur : true;
return matchesSearch && matchesEtat && matchesMonde && matchesJoueur;
});
}, [data, search, etat, monde, joueur, hidePlayerFilter]);
const joueurs = [...new Set(data.map((p) => p.joueur))];
const etats = ["En cours", "Terminé", "Pause"];
const mondes = ["Overworld", "Nether", "End"];
const headers = [
{ label: "Joueur", icon: User },
{ label: "État", icon: BadgeCheck },
{ label: "Monde", icon: Globe },
{ label: "Projet", icon: FileText },
{ label: "Description", icon: AlignLeft },
{ label: "Coordonnées", icon: MapPin },
{ label: "Tags", icon: Tag },
];
function resolveWorldId(monde: Project["monde"]): string {
switch (monde) {
case "Overworld":
return "world";
case "Nether":
return "world_nether";
case "End":
return "world_the_end";
default:
return "world"; // fallback
}
}
if (!data.length) {
return <p className="mt-8 text-center text-amber-50/60">Aucun projet enregistré pour le moment.</p>;
}
return (
<div className="w-full overflow-x-auto px-2 sm:px-4 py-8">
<div className="max-w-7xl mx-auto">
<div className="mb-4 flex flex-wrap gap-2 items-center">
<input
type="text"
placeholder="Rechercher un projet..."
value={search}
onChange={(e) => setSearch(e.target.value)}
className="rounded-md border border-white/20 bg-white/10 px-3 py-1 text-sm text-amber-50 placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-orange-500"
/>
{!hidePlayerFilter && (
<select
value={joueur}
onChange={(e) => setJoueur(e.target.value)}
className="rounded-md bg-slate-800 text-amber-50 px-3 py-1 text-sm"
>
<option value="">Tous les joueurs</option>
{joueurs.map((j) => (
<option key={j} value={j}>{j}</option>
))}
</select>
)}
<select
value={etat}
onChange={(e) => setEtat(e.target.value)}
className="rounded-md bg-slate-800 text-amber-50 px-3 py-1 text-sm"
>
<option value="">Tous les états</option>
{etats.map((e) => (
<option key={e} value={e}>{e}</option>
))}
</select>
<select
value={monde}
onChange={(e) => setMonde(e.target.value)}
className="rounded-md bg-slate-800 text-amber-50 px-3 py-1 text-sm"
>
<option value="">Tous les mondes</option>
{mondes.map((m) => (
<option key={m} value={m}>{m}</option>
))}
</select>
</div>
<div className="overflow-auto rounded-xl border border-white/10">
<table className="min-w-[1100px] w-full text-sm text-amber-50">
<thead className="bg-slate-800 text-amber-50">
<tr>
{headers.map(({ label, icon: Icon }) => (
<th key={label} className="px-4 py-3 text-left font-semibold whitespace-nowrap">
<div className="flex items-center gap-1">
<Icon size={14} className="opacity-70" />
{label}
</div>
</th>
))}
</tr>
</thead>
<tbody>
{filtered.map((p, i) => (
<tr key={p.id ?? i} className="border-t border-white/10 hover:bg-white/5">
<Td>
<div className="flex items-center gap-2">
<Image
src={`https://mc-heads.net/avatar/${p.joueur}/20`}
alt=""
width={20}
height={20}
unoptimized
className="rounded"
onError={(e) => ((e.target as HTMLImageElement).style.display = "none")}
/>
{hidePlayerFilter ? (
<span className="text-amber-50/80">{p.joueur}</span>
) : (
<Link
href={`/user/${p.joueur}`}
className="text-blue-400 hover:underline hover:text-blue-300 transition"
>
{p.joueur}
</Link>
)}
</div>
</Td>
<Td><EtatBadge v={p.etat} /></Td>
<Td><MondeBadge v={p.monde} /></Td>
<Td className="font-medium">{p.projet}</Td>
<Td>
<div className="max-h-[100px] overflow-auto whitespace-pre-line text-amber-50/80 break-words">
{p.description}
</div>
</Td>
<Td>
<div className="flex justify-between items-start gap-2 whitespace-nowrap">
<div className="flex flex-col gap-1">
<span className="font-mono tabular-nums">{p.coords}</span>
{p.coords && (
<a
href={`https://maps.aystone.fr/cobble/#${resolveWorldId(p.monde)}:${p.coords.replace(/ /g, ":")}:1500:0:0:0:0:free`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex justify-center items-center w-[70px] text-[11px] font-medium rounded-full px-2 py-0.5 border border-blue-500 text-blue-400 hover:bg-blue-500/10 transition"
>
DynMap
</a>
)}
</div>
<motion.button
whileTap={{ scale: 0.9 }}
onClick={() => {
navigator.clipboard.writeText(p.coords);
setCopied(i);
setTimeout(() => setCopied(null), 1200);
}}
className="grid h-7 w-7 flex-shrink-0 place-items-center rounded bg-white/10 hover:bg-white/20"
>
{copied === i ? (
<Check size={16} className="text-green-400" />
) : (
<Copy size={14} />
)}
</motion.button>
</div>
</Td>
<Td>
<div className="flex gap-1 overflow-x-auto max-w-xs whitespace-nowrap pr-1">
{p.tags.map((t, idx) => <TagBadge key={t + idx} v={t} />)}
</div>
</Td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
);
}
function Td({ children }: { children: React.ReactNode }) {
return <td className="px-4 py-3 align-top">{children}</td>;
}
function EtatBadge({ v }: { v: Project["etat"] }) {
const cls = v === "En cours"
? "bg-yellow-400/90 text-black"
: v === "Terminé"
? "bg-green-600/90"
: "bg-red-600/90";
return <span className={`rounded-full px-2 py-0.5 text-[11px] font-medium whitespace-nowrap ${cls}`}>{v}</span>;
}
function MondeBadge({ v }: { v: Project["monde"] }) {
const map = {
Overworld: "bg-emerald-700/80",
Nether: "bg-red-700/80",
End: "bg-violet-800/90",
} as const;
return <span className={`rounded-full px-2 py-0.5 text-[11px] ${map[v]}`}>{v}</span>;
}
function TagBadge({ v }: { v: string }) {
const palette: Record<string, string> = {
spawn: "bg-fuchsia-700/90",
build: "bg-emerald-700/90",
usine: "bg-orange-600/90",
};
return <span className={`rounded-full px-2 py-0.5 text-[11px] ${palette[v] ?? "bg-slate-800/70"}`}>{v}</span>;
}
+171
View File
@@ -0,0 +1,171 @@
"use client";
import { useEffect, useRef } from "react";
interface RedstoneParticlesProps {
className?: string;
density?: number;
maxRadius?: number;
}
class Star {
context: CanvasRenderingContext2D;
areaWidth: number;
areaHeight: number;
position: { x: number; y: number };
speed: { x: number; y: number };
radius: number;
alpha: number;
alphaSpeed: number;
rgb: string[];
selectedColor: number;
color: string;
constructor(args: {
context: CanvasRenderingContext2D;
areaWidth: number;
areaHeight: number;
x?: number;
y?: number;
speedX?: number;
speedY?: number;
radius: number;
alpha?: number;
alphaSpeed?: number;
}) {
this.context = args.context;
this.areaWidth = args.areaWidth;
this.areaHeight = args.areaHeight;
this.position = {
x: args.x ?? Math.random() * this.areaWidth,
y: args.y ?? Math.random() * this.areaHeight,
};
this.speed = {
x: args.speedX ?? Math.random() * 0.003 - 0.0015,
y: args.speedY ?? Math.random() * 0.003 - 0.0015,
};
this.radius = Math.ceil(Math.random() * args.radius) || 2;
this.alpha = args.alpha ?? Math.random() * 0.5 + 0.5;
this.alphaSpeed = args.alphaSpeed ?? (Math.random() * 0.04 - 0.02);
this.rgb = ["255,0,0", "255,50,50", "200,0,0", "255,80,80"];
this.selectedColor = Math.floor(Math.random() * this.rgb.length);
this.color = `rgba(${this.rgb[this.selectedColor]},${this.alpha})`;
}
draw() {
this.updateCoords();
this.updateAlpha();
this.context.beginPath();
this.context.fillStyle = this.color;
this.context.rect(this.position.x, this.position.y, this.radius, this.radius);
this.context.fill();
this.context.closePath();
}
updateCoords() {
this.position.x += this.speed.x;
this.position.y -= this.speed.y;
if (this.position.x > this.areaWidth + this.radius) this.position.x = 0 - this.radius;
if (this.position.y > this.areaHeight + this.radius) this.position.y = 0 - this.radius;
if (this.position.x < 0 - this.radius) this.position.x = this.areaWidth + this.radius;
if (this.position.y < 0 - this.radius) this.position.y = this.areaHeight + this.radius;
}
updateAlpha() {
this.alpha += this.alphaSpeed;
if (this.alpha >= 1 || this.alpha <= 0) this.alphaSpeed = -this.alphaSpeed;
this.color = `rgba(${this.rgb[this.selectedColor]},${this.alpha})`;
}
}
class Starfield {
canvas: HTMLCanvasElement;
ctx: CanvasRenderingContext2D;
width: number;
height: number;
stars: Star[];
totalStars: number;
maxRadius: number;
constructor(canvas: HTMLCanvasElement, totalStars = 100, maxRadius = 3) {
this.canvas = canvas;
this.ctx = canvas.getContext("2d")!;
this.width = 0;
this.height = 0;
this.stars = [];
this.totalStars = totalStars;
this.maxRadius = maxRadius;
this.resize();
this.setStars();
}
resize() {
this.width = this.canvas.clientWidth;
this.height = this.canvas.clientHeight;
this.canvas.width = this.width * window.devicePixelRatio;
this.canvas.height = this.height * window.devicePixelRatio;
this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
}
setStars() {
this.stars = [];
for (let i = 0; i < this.totalStars; i++) {
this.stars.push(
new Star({
context: this.ctx,
areaWidth: this.width,
areaHeight: this.height,
radius: this.maxRadius,
})
);
}
}
render() {
this.ctx.clearRect(0, 0, this.width, this.height);
this.stars.forEach((star) => star.draw());
}
}
export default function RedstoneParticles({ className = "", density = 60, maxRadius = 2 }: RedstoneParticlesProps) {
const canvasRef = useRef<HTMLCanvasElement>(null);
const starfieldRef = useRef<Starfield | null>(null);
const animationFrameRef = useRef<number | null>(null);
useEffect(() => {
if (!canvasRef.current) return;
starfieldRef.current = new Starfield(canvasRef.current, density, maxRadius);
const handleResize = () => {
starfieldRef.current?.resize();
starfieldRef.current?.setStars();
};
window.addEventListener("resize", handleResize);
const animate = () => {
starfieldRef.current?.render();
animationFrameRef.current = requestAnimationFrame(animate);
};
animate();
return () => {
window.removeEventListener("resize", handleResize);
if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current);
};
}, [density, maxRadius]);
return (
<canvas
ref={canvasRef}
className={className}
style={{
position: "absolute",
width: "100%",
height: "100%",
top: 0,
left: 0,
pointerEvents: "none",
zIndex: 0,
}}
/>
);
}
+16
View File
@@ -0,0 +1,16 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
];
export default eslintConfig;
+10
View File
@@ -0,0 +1,10 @@
import fs from "node:fs/promises";
import path from "node:path";
const IMG_EXT = /\.(png|jpe?g|gif|webp|avif|svg)$/i;
export async function getAdFiles(): Promise<string[]> {
const dir = path.join(process.cwd(), "public", "ads");
const files = await fs.readdir(dir);
return files.filter((f) => IMG_EXT.test(f));
}
+13
View File
@@ -0,0 +1,13 @@
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: ["error", "warn"],
});
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
+15
View File
@@ -0,0 +1,15 @@
import { z } from "zod";
export const projectSchema = z.object({
id: z.string().uuid(),
joueur: z.string(),
projet: z.string(),
description: z.string(),
coords: z.string().nullable(),
etat: z.enum(["En cours", "Terminé", "Pause"]),
monde: z.enum(["Overworld", "Nether", "End"]),
tags: z.array(z.string()),
createdAt: z.date().or(z.string().transform((s) => new Date(s))),
});
export type SafeProject = z.infer<typeof projectSchema>;
+23
View File
@@ -0,0 +1,23 @@
import { auth } from "@/auth";
import { NextResponse } from "next/server";
export default auth((req) => {
const { pathname } = req.nextUrl;
if (pathname.startsWith("/dashboard") && !req.auth) {
return Response.redirect(
new URL("/api/auth/signin?callbackUrl=/dashboard", req.url)
);
}
const res = NextResponse.next();
res.headers.set("X-Frame-Options", "DENY");
res.headers.set("Content-Security-Policy", "frame-ancestors 'none';");
return res;
});
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};
+30
View File
@@ -0,0 +1,30 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "cdn.discordapp.com",
},
{
protocol: "https",
hostname: "mc-heads.net",
},
],
},
async redirects() {
return [
{
source: "/@:username",
destination: "/user/:username",
permanent: true,
},
];
},
typescript: {
ignoreBuildErrors: true,
},
};
export default nextConfig;
+7704
View File
File diff suppressed because it is too large Load Diff
+38
View File
@@ -0,0 +1,38 @@
{
"name": "aystone",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@auth/prisma-adapter": "^2.10.0",
"@headlessui/react": "^2.2.6",
"@prisma/client": "^6.12.0",
"@tailwindcss/postcss": "^4.1.11",
"auth": "^1.2.3",
"framer-motion": "^12.23.9",
"lucide-react": "^0.526.0",
"next": "15.5.7",
"next-auth": "^5.0.0-beta.29",
"postcss": "^8.5.6",
"react": "19.1.2",
"react-dom": "19.1.2",
"sonner": "^2.0.6",
"tailwindcss": "^4.1.11",
"zod": "^4.0.10"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.5.7",
"prisma": "^6.12.0",
"typescript": "^5"
}
}
+5019
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;
@@ -0,0 +1,82 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT,
"email" TEXT,
"emailVerified" TIMESTAMP(3),
"image" TEXT,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"providerAccountId" TEXT NOT NULL,
"refresh_token" TEXT,
"access_token" TEXT,
"expires_at" INTEGER,
"id_token" TEXT,
"scope" TEXT,
"token_type" TEXT,
"session_state" TEXT,
"oauth_token_secret" TEXT,
"oauth_token" TEXT,
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"sessionToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);
-- CreateTable
CREATE TABLE "Post" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"authorId" TEXT NOT NULL,
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[mcName]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterTable
ALTER TABLE "User" ADD COLUMN "mcName" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "User_mcName_key" ON "User"("mcName");
@@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "Project" (
"id" TEXT NOT NULL,
"joueur" TEXT NOT NULL,
"etat" TEXT NOT NULL,
"monde" TEXT NOT NULL,
"projet" TEXT NOT NULL,
"description" TEXT NOT NULL,
"coords" TEXT NOT NULL,
"tags" TEXT[] DEFAULT ARRAY[]::TEXT[],
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Project_pkey" PRIMARY KEY ("id")
);
@@ -0,0 +1,15 @@
-- CreateTable
CREATE TABLE "Availability" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"slots" TEXT[],
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Availability_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Availability_userId_key" ON "Availability"("userId");
-- AddForeignKey
ALTER TABLE "Availability" ADD CONSTRAINT "Availability_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,23 @@
/*
Warnings:
- You are about to drop the column `slots` on the `Availability` table. All the data in the column will be lost.
- Added the required column `day` to the `Availability` table without a default value. This is not possible if the table is not empty.
- Added the required column `fromHour` to the `Availability` table without a default value. This is not possible if the table is not empty.
- Added the required column `toHour` to the `Availability` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Availability" DROP CONSTRAINT "Availability_userId_fkey";
-- DropIndex
DROP INDEX "Availability_userId_key";
-- AlterTable
ALTER TABLE "Availability" DROP COLUMN "slots",
ADD COLUMN "day" INTEGER NOT NULL,
ADD COLUMN "fromHour" INTEGER NOT NULL,
ADD COLUMN "toHour" INTEGER NOT NULL;
-- AddForeignKey
ALTER TABLE "Availability" ADD CONSTRAINT "Availability_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
+95
View File
@@ -0,0 +1,95 @@
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
/// ---- NextAuth standard models ----
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
mcName String? @unique
accounts Account[]
sessions Session[]
posts Post[]
availability Availability[]
}
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?
id_token String? @db.Text
scope String?
token_type String?
session_state String?
oauth_token_secret String?
oauth_token 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])
}
/// ---- Example custom model ----
model Post {
id String @id @default(cuid())
title String
content String?
createdAt DateTime @default(now())
authorId String
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
}
model Project {
id String @id @default(cuid())
joueur String
etat String
monde String
projet String
description String
coords String?
tags String[] @default([])
createdAt DateTime @default(now())
}
model Availability {
id String @id @default(cuid())
userId String
day Int // 0 = Lundi … 6 = Dimanche
fromHour Int // 023
toHour Int // 023, > fromHour
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

+42
View File
@@ -0,0 +1,42 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": [
"./*"
]
}
},
"include": [
"next-env.d.ts",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
+16
View File
@@ -0,0 +1,16 @@
import "next-auth";
declare module "next-auth" {
interface Session {
user: {
id: string;
name?: string | null;
email?: string | null;
image?: string | null;
};
}
interface User {
id: string;
}
}