1
1
import React , { useEffect , useContext , useState } from "react" ;
2
2
import logo from "../../img/Icono puppereats.png" ;
3
- import { EdicionPerfil } from "../component/edicionPerfil" ;
3
+ import { EdicionPerfil } from "../component/edicionPerfil" ;
4
4
import { Context } from "../store/appContext" ;
5
- import { User , MapPin , PlusCircle } from "lucide-react" ;
5
+ import { User , MapPin , PlusCircle , LogOut , ShoppingCart } from "lucide-react" ; // Importar ShoppingCart para el ícono
6
6
import { useNavigate , Link } from "react-router-dom" ;
7
7
import "bootstrap/dist/css/bootstrap.min.css" ;
8
8
@@ -27,38 +27,74 @@ export const PerfilUsuario = () => {
27
27
28
28
return (
29
29
< div className = "container py-5" style = { { background : "#f9f6f2" , minHeight : "100vh" , borderRadius : "10px" } } >
30
- { /* Header */ }
31
- < div className = "d-flex justify-content-between align-items-center mb-4" >
32
- < div >
33
- < Link to = "/" className = "navbar-brand d-flex align-items-center" onClick = { ( ) => setActiveCategory ( null ) } >
34
- < img src = { logo } alt = "Logo" style = { { height : "60px" , border : "3px solid #000" , borderRadius : "10px" , padding : "3px" } } />
35
- < span className = "fw-bold text-dark" style = { { fontSize : "1.5rem" , marginLeft : "10px" } } > Pupper Eats</ span >
36
- </ Link >
37
- < button className = "btn btn-warning me-2" onClick = { ( ) => navigate ( "/carrito" ) } > 🛒 Carrito</ button >
38
- < button className = "btn btn-outline-secondary" onClick = { actions . logout } > Cerrar sesión</ button >
30
+ { /* Navbar personalizado */ }
31
+ < nav className = "navbar navbar-expand-lg mb-4" style = { { borderRadius : "12px" , boxShadow : "0 4px 6px rgba(0, 0, 0, 0.1)" , backgroundColor :"#257180" } } >
32
+ < div className = "container-fluid" >
33
+ { /* Logo */ }
34
+ < Link to = "/" className = "navbar-brand d-flex align-items-center" >
35
+ < img
36
+ src = { logo }
37
+ alt = "Logo"
38
+ style = { { height : "60px" , border : "3px solid #000" , borderRadius : "10px" , padding : "3px" } }
39
+ />
40
+ < span className = "fw-bold text-dark ms-2" style = { { fontSize : "2.5rem" } } > Pupper Eats</ span >
41
+ </ Link >
42
+
43
+ { /* Botón del carrito */ }
44
+ < button
45
+ className = "btn btn-warning btn-sm d-flex align-items-center gap-2 ms-auto"
46
+ onClick = { ( ) => navigate ( "/carrito" ) }
47
+ style = { { borderRadius : "8px" , whiteSpace : "nowrap" } } // Estilo personalizado
48
+ >
49
+ < ShoppingCart size = { 16 } /> { /* Ícono del carrito */ }
50
+ < span > Carrito</ span >
51
+ </ button >
39
52
</ div >
40
- </ div >
53
+ </ nav >
41
54
42
- { /* Perfil de Usuario */ }
43
- < div className = "card p-4 mb-4 shadow-lg" style = { { borderRadius : "12px" , backgroundColor : "#fff8e1" } } >
44
- < h2 className = "text-dark" > Hola, < span className = "fw-bold" > { store . user . name } </ span > 👋</ h2 >
55
+ { /* Perfil usuario */ }
56
+ < div className = "card p-4 mb-5" style = { { borderRadius : "12px" , backgroundColor : "#f9f6f2" , border : "none" , border : "none" } } >
57
+ < h2 className = "text-dark mb-3" > Hola, < span className = "fw-bold" > { store . user . name } </ span > 👋</ h2 >
58
+ < button
59
+ className = "btn btn-sm d-flex align-items-center gap-2"
60
+ onClick = { actions . logout }
61
+ style = { { border : "none" , color : "#6c757d" , padding : "0" } } // Estilo personalizado
62
+ >
63
+ < LogOut size = { 16 } /> { /* Ícono de cerrar sesión */ }
64
+ < span > Cerrar sesión</ span >
65
+ </ button >
45
66
< div className = "mt-3" >
46
- < p > < User size = { 16 } /> { store . user . name } </ p >
47
- < p > < MapPin size = { 16 } /> { store . user . email } </ p >
48
- < button className = "btn btn-outline-primary" onClick = { ( ) => setIsEditModalOpen ( true ) } > Editar perfil</ button >
67
+ < p className = "d-flex align-items-center gap-2" >
68
+ < User size = { 20 } className = "text-primary" /> { store . user . name }
69
+ </ p >
70
+ < p className = "d-flex align-items-center gap-2" >
71
+ < MapPin size = { 20 } className = "text-primary" /> { store . user . email }
72
+ </ p >
73
+ < button
74
+ className = "btn btn-dark"
75
+ onClick = { ( ) => setIsEditModalOpen ( true ) }
76
+ style = { { borderRadius : "none" , backgroundColor : "#FD8B51" } }
77
+ >
78
+ Editar perfil
79
+ </ button >
49
80
</ div >
50
81
</ div >
51
82
52
83
{ /* Modal de Edición de Perfil */ }
53
84
< EdicionPerfil isOpen = { isEditModalOpen } onClose = { ( ) => setIsEditModalOpen ( false ) } />
54
85
55
86
{ /* Mis Mascotas */ }
56
- < h3 className = "text-dark mb-3" > 🐾 Mis Mascotas</ h3 >
57
- < div className = "card p-3 shadow-lg" style = { { borderRadius : "12px" , backgroundColor : "#fff" } } >
58
- < div className = "d-flex align-items-center gap-3 flex-wrap" >
59
- < button className = "btn btn-outline-primary d-flex flex-column align-items-center" >
60
- < PlusCircle size = { 40 } />
61
- < Link to = "/registro-mascota" className = "btn btn-primary" > Añadir perfil mascota</ Link >
87
+ < h2 className = "text-dark mb-4" > 🐾 Mis Mascotas</ h2 >
88
+ < div className = "card p-4" style = { { borderRadius : "12px" , backgroundColor : "#fff" , border : "none" } } >
89
+ < div className = "d-flex align-items-center gap-4 flex-wrap" >
90
+ < button
91
+ className = "btn btn-outline-light d-flex flex-column align-items-center justify-content-center p-3"
92
+ style = { { borderRadius : "12px" , width : "120px" , height : "120px" , color :"#F2E5BF" } }
93
+ >
94
+ < PlusCircle size = { 40 } className = "mb-2" />
95
+ < Link to = "/registro-mascota" className = "text-decoration-none text-dark fs-6 fw-medium" >
96
+ < span > Añadir mascota</ span >
97
+ </ Link >
62
98
</ button >
63
99
{ store . pets && store . pets . length > 0 ? (
64
100
store . pets . map ( ( pet , index ) => (
@@ -69,12 +105,15 @@ export const PerfilUsuario = () => {
69
105
style = { { cursor : "pointer" } }
70
106
>
71
107
< img
72
- src = { pet . url || "https://via.placeholder.com/60" }
108
+ src = { pet . animal_type === "perro" ? "https://images.emojiterra.com/google/noto-emoji/unicode-16.0/color/1024px/1f436.png" :
109
+ pet . animal_type === "gato" ? "https://cdn-icons-png.flaticon.com/512/6988/6988878.png" :
110
+ pet . animal_type === "exotico" ? "https://cdn-icons-png.flaticon.com/512/802/802338.png" :
111
+ "https://via.placeholder.com/60" }
73
112
alt = { pet . name }
74
113
className = "rounded-circle border border-secondary"
75
114
style = { { width : 60 , height : 60 , objectFit : "cover" } }
76
115
/>
77
- < span className = "d-block mt-1 fw-semibold" > { pet . name } </ span >
116
+ < span className = "d-block mt-2 fw-semibold" > { pet . name } </ span >
78
117
</ div >
79
118
) )
80
119
) : (
0 commit comments