muffin-admin 3.11.0 → 3.11.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.
@@ -10,15 +10,14 @@ import { buildProvider, muffinTranslations } from "./i18n";
10
10
  import { buildAdmin, findBuilder, findIcon, setupAdmin } from "./utils";
11
11
  export function MuffinAdmin(props) {
12
12
  const opts = useMuffinAdminOpts();
13
- const { resources = [], auth, adminProps, apiUrl, locales } = opts;
13
+ const { resources = [], auth, adminProps, apiUrl, locales: backendLocales } = opts;
14
14
  document.title = (adminProps === null || adminProps === void 0 ? void 0 : adminProps.title) || "Muffin Admin";
15
- const muffinI18nProvider = buildProvider(locales
15
+ const muffinI18nProvider = buildProvider(backendLocales
16
16
  ? Object.fromEntries(Object.entries(muffinTranslations).map(([locale, messages]) => [
17
17
  locale,
18
- Object.assign(Object.assign({}, messages), locales[locale]),
18
+ Object.assign(Object.assign(Object.assign({}, messages), backendLocales[locale]), (buildAdmin(["locale", locale]) || {})),
19
19
  ]))
20
20
  : muffinTranslations);
21
- console.log(999, muffinI18nProvider.getLocale());
22
21
  const { basename, authProvider = findBuilder(["authprovider"])(auth), dataProvider = findBuilder(["dataprovider"])(apiUrl), catchAll, dashboard = findBuilder(["dashboard"]), disableTelemetry, error, i18nProvider = muffinI18nProvider, layout = findBuilder(["layout"]), loading, loginPage = findBuilder(["loginpage"]), authCallbackPage, notification, queryClient, requireAuth = auth.required, store = localStorageStore(), ready, theme, lightTheme, darkTheme, defaultTheme, title = "React Admin", } = props;
23
22
  return (_jsx(AdminContext, { authProvider: authProvider, basename: basename, dataProvider: dataProvider, i18nProvider: i18nProvider, store: store, queryClient: queryClient, theme: theme, lightTheme: lightTheme, darkTheme: darkTheme, defaultTheme: defaultTheme, children: _jsx(ConfirmationProvider, { children: _jsx(AdminUI, { layout: layout, dashboard: dashboard, disableTelemetry: disableTelemetry, catchAll: catchAll, error: error, title: title, loading: loading, loginPage: loginPage, authCallbackPage: authCallbackPage, notification: notification, requireAuth: requireAuth, ready: ready, children: resources === null || resources === void 0 ? void 0 : resources.map(({ name }) => buildAdmin(["resource", name], { name })) }) }) }));
24
23
  }
@@ -11,11 +11,11 @@ import Typography from "@mui/material/Typography";
11
11
  import { useTranslate } from "react-admin";
12
12
  import { HelpLink } from "./common/HelpLink";
13
13
  import { useMuffinAdminOpts } from "./hooks";
14
- import { setupAdmin } from "./utils";
14
+ import { buildAdmin, setupAdmin } from "./utils";
15
15
  export function MuffinDashboard() {
16
16
  const { dashboard, help } = useMuffinAdminOpts();
17
17
  const translate = useTranslate();
18
- return (_jsxs(Stack, { gap: 2, children: [help && (_jsx(Card, { children: _jsx(CardContent, { children: _jsx(HelpLink, { size: "large", href: help, label: translate("muffin.how_to_use_admin") }) }) })), _jsx(Grid, { container: true, spacing: 1, children: _jsx(AdminCards, { src: dashboard }) })] }));
18
+ return (_jsxs(Stack, { gap: 2, pt: 1, children: [_jsxs(Stack, { direction: "row", children: [help && _jsx(HelpLink, { size: "large", href: help, label: translate("muffin.how_to_use_admin") }), buildAdmin(["dashboard-actions"])] }), _jsx(Grid, { container: true, spacing: 1, children: _jsx(AdminCards, { src: dashboard }) })] }));
19
19
  }
20
20
  setupAdmin(["dashboard"], MuffinDashboard);
21
21
  function AdminCards({ src }) {