feat: implement core platform features including business directory, admin dashboard, authentication, and API infrastructure
Some checks failed
Build and Push App / build (push) Failing after 16m2s

This commit is contained in:
2026-04-18 22:10:19 +02:00
parent 6ec1a3ae84
commit 3e2063e4fa
89 changed files with 4405 additions and 967 deletions

44
lib/geo.ts Normal file
View File

@@ -0,0 +1,44 @@
export async function getGeoInfo(ip: string, headers: Headers) {
// 1. Try platform-specific headers first (Vercel, Cloudflare, etc.)
const headerCountry =
headers.get('x-vercel-ip-country') ||
headers.get('cf-ipcountry') ||
headers.get('x-country-code');
if (headerCountry && headerCountry !== 'XX') {
// If we have a country code, we might still want to get the name
// For now, let's keep it simple or use a lookup map
return {
country: headerCountry,
city: headers.get('x-vercel-ip-city') || 'Unknown'
};
}
// 2. Handle localhost
if (ip === '127.0.0.1' || ip === '::1' || ip.includes('127.0.0.1')) {
return { country: 'Local / Dev', city: 'Localhost' };
}
// 3. Fallback to external API
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 2000); // 2s timeout
const response = await fetch(`http://ip-api.com/json/${ip}`, { signal: controller.signal });
clearTimeout(timeoutId);
if (response.ok) {
const data = await response.json();
if (data.status === 'success') {
return {
country: data.country || 'Unknown',
city: data.city || 'Unknown'
};
}
}
} catch (error) {
console.error('GeoIP lookup error:', error);
}
return { country: 'Unknown', city: 'Unknown' };
}

12
lib/legal.ts Normal file
View File

@@ -0,0 +1,12 @@
import { prisma } from './prisma';
export async function getLegalDocument(type: 'CGU' | 'CGV') {
try {
return await prisma.legalDocument.findUnique({
where: { type }
});
} catch (error) {
console.error(`Error fetching ${type}:`, error);
return null;
}
}

View File

@@ -3,16 +3,15 @@ import { prisma } from './prisma';
export async function getSiteSettings() {
// Default fallback values used during build or if DB is down
const defaultSettings = {
siteName: "Afropreunariat",
siteName: "Afrohub",
siteSlogan: "La plateforme de référence pour l'entrepreneuriat africain. Visibilité, connexion et croissance pour les TPE/PME.",
contactEmail: "support@afropreunariat.com",
contactPhone: "+225 00 00 00 00 00",
contactEmail: "support@afrohub.com",
address: "Abidjan, Côte d'Ivoire / Paris, France",
facebookUrl: "#",
twitterUrl: "#",
instagramUrl: "#",
linkedinUrl: "#",
footerText: "© 2025 Afropreunariat. Tous droits réservés."
footerText: "© 2025 Afrohub. Tous droits réservés."
};
try {