diff --git a/public/1.jpg b/public/1.jpg new file mode 100644 index 0000000..75b8c35 Binary files /dev/null and b/public/1.jpg differ diff --git a/public/2.jpg b/public/2.jpg new file mode 100644 index 0000000..101adf2 Binary files /dev/null and b/public/2.jpg differ diff --git a/public/3.jpg b/public/3.jpg new file mode 100644 index 0000000..e6cfe1c Binary files /dev/null and b/public/3.jpg differ diff --git a/public/4.jpg b/public/4.jpg new file mode 100644 index 0000000..461fb36 Binary files /dev/null and b/public/4.jpg differ diff --git a/public/5.jpg b/public/5.jpg new file mode 100644 index 0000000..7464b17 Binary files /dev/null and b/public/5.jpg differ diff --git a/src/App.jsx b/src/App.jsx index 700a3d3..b318172 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,7 +15,7 @@ function App() { return ( <> - + {/* */} {/* */} @@ -44,7 +44,6 @@ export default function AppHeader({ zone = 'public' }) { pr: 2, py: 0.5, borderRadius: 1, - bgcolor: '#000000a0', color: '#A68A72FF', width: { md: '300px', lg: '400px' } }} diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index af4f169..1c99357 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -3,9 +3,9 @@ import fendiLogo from '/logo.png' export default function Footer({ zone = 'public' }) { const bgColor = { - public: '#000000a0', - restricted: '#e0e0ff', - private: '#d0f0e0', + public: '#40120EFF', + restricted: '#40120EFF', + private: '#40120EFF', }; const year = new Date().getFullYear(); diff --git a/src/index.css b/src/index.css index e37e808..bb0ec7a 100644 --- a/src/index.css +++ b/src/index.css @@ -28,13 +28,9 @@ body { min-width: 320px; min-height: 100vh; display: block; - /* color: #26201A; */ + background-color: #ffffff; } -/* .MuiTypography-root { - color: #26201A !important; -} */ - h1 { font-size: 3.2em; line-height: 1.1; diff --git a/src/private/AddOrEditProductForm.jsx b/src/private/AddOrEditProductForm.jsx index d78393a..7929e00 100644 --- a/src/private/AddOrEditProductForm.jsx +++ b/src/private/AddOrEditProductForm.jsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; -import { Box, Button, TextField, Grid, Avatar, Typography } from '@mui/material'; +import { Box, Button, TextField, Grid, Avatar, Typography, Paper } from '@mui/material'; +import { handleDecimalInputKeyDown } from '../utils/validation'; export default function AddOrEditProductForm({ onAdd, initialData, onCancel }) { const [product, setProduct] = useState({ @@ -52,26 +53,78 @@ export default function AddOrEditProductForm({ onAdd, initialData, onCancel }) { }; return ( - - - - - + + + {/* Left visual panel */} + + + {product.name || 'N/A'} + + + {product.provider || 'N/A'} + + + {product.price ? `$${product.price.toFixed(2)}` : '$0.00'} + + {product.representation ? ( + + ) : ( + + Image Preview + + )} + + + + + + {/* Right input panel */} + + + - - + - - - - - {product.representation && ( - - Representation - - - )} - - - - {/* Fields... */} - - - + + + + diff --git a/src/private/Admin.jsx b/src/private/Admin.jsx index d010f91..763bfa6 100644 --- a/src/private/Admin.jsx +++ b/src/private/Admin.jsx @@ -15,7 +15,7 @@ import '../App.css'; const columnsBase = [ { field: 'representation', - headerName: 'Representation', + headerName: '', flex: 2, renderCell: (params) => { const { representation, name, provider, price } = params.row; @@ -25,7 +25,7 @@ const columnsBase = [ component="img" src={representation || '/favicon.png'} alt={name} - sx={{ width: 140, height: 140, borderRadius: 1, objectFit: 'cover' }} + sx={{ width: 120, height: 140, borderRadius: 1, objectFit: 'cover' }} /> {name} @@ -37,18 +37,17 @@ const columnsBase = [ } }, { field: 'company', headerName: 'Company', flex: 1 }, - { field: 'name', headerName: 'Name', flex: 1 }, - { field: 'stock', headerName: 'Stock', width: 120, type: 'number' }, { field: 'category', headerName: 'Category', flex: 1 }, + { field: 'stock', headerName: 'Stock', width: 120, type: 'number' }, ]; export default function Admin({ children, maxWidth = 'lg', sx = {} }) { const [rows, setRows] = useState([ - { id: 1, company: 'Fendi casa', name: 'Product 1', price: 10.99, provider: 'Provider A', stock: 100, category: 'Home', representation: '/favicon.png' }, - { id: 2, company: 'Fendi casa', name: 'Product 2', price: 20.0, provider: 'Provider B', stock: 50, category: 'Home', representation: '/logo.png' }, - { id: 3, company: 'Fendi casa', name: 'Product 3', price: 5.5, provider: 'Provider C', stock: 200, category: 'Home', representation: '/background.jpg' }, - { id: 4, company: 'Fendi casa', name: 'Product 4', price: 15.75, provider: 'Provider D', stock: 30, category: 'Home', representation: '/background.jpg' }, - { id: 5, company: 'Fendi casa', name: 'Product 5', price: 8.2, provider: 'Provider E', stock: 75, category: 'Home', representation: '/favicon.png' } + { id: 1, company: 'Fendi casa', name: 'Product 1', price: 10.99, provider: 'Provider A', stock: 100, category: 'Home', representation: '/1.jpg' }, + { id: 2, company: 'Fendi casa', name: 'Product 2', price: 20.0, provider: 'Provider B', stock: 50, category: 'Home', representation: '/2.jpg' }, + { id: 3, company: 'Fendi casa', name: 'Product 3', price: 5.5, provider: 'Provider C', stock: 200, category: 'Home', representation: '/3.jpg' }, + { id: 4, company: 'Fendi casa', name: 'Product 4', price: 15.75, provider: 'Provider D', stock: 30, category: 'Home', representation: '/4.jpg' }, + { id: 5, company: 'Fendi casa', name: 'Product 5', price: 8.2, provider: 'Provider E', stock: 75, category: 'Home', representation: '/5.jpg' } ]); const [open, setOpen] = useState(false); @@ -94,7 +93,7 @@ export default function Admin({ children, maxWidth = 'lg', sx = {} }) { renderCell: (params) => ( - + Product Catalog - { setOpen(false); setEditingProduct(null); }} maxWidth="sm" fullWidth> + { setOpen(false); setEditingProduct(null); }} maxWidth="md" fullWidth> {editingProduct ? 'Edit Product' : 'Add Product'} { setOpen(false); setEditingProduct(null); }} /> diff --git a/src/utils/validation.jsx b/src/utils/validation.jsx new file mode 100644 index 0000000..2480078 --- /dev/null +++ b/src/utils/validation.jsx @@ -0,0 +1,12 @@ +export function handleDecimalInputKeyDown(e) { + const allowedKeys = ['Backspace', 'Tab', 'Delete', 'ArrowLeft', 'ArrowRight']; + const isDigit = /^[0-9]$/.test(e.key); + const isDot = e.key === '.'; + + const currentValue = e.target.value ?? ''; + const alreadyHasDot = currentValue.includes('.'); + + if (allowedKeys.includes(e.key)) return; + if (isDot && !alreadyHasDot) return; + if (!isDigit) e.preventDefault(); +} \ No newline at end of file