-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathApp.tsx
87 lines (83 loc) · 2.34 KB
/
App.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import KitchenIcon from "@mui/icons-material/Kitchen";
import { Box } from "@mui/material";
import { ContainerLayout } from "@react-admin/ra-navigation";
import { Search } from "@react-admin/ra-search";
import {
Admin,
RefreshIconButton,
Resource,
ToggleThemeButton,
localStorageStore,
} from "react-admin";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import customers from "./customers";
import products from "./products";
import tickets from "./tickets";
import { MessageShow } from "./messages/MessageShow";
import { authProvider } from "./authProvider";
import { dataProvider } from "./dataProvider";
import { ConnectionWatcher } from "./ConnectionWatcher";
const MyLayout = (props: any) => (
<>
<ContainerLayout
{...props}
maxWidth="xl"
toolbar={
<Box display="flex" gap={1} mr={1} alignItems="center">
<Search />
<ToggleThemeButton />
<RefreshIconButton />
</Box>
}
sx={{
"& .RaHeader-toolbar > *": {
flexBasis: "33.33%",
// FIXME: This should be fixed in ra-navigation
alignItems: "center",
justifyContent: "center",
},
"& .RaHeader-toolbar > *:first-of-type": {
justifyContent: "flex-start",
},
"& .RaHeader-toolbar > *:last-child": {
justifyContent: "flex-end",
},
"& .MuiTabs-flexContainer": {
justifyContent: "center",
},
}}
/>
<ReactQueryDevtools
initialIsOpen={false}
// To avoid collision with the ConnectionWatcher notifications
buttonPosition="bottom-left"
/>
<ConnectionWatcher />
</>
);
const App = () => (
<Admin
dataProvider={dataProvider}
authProvider={authProvider}
store={localStorageStore(undefined, "HelpDesk")}
title={
<Box display="flex" gap={1} alignItems="center">
<KitchenIcon /> Acme Refrigerator HelpDesk
</Box>
}
layout={MyLayout}
defaultTheme="light"
>
<Resource name="tickets" {...tickets} />
<Resource name="customers" {...customers} />
<Resource name="products" {...products} />
<Resource
name="agents"
recordRepresentation={(record) =>
`${record.firstName} ${record.lastName}`
}
/>
<Resource name="messages" show={MessageShow} />
</Admin>
);
export default App;