1. Système d'Analytics (Nouveauté Majeure)

Modèle de Données : Ajout de la table AnalyticsEvent dans prisma/schema.prisma pour suivre les vues de pages, les clics et le temps de rétention (DWELL_TIME).
API Backend : Création de la route app/api/analytics/route.ts pour enregistrer les événements en base de données.
Tracking Client : Création du composant AnalyticsTracker.tsx (intégré dans le layout principal) qui capture automatiquement :
Le changement de page (Page Views).
Les clics sur les boutons et liens importants.
Le temps passé sur chaque page.
2. Intégration Base de Données (PostgreSQL/Prisma)
Fiches Entreprises : Mise à jour de app/directory/[id]/page.tsx pour récupérer les données réelles depuis PostgreSQL via Prisma au lieu d'utiliser les données de test (mockData).
Navigation Dashboard : Correction du bouton "Voir ma fiche" dans le tableau de bord pour qu'il redirige correctement vers le profil public de l'entrepreneur.
3. Administration & Metrics
Nouvelle Application Admin : Initialisation d'un dossier admin/ (application Next.js séparée) destinée à la gestion de la plateforme et à la visualisation des statistiques (Metrics & Analytics).
4. Authentification & Inscription
Nouvelle Page : Création de app/register/page.tsx pour permettre l'inscription des nouveaux utilisateurs.
Gestion de Session : Amélioration de UserProvider.tsx pour une meilleure gestion de l'état utilisateur à travers l'application.
5. Maintenance & Types
Mise à jour des types globaux dans types.ts et rafraîchissement du package-lock.json suite à l'ajout de dépendances.
This commit is contained in:
2026-04-11 22:20:41 +02:00
parent d88ba7c53c
commit b227657f19
100 changed files with 14142 additions and 157 deletions

View File

@@ -0,0 +1,58 @@
"use server";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
export async function createBlogPost(data: {
title: string;
excerpt: string;
content: string;
author: string;
imageUrl: string;
}) {
try {
const post = await prisma.blogPost.create({
data: {
...data,
},
});
revalidatePath("/blog");
return { success: true, data: post };
} catch (error) {
console.error("Failed to create blog post:", error);
return { success: false, error: "Erreur lors de la création de l'article" };
}
}
export async function updateBlogPost(id: string, data: {
title: string;
excerpt: string;
content: string;
author: string;
imageUrl: string;
}) {
try {
const post = await prisma.blogPost.update({
where: { id },
data,
});
revalidatePath("/blog");
return { success: true, data: post };
} catch (error) {
console.error("Failed to update blog post:", error);
return { success: false, error: "Erreur lors de la mise à jour" };
}
}
export async function deleteBlogPost(id: string) {
try {
await prisma.blogPost.delete({
where: { id },
});
revalidatePath("/blog");
return { success: true };
} catch (error) {
console.error("Failed to delete blog post:", error);
return { success: false, error: "Erreur lors de la suppression" };
}
}

View File

@@ -0,0 +1,63 @@
"use server";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
export async function toggleVerification(id: string, currentStatus: boolean) {
try {
await prisma.business.update({
where: { id },
data: { verified: !currentStatus },
});
revalidatePath("/entrepreneurs");
revalidatePath("/dashboard");
return { success: true };
} catch (error) {
console.error("Failed to toggle verification:", error);
return { success: false, error: "Erreur lors de la mise à jour" };
}
}
export async function setFeaturedBusiness(id: string, data: {
founderName: string;
founderImageUrl: string;
keyMetric: string;
}) {
try {
// 1. Reset all others (we only want one entrepreneur of the month)
await prisma.business.updateMany({
where: { isFeatured: true },
data: { isFeatured: false },
});
// 2. Set the new one
await prisma.business.update({
where: { id },
data: {
isFeatured: true,
...data,
},
});
revalidatePath("/entrepreneurs");
revalidatePath("/dashboard");
return { success: true };
} catch (error) {
console.error("Failed to set featured business:", error);
return { success: false, error: "Erreur lors de la mise à jour de l'entrepreneur du mois" };
}
}
export async function removeFeaturedBusiness(id: string) {
try {
await prisma.business.update({
where: { id },
data: { isFeatured: false },
});
revalidatePath("/entrepreneurs");
return { success: true };
} catch (error) {
console.error("Failed to remove featured status:", error);
return { success: false, error: "Erreur lors de la suppression" };
}
}

View File

@@ -0,0 +1,18 @@
"use server";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
export async function deleteComment(id: string) {
try {
await prisma.comment.delete({
where: { id },
});
revalidatePath("/comments");
revalidatePath("/dashboard");
return { success: true };
} catch (error) {
console.error("Failed to delete comment:", error);
return { success: false, error: "Erreur lors de la suppression" };
}
}

View File

@@ -0,0 +1,67 @@
"use server";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
import { InterviewType } from "@prisma/client";
export async function createInterview(data: {
title: string;
guestName: string;
companyName: string;
role: string;
type: InterviewType;
thumbnailUrl: string;
videoUrl?: string;
content?: string;
excerpt: string;
duration?: string;
}) {
try {
const interview = await prisma.interview.create({
data,
});
revalidatePath("/blog");
return { success: true, data: interview };
} catch (error) {
console.error("Failed to create interview:", error);
return { success: false, error: "Erreur lors de la création de l'interview" };
}
}
export async function updateInterview(id: string, data: {
title: string;
guestName: string;
companyName: string;
role: string;
type: InterviewType;
thumbnailUrl: string;
videoUrl?: string;
content?: string;
excerpt: string;
duration?: string;
}) {
try {
const interview = await prisma.interview.update({
where: { id },
data,
});
revalidatePath("/blog");
return { success: true, data: interview };
} catch (error) {
console.error("Failed to update interview:", error);
return { success: false, error: "Erreur lors de la mise à jour" };
}
}
export async function deleteInterview(id: string) {
try {
await prisma.interview.delete({
where: { id },
});
revalidatePath("/blog");
return { success: true };
} catch (error) {
console.error("Failed to delete interview:", error);
return { success: false, error: "Erreur lors de la suppression" };
}
}