From ee36dd9db98b1e6f256609e83458809118a302f2 Mon Sep 17 00:00:00 2001 From: tamfrr Date: Tue, 26 Nov 2024 14:14:05 -0800 Subject: [PATCH] Atualizar src/app/admin/page.jsx --- src/app/admin/page.jsx | 147 ++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 69 deletions(-) diff --git a/src/app/admin/page.jsx b/src/app/admin/page.jsx index 2ebf471..1fb863c 100644 --- a/src/app/admin/page.jsx +++ b/src/app/admin/page.jsx @@ -1,91 +1,102 @@ -import React from 'react'; -import { Pencil, Trash, Plus } from 'lucide-react'; +"use client"; +import { useState } from 'react'; +import { PlusCircle, Pencil, Trash2, ImagePlus } from 'lucide-react'; -const AdminDashboard = () => { - // Dados de exemplo (depois virão do backend) - const cars = [ +export default function AdminPage() { + const [cars, setCars] = useState([ { id: 1, - name: 'BMW M4 2024', - price: 75000, - image: '/api/placeholder/200/150', - isSpecial: true - }, - { - id: 2, - name: 'Mercedes-Benz C-Class 2015', + name: 'MERCEDES-BENZ C-CLASS 2015', price: 35000, - image: '/api/placeholder/200/150', - isSpecial: true + special: true } - ]; + ]); + + const handleDelete = async (id) => { + if (confirm('Are you sure you want to delete this car?')) { + // Aqui virá a deleção via API + setCars(cars.filter(car => car.id !== id)); + } + }; return (
-
-
-
- LOGO +
+
+
+

Car Management

+
- Admin Panel
-
- {/* Add New Car Button */} -
- -
- - {/* Cars List */} -
-
-

Cars Management

-
- +
+
- +
- - - - - + + + + + - + {cars.map((car) => ( - - - - - + + + + ))} @@ -95,6 +106,4 @@ const AdminDashboard = () => { ); -}; - -export default AdminDashboard; +} \ No newline at end of file
ImageNamePriceSpecialActions + Image + + Name + + Price + + Special + + Actions +
- {car.name} - {car.name}${car.price.toLocaleString()} - {car.isSpecial ? ( - - Special - - ) : '-'} - -
- -
+
+
+ +
+
+
{car.name}
+
+
${car.price.toLocaleString()}
+
+ + {car.special ? 'Yes' : 'No'} + + + + +