muffin-admin 3.9.0 → 3.10.1

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/types.d.ts CHANGED
@@ -93,5 +93,6 @@ export type AdminOpts = {
93
93
  };
94
94
  dashboard: AdminDashboardBlock[] | AdminDashboardBlock;
95
95
  resources: AdminResourceProps[];
96
+ help?: string;
96
97
  version: string;
97
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "3.9.0",
3
+ "version": "3.10.1",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -1,21 +1,34 @@
1
1
  import Card from "@mui/material/Card"
2
2
  import CardContent from "@mui/material/CardContent"
3
3
  import Grid from "@mui/material/Grid"
4
+ import Stack from "@mui/material/Stack"
4
5
  import Table from "@mui/material/Table"
5
6
  import TableBody from "@mui/material/TableBody"
6
7
  import TableCell from "@mui/material/TableCell"
7
8
  import TableRow from "@mui/material/TableRow"
8
9
  import Typography from "@mui/material/Typography"
10
+ import { useTranslate } from "react-admin"
11
+ import { HelpLink } from "./common/HelpLink"
9
12
  import { useMuffinAdminOpts } from "./hooks"
10
13
  import { AdminDashboardBlock } from "./types"
11
14
  import { setupAdmin } from "./utils"
12
15
 
13
16
  export function MuffinDashboard() {
14
- const { dashboard } = useMuffinAdminOpts()
17
+ const { dashboard, help } = useMuffinAdminOpts()
18
+ const translate = useTranslate()
15
19
  return (
16
- <Grid container spacing={1}>
17
- <AdminCards src={dashboard} />
18
- </Grid>
20
+ <Stack gap={2}>
21
+ {help && (
22
+ <Card>
23
+ <CardContent>
24
+ <HelpLink size="large" href={help} label={translate("muffin.how_to_use_admin")} />
25
+ </CardContent>
26
+ </Card>
27
+ )}
28
+ <Grid container spacing={1}>
29
+ <AdminCards src={dashboard} />
30
+ </Grid>
31
+ </Stack>
19
32
  )
20
33
  }
21
34
 
@@ -80,8 +80,8 @@ function MuffinListToolbar() {
80
80
  const actions = baseActions.filter((a) => a.view.includes("list"))
81
81
  return (
82
82
  <TopToolbar>
83
- <SelectColumnsButton />
84
83
  {help && <HelpLink href={help} />}
84
+ <SelectColumnsButton />
85
85
  <FilterButton />
86
86
  {actions.length ? actions.map((props) => <ActionButton key={props.id} {...props} />) : null}
87
87
  {create && <CreateButton />}
package/src/i18n/en.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  const muffinEnglishMessages = {
2
2
  muffin: {
3
3
  instructions: "Instructions",
4
+ how_to_use_admin: "How to use Admin?",
4
5
  },
5
6
  }
6
7
 
package/src/i18n/ru.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  const muffinRussianMessages = {
2
2
  muffin: {
3
3
  instructions: "Инструкции",
4
+ how_to_use_admin: "Как использовать админку?",
4
5
  },
5
6
  }
6
7
 
package/src/types.ts CHANGED
@@ -15,7 +15,7 @@ export type AdminAction = {
15
15
  }
16
16
 
17
17
  export type AdminField = [string, { source: string }]
18
- export type AdminInput = [string, { required: boolean; source: string; [key: string]: any }]
18
+ export type AdminInput = [string, { required: boolean; source: string;[key: string]: any }]
19
19
 
20
20
  export type AdminShowLink = {
21
21
  label: string
@@ -46,11 +46,11 @@ export type AdminResourceProps = {
46
46
  actions: AdminAction[]
47
47
  create: AdminInput[] | false
48
48
  edit:
49
- | {
50
- inputs: AdminInput[]
51
- remove?: boolean
52
- }
53
- | false
49
+ | {
50
+ inputs: AdminInput[]
51
+ remove?: boolean
52
+ }
53
+ | false
54
54
  list: {
55
55
  limit: number
56
56
  limitMax: number
@@ -95,5 +95,6 @@ export type AdminOpts = {
95
95
  }
96
96
  dashboard: AdminDashboardBlock[] | AdminDashboardBlock
97
97
  resources: AdminResourceProps[]
98
+ help?: string
98
99
  version: string
99
100
  }