feat: implement comprehensive CMS dashboard for managing news, events, interviews, and one-shot pricing plans
This commit is contained in:
@@ -30,7 +30,8 @@ export async function createBlogPost(data: {
|
||||
status: data.status || ContentStatus.PUBLISHED,
|
||||
},
|
||||
});
|
||||
revalidatePath("/blog");
|
||||
revalidatePath("/actualites");
|
||||
revalidatePath("/");
|
||||
return { success: true, id: post.id };
|
||||
} catch (error) {
|
||||
console.error("Failed to create blog post:", error);
|
||||
@@ -62,7 +63,8 @@ export async function updateBlogPost(id: string, data: {
|
||||
tags: data.tags || [],
|
||||
},
|
||||
});
|
||||
revalidatePath("/blog");
|
||||
revalidatePath("/actualites");
|
||||
revalidatePath("/");
|
||||
return { success: true, id: post.id };
|
||||
} catch (error) {
|
||||
console.error("Failed to update blog post:", error);
|
||||
@@ -75,7 +77,8 @@ export async function deleteBlogPost(id: string) {
|
||||
await prisma.blogPost.delete({
|
||||
where: { id },
|
||||
});
|
||||
revalidatePath("/blog");
|
||||
revalidatePath("/actualites");
|
||||
revalidatePath("/");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to delete blog post:", error);
|
||||
64
admin/src/app/actions/approval.ts
Normal file
64
admin/src/app/actions/approval.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { ContentStatus } from "@prisma/client";
|
||||
|
||||
export async function approveBlogPost(id: string) {
|
||||
try {
|
||||
await prisma.blogPost.update({
|
||||
where: { id },
|
||||
data: { status: ContentStatus.PUBLISHED }
|
||||
});
|
||||
revalidatePath("/actualites");
|
||||
revalidatePath("/blog");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to approve blog post:", error);
|
||||
return { success: false, error: "Erreur lors de l'approbation" };
|
||||
}
|
||||
}
|
||||
|
||||
export async function approveEvent(id: string) {
|
||||
try {
|
||||
await prisma.event.update({
|
||||
where: { id },
|
||||
data: { status: ContentStatus.PUBLISHED }
|
||||
});
|
||||
revalidatePath("/actualites");
|
||||
revalidatePath("/evenements");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to approve event:", error);
|
||||
return { success: false, error: "Erreur lors de l'approbation" };
|
||||
}
|
||||
}
|
||||
|
||||
export async function rejectBlogPost(id: string) {
|
||||
try {
|
||||
// We could delete or archive it. Let's archive it.
|
||||
await prisma.blogPost.update({
|
||||
where: { id },
|
||||
data: { status: ContentStatus.ARCHIVED }
|
||||
});
|
||||
revalidatePath("/actualites");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to reject blog post:", error);
|
||||
return { success: false, error: "Erreur lors du rejet" };
|
||||
}
|
||||
}
|
||||
|
||||
export async function rejectEvent(id: string) {
|
||||
try {
|
||||
await prisma.event.update({
|
||||
where: { id },
|
||||
data: { status: ContentStatus.ARCHIVED }
|
||||
});
|
||||
revalidatePath("/actualites");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to reject event:", error);
|
||||
return { success: false, error: "Erreur lors du rejet" };
|
||||
}
|
||||
}
|
||||
40
admin/src/app/actions/one-shot.ts
Normal file
40
admin/src/app/actions/one-shot.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
"use server";
|
||||
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { OneShotType } from "@prisma/client";
|
||||
|
||||
export async function getOneShotPlans() {
|
||||
try {
|
||||
return await prisma.oneShotPlan.findMany({
|
||||
orderBy: { type: 'asc' }
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch one-shot plans:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateOneShotPlan(type: OneShotType, data: {
|
||||
name: string;
|
||||
priceXOF: number;
|
||||
priceEUR: number;
|
||||
description?: string;
|
||||
}) {
|
||||
try {
|
||||
await prisma.oneShotPlan.upsert({
|
||||
where: { type },
|
||||
update: data,
|
||||
create: {
|
||||
type,
|
||||
...data
|
||||
}
|
||||
});
|
||||
revalidatePath("/settings");
|
||||
revalidatePath("/subscription");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Failed to update one-shot plan:", error);
|
||||
return { success: false, error: "Erreur lors de la mise à jour" };
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,8 @@ export async function searchBusinesses(query: string) {
|
||||
id: true,
|
||||
name: true,
|
||||
logoUrl: true,
|
||||
coverUrl: true,
|
||||
description: true,
|
||||
location: true,
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import BlogForm from "@/components/BlogForm";
|
||||
import ActualitesForm from "@/components/ActualitesForm";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export default async function EditBlogPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
export default async function EditActualitesPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
const post = await prisma.blogPost.findUnique({
|
||||
where: { id },
|
||||
@@ -12,5 +12,5 @@ export default async function EditBlogPage({ params }: { params: Promise<{ id: s
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <BlogForm initialData={post} />;
|
||||
return <ActualitesForm initialData={post} />;
|
||||
}
|
||||
5
admin/src/app/actualites/new/page.tsx
Normal file
5
admin/src/app/actualites/new/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import ActualitesForm from "@/components/ActualitesForm";
|
||||
|
||||
export default function NewActualitesPage() {
|
||||
return <ActualitesForm />;
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import Link from 'next/link';
|
||||
import { Plus, BookOpen, Mic2, Trash2, Edit, Calendar, MapPin } from 'lucide-react';
|
||||
import DeleteBlogButton from '@/components/DeleteBlogButton';
|
||||
import { Plus, BookOpen, Mic2, Trash2, Edit, Calendar, MapPin, Clock, ShieldCheck, ShieldAlert } from 'lucide-react';
|
||||
import DeleteActualitesButton from '@/components/DeleteActualitesButton';
|
||||
import DeleteInterviewButton from '@/components/DeleteInterviewButton';
|
||||
import DeleteEventButton from '@/components/DeleteEventButton';
|
||||
import ApproveContentButton from '@/components/ApproveContentButton';
|
||||
|
||||
async function getData() {
|
||||
const posts = await prisma.blogPost.findMany({ orderBy: { createdAt: 'desc' } });
|
||||
@@ -14,25 +15,30 @@ async function getData() {
|
||||
|
||||
const getStatusBadge = (status: string) => {
|
||||
switch (status) {
|
||||
case 'PENDING': return <span className="px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-500 border border-amber-500/20 flex items-center gap-1 w-fit"><Clock className="w-3 h-3" /> EN ATTENTE</span>;
|
||||
case 'DRAFT': return <span className="px-2 py-0.5 rounded-full text-[10px] font-bold bg-slate-500/10 text-slate-400 border border-slate-500/20">BROUILLON</span>;
|
||||
case 'PUBLISHED': return <span className="px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20">PUBLIÉ</span>;
|
||||
case 'ARCHIVED': return <span className="px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20">ARCHIVÉ</span>;
|
||||
case 'ARCHIVED': return <span className="px-2 py-0.5 rounded-full text-[10px] font-bold bg-red-500/10 text-red-400 border border-red-500/20 text-xs tracking-tighter">REJETÉ/ARCHIVÉ</span>;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default async function BlogCMSPage() {
|
||||
export default async function ActualitesCMSPage() {
|
||||
const { posts, interviews, events } = await getData();
|
||||
|
||||
const pendingPosts = posts.filter(p => p.status === 'PENDING');
|
||||
const pendingEvents = events.filter(e => e.status === 'PENDING');
|
||||
const hasPending = pendingPosts.length > 0 || pendingEvents.length > 0;
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="flex justify-between items-end mb-8">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-white mb-2">CMS Blog, Interviews & Événements</h1>
|
||||
<h1 className="text-3xl font-bold text-white mb-2">CMS Actualités, Interviews & Événements</h1>
|
||||
<p className="text-slate-400">Gérez le contenu éditorial et événementiel de la plateforme.</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link href="/blog/new" className="btn-verify flex items-center gap-2 bg-indigo-600">
|
||||
<Link href="/actualites/new" className="btn-verify flex items-center gap-2 bg-indigo-600">
|
||||
<Plus className="w-4 h-4" />
|
||||
Nouvel Article
|
||||
</Link>
|
||||
@@ -47,12 +53,77 @@ export default async function BlogCMSPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* PENDING SUBMISSIONS SECTION */}
|
||||
{hasPending && (
|
||||
<div className="bg-amber-500/5 border border-amber-500/20 rounded-2xl p-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500">
|
||||
<div className="flex items-center gap-3 mb-6">
|
||||
<div className="p-2 bg-amber-500/20 rounded-xl text-amber-500">
|
||||
<ShieldAlert className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="text-xl font-bold text-white">Soumissions en attente ({pendingPosts.length + pendingEvents.length})</h2>
|
||||
<p className="text-sm text-slate-400">Contenu soumis par les utilisateurs nécessitant une validation.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
{pendingPosts.map(post => (
|
||||
<div key={post.id} className="bg-slate-900/50 border border-slate-800 rounded-xl p-4 flex items-center justify-between group hover:border-amber-500/30 transition-all">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-10 h-10 bg-indigo-500/10 rounded-lg flex items-center justify-center text-indigo-400">
|
||||
<BookOpen className="w-5 h-5" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<h4 className="font-bold text-white">{post.title}</h4>
|
||||
<span className="text-[10px] bg-indigo-500/10 text-indigo-400 px-1.5 py-0.5 rounded uppercase font-bold tracking-tighter border border-indigo-500/20">Article</span>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500 mt-0.5">Par {post.author} • {new Date(post.createdAt).toLocaleDateString('fr-FR')}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<Link href={`/actualites/edit/${post.id}`} className="p-2 text-slate-400 hover:text-white" title="Modifier/Voir">
|
||||
<Edit className="w-5 h-5" />
|
||||
</Link>
|
||||
<ApproveContentButton id={post.id} type="post" action="approve" />
|
||||
<ApproveContentButton id={post.id} type="post" action="reject" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
{pendingEvents.map(event => (
|
||||
<div key={event.id} className="bg-slate-900/50 border border-slate-800 rounded-xl p-4 flex items-center justify-between group hover:border-amber-500/30 transition-all">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="w-10 h-10 bg-amber-500/10 rounded-lg flex items-center justify-center text-amber-500">
|
||||
<Calendar className="w-5 h-5" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<h4 className="font-bold text-white">{event.title}</h4>
|
||||
<span className="text-[10px] bg-amber-500/10 text-amber-400 px-1.5 py-0.5 rounded uppercase font-bold tracking-tighter border border-amber-500/20">Événement</span>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500 mt-0.5">{new Date(event.date).toLocaleDateString('fr-FR')} • {event.location}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<Link href={`/event/edit/${event.id}`} className="p-2 text-slate-400 hover:text-white" title="Modifier/Voir">
|
||||
<Edit className="w-5 h-5" />
|
||||
</Link>
|
||||
<ApproveContentButton id={event.id} type="event" action="approve" />
|
||||
<ApproveContentButton id={event.id} type="event" action="reject" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 gap-8">
|
||||
{/* Blog Posts Section */}
|
||||
<div className="card">
|
||||
<div className="flex items-center gap-2 mb-6">
|
||||
<BookOpen className="text-indigo-400 w-5 h-5" />
|
||||
<h2 className="text-xl font-bold text-white">Articles de Blog ({posts.length})</h2>
|
||||
<h2 className="text-xl font-bold text-white">Articles d'Actualités ({posts.length})</h2>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="data-table w-full">
|
||||
@@ -77,10 +148,10 @@ export default async function BlogCMSPage() {
|
||||
<td className="py-4 px-4 text-sm text-slate-500">{new Date(post.createdAt).toLocaleDateString('fr-FR')}</td>
|
||||
<td className="py-4 px-4 text-right">
|
||||
<div className="flex justify-end gap-2">
|
||||
<Link href={`/blog/edit/${post.id}`} className="p-2 text-slate-400 hover:text-indigo-400">
|
||||
<Link href={`/actualites/edit/${post.id}`} className="p-2 text-slate-400 hover:text-indigo-400">
|
||||
<Edit className="w-5 h-5" />
|
||||
</Link>
|
||||
<DeleteBlogButton id={post.id} />
|
||||
<DeleteActualitesButton id={post.id} />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -1,5 +0,0 @@
|
||||
import BlogForm from "@/components/BlogForm";
|
||||
|
||||
export default function NewBlogPage() {
|
||||
return <BlogForm />;
|
||||
}
|
||||
@@ -2,20 +2,32 @@
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { getPricingPlans } from '@/app/actions/plans';
|
||||
import { getOneShotPlans } from '@/app/actions/one-shot';
|
||||
import { CreditCard, Edit3, CheckCircle2, Star, Loader2, Zap } from 'lucide-react';
|
||||
import PlanEditModal from '@/components/PlanEditModal';
|
||||
import OneShotPricingSettings from '@/components/OneShotPricingSettings';
|
||||
|
||||
export default function PlansPage() {
|
||||
const [plans, setPlans] = useState<any[]>([]);
|
||||
const [oneShotPlans, setOneShotPlans] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [editingPlan, setEditingPlan] = useState<any>(null);
|
||||
const [billingCycle, setBillingCycle] = useState<'monthly' | 'yearly'>('monthly');
|
||||
|
||||
useEffect(() => {
|
||||
async function loadPlans() {
|
||||
const data = await getPricingPlans();
|
||||
setPlans(data);
|
||||
setLoading(false);
|
||||
try {
|
||||
const [plansData, oneShotData] = await Promise.all([
|
||||
getPricingPlans(),
|
||||
getOneShotPlans()
|
||||
]);
|
||||
setPlans(plansData);
|
||||
setOneShotPlans(oneShotData || []);
|
||||
} catch (error) {
|
||||
console.error("Failed to load plans:", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
loadPlans();
|
||||
}, []);
|
||||
@@ -32,8 +44,8 @@ export default function PlansPage() {
|
||||
<div className="p-8">
|
||||
<div className="flex flex-col md:flex-row md:items-center justify-between gap-6 mb-8">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-white mb-2 font-serif">Gestion des Tarifs & Forfaits</h1>
|
||||
<p className="text-slate-400">Modifiez les noms, prix et limites d'offres affichés sur le site.</p>
|
||||
<h1 className="text-3xl font-bold text-white mb-2 font-serif">Gestion des Forfaits & Services</h1>
|
||||
<p className="text-slate-400">Modifiez les abonnements mensuels et les services ponctuels (One-Shot).</p>
|
||||
</div>
|
||||
|
||||
{/* Toggle Billing */}
|
||||
@@ -129,6 +141,11 @@ export default function PlansPage() {
|
||||
currentCycle={billingCycle}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* One Shot Plans Section */}
|
||||
<div className="mt-16 pt-16 border-t border-slate-800">
|
||||
<OneShotPricingSettings initialPlans={oneShotPlans} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import React, { useState, useEffect, useTransition } from 'react';
|
||||
import { Save, Globe, Mail, Phone, MapPin, Share2, Link as LinkIcon, Loader2, Newspaper, Briefcase } from 'lucide-react';
|
||||
import { getSiteSettings, updateSiteSettings } from '@/app/actions/settings';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { getBlogPosts } from '@/app/actions/blog';
|
||||
import { getBlogPosts } from '@/app/actions/actualites';
|
||||
import RichTextEditor from '@/components/RichTextEditor';
|
||||
|
||||
const BUSINESS_CATEGORIES = [
|
||||
@@ -34,10 +34,10 @@ const BLOG_CATEGORIES = [
|
||||
"Formation"
|
||||
];
|
||||
|
||||
export default function SettingsPage({
|
||||
searchParams
|
||||
}: {
|
||||
searchParams: Promise<{ tab?: string }>
|
||||
export default function SettingsPage({
|
||||
searchParams
|
||||
}: {
|
||||
searchParams: Promise<{ tab?: string }>
|
||||
}) {
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [settings, setSettings] = useState<any>(null);
|
||||
@@ -48,25 +48,31 @@ export default function SettingsPage({
|
||||
const [selectedBlogCategories, setSelectedBlogCategories] = useState<string[]>([]);
|
||||
const [resetPasswordTemplate, setResetPasswordTemplate] = useState('');
|
||||
const [verifyEmailTemplate, setVerifyEmailTemplate] = useState('');
|
||||
|
||||
|
||||
// Use a state for the tab if we want it to be fully client-side reactive without full reload
|
||||
// But since the user wants it "like moderation center", I'll use URL search params
|
||||
const [currentTab, setCurrentTab] = useState('general');
|
||||
|
||||
useEffect(() => {
|
||||
async function loadData() {
|
||||
const [settingsData, postsData] = await Promise.all([
|
||||
getSiteSettings(),
|
||||
getBlogPosts()
|
||||
]);
|
||||
setSettings(settingsData);
|
||||
setAllPosts(postsData);
|
||||
setSelectedPostIds(settingsData?.homeBlogIds || []);
|
||||
setSelectedHomeCategories(settingsData?.homeCategories || []);
|
||||
setSelectedBlogCategories(settingsData?.homeBlogCategories || []);
|
||||
setResetPasswordTemplate(settingsData?.resetPasswordTemplate || '');
|
||||
setVerifyEmailTemplate(settingsData?.verifyEmailTemplate || '');
|
||||
setLoading(false);
|
||||
try {
|
||||
const [settingsData, postsData] = await Promise.all([
|
||||
getSiteSettings(),
|
||||
getBlogPosts()
|
||||
]);
|
||||
setSettings(settingsData);
|
||||
setAllPosts(postsData);
|
||||
setSelectedPostIds(settingsData?.homeBlogIds || []);
|
||||
setSelectedHomeCategories(settingsData?.homeCategories || []);
|
||||
setSelectedBlogCategories(settingsData?.homeBlogCategories || []);
|
||||
setResetPasswordTemplate(settingsData?.resetPasswordTemplate || '');
|
||||
setVerifyEmailTemplate(settingsData?.verifyEmailTemplate || '');
|
||||
} catch (error) {
|
||||
console.error("Failed to load settings data:", error);
|
||||
toast.error("Erreur lors du chargement des données");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
loadData();
|
||||
}, []);
|
||||
@@ -110,19 +116,19 @@ export default function SettingsPage({
|
||||
};
|
||||
|
||||
const togglePostId = (id: string) => {
|
||||
setSelectedPostIds(prev =>
|
||||
setSelectedPostIds(prev =>
|
||||
prev.includes(id) ? prev.filter(i => i !== id) : [...prev, id]
|
||||
);
|
||||
};
|
||||
|
||||
const toggleHomeCategory = (cat: string) => {
|
||||
setSelectedHomeCategories(prev =>
|
||||
setSelectedHomeCategories(prev =>
|
||||
prev.includes(cat) ? prev.filter(c => c !== cat) : [...prev, cat]
|
||||
);
|
||||
};
|
||||
|
||||
const toggleBlogCategory = (cat: string) => {
|
||||
setSelectedBlogCategories(prev =>
|
||||
setSelectedBlogCategories(prev =>
|
||||
prev.includes(cat) ? prev.filter(c => c !== cat) : [...prev, cat]
|
||||
);
|
||||
};
|
||||
@@ -146,19 +152,19 @@ export default function SettingsPage({
|
||||
|
||||
{/* Tabs Switcher */}
|
||||
<div className="flex gap-2 mb-8 bg-slate-900/50 p-1 rounded-xl border border-slate-800 w-fit">
|
||||
<button
|
||||
onClick={() => setCurrentTab('general')}
|
||||
className={`px-6 py-2 rounded-lg text-sm font-bold transition-all flex items-center gap-2 ${currentTab === 'general' ? 'bg-indigo-600 text-white shadow-lg' : 'text-slate-400 hover:text-white hover:bg-slate-800'}`}
|
||||
<button
|
||||
onClick={() => setCurrentTab('general')}
|
||||
className={`px-6 py-2 rounded-lg text-sm font-bold transition-all flex items-center gap-2 ${currentTab === 'general' ? 'bg-indigo-600 text-white shadow-lg' : 'text-slate-400 hover:text-white hover:bg-slate-800'}`}
|
||||
>
|
||||
<Globe className="w-4 h-4" />
|
||||
Général
|
||||
<Globe className="w-4 h-4" />
|
||||
Général
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setCurrentTab('emails')}
|
||||
className={`px-6 py-2 rounded-lg text-sm font-bold transition-all flex items-center gap-2 ${currentTab === 'emails' ? 'bg-indigo-600 text-white shadow-lg' : 'text-slate-400 hover:text-white hover:bg-slate-800'}`}
|
||||
<button
|
||||
onClick={() => setCurrentTab('emails')}
|
||||
className={`px-6 py-2 rounded-lg text-sm font-bold transition-all flex items-center gap-2 ${currentTab === 'emails' ? 'bg-indigo-600 text-white shadow-lg' : 'text-slate-400 hover:text-white hover:bg-slate-800'}`}
|
||||
>
|
||||
<Mail className="w-4 h-4" />
|
||||
Configuration Mail
|
||||
<Mail className="w-4 h-4" />
|
||||
Configuration Mail
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -174,26 +180,26 @@ export default function SettingsPage({
|
||||
<div className="p-6 grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Nom du site</label>
|
||||
<input
|
||||
name="siteName"
|
||||
<input
|
||||
name="siteName"
|
||||
defaultValue={settings?.siteName}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Slogan du site</label>
|
||||
<input
|
||||
name="siteSlogan"
|
||||
<input
|
||||
name="siteSlogan"
|
||||
defaultValue={settings?.siteSlogan}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="md:col-span-2 space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Texte du pied de page (Footer)</label>
|
||||
<input
|
||||
name="footerText"
|
||||
<input
|
||||
name="footerText"
|
||||
defaultValue={settings?.footerText}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -213,11 +219,10 @@ export default function SettingsPage({
|
||||
key={cat}
|
||||
type="button"
|
||||
onClick={() => toggleHomeCategory(cat)}
|
||||
className={`text-left p-2 rounded-lg border text-xs transition-all ${
|
||||
selectedHomeCategories.includes(cat)
|
||||
? 'bg-indigo-600/20 border-indigo-500 text-indigo-300'
|
||||
: 'bg-slate-950 border-slate-700 text-slate-400 hover:border-slate-500'
|
||||
}`}
|
||||
className={`text-left p-2 rounded-lg border text-xs transition-all ${selectedHomeCategories.includes(cat)
|
||||
? 'bg-indigo-600/20 border-indigo-500 text-indigo-300'
|
||||
: 'bg-slate-950 border-slate-700 text-slate-400 hover:border-slate-500'
|
||||
}`}
|
||||
>
|
||||
{cat}
|
||||
</button>
|
||||
@@ -234,9 +239,9 @@ export default function SettingsPage({
|
||||
</div>
|
||||
<div className="p-6 space-y-6">
|
||||
<div className="flex items-center gap-3 p-3 bg-indigo-600/10 border border-indigo-500/20 rounded-xl">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="homeBlogShow"
|
||||
<input
|
||||
type="checkbox"
|
||||
name="homeBlogShow"
|
||||
id="homeBlogShow"
|
||||
defaultChecked={settings?.homeBlogShow}
|
||||
className="w-5 h-5 rounded border-slate-700 bg-slate-950 text-indigo-600 focus:ring-indigo-500"
|
||||
@@ -247,18 +252,18 @@ export default function SettingsPage({
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Titre de la section</label>
|
||||
<input
|
||||
name="homeBlogTitle"
|
||||
<input
|
||||
name="homeBlogTitle"
|
||||
defaultValue={settings?.homeBlogTitle}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Sous-titre</label>
|
||||
<input
|
||||
name="homeBlogSubtitle"
|
||||
<input
|
||||
name="homeBlogSubtitle"
|
||||
defaultValue={settings?.homeBlogSubtitle}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -287,12 +292,12 @@ export default function SettingsPage({
|
||||
<div className="grid grid-cols-1 gap-6">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Nombre maximum d'articles</label>
|
||||
<input
|
||||
<input
|
||||
type="number"
|
||||
name="homeBlogCount"
|
||||
name="homeBlogCount"
|
||||
defaultValue={settings?.homeBlogCount}
|
||||
min="1" max="12"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -305,11 +310,10 @@ export default function SettingsPage({
|
||||
key={post.id}
|
||||
type="button"
|
||||
onClick={() => togglePostId(post.id)}
|
||||
className={`flex items-center justify-between p-3 rounded-lg text-sm transition-all ${
|
||||
selectedPostIds.includes(post.id)
|
||||
? 'bg-indigo-600/20 border-indigo-500/50 text-white'
|
||||
: 'text-slate-400 hover:bg-slate-900'
|
||||
}`}
|
||||
className={`flex items-center justify-between p-3 rounded-lg text-sm transition-all ${selectedPostIds.includes(post.id)
|
||||
? 'bg-indigo-600/20 border-indigo-500/50 text-white'
|
||||
: 'text-slate-400 hover:bg-slate-900'
|
||||
}`}
|
||||
>
|
||||
<span>{post.title}</span>
|
||||
{selectedPostIds.includes(post.id) && <span className="text-indigo-400 font-bold text-xs">SÉLECTIONNÉ</span>}
|
||||
@@ -327,11 +331,10 @@ export default function SettingsPage({
|
||||
key={cat}
|
||||
type="button"
|
||||
onClick={() => toggleBlogCategory(cat)}
|
||||
className={`px-4 py-2 rounded-full border text-xs transition-all ${
|
||||
selectedBlogCategories.includes(cat)
|
||||
? 'bg-purple-600 border-purple-500 text-white'
|
||||
: 'bg-slate-950 border-slate-700 text-slate-400 hover:border-slate-500'
|
||||
}`}
|
||||
className={`px-4 py-2 rounded-full border text-xs transition-all ${selectedBlogCategories.includes(cat)
|
||||
? 'bg-purple-600 border-purple-500 text-white'
|
||||
: 'bg-slate-950 border-slate-700 text-slate-400 hover:border-slate-500'
|
||||
}`}
|
||||
>
|
||||
{cat}
|
||||
</button>
|
||||
@@ -353,10 +356,10 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Email de support</label>
|
||||
<div className="relative">
|
||||
<Mail className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="contactEmail"
|
||||
<input
|
||||
name="contactEmail"
|
||||
defaultValue={settings?.contactEmail}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -364,10 +367,10 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Téléphone de contact</label>
|
||||
<div className="relative">
|
||||
<Phone className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="contactPhone"
|
||||
<input
|
||||
name="contactPhone"
|
||||
defaultValue={settings?.contactPhone}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -375,10 +378,10 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Adresse physique</label>
|
||||
<div className="relative">
|
||||
<MapPin className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="address"
|
||||
<input
|
||||
name="address"
|
||||
defaultValue={settings?.address}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -396,11 +399,11 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Facebook URL</label>
|
||||
<div className="relative">
|
||||
<Share2 className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="facebookUrl"
|
||||
<input
|
||||
name="facebookUrl"
|
||||
defaultValue={settings?.facebookUrl}
|
||||
placeholder="https://facebook.com/..."
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -408,11 +411,11 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Twitter (X) URL</label>
|
||||
<div className="relative">
|
||||
<Share2 className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="twitterUrl"
|
||||
<input
|
||||
name="twitterUrl"
|
||||
defaultValue={settings?.twitterUrl}
|
||||
placeholder="https://twitter.com/..."
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -420,11 +423,11 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">Instagram URL</label>
|
||||
<div className="relative">
|
||||
<Share2 className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="instagramUrl"
|
||||
<input
|
||||
name="instagramUrl"
|
||||
defaultValue={settings?.instagramUrl}
|
||||
placeholder="https://instagram.com/..."
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -432,11 +435,11 @@ export default function SettingsPage({
|
||||
<label className="text-sm font-medium text-slate-400">LinkedIn URL</label>
|
||||
<div className="relative">
|
||||
<Share2 className="absolute left-3 top-3.5 w-4 h-4 text-slate-500" />
|
||||
<input
|
||||
name="linkedinUrl"
|
||||
<input
|
||||
name="linkedinUrl"
|
||||
defaultValue={settings?.linkedinUrl}
|
||||
placeholder="https://linkedin.com/in/..."
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 pl-10 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -459,17 +462,17 @@ export default function SettingsPage({
|
||||
<h3 className="text-sm font-bold text-indigo-400 uppercase tracking-wider">Réinitialisation de mot de passe</h3>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Objet de l'email</label>
|
||||
<input
|
||||
name="resetPasswordSubject"
|
||||
<input
|
||||
name="resetPasswordSubject"
|
||||
defaultValue={settings?.resetPasswordSubject}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Modèle d'email</label>
|
||||
<RichTextEditor
|
||||
value={resetPasswordTemplate}
|
||||
onChange={setResetPasswordTemplate}
|
||||
<RichTextEditor
|
||||
value={resetPasswordTemplate}
|
||||
onChange={setResetPasswordTemplate}
|
||||
placeholder="Contenu de l'email..."
|
||||
/>
|
||||
<p className="text-[10px] text-slate-500">
|
||||
@@ -485,17 +488,17 @@ export default function SettingsPage({
|
||||
<h3 className="text-sm font-bold text-emerald-400 uppercase tracking-wider">Vérification de compte</h3>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Objet de l'email</label>
|
||||
<input
|
||||
name="verifyEmailSubject"
|
||||
<input
|
||||
name="verifyEmailSubject"
|
||||
defaultValue={settings?.verifyEmailSubject}
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
className="w-full bg-slate-950 border border-slate-700 rounded-xl p-3 text-white focus:outline-none focus:border-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-slate-400">Modèle d'email</label>
|
||||
<RichTextEditor
|
||||
value={verifyEmailTemplate}
|
||||
onChange={setVerifyEmailTemplate}
|
||||
<RichTextEditor
|
||||
value={verifyEmailTemplate}
|
||||
onChange={setVerifyEmailTemplate}
|
||||
placeholder="Contenu de l'email..."
|
||||
/>
|
||||
<p className="text-[10px] text-slate-500">
|
||||
|
||||
@@ -2,9 +2,11 @@ import SlideForm from "@/components/SlideForm";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export default async function EditSlidePage({ params }: { params: { id: string } }) {
|
||||
export default async function EditSlidePage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
|
||||
const slide = await prisma.homeSlide.findUnique({
|
||||
where: { id: params.id },
|
||||
where: { id },
|
||||
include: { business: true }
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user