Skip to content
Snippets Groups Projects
Verified Commit 6c33f13b authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Remove date provider.

parent dbfa710a
No related branches found
No related tags found
2 merge requests!85Implement the remaining api calls to make possible to link a driver shift with a reservation.,!75Resolve "Driver shift page where driver inserts shift."
......@@ -2,10 +2,12 @@ import React, { FC } from 'react';
import Container from '@material-ui/core/Container';
import { Route, useRouteMatch } from 'react-router-dom';
import { AuthRoutes } from 'api/routes';
import { Driver } from 'roles/Driver';
import { HomePage } from './HomePage/HomePage';
import { ProfilePage } from './ProfilePage/ProfilePage';
import { ReservationPage } from './ReservationPage/ReservationPage';
import { VeiclePage } from './VehiclePage/VehiclePage';
import { DriverShiftPage } from './DriverShift/DriverShiftPage';
export const Dashboard: FC = () => {
const { path } = useRouteMatch();
......@@ -17,7 +19,10 @@ export const Dashboard: FC = () => {
path={`${path}${AuthRoutes.reservation}`}
component={ReservationPage}
/>
<Route path={`${path}${AuthRoutes.vehicle}`} component={VeiclePage} />
<Route
path={`${path}${AuthRoutes.driver}`}
component={Driver(DriverShiftPage)}
/>
</>
);
};
import React, { FC, useState } from 'react';
import { Grid } from '@material-ui/core';
import { Reservation } from 'components/Dashboard/ReservationPage/Reservation/Reservation';
import DateFnsUtils from '@date-io/date-fns';
import itLocale from 'date-fns/locale/en-US';
import {
KeyboardDatePicker,
MuiPickersUtilsProvider,
} from '@material-ui/pickers';
import { useReservationsListByWeek } from 'hooks/useReservationsListByWeek';
import { KeyboardDatePicker } from '@material-ui/pickers/DatePicker';
/**
* Displays a list of all reservations from api.
......@@ -19,24 +14,22 @@ export const ReservationsListByWeek: FC = () => {
const reservations = useReservationsListByWeek(selectedDate);
return (
<MuiPickersUtilsProvider locale={itLocale} utils={DateFnsUtils}>
<div data-testid="ReservationListViewer">
<KeyboardDatePicker
value={selectedDate}
variant="static"
onChange={(date) => handleDateChange(date)}
format="dd/MM/yyyy"
/>
<Grid item container>
{reservations.length !== 0 ? (
reservations.map((reservation, key) => (
<Reservation reservation={reservation} />
))
) : (
<h1>You do not have reservations.</h1>
)}
</Grid>
</div>{' '}
</MuiPickersUtilsProvider>
<div data-testid="ReservationListViewer">
<KeyboardDatePicker
value={selectedDate}
variant="static"
onChange={(date) => handleDateChange(date)}
format="dd/MM/yyyy"
/>
<Grid item container>
{reservations.length !== 0 ? (
reservations.map((reservation, key) => (
<Reservation reservation={reservation} />
))
) : (
<h1>You do not have reservations.</h1>
)}
</Grid>
</div>
);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment