-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from tan12082001/reserve-item-component
Reserve item component
- Loading branch information
Showing
31 changed files
with
596 additions
and
122 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import './styles/App.css'; | ||
import React from 'react'; | ||
import Router from './routes/routes'; | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
// my reservations list component | ||
import React, {useEffect} from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { fetchCarReservations } from '../../redux/thunk'; | ||
|
||
const MyReservationsList = () => { | ||
const dispatch = useDispatch(); | ||
const myReservations = useSelector((state) => state.reservation.reservations); | ||
const status = useSelector((state) => state.reservation.status); | ||
const error = useSelector((state) => state.reservation.error); | ||
|
||
useEffect(() => { | ||
dispatch(fetchCarReservations()); | ||
}, [dispatch]); | ||
|
||
if (status === 'loading') { | ||
return <p>Loading...</p>; | ||
} | ||
|
||
if (status === 'failed') { | ||
return <p>Error: {error}</p>; | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>My Reservations</h1> | ||
{myReservations.map((reservation) => ( | ||
<div key={reservation.id}> | ||
<p>{`Car: ${reservation.car.name}, Date: ${reservation.date}, City: ${reservation.city}`}</p> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MyReservationsList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
// reserve item page component | ||
import React from 'react'; | ||
import ReserveCarFrom from './ReserveCarForm'; | ||
|
||
const ReserveCar = () => ( | ||
<div className="reserve-car-outer"> | ||
<div className="testing-backdrop"> | ||
<div className="reserve-car-inner"> | ||
<h1 id="reserve-car-head-title">Book A Car on Hourly bases!</h1> | ||
<div className="blank-div" /> | ||
<p id="reserve-page-head-description"> | ||
You can reserve a car from the list of cars present. You can Book the car by selecting the | ||
{' '} | ||
<i>City</i> | ||
{' '} | ||
and the | ||
<i>Date</i> | ||
{' '} | ||
you want to book | ||
the Vehicle. We have services all over the globe which some include test-riding facilites. | ||
To book the car select both City and Date, please use the selector below. | ||
</p> | ||
<ReserveCarFrom /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default ReserveCar; |
Oops, something went wrong.