muffin-admin 1.45.2 → 1.45.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MuffinAdmin.js +2 -2
- package/dist/MuffinDashboard.d.ts +3 -1
- package/dist/MuffinDashboard.js +10 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinAdmin.tsx +5 -5
- package/src/MuffinDashboard.tsx +19 -7
- package/src/index.tsx +1 -0
package/package.json
CHANGED
package/src/MuffinAdmin.tsx
CHANGED
|
@@ -20,7 +20,7 @@ const darkTheme = createTheme({
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
export function MuffinAdmin(props: AdminOpts) {
|
|
23
|
-
const { resources, auth, appBarLinks } = props
|
|
23
|
+
const { resources, auth, appBarLinks, dashboard } = props
|
|
24
24
|
const children = resources.map((resource) =>
|
|
25
25
|
buildAdmin(["resource", resource.name], {
|
|
26
26
|
...resource,
|
|
@@ -54,12 +54,12 @@ export function MuffinAdmin(props: AdminOpts) {
|
|
|
54
54
|
return (
|
|
55
55
|
<AdminPropsContext.Provider value={props}>
|
|
56
56
|
<Admin
|
|
57
|
-
requireAuth={auth.required}
|
|
58
|
-
dashboard={buildAdmin(["dashboard"])}
|
|
59
|
-
loginPage={findBuilder(["loginpage"])}
|
|
60
57
|
authProvider={buildAdmin(["authprovider"], auth)}
|
|
61
|
-
|
|
58
|
+
dashboard={buildAdmin(["dashboard"], dashboard)}
|
|
62
59
|
dataProvider={buildAdmin(["dataprovider"], props) as unknown as DataProvider}
|
|
60
|
+
layout={(props) => <Layout {...props} appBar={appBar} />}
|
|
61
|
+
loginPage={findBuilder(["loginpage"])}
|
|
62
|
+
requireAuth={auth.required}
|
|
63
63
|
>
|
|
64
64
|
{children}
|
|
65
65
|
</Admin>
|
package/src/MuffinDashboard.tsx
CHANGED
|
@@ -7,20 +7,30 @@ import TableCell from "@mui/material/TableCell"
|
|
|
7
7
|
import TableRow from "@mui/material/TableRow"
|
|
8
8
|
import Typography from "@mui/material/Typography"
|
|
9
9
|
import { AdminDashboardBlock, AdminOpts } from "./types"
|
|
10
|
+
import { setupAdmin } from "./utils"
|
|
10
11
|
|
|
11
|
-
export function MuffinDashboard(
|
|
12
|
+
export function MuffinDashboard({ src }: { src: AdminOpts["dashboard"] }) {
|
|
12
13
|
return (
|
|
13
14
|
<Grid container spacing={1}>
|
|
14
|
-
{
|
|
15
|
-
props.map((card, idx) => <DashboardCard key={idx} {...card} />)
|
|
16
|
-
) : (
|
|
17
|
-
<DashboardCard {...props} />
|
|
18
|
-
)}
|
|
15
|
+
<AdminCards src={src} />
|
|
19
16
|
</Grid>
|
|
20
17
|
)
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
function
|
|
20
|
+
function AdminCards({ src }: { src: AdminDashboardBlock | AdminDashboardBlock[] }) {
|
|
21
|
+
if (Array.isArray(src))
|
|
22
|
+
return (
|
|
23
|
+
<Grid container item spacing={2}>
|
|
24
|
+
{src.map((card, idx) => (
|
|
25
|
+
<AdminCards key={idx} src={card} />
|
|
26
|
+
))}
|
|
27
|
+
</Grid>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return <DashboardCard {...src} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DashboardCard({ title, value }: AdminDashboardBlock) {
|
|
24
34
|
return (
|
|
25
35
|
<Grid item xs>
|
|
26
36
|
<Card>
|
|
@@ -50,3 +60,5 @@ const AdminTableView = ({ src }) => (
|
|
|
50
60
|
</TableBody>
|
|
51
61
|
</Table>
|
|
52
62
|
)
|
|
63
|
+
|
|
64
|
+
setupAdmin(["dashboard"], (dashboard) => () => <MuffinDashboard src={dashboard} />)
|
package/src/index.tsx
CHANGED