-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathLayout.tsx
52 lines (47 loc) · 1.48 KB
/
Layout.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
import * as React from 'react';
import { SolarLayout, SolarLayoutProps } from '@react-admin/ra-navigation';
import { useQueryClient } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import {
useStore,
useRedirect,
useDataProvider,
useRefresh,
} from 'react-admin';
import { TourProvider } from '@react-admin/ra-tour';
import AppBar from './AppBar';
import { Menu } from './Menu';
import CustomBreadcrumb from './Breadcrumb';
import tours from '../tours/tours';
const RA_TOUR_PREFERENCE_KEY = '@react-admin/ra-tour';
const Layout = (props: SolarLayoutProps) => {
const [tourPreferences, setTourPreferences] = useStore(
RA_TOUR_PREFERENCE_KEY
);
const redirect = useRedirect();
const dataProvider = useDataProvider();
const queryClient = useQueryClient();
const refresh = useRefresh();
return (
<TourProvider
initialState={tourPreferences}
tours={tours}
tools={{
redirect,
refresh,
dataProvider,
queryClient,
setTourPreferences,
}}
>
<>
<ReactQueryDevtools initialIsOpen={false} />
<SolarLayout {...props} menu={Menu} appBar={AppBar}>
<CustomBreadcrumb />
{props.children}
</SolarLayout>
</>
</TourProvider>
);
};
export default Layout;