feat: ajout sitemap, api et components

This commit is contained in:
2025-11-25 05:43:26 +01:00
parent da613c822a
commit 5a7cf45d98
29 changed files with 3339 additions and 34 deletions
+206
View File
@@ -0,0 +1,206 @@
import { NextResponse } from "next/server";
import nodemailer from "nodemailer";
// Fonction pour vérifier le token Turnstile
async function verifyTurnstileToken(token: string): Promise<boolean> {
const response = await fetch(
"https://challenges.cloudflare.com/turnstile/v0/siteverify",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
secret: process.env.TURNSTILE_SECRET_KEY,
response: token,
}),
}
);
const data = await response.json();
return data.success;
}
export async function POST(request: Request) {
try {
const { name, email, message, captchaToken } = await request.json();
// Validation
if (!name || !email || !message) {
return NextResponse.json(
{ error: "Tous les champs sont requis" },
{ status: 400 }
);
}
// Vérifier le captcha
if (!captchaToken) {
return NextResponse.json(
{ error: "Captcha requis" },
{ status: 400 }
);
}
const isCaptchaValid = await verifyTurnstileToken(captchaToken);
if (!isCaptchaValid) {
return NextResponse.json(
{ error: "Captcha invalide. Veuillez réessayer." },
{ status: 400 }
);
}
// Configuration du transporteur SMTP
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: parseInt(process.env.SMTP_PORT || "587"),
secure: process.env.SMTP_PORT === "465",
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
},
tls: {
rejectUnauthorized: true,
},
});
// Vérifier la connexion SMTP
await transporter.verify();
// HTML de l'email
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 600px;
margin: 20px auto;
background: white;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 {
margin: 0;
font-size: 24px;
}
.content {
padding: 30px;
}
.info-box {
background: #f8f9fa;
border-left: 4px solid #667eea;
padding: 15px;
margin: 15px 0;
}
.label {
font-weight: bold;
color: #667eea;
margin-bottom: 5px;
}
.message-content {
background: #f8f9fa;
padding: 20px;
border-radius: 5px;
margin-top: 15px;
white-space: pre-wrap;
word-wrap: break-word;
}
.footer {
background: #f8f9fa;
padding: 20px;
text-align: center;
color: #666;
font-size: 12px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>✉️ Nouveau message depuis votre portfolio</h1>
</div>
<div class="content">
<div class="info-box">
<div class="label">👤 Nom</div>
<div>${name}</div>
</div>
<div class="info-box">
<div class="label">📧 Email</div>
<div><a href="mailto:${email}" style="color: #667eea; text-decoration: none;">${email}</a></div>
</div>
<div class="info-box">
<div class="label">💬 Message</div>
<div class="message-content">${message}</div>
</div>
</div>
<div class="footer">
<p>Ce message a été envoyé depuis le formulaire de contact de jessy-david.dev</p>
<p>✅ Captcha vérifié - Message légitime</p>
</div>
</div>
</body>
</html>
`;
const textContent = `
Nouveau message depuis votre portfolio
Nom: ${name}
Email: ${email}
Message:
${message}
---
Pour répondre, envoyez un email à: ${email}
Captcha vérifié
`;
const mailOptions = {
from: process.env.SMTP_FROM,
to: process.env.EMAIL_TO,
replyTo: email,
subject: `💬 Nouveau message de ${name}`,
text: textContent,
html: htmlContent,
};
const info = await transporter.sendMail(mailOptions);
return NextResponse.json({
success: true,
messageId: info.messageId,
});
} catch (error: unknown) {
const errorMessage =
error instanceof Error ? error.message : "Erreur inconnue";
return NextResponse.json(
{
error: "Erreur lors de l'envoi du message",
details:
process.env.NODE_ENV === "development"
? errorMessage
: "Erreur serveur",
},
{ status: 500 }
);
}
}
+94
View File
@@ -1 +1,95 @@
/* globals.css */
@import "tailwindcss";
/* BASE */
html {
scroll-behavior: smooth;
}
/* GRID PATTERNS (Light) */
.grid-wrapper {
min-height: 100%;
width: 100%;
position: relative;
background-color: #f8fafc;
}
.grid-background {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
background-image: linear-gradient(to right, #e2e8f0 1px, transparent 1px),
linear-gradient(to bottom, #e2e8f0 1px, transparent 1px);
background-size: 20px 30px;
-webkit-mask-image: radial-gradient(
ellipse 70% 60% at 50% 0%,
#000 60%,
transparent 100%
);
mask-image: radial-gradient(
ellipse 70% 60% at 50% 0%,
#000 60%,
transparent 100%
);
}
/* GRID PATTERNS (Dark) */
.grid-wrapper-dark {
min-height: 100%;
width: 100%;
position: absolute;
inset: 0;
background-color: #0f172a;
}
.grid-background-dark {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
background-image: linear-gradient(to right, #1e293b 1px, transparent 1px),
linear-gradient(to bottom, #1e293b 1px, transparent 1px);
background-size: 20px 30px;
-webkit-mask-image: radial-gradient(
ellipse 70% 60% at 50% 0%,
#000 60%,
transparent 100%
);
mask-image: radial-gradient(
ellipse 70% 60% at 50% 0%,
#000 60%,
transparent 100%
);
}
/* GRID UTILITY */
.bg-grid-slate-200\/50 {
background-image: linear-gradient(
to right,
rgb(226 232 240 / 0.5) 1px,
transparent 1px
),
linear-gradient(to bottom, rgb(226 232 240 / 0.5) 1px, transparent 1px);
background-size: 100px 100px;
}
/* ANIMATIONS */
.animate-fade-in {
animation: fadeIn 1s ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
+207 -5
View File
@@ -1,10 +1,187 @@
import type { Metadata } from "next";
import Footer from "@/component/layout/Footer";
import NavBar from "@/component/layout/NavBar";
import GridBackground from "@/component/ui/GridBackground";
import type { Metadata, Viewport } from "next";
import { Inter } from "next/font/google";
import { ReactNode } from "react";
import "./globals.css";
const inter = Inter({
subsets: ["latin"],
display: "swap",
variable: "--font-inter",
});
const siteConfig = {
name: "Jessy David",
title: "Jessy David | Développeur Web Full-Stack",
description:
"Développeur Web Full-Stack passionné, spécialisé en React, Next.js et Node.js. Création de sites web modernes, applications web performantes et solutions digitales sur mesure.",
url: "https://jessy-david.dev",
ogImage: "https://jessy-david.dev/og-image.jpg",
author: "Jessy David",
keywords: [
"développeur web",
"développeur full-stack",
"React",
"Next.js",
"Node.js",
"TypeScript",
"JavaScript",
"création site web",
"freelance",
"France",
"portfolio",
"Jessy David",
],
twitterHandle: "@jessydavid",
};
export const metadata: Metadata = {
title: "Portfolio · Jessy David",
description: "Portfolio de Jessy David",
title: {
default: siteConfig.title,
template: `%s | ${siteConfig.name}`,
},
description: siteConfig.description,
keywords: siteConfig.keywords,
authors: [{ name: siteConfig.author, url: siteConfig.url }],
creator: siteConfig.author,
publisher: siteConfig.author,
metadataBase: new URL(siteConfig.url),
alternates: {
canonical: "/",
languages: {
"fr-FR": "/",
},
},
robots: {
index: true,
follow: true,
nocache: false,
googleBot: {
index: true,
follow: true,
noimageindex: false,
"max-video-preview": -1,
"max-image-preview": "large",
"max-snippet": -1,
},
},
openGraph: {
type: "website",
locale: "fr_FR",
url: siteConfig.url,
siteName: siteConfig.name,
title: siteConfig.title,
description: siteConfig.description,
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: `${siteConfig.name} - Portfolio Développeur Web`,
type: "image/jpeg",
},
],
},
twitter: {
card: "summary_large_image",
title: siteConfig.title,
description: siteConfig.description,
creator: siteConfig.twitterHandle,
images: [siteConfig.ogImage],
},
icons: {
icon: [
{ url: "/favicon.ico", sizes: "any" },
{ url: "/favicon-16x16.png", sizes: "16x16", type: "image/png" },
{ url: "/favicon-32x32.png", sizes: "32x32", type: "image/png" },
],
apple: [
{
url: "/apple-touch-icon.png",
sizes: "180x180",
type: "image/png",
},
],
},
manifest: "/site.webmanifest",
category: "technology",
verification: {
google: "ton-code-google-search-console",
},
other: {
"msapplication-TileColor": "#0f172a",
"theme-color": "#0f172a",
},
};
export const viewport: Viewport = {
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "#ffffff" },
{ media: "(prefers-color-scheme: dark)", color: "#0f172a" },
],
width: "device-width",
initialScale: 1,
maximumScale: 5,
userScalable: true,
colorScheme: "dark",
};
const jsonLd = {
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebSite",
"@id": `${siteConfig.url}/#website`,
url: siteConfig.url,
name: siteConfig.name,
description: siteConfig.description,
inLanguage: "fr-FR",
},
{
"@type": "Person",
"@id": `${siteConfig.url}/#person`,
name: siteConfig.name,
url: siteConfig.url,
image: siteConfig.ogImage,
jobTitle: "Développeur Web Full-Stack",
description: siteConfig.description,
sameAs: [
"https://github.com/jessydavid-dev",
"https://linkedin.com/in/jessy-david",
"https://twitter.com/jessydavid",
],
knowsAbout: [
"React",
"Next.js",
"TypeScript",
"Node.js",
"JavaScript",
"Tailwind CSS",
"PostgreSQL",
"MongoDB",
],
},
{
"@type": "ProfilePage",
"@id": `${siteConfig.url}/#profilepage`,
url: siteConfig.url,
name: `Portfolio de ${siteConfig.name}`,
description: siteConfig.description,
mainEntity: { "@id": `${siteConfig.url}/#person` },
inLanguage: "fr-FR",
},
],
};
export default function RootLayout({
@@ -13,8 +190,33 @@ export default function RootLayout({
children: ReactNode;
}>) {
return (
<html lang="fr">
<body className="antialiased">{children}</body>
<html lang="fr" className={inter.variable}>
<head>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossOrigin="anonymous"
/>
<link
rel="dns-prefetch"
href="https://www.google-analytics.com"
/>
</head>
<body className={`${inter.className} antialiased`}>
<GridBackground variant="light" />
<NavBar />
<main id="main-content" className="relative z-10">
{children}
</main>
<Footer />
</body>
</html>
);
}
+13 -4
View File
@@ -1,8 +1,17 @@
import About from "@/component/sections/About";
import Contact from "@/component/sections/Contact";
import Hero from "@/component/sections/Hero";
import Projects from "@/component/sections/Projects";
import Skills from "@/component/sections/Skills";
export default function Page() {
return (
<div className="p-4">
<h1 className="text-2xl font-bold">Jessy David</h1>
<p>Hello World !</p>
</div>
<main className="min-h-screen">
<Hero />
<About />
<Skills />
<Projects />
<Contact />
</main>
);
}
+32
View File
@@ -0,0 +1,32 @@
import { MetadataRoute } from "next";
export default function sitemap(): MetadataRoute.Sitemap {
const baseUrl = "https://jessy-david.dev";
return [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: "monthly",
priority: 1,
},
{
url: `${baseUrl}/#about`,
lastModified: new Date(),
changeFrequency: "monthly",
priority: 0.8,
},
{
url: `${baseUrl}/#projects`,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 0.9,
},
{
url: `${baseUrl}/#contact`,
lastModified: new Date(),
changeFrequency: "yearly",
priority: 0.7,
},
];
}