Premier commit de la v2 de l'app

This commit is contained in:
UltraLionFr
2025-07-29 05:15:33 +02:00
parent 2f14898357
commit b593c60ab2
67 changed files with 5003 additions and 388 deletions
+80 -33
View File
@@ -1,36 +1,83 @@
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).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
``` ```
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
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. ```
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
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.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [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.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
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.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
+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;
+23
View File
@@ -0,0 +1,23 @@
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-white px-4 py-12 flex flex-col items-center">
<h1 className="text-4xl font-bold mb-6 text-center">
🎨 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-white/60 group-hover:text-white"}
`}
/>
<span
className={`transition ${
active
? "text-red-500"
: "text-white/60 group-hover:text-white"
}`}
>
{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-white/70">{title}</h3>
<p className="mt-2 text-3xl font-semibold text-white">{value}</p>
</motion.div>
);
}
+90
View File
@@ -0,0 +1,90 @@
"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");
await prisma.user.upsert({
where: { email: session.user!.email! },
update: { mcName },
create: {
email: session.user!.email!,
name: session.user!.name,
image: session.user!.image,
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-white 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-white 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-white 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-white 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-white 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-white 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-white" />
</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-white 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-white">
<option>En cours</option>
<option>Terminé</option>
<option>Pause</option>
</select>
<select name="monde" className="input-style bg-gray-700 text-white">
<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-white 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-white">
<Sidebar />
<main className="flex-1 p-6">{children}</main>
</div>
</Providers>
);
}
+45
View File
@@ -0,0 +1,45 @@
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>
</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>
);
}
+77
View File
@@ -0,0 +1,77 @@
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}"
className="input pl-12"
/>
</div>
<button
type="submit"
className="rounded bg-indigo-600 px-4 py-2 text-sm font-medium hover:bg-indigo-700"
>
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-white">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-white/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-white/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-white/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-white/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} />;
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

+9 -40
View File
@@ -1,42 +1,11 @@
:root { @import "tailwindcss";
--background: #ffffff;
--foreground: #171717;
}
@media (prefers-color-scheme: dark) { .input {
:root { @apply w-full rounded-md bg-[#20222e] px-10 py-2.5 text-sm text-white
--background: #0a0a0a; placeholder-white/40 ring-1 ring-white/10 outline-none
--foreground: #ededed; focus:ring-2 focus:ring-indigo-500 transition;
}
}
html,
body {
max-width: 100vw;
overflow-x: hidden;
}
body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
a {
color: inherit;
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
} }
.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)];
}
+18 -20
View File
@@ -1,32 +1,30 @@
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 type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css"; import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Create Next App", title: "Aystone - Instance Cobble",
description: "Generated by create next app", description: "Site communautaire Aystone",
}; };
export default function RootLayout({ export default function RootLayout({
children, children,
}: Readonly<{ }: {
children: React.ReactNode; children: React.ReactNode;
}>) { }) {
return ( return (
<html lang="en"> <html lang="fr">
<body className={`${geistSans.variable} ${geistMono.variable}`}> <body className="bg-[#0e0e10] text-white antialiased">
{children} <AdsSideBanners />
<Providers>
<Navbar />
<main className="min-h-screen">{children}</main>
<Footer />
</Providers>
</body> </body>
</html> </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-white mb-2">404 Page introuvable</h1>
<p className="text-white/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-white 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 />;
}
-167
View File
@@ -1,167 +0,0 @@
.page {
--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);
--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
display: grid;
grid-template-rows: 20px 1fr 20px;
align-items: center;
justify-items: center;
min-height: 100svh;
padding: 80px;
gap: 64px;
font-family: var(--font-geist-sans);
}
@media (prefers-color-scheme: dark) {
.page {
--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);
--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}
.main {
display: flex;
flex-direction: column;
gap: 32px;
grid-row-start: 2;
}
.main ol {
font-family: var(--font-geist-mono);
padding-left: 0;
margin: 0;
font-size: 14px;
line-height: 24px;
letter-spacing: -0.01em;
list-style-position: inside;
}
.main li:not(:last-of-type) {
margin-bottom: 8px;
}
.main code {
font-family: inherit;
background: var(--gray-alpha-100);
padding: 2px 4px;
border-radius: 4px;
font-weight: 600;
}
.ctas {
display: flex;
gap: 16px;
}
.ctas a {
appearance: none;
border-radius: 128px;
height: 48px;
padding: 0 20px;
border: 1px solid transparent;
transition:
background 0.2s,
color 0.2s,
border-color 0.2s;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
line-height: 20px;
font-weight: 500;
}
a.primary {
background: var(--foreground);
color: var(--background);
gap: 8px;
}
a.secondary {
border-color: var(--gray-alpha-200);
min-width: 158px;
}
.footer {
grid-row-start: 3;
display: flex;
gap: 24px;
}
.footer a {
display: flex;
align-items: center;
gap: 8px;
}
.footer img {
flex-shrink: 0;
}
/* Enable hover only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
a.primary:hover {
background: var(--button-primary-hover);
border-color: transparent;
}
a.secondary:hover {
background: var(--button-secondary-hover);
border-color: transparent;
}
.footer a:hover {
text-decoration: underline;
text-underline-offset: 4px;
}
}
@media (max-width: 600px) {
.page {
padding: 32px;
padding-bottom: 80px;
}
.main {
align-items: center;
}
.main ol {
text-align: center;
}
.ctas {
flex-direction: column;
}
.ctas a {
font-size: 14px;
height: 40px;
padding: 0 16px;
}
a.secondary {
min-width: auto;
}
.footer {
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
}
@media (prefers-color-scheme: dark) {
.logo {
filter: invert();
}
}
+28 -92
View File
@@ -1,95 +1,31 @@
import Image from "next/image"; import Banner from "@/components/Banner";
import styles from "./page.module.css"; 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,
}));
export default function Home() {
return ( return (
<div className={styles.page}> <>
<main className={styles.main}> <Banner />
<Image <MotionHeading />
className={styles.logo} <ProjectsTable data={projects} />
src="/next.svg" </>
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol>
<li>
Get started by editing <code>app/page.tsx</code>.
</li>
<li>Save and see your changes instantly.</li>
</ol>
<div className={styles.ctas}>
<a
className={styles.primary}
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className={styles.logo}
src="/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
className={styles.secondary}
>
Read our docs
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org
</a>
</footer>
</div>
); );
} }
+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>;
}
+51
View File
@@ -0,0 +1,51 @@
import { auth } from "@/auth";
import Banner from "@/components/Banner";
import ProjectsTable, { Project } from "@/components/ProjectsTable";
import { prisma } from "@/lib/prisma";
import { notFound, redirect } from "next/navigation";
type Props = {
params: { username: string };
};
export default async function UserProfilePage({ params }: Props) {
const session = await auth();
if (!session) return redirect("/");
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-white text-center">
Projets de <span className="text-yellow-300">{username}</span>
</h1>
{projects.length === 0 ? (
<p className="mt-4 text-white/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);
+105
View File
@@ -0,0 +1,105 @@
"use client";
import { motion } from "framer-motion";
import Image from "next/image";
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[] }) {
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">
<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>
{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="overflow-hidden rounded-xl border border-[#1c2536] bg-[#0b1320] shadow"
>
<div className="relative h-42 w-full">
<Image
src={`/ads/${file}`}
alt={file}
fill
className="object-cover"
sizes="(min-width:1024px) 33vw, (min-width:640px) 50vw, 100vw"
priority
/>
</div>
{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>
)}
<p className="truncate bg-[#0b1320] px-3 py-2 text-center text-xs text-gray-500">
{file}
</p>
</motion.li>
);
})}
</motion.ul>
)}
</section>
</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-white" />
</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-white/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-white/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-white 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: "/cobble",
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-white 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-white">
<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-white/70">{outil.description}</p>
</motion.a>
))}
</div>
</div>
);
}
+241
View File
@@ -0,0 +1,241 @@
"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 },
];
if (!data.length) {
return <p className="mt-8 text-center text-white/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-white 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-white">
<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-white/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-white/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/#world:${p.coords.replace(/ /g, ":")}:1500:0:0:0:0:perspective`}
target="_blank"
rel="noopener noreferrer"
className="inline-block rounded bg-blue-600 px-2 py-0.5 text-[11px] text-white hover:bg-blue-700"
>
Ouvrir 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,
}}
/>
);
}
+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).*)"],
};
+22 -2
View File
@@ -1,7 +1,27 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
/* config options here */ images: {
remotePatterns: [
{
protocol: "https",
hostname: "cdn.discordapp.com",
},
{
protocol: "https",
hostname: "mc-heads.net",
},
],
},
async redirects() {
return [
{
source: "/@:username",
destination: "/user/:username",
permanent: true,
},
];
},
}; };
export default nextConfig; export default nextConfig;
+2339 -24
View File
File diff suppressed because it is too large Load Diff
+16 -3
View File
@@ -9,17 +9,30 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "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.4.4",
"next-auth": "^5.0.0-beta.29",
"postcss": "^8.5.6",
"react": "19.1.0", "react": "19.1.0",
"react-dom": "19.1.0", "react-dom": "19.1.0",
"next": "15.4.4" "sonner": "^2.0.6",
"tailwindcss": "^4.1.11",
"zod": "^4.0.10"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^5", "@eslint/eslintrc": "^3",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
"eslint": "^9", "eslint": "^9",
"eslint-config-next": "15.4.4", "eslint-config-next": "15.4.4",
"@eslint/eslintrc": "^3" "prisma": "^6.12.0",
"typescript": "^5"
} }
} }
+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

-1
View File
@@ -1 +0,0 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 391 B

-1
View File
@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

-1
View File
@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 128 B

-1
View File
@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

Before

Width:  |  Height:  |  Size: 385 B

+2 -2
View File
@@ -22,6 +22,6 @@
"@/*": ["./*"] "@/*": ["./*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": ["next-env.d.ts","next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"] "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;
}
}