Migrate makeStyles
to MUI v5
This commit is contained in:
parent
3276a9b6ed
commit
c9796b155c
@ -25,7 +25,8 @@
|
|||||||
"@emotion/react": "^11.7.1",
|
"@emotion/react": "^11.7.1",
|
||||||
"@emotion/styled": "^11.6.0",
|
"@emotion/styled": "^11.6.0",
|
||||||
"@mui/icons-material": "^5.3.1",
|
"@mui/icons-material": "^5.3.1",
|
||||||
"@mui/material": "^5.4.0",
|
"@mui/material": "^5.11.7",
|
||||||
|
"@mui/styles": "^5.11.7",
|
||||||
"papaparse": "^5.2.0",
|
"papaparse": "^5.2.0",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"ra-language-chinese": "^2.0.10",
|
"ra-language-chinese": "^2.0.10",
|
||||||
|
137
src/App.js
137
src/App.js
@ -1,5 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
||||||
|
import { StylesProvider, createGenerateClassName } from "@mui/styles";
|
||||||
|
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
||||||
import polyglotI18nProvider from "ra-i18n-polyglot";
|
import polyglotI18nProvider from "ra-i18n-polyglot";
|
||||||
import authProvider from "./synapse/authProvider";
|
import authProvider from "./synapse/authProvider";
|
||||||
import dataProvider from "./synapse/dataProvider";
|
import dataProvider from "./synapse/dataProvider";
|
||||||
@ -41,65 +43,84 @@ const i18nProvider = polyglotI18nProvider(
|
|||||||
resolveBrowserLocale()
|
resolveBrowserLocale()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const defaultTheme = createTheme();
|
||||||
|
const generateClassName = createGenerateClassName({
|
||||||
|
disableGlobal: true,
|
||||||
|
seed: "mui-jss",
|
||||||
|
});
|
||||||
|
|
||||||
const App = () => (
|
const App = () => (
|
||||||
<Admin
|
<StylesProvider generateClassName={generateClassName}>
|
||||||
disableTelemetry
|
<ThemeProvider theme={defaultTheme}>
|
||||||
loginPage={LoginPage}
|
<Admin
|
||||||
authProvider={authProvider}
|
disableTelemetry
|
||||||
dataProvider={dataProvider}
|
loginPage={LoginPage}
|
||||||
i18nProvider={i18nProvider}
|
authProvider={authProvider}
|
||||||
customRoutes={[
|
dataProvider={dataProvider}
|
||||||
<Route key="userImport" path="/import_users" component={ImportFeature} />,
|
i18nProvider={i18nProvider}
|
||||||
]}
|
customRoutes={[
|
||||||
>
|
<Route
|
||||||
<Resource
|
key="userImport"
|
||||||
name="users"
|
path="/import_users"
|
||||||
list={UserList}
|
component={ImportFeature}
|
||||||
create={UserCreate}
|
/>,
|
||||||
edit={UserEdit}
|
]}
|
||||||
icon={UserIcon}
|
>
|
||||||
/>
|
<Resource
|
||||||
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
name="users"
|
||||||
<Resource
|
list={UserList}
|
||||||
name="user_media_statistics"
|
create={UserCreate}
|
||||||
list={UserMediaStatsList}
|
edit={UserEdit}
|
||||||
icon={EqualizerIcon}
|
icon={UserIcon}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="reports"
|
name="rooms"
|
||||||
list={ReportList}
|
list={RoomList}
|
||||||
show={ReportShow}
|
show={RoomShow}
|
||||||
icon={ReportIcon}
|
icon={RoomIcon}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="room_directory"
|
name="user_media_statistics"
|
||||||
list={RoomDirectoryList}
|
list={UserMediaStatsList}
|
||||||
icon={FolderSharedIcon}
|
icon={EqualizerIcon}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="destinations"
|
name="reports"
|
||||||
list={DestinationList}
|
list={ReportList}
|
||||||
show={DestinationShow}
|
show={ReportShow}
|
||||||
icon={CloudQueueIcon}
|
icon={ReportIcon}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="registration_tokens"
|
name="room_directory"
|
||||||
list={RegistrationTokenList}
|
list={RoomDirectoryList}
|
||||||
create={RegistrationTokenCreate}
|
icon={FolderSharedIcon}
|
||||||
edit={RegistrationTokenEdit}
|
/>
|
||||||
icon={ConfirmationNumberIcon}
|
<Resource
|
||||||
/>
|
name="destinations"
|
||||||
<Resource name="connections" />
|
list={DestinationList}
|
||||||
<Resource name="devices" />
|
show={DestinationShow}
|
||||||
<Resource name="room_members" />
|
icon={CloudQueueIcon}
|
||||||
<Resource name="users_media" />
|
/>
|
||||||
<Resource name="joined_rooms" />
|
<Resource
|
||||||
<Resource name="pushers" />
|
name="registration_tokens"
|
||||||
<Resource name="servernotices" />
|
list={RegistrationTokenList}
|
||||||
<Resource name="forward_extremities" />
|
create={RegistrationTokenCreate}
|
||||||
<Resource name="room_state" />
|
edit={RegistrationTokenEdit}
|
||||||
<Resource name="destination_rooms" />
|
icon={ConfirmationNumberIcon}
|
||||||
</Admin>
|
/>
|
||||||
|
<Resource name="connections" />
|
||||||
|
<Resource name="devices" />
|
||||||
|
<Resource name="room_members" />
|
||||||
|
<Resource name="users_media" />
|
||||||
|
<Resource name="joined_rooms" />
|
||||||
|
<Resource name="pushers" />
|
||||||
|
<Resource name="servernotices" />
|
||||||
|
<Resource name="forward_extremities" />
|
||||||
|
<Resource name="room_state" />
|
||||||
|
<Resource name="destination_rooms" />
|
||||||
|
</Admin>
|
||||||
|
</ThemeProvider>
|
||||||
|
</StylesProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
TextField,
|
TextField,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import LockIcon from "@mui/icons-material/Lock";
|
import LockIcon from "@mui/icons-material/Lock";
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
@ -345,7 +345,6 @@ const LoginPage = ({ theme }) => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={loading || !supportPassAuth}
|
disabled={loading || !supportPassAuth}
|
||||||
className={classes.button}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
{loading && <CircularProgress size={25} thickness={2} />}
|
{loading && <CircularProgress size={25} thickness={2} />}
|
||||||
@ -356,7 +355,6 @@ const LoginPage = ({ theme }) => {
|
|||||||
color="secondary"
|
color="secondary"
|
||||||
onClick={handleSSO}
|
onClick={handleSSO}
|
||||||
disabled={loading || ssoBaseUrl === ""}
|
disabled={loading || ssoBaseUrl === ""}
|
||||||
className={classes.button}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
{loading && <CircularProgress size={25} thickness={2} />}
|
{loading && <CircularProgress size={25} thickness={2} />}
|
||||||
|
@ -2,7 +2,7 @@ import React, { Fragment } from "react";
|
|||||||
import { Avatar, Chip } from "@mui/material";
|
import { Avatar, Chip } from "@mui/material";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import {
|
import {
|
||||||
BooleanField,
|
BooleanField,
|
||||||
BulkDeleteButton,
|
BulkDeleteButton,
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
useRefresh,
|
useRefresh,
|
||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
import ActionDelete from "@mui/icons-material/Delete";
|
import ActionDelete from "@mui/icons-material/Delete";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import { alpha } from "@mui/material/styles";
|
import { alpha } from "@mui/material/styles";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment, useState } from "react";
|
import React, { Fragment, useState } from "react";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { alpha } from "@mui/material/styles";
|
import { alpha } from "@mui/material/styles";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import {
|
import {
|
||||||
BooleanInput,
|
BooleanInput,
|
||||||
Button,
|
Button,
|
||||||
|
@ -24,7 +24,7 @@ import {
|
|||||||
} from "react-admin";
|
} from "react-admin";
|
||||||
import get from "lodash/get";
|
import get from "lodash/get";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import { Tooltip, Typography, Chip } from "@mui/material";
|
import { Tooltip, Typography, Chip } from "@mui/material";
|
||||||
import FastForwardIcon from "@mui/icons-material/FastForward";
|
import FastForwardIcon from "@mui/icons-material/FastForward";
|
||||||
import HttpsIcon from "@mui/icons-material/Https";
|
import HttpsIcon from "@mui/icons-material/Https";
|
||||||
|
@ -52,7 +52,7 @@ import { Link } from "react-router-dom";
|
|||||||
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
import { ServerNoticeButton, ServerNoticeBulkButton } from "./ServerNotices";
|
||||||
import { DeviceRemoveButton } from "./devices";
|
import { DeviceRemoveButton } from "./devices";
|
||||||
import { ProtectMediaButton, QuarantineMediaButton } from "./media";
|
import { ProtectMediaButton, QuarantineMediaButton } from "./media";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const redirect = () => {
|
const redirect = () => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user