Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #119 from igrowker/javi-branch
Browse files Browse the repository at this point in the history
Últimos cambios
  • Loading branch information
josepacco00 authored Dec 9, 2024
2 parents 07ef65c + 3205c57 commit 4f8e5d9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/Book/Book.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Book: React.FC = () => {
bookingDate: reservation && reservation.bookingDate ? new Date(reservation.bookingDate) : undefined,
participants: reservation && reservation.participants ? String(reservation.participants) : "1",
email: reservation && reservation.email ? reservation.email : user?.email,
phone: reservation && reservation.phone ? reservation.phone : user?.phone
phone: reservation && reservation.phone?.slice(1) ? reservation.phone : user?.phone.split("+")[1]
},
mode: "onChange",
resolver: zodResolver(createNewReservationSchema(experience!.availabilityDates, experience!.capacity)),
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExperiencePanel/BookingInfo/BookingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function BookingInfo() {
<HeaderPanel title="Información de Reserva" />
<div className="px-5 my-5">
<img
src={imageSafari}
src={experience.experienceImages[0] ?? imageSafari}
alt="Imagen de Safari"
className="object-cover w-full h-32 rounded-3xl"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import imageSafari from "../../../assets/img/Safari.jpg";
import { useNavigate } from "react-router-dom";

function ExperienceCardProvider({ title, experienceId , price, status } : {title: string, experienceId: string, price: number, status:string } ) {
function ExperienceCardProvider({ title, experienceId , price, status, image } : {title: string, experienceId: string, price: number, status:string, image: string } ) {
const navigate = useNavigate();

return (
<div className="flex gap-4 p-4 border rounded-lg">
<div>
<img
src={imageSafari}
src={image ? image : imageSafari}
alt=""
className="max-w-[95px] h-28 rounded-xl"
/>
Expand All @@ -23,7 +23,7 @@ function ExperienceCardProvider({ title, experienceId , price, status } : {title
</p> : <p>
Estado: <span className="text-red-600">Inactivo</span>
</p>}
<p>Precio: ${price}</p>
<p>Precio: {price}</p>
</div>

<div className="flex gap-2 text-xs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function PanelProvider() {
status={experience.status}
price={experience.price}
title={experience.title}
image={experience?.experienceImages[0]}
/>
))}
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/components/ExperiencePanel/TouristUser/ExperienceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import Cookies from "js-cookie";
interface ExperienceCardProps {
idBooking: string;
bookingInfo: Booking;
// image: string
// userId: string;
}

function ExperienceCard({ idBooking, bookingInfo }: ExperienceCardProps) {
const navigate = useNavigate();

// experienceId posiblemente tenga que extraerlo
const { status, bookingDate, experienceTitle } = bookingInfo;
console.log(bookingInfo)
const { status, bookingDate, experienceTitle, experienceImages } = bookingInfo;

const dateFormatted = formatToShortDate(bookingDate);

Expand All @@ -36,7 +36,7 @@ function ExperienceCard({ idBooking, bookingInfo }: ExperienceCardProps) {
<div className="flex gap-4 p-4 border rounded-lg">
<div>
<img
src={imageSafari} // Usamos la imagen de la experiencia si está disponible
src={experienceImages[0] ?? imageSafari} // Usamos la imagen de la experiencia si está disponible
alt="Imagen de Safari"
className="max-w-[95px] h-28 rounded-xl"
/>
Expand All @@ -47,6 +47,7 @@ function ExperienceCard({ idBooking, bookingInfo }: ExperienceCardProps) {
</h1>
<p>
Estado: <span className={color}>{text}</span>

</p>
<p>Fecha: {dateFormatted}</p>
<div className="flex gap-2 text-xs">
Expand Down
4 changes: 3 additions & 1 deletion src/components/ExperiencePanel/TouristUser/PanelTourist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function PanelTourist() {
try {
const response = await bookingServices.getBookingsFromUser(userId);
setBookings(response);
console.log(bookings)
// console.log(response)
} catch (error) {
console.error("Error fetching bookings:", error);
} finally {
Expand All @@ -42,12 +42,14 @@ function PanelTourist() {
</div>
) : bookings && bookings.length > 0 ? (


<div className="flex flex-col gap-2 mt-4">
{bookings.map((booking) => (
<ExperienceCard
bookingInfo={booking}
key={booking.id}
idBooking={booking.id}
// image={booking.experienceImages[0]}
/>
))}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/mocks/experienice.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export const experienceMock: IExperience = {
price: 100,
rating: 3.7,
tags: ["Tag1", "Tag2", "Tag3"],
title: "Experience Title"
title: "Experience Title",
experienceImages: ["https://www.subexpuesta.com/img/content/paisajes-naturales_1.webp"]
}
1 change: 1 addition & 0 deletions src/types/booking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export interface Booking {
status: string;
totalPrice: number;
userId: string;
experienceImages: string[]
}

0 comments on commit 4f8e5d9

Please sign in to comment.