-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathTourList.tsx
55 lines (50 loc) · 1.56 KB
/
TourList.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { ReactElement } from 'react';
import { Grid } from '@mui/material';
import PlaylistAddCheckIcon from '@mui/icons-material/PlaylistAddCheck';
import RotateLeftIcon from '@mui/icons-material/RotateLeft';
import { TopToolbar, Button } from 'react-admin';
import tours from './data';
import Tour from './Tour';
import { useTourStates } from './useTourState';
import { useDefineAppLocation } from '@react-admin/ra-navigation';
const ListActions = (): ReactElement => {
const [, tourStatesActions] = useTourStates();
return (
<TopToolbar>
<Button
label="Mark all as played"
onClick={(): void => tourStatesActions.markAllAsPlayed()}
>
<PlaylistAddCheckIcon />
</Button>
<Button
label="Reset"
onClick={(): void => tourStatesActions.resetAll()}
>
<RotateLeftIcon />
</Button>
</TopToolbar>
);
};
const TourList = (): ReactElement => {
useDefineAppLocation('tours');
return (
<>
<ListActions />
<Grid
container
alignItems="stretch"
spacing={2}
sx={{ px: 1 }}
data-testid="tourlist"
>
{tours.map(tour => (
<Grid item key={tour.id} xs={12} sm={6} md={4} lg={3}>
<Tour record={tour} />
</Grid>
))}
</Grid>
</>
);
};
export default TourList;