admin build v3
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
export const dynamic = 'force-dynamic';
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import Sidebar from "@/components/Sidebar";
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "AfroAdmin - Administration Afrohub",
|
||||
@@ -15,9 +19,11 @@ export default function RootLayout({
|
||||
}>) {
|
||||
return (
|
||||
<html lang="fr">
|
||||
<body>
|
||||
<body className={inter.className}>
|
||||
<div className="flex min-h-screen">
|
||||
<Sidebar />
|
||||
<main className="admin-content flex-1">
|
||||
<Toaster position="top-right" />
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
"use client";
|
||||
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
@@ -5,14 +6,18 @@ import { LayoutDashboard, ArrowLeft } from 'lucide-react';
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-950 flex items-center justify-center p-6">
|
||||
<div className="max-w-md w-full text-center">
|
||||
<div className="mb-8">
|
||||
<div className="inline-flex items-center justify-center w-20 h-20 rounded-2xl bg-indigo-500/10 border border-indigo-500/20 mb-6">
|
||||
<span className="text-4xl font-bold text-indigo-400">404</span>
|
||||
<div className="min-h-screen bg-slate-950 flex items-center justify-center p-4">
|
||||
<div className="max-w-md w-full text-center space-y-8">
|
||||
<div className="relative">
|
||||
<h1 className="text-[150px] font-black text-slate-900 leading-none select-none">404</h1>
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<span className="text-4xl font-bold text-white tracking-widest uppercase">Perdu ?</span>
|
||||
</div>
|
||||
<h1 className="text-3xl font-bold text-white mb-2">Page d'administration introuvable</h1>
|
||||
<p className="text-slate-400">La ressource que vous recherchez n'existe pas ou a été déplacée.</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-2xl font-bold text-white">Cette page n'existe pas</h2>
|
||||
<p className="text-slate-400">Le contenu que vous recherchez semble avoir été déplacé ou supprimé.</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
@@ -23,13 +28,13 @@ export default function NotFound() {
|
||||
<LayoutDashboard className="w-5 h-5" />
|
||||
Retour au Dashboard
|
||||
</Link>
|
||||
<Link
|
||||
href="/dashboard"
|
||||
<button
|
||||
onClick={() => window.history.back()}
|
||||
className="w-full flex items-center justify-center gap-2 px-6 py-3 bg-slate-900 text-slate-300 border border-slate-800 rounded-xl font-semibold hover:bg-slate-800 transition-colors"
|
||||
>
|
||||
<ArrowLeft className="w-5 h-5" />
|
||||
Page précédente
|
||||
</Link>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default function Home() {
|
||||
redirect("/dashboard");
|
||||
|
||||
@@ -2,16 +2,13 @@ import { PrismaClient } from '@prisma/client'
|
||||
import { PrismaPg } from '@prisma/adapter-pg'
|
||||
import pg from 'pg'
|
||||
|
||||
const globalForPrisma = globalThis as unknown as { prisma_v4: PrismaClient }
|
||||
const globalForPrisma = globalThis as unknown as { prisma_v4?: PrismaClient }
|
||||
|
||||
function makePrisma() {
|
||||
function createPrismaClient() {
|
||||
const connectionString = process.env.DATABASE_URL
|
||||
|
||||
if (!connectionString && process.env.NODE_ENV === 'production') {
|
||||
// If we're in production build and DATABASE_URL is missing,
|
||||
// we return a proxy or a dummy to avoid crashing the build worker
|
||||
// if it just evaluates the module.
|
||||
console.warn("DATABASE_URL is missing. Prisma Client might fail if called.");
|
||||
console.warn("DATABASE_URL is missing during build.");
|
||||
}
|
||||
|
||||
const pool = new pg.Pool({ connectionString: connectionString || "" })
|
||||
@@ -19,8 +16,13 @@ function makePrisma() {
|
||||
return new PrismaClient({ adapter })
|
||||
}
|
||||
|
||||
export const prisma = globalForPrisma.prisma_v4 || makePrisma()
|
||||
export const prisma = new Proxy({} as PrismaClient, {
|
||||
get(target, prop) {
|
||||
if (!globalForPrisma.prisma_v4) {
|
||||
globalForPrisma.prisma_v4 = createPrismaClient();
|
||||
}
|
||||
return (globalForPrisma.prisma_v4 as any)[prop];
|
||||
}
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma_v4 = prisma
|
||||
|
||||
export default prisma
|
||||
export default prisma;
|
||||
|
||||
Reference in New Issue
Block a user