feat: implement business detail client view with interactive features including rating, favoriting, messaging, and analytics tracking

This commit is contained in:
2026-05-09 21:12:01 +02:00
parent 6a42c52b58
commit 6acd5ebe2e
14 changed files with 516 additions and 40 deletions

28
app/actions/upload.ts Normal file
View File

@@ -0,0 +1,28 @@
'use server';
export async function uploadImage(formData: FormData) {
try {
const file = formData.get('file') as File;
if (!file) {
return { success: false, error: 'Aucun fichier fourni' };
}
// Convert file to buffer
const bytes = await file.arrayBuffer();
const buffer = Buffer.from(bytes);
// Convert to Base64
const base64 = buffer.toString('base64');
const mimeType = file.type || 'image/jpeg';
const dataUrl = `data:${mimeType};base64,${base64}`;
// Return the data URL directly (it will be saved in the database)
return {
success: true,
url: dataUrl
};
} catch (error) {
console.error('Error during image conversion:', error);
return { success: false, error: 'Erreur lors de la conversion de l\'image' };
}
}