diff --git a/src/AdminGuesser.tsx b/src/AdminGuesser.tsx index c92ca6c0..5c335fc9 100644 --- a/src/AdminGuesser.tsx +++ b/src/AdminGuesser.tsx @@ -1,15 +1,12 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import PropTypes from 'prop-types'; import { - Admin, + AdminContext, + AdminUI, ComponentPropType, - I18nContextProvider, Loading, - ThemeProvider, - ThemesContext, defaultI18nProvider, } from 'react-admin'; -import { createHashHistory, createMemoryHistory } from 'history'; import { ErrorBoundary } from 'react-error-boundary'; import type { FallbackProps } from 'react-error-boundary'; import type { ComponentType, ErrorInfo } from 'react'; @@ -23,6 +20,7 @@ import { Error as DefaultError, Layout, LoginPage, + darkTheme, lightTheme, } from './layout/index.js'; import getRoutesAndResourcesFromNodes, { @@ -68,7 +66,7 @@ const getOverrideCode = (resources: Resource[]) => { export const AdminResourcesGuesser = ({ // Admin props loadingPage: LoadingPage = Loading, - admin: AdminEl = Admin, + admin: AdminEl = AdminUI, // Props children, includeDeprecated, @@ -116,7 +114,7 @@ const AdminGuesser = ({ includeDeprecated = false, // Admin props dataProvider, - history, + i18nProvider, layout = Layout, loginPage = LoginPage, loading: loadingPage, @@ -129,14 +127,6 @@ const AdminGuesser = ({ const [loading, setLoading] = useState(true); const [, setError] = useState(); const [introspect, setIntrospect] = useState(true); - let adminHistory = history; - - if (!adminHistory) { - adminHistory = - typeof window === 'undefined' - ? createMemoryHistory() - : createHashHistory(); - } useEffect(() => { if (typeof dataProvider.introspect !== 'function') { @@ -175,23 +165,29 @@ const AdminGuesser = ({ ); return ( - - - - {children} - - - + + + + + {children} + + + + ); }; @@ -231,19 +227,9 @@ const AdminGuesserWithError = ({ ); return ( - - - - - - - - - + + + ); }; diff --git a/src/__snapshots__/AdminGuesser.test.tsx.snap b/src/__snapshots__/AdminGuesser.test.tsx.snap index 073fa111..85acc1f7 100644 --- a/src/__snapshots__/AdminGuesser.test.tsx.snap +++ b/src/__snapshots__/AdminGuesser.test.tsx.snap @@ -3,7 +3,7 @@ exports[` renders loading 1`] = ``; exports[` renders with custom resources 1`] = ` - renders with custom resources 1`] = ` - + `; exports[` renders without custom resources 1`] = ` - renders without custom resources 1`] = ` - + `; exports[` renders without data 1`] = ` - { /> - ); };