diff --git a/app/api/admin/reports/[id]/route.ts b/app/api/admin/reports/[id]/route.ts index 5ca53a2..4121fd7 100644 --- a/app/api/admin/reports/[id]/route.ts +++ b/app/api/admin/reports/[id]/route.ts @@ -4,11 +4,11 @@ import prisma from '../../../../../lib/prisma' // PATCH /api/admin/reports/[id] — Update report status export async function PATCH( request: NextRequest, - { params }: { params: Promise<{ id: string }> } -) { + context: { params: Promise<{ id: string }> } +): Promise { try { const userId = request.headers.get('x-user-id') - const { id } = await params + const { id } = await context.params const { status } = await request.json() if (!userId) { diff --git a/app/api/blog/[id]/route.ts b/app/api/blog/[id]/route.ts index 3ceeee5..473a231 100644 --- a/app/api/blog/[id]/route.ts +++ b/app/api/blog/[id]/route.ts @@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma' type Params = { params: Promise<{ id: string }> } // GET /api/blog/[id] -export async function GET(_request: NextRequest, { params }: Params) { +export async function GET( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const post = await prisma.blogPost.findUnique({ where: { id } }) if (!post) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 }) return NextResponse.json(post) @@ -17,9 +20,12 @@ export async function GET(_request: NextRequest, { params }: Params) { } // PATCH /api/blog/[id] -export async function PATCH(request: NextRequest, { params }: Params) { +export async function PATCH( + request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const body = await request.json() const post = await prisma.blogPost.update({ where: { id }, data: body }) return NextResponse.json(post) @@ -30,9 +36,12 @@ export async function PATCH(request: NextRequest, { params }: Params) { } // DELETE /api/blog/[id] -export async function DELETE(_request: NextRequest, { params }: Params) { +export async function DELETE( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params await prisma.blogPost.delete({ where: { id } }) return NextResponse.json({ success: true }) } catch (error) { diff --git a/app/api/businesses/[id]/route.ts b/app/api/businesses/[id]/route.ts index df10847..5995ab7 100644 --- a/app/api/businesses/[id]/route.ts +++ b/app/api/businesses/[id]/route.ts @@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma' type Params = { params: Promise<{ id: string }> } // GET /api/businesses/[id] -export async function GET(_request: NextRequest, { params }: Params) { +export async function GET( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const business = await prisma.business.findFirst({ where: { OR: [ @@ -25,9 +28,12 @@ export async function GET(_request: NextRequest, { params }: Params) { } // PATCH /api/businesses/[id] -export async function PATCH(request: NextRequest, { params }: Params) { +export async function PATCH( + request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const body = await request.json() const business = await prisma.business.update({ where: { id }, @@ -42,9 +48,12 @@ export async function PATCH(request: NextRequest, { params }: Params) { } // DELETE /api/businesses/[id] -export async function DELETE(_request: NextRequest, { params }: Params) { +export async function DELETE( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params await prisma.business.delete({ where: { id } }) return NextResponse.json({ success: true }) } catch (error) { diff --git a/app/api/conversations/[id]/archive/route.ts b/app/api/conversations/[id]/archive/route.ts index c3f114d..3459791 100644 --- a/app/api/conversations/[id]/archive/route.ts +++ b/app/api/conversations/[id]/archive/route.ts @@ -4,11 +4,11 @@ import prisma from '../../../../../lib/prisma' // PATCH /api/conversations/[id]/archive — Toggle archive status for the user export async function PATCH( request: NextRequest, - { params }: { params: Promise<{ id: string }> } -) { + context: { params: Promise<{ id: string }> } +): Promise { try { const userId = request.headers.get('x-user-id') - const { id } = await params + const { id } = await context.params const { archived } = await request.json() if (!userId) { diff --git a/app/api/conversations/[id]/route.ts b/app/api/conversations/[id]/route.ts index 0c0b17f..bcb281a 100644 --- a/app/api/conversations/[id]/route.ts +++ b/app/api/conversations/[id]/route.ts @@ -4,11 +4,11 @@ import prisma from '../../../../lib/prisma' // GET /api/conversations/[id] — Get messages for a conversation export async function GET( request: NextRequest, - { params }: { params: Promise<{ id: string }> } -) { + context: { params: Promise<{ id: string }> } +): Promise { try { const userId = request.headers.get('x-user-id') - const { id } = await params + const { id } = await context.params if (!userId) { return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 }) @@ -36,6 +36,7 @@ export async function GET( select: { id: true, name: true, + email: true, avatar: true } } diff --git a/app/api/conversations/route.ts b/app/api/conversations/route.ts index d579fd2..264a0f7 100644 --- a/app/api/conversations/route.ts +++ b/app/api/conversations/route.ts @@ -36,6 +36,7 @@ export async function GET(request: NextRequest) { select: { id: true, name: true, + email: true, avatar: true, role: true } diff --git a/app/api/interviews/[id]/route.ts b/app/api/interviews/[id]/route.ts index 54e0225..2a59971 100644 --- a/app/api/interviews/[id]/route.ts +++ b/app/api/interviews/[id]/route.ts @@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma' type Params = { params: Promise<{ id: string }> } // GET /api/interviews/[id] -export async function GET(_request: NextRequest, { params }: Params) { +export async function GET( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const interview = await prisma.interview.findUnique({ where: { id } }) if (!interview) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 }) return NextResponse.json(interview) @@ -17,9 +20,12 @@ export async function GET(_request: NextRequest, { params }: Params) { } // PATCH /api/interviews/[id] -export async function PATCH(request: NextRequest, { params }: Params) { +export async function PATCH( + request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const body = await request.json() const interview = await prisma.interview.update({ where: { id }, data: body }) return NextResponse.json(interview) @@ -30,9 +36,12 @@ export async function PATCH(request: NextRequest, { params }: Params) { } // DELETE /api/interviews/[id] -export async function DELETE(_request: NextRequest, { params }: Params) { +export async function DELETE( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params await prisma.interview.delete({ where: { id } }) return NextResponse.json({ success: true }) } catch (error) { diff --git a/app/api/messages/[id]/report/route.ts b/app/api/messages/[id]/report/route.ts index bde736d..08fd2fd 100644 --- a/app/api/messages/[id]/report/route.ts +++ b/app/api/messages/[id]/report/route.ts @@ -4,11 +4,11 @@ import prisma from '../../../../../lib/prisma' // POST /api/messages/[id]/report — Report a message for moderation export async function POST( request: NextRequest, - { params }: { params: Promise<{ id: string }> } -) { + context: { params: Promise<{ id: string }> } +): Promise { try { const userId = request.headers.get('x-user-id') - const { id } = await params + const { id } = await context.params const { reason } = await request.json() if (!userId) { diff --git a/app/api/offers/[id]/route.ts b/app/api/offers/[id]/route.ts index 3fa183a..5fdb075 100644 --- a/app/api/offers/[id]/route.ts +++ b/app/api/offers/[id]/route.ts @@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma' type Params = { params: Promise<{ id: string }> } // GET /api/offers/[id] -export async function GET(_request: NextRequest, { params }: Params) { +export async function GET( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const offer = await prisma.offer.findUnique({ where: { id }, include: { business: true }, @@ -20,9 +23,12 @@ export async function GET(_request: NextRequest, { params }: Params) { } // PATCH /api/offers/[id] -export async function PATCH(request: NextRequest, { params }: Params) { +export async function PATCH( + request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params const body = await request.json() const offer = await prisma.offer.update({ where: { id }, @@ -37,9 +43,12 @@ export async function PATCH(request: NextRequest, { params }: Params) { } // DELETE /api/offers/[id] -export async function DELETE(_request: NextRequest, { params }: Params) { +export async function DELETE( + _request: NextRequest, + context: { params: Promise<{ id: string }> } +): Promise { try { - const { id } = await params + const { id } = await context.params await prisma.offer.delete({ where: { id } }) return NextResponse.json({ success: true }) } catch (error) { diff --git a/app/api/users/me/route.ts b/app/api/users/me/route.ts index 3971f96..f7d82cd 100644 --- a/app/api/users/me/route.ts +++ b/app/api/users/me/route.ts @@ -2,7 +2,10 @@ import { NextRequest, NextResponse } from 'next/server' import prisma from '../../../../lib/prisma' // PATCH /api/users/me — Update personal user profile -export async function PATCH(request: NextRequest) { +export async function PATCH( + request: NextRequest, + context: { params: Promise } +): Promise { try { const userId = request.headers.get('x-user-id') const data = await request.json() diff --git a/app/api/users/profile/route.ts b/app/api/users/profile/route.ts index 753edb3..4b25e7e 100644 --- a/app/api/users/profile/route.ts +++ b/app/api/users/profile/route.ts @@ -17,7 +17,10 @@ export async function GET(request: NextRequest) { name: true, email: true, role: true, - avatar: true + avatar: true, + phone: true, + bio: true, + location: true } }); diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 0dfef90..02a2c97 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -1,7 +1,7 @@ "use client"; -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, Suspense } from 'react'; import Link from 'next/link'; import { LayoutDashboard, Edit3, ShoppingBag, CreditCard, LogOut, Eye, MessageSquare, User as UserIcon, Rocket, ShieldAlert } from 'lucide-react'; import { useRouter, useSearchParams } from 'next/navigation'; @@ -15,7 +15,7 @@ import DashboardOffers from '../../components/dashboard/DashboardOffers'; import PricingSection from '../../components/PricingSection'; import { useUser } from '../../components/UserProvider'; -const DashboardPage = () => { +const DashboardContent = () => { const { user, logout } = useUser(); const router = useRouter(); const searchParams = useSearchParams(); @@ -319,4 +319,16 @@ const DashboardPage = () => { ); } +const DashboardPage = () => { + return ( + +
+ + }> + +
+ ); +}; + export default DashboardPage; diff --git a/components/dashboard/DashboardMessages.tsx b/components/dashboard/DashboardMessages.tsx index 433d3b5..f4f7451 100644 --- a/components/dashboard/DashboardMessages.tsx +++ b/components/dashboard/DashboardMessages.tsx @@ -12,6 +12,7 @@ interface Message { createdAt: string; sender: { name: string; + email?: string; avatar?: string; }; } @@ -25,9 +26,11 @@ interface Conversation { ownerId: string; }; participants: { + isArchived: boolean; user: { id: string; name: string; + email?: string; avatar?: string; }; }[]; diff --git a/lib/mockData.ts b/lib/mockData.ts index dac3054..a819cae 100644 --- a/lib/mockData.ts +++ b/lib/mockData.ts @@ -26,6 +26,10 @@ export const MOCK_BUSINESSES: Business[] = [ }, contactEmail: 'contact@afrotech.ci', contactPhone: '+225 07 07 07 07 07', + showEmail: true, + showPhone: true, + showSocials: true, + isActive: true, verified: true, viewCount: 1240, rating: 4.8, @@ -33,7 +37,6 @@ export const MOCK_BUSINESSES: Business[] = [ // Featured Data isFeatured: true, founderName: 'Jean-Marc Kouassi', - // UPDATED IMAGE: Profile of an Afro-descendant entrepreneur founderImageUrl: 'https://images.unsplash.com/photo-1531384441138-2736e62e0919?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', keyMetric: '+50 Projets Livrés' }, @@ -47,6 +50,10 @@ export const MOCK_BUSINESSES: Business[] = [ logoUrl: 'https://picsum.photos/200/200?random=2', contactEmail: 'hello@baobabfoods.fr', contactPhone: '+33 6 12 34 56 78', + showEmail: true, + showPhone: true, + showSocials: true, + isActive: true, verified: true, viewCount: 850, rating: 4.9, @@ -64,6 +71,10 @@ export const MOCK_BUSINESSES: Business[] = [ description: 'Création de tenues modernes utilisant le tissu Ankara authentique. Nous travaillons directement avec des tisserands locaux pour garantir une qualité exceptionnelle et une rémunération équitable. Exportation internationale et vente en ligne.', logoUrl: 'https://picsum.photos/200/200?random=3', contactEmail: 'sales@lagosfashion.ng', + showEmail: true, + showPhone: false, + showSocials: false, + isActive: true, verified: false, viewCount: 320, rating: 4.5, @@ -80,6 +91,10 @@ export const MOCK_BUSINESSES: Business[] = [ logoUrl: 'https://picsum.photos/200/200?random=4', contactEmail: 'info@saharasolar.sn', contactPhone: '+221 77 000 00 00', + showEmail: true, + showPhone: true, + showSocials: false, + isActive: true, verified: true, viewCount: 560, rating: 4.7, @@ -98,6 +113,10 @@ export const MOCK_BUSINESSES: Business[] = [ contactEmail: 'contact@nubianessence.cm', contactPhone: '+237 6 99 99 99 99', socialLinks: { instagram: 'https://instagram.com', facebook: 'https://facebook.com' }, + showEmail: true, + showPhone: true, + showSocials: true, + isActive: true, verified: true, viewCount: 410, rating: 4.6, @@ -117,6 +136,10 @@ export const MOCK_BUSINESSES: Business[] = [ contactEmail: 'admissions@kijani.ke', contactPhone: '+254 700 000 000', socialLinks: { linkedin: 'https://linkedin.com', website: 'https://kijani.ke' }, + showEmail: true, + showPhone: true, + showSocials: true, + isActive: true, verified: true, viewCount: 980, rating: 5.0, @@ -133,6 +156,10 @@ export const MOCK_BUSINESSES: Business[] = [ description: 'La solution de paiement agrégée pour les e-commerçants en RDC. Acceptez M-Pesa, Orange Money, Airtel Money et les cartes Visa/Mastercard via une API unique et sécurisée.', logoUrl: 'https://picsum.photos/200/200?random=7', contactEmail: 'biz@payna.cd', + showEmail: true, + showPhone: false, + showSocials: false, + isActive: true, verified: false, viewCount: 230, rating: 4.2, @@ -150,6 +177,10 @@ export const MOCK_BUSINESSES: Business[] = [ contactEmail: 'projet@ecobati.bj', contactPhone: '+229 97 00 00 00', socialLinks: { instagram: 'https://instagram.com', website: 'https://ecobati.bj' }, + showEmail: true, + showPhone: true, + showSocials: true, + isActive: true, verified: true, viewCount: 670, rating: 4.8, diff --git a/next-env.d.ts b/next-env.d.ts index c4b7818..9edff1c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/types.ts b/types.ts index 7136ab6..7db83b8 100644 --- a/types.ts +++ b/types.ts @@ -11,6 +11,9 @@ export interface User { email: string; role: UserRole; avatar?: string; + phone?: string; + bio?: string; + location?: string; isSuspended?: boolean; suspensionReason?: string; }