Skip to content

Migrated from React v18 to v19 and updated all MUI packages. #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: v2-development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions Servers/UI/OJS.Servers.Ui/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
"homepage": "https://localhost:5002",
"type": "module",
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@material-ui/core": "^4.12.3",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@monaco-editor/react": "4.6.0",
"@mui/base": "^5.0.0-beta.58",
"@mui/icons-material": "^5.15.0",
"@mui/material": "^5.15.21",
"@mui/system": "^5.2.4",
"@mui/x-data-grid": "^6.19.4",
"@mui/x-date-pickers": "^6.19.4",
"@mui/x-tree-view": "^7.8.0",
"@mui/base": "^5.0.0-beta.70",
"@mui/icons-material": "^7.1.1",
"@mui/material": "^7.1.1",
"@mui/system": "^7.1.1",
"@mui/x-data-grid": "^8.5.1",
"@mui/x-date-pickers": "^8.5.1",
"@mui/x-tree-view": "^8.5.1",
"@reduxjs/toolkit": "^1.9.7",
"@types/prismjs": "^1.16.6",
"@vitejs/plugin-react": "^2.0.1",
Expand All @@ -26,32 +25,33 @@
"monaco-editor": "^0.34.1",
"prismjs": "^1.25.0",
"quill": "^2.0.2",
"react": "^18.3.1",
"react": "^19.0.0",
"react-alice-carousel": "^2.5.1",
"react-arborist": "^3.4.0",
"react-diff-viewer": "^3.1.1",
"react-dom": "^18.3.1",
"react-dom": "^19.0.0",
"react-helmet-async": "^2.0.5",
"react-icons": "^4.3.1",
"react-json-view": "^1.21.3",
"react-lite-youtube-embed": "^2.4.0",
"react-markdown": "^8.0.7",
"react-markdown": "^10.1.0",
"react-redux": "^8.1.3",
"react-router": "^6.24.0",
"react-router-dom": "^6.24.0",
"redux-persist": "^6.0.0",
"redux-persist-indexeddb-storage": "^1.0.4",
"sass": "^1.69.5",
"sass": "^1.89.2",
"use-resize-observer": "^9.1.0",
"uuid": "^9.0.0",
"vfile": "5.3.7",
"vite": "^3.0.7",
"yarn": "^1.22.17"
},
"devDependencies": {
"@types/lodash": "^4.14.175",
"@types/node": "18.11.2",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.1",
"@types/react": "^19.1.7",
"@types/react-dom": "^19.0.0",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
Expand Down Expand Up @@ -98,5 +98,8 @@
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"resolutions": {
"vfile": "5.3.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const TabsInView = (props: ITabsInViewProps) => {
return (
<Slide direction="left" in mountOnEnter unmountOnExit timeout={300}>
<Box>
{form && form()}
{form?.()}
<Box sx={{ padding: '2rem' }}>
<Tabs
sx={{ minWidth: '100%', display: 'flex', justifyContent: 'space-around' }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ChangeEvent, FC, useState } from 'react';
import React, { ChangeEvent, FC, RefObject, useState } from 'react';
import { CiSquareMore } from 'react-icons/ci';
import HomeIcon from '@mui/icons-material/Home';
import LogoutIcon from '@mui/icons-material/Logout';
Expand All @@ -16,7 +16,7 @@ interface IUserActionsProps {
themeMode: ThemeMode;
showMenu: boolean;
setShowMenu: (show: boolean) => void;
iconButtonRef: React.RefObject<HTMLButtonElement>;
iconButtonRef: RefObject<HTMLButtonElement | null>;
}

const MaterialUISwitch = styled(Switch)(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const UsersInExamGroupView = (props: IUsersInExamGroupViewProps) => {
filterable: false,
sortable: false,
flex: 1,
valueFormatter: (params) => params.value.toString(),
valueFormatter: (_, row) => row.value?.toString(),
},
{
field: 'userName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const AdministrationSubmissionTypeDocumentPage = () => {

const params = new URLSearchParams(location.search);

const isEditMode = params.get('isEditMode') === 'true'
? true
: false ?? false;
const isEditMode = params.get('isEditMode') === 'true';

const renderSubmissionTypeDocumentForm = () => (
<SubmissionTypeDocumentForm id={Number(submissionTypeDocumentId)} isEditMode={isEditMode} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import { SyntheticEvent, useEffect, useMemo, useState } from 'react';
import { useParams } from 'react-router-dom';
import Box from '@mui/material/Box';
import { TreeItem } from '@mui/x-tree-view';
import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView';
import { TreeItem2 } from '@mui/x-tree-view/TreeItem2';

import { IContestCategory } from '../../../common/types';
import { getAllContestsPageUrl } from '../../../common/urls/compose-client-urls';
Expand Down Expand Up @@ -81,7 +81,7 @@ const ContestCategories = (props: IContestCategoriesProps) => {
}, [ categoryId ]);

const handleExpandedItemsChange = (
event: SyntheticEvent,
event: SyntheticEvent | null,
itemIds: string[],
) => {
setExpandedItems(itemIds);
Expand Down Expand Up @@ -118,15 +118,15 @@ const ContestCategories = (props: IContestCategoriesProps) => {

if (category.children.length > 0) {
return (
<TreeItem2
<TreeItem
itemId={`${category.id}`}
key={category.id}
label={category.name}
className={categoryListItemClassNames}
classes={{ content: categoryListItemContentClassNames }}
>
{category.children.map((child) => renderCategory(child, true))}
</TreeItem2>
</TreeItem>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import makeStyles from '@material-ui/core/styles/makeStyles';
import { PaginationItem } from '@mui/material';
import Pagination from '@mui/material/Pagination';
import useTheme from 'src/hooks/use-theme';
Expand Down Expand Up @@ -31,22 +30,6 @@ const PaginationControls = ({
className,
);

const useStyles = makeStyles(() => ({
ul: {
// This sets the background color of the selected page button
'& .MuiPaginationItem-root.Mui-selected': { backgroundColor: '#44a9f8', color: '#ffffff' },
'& .MuiPaginationItem-root': { color: themeColors.textColor },
'& .MuiPaginationItem-ellipsis': { cursor: 'pointer' },
'& .Mui-disabled': { pointerEvents: 'none' },
},
ellipsis: {
pointerEvents: 'auto',
cursor: 'pointer',
},
}));

const classes = useStyles();

const handleEllipsisClick = (type: string) => {
if (isDataFetching) {
return;
Expand All @@ -71,30 +54,28 @@ const PaginationControls = ({
count={count}
siblingCount={PAGE_SIBLING_COUNT}
boundaryCount={PAGE_BOUNDARY_COUNT}
onChange={(ev, value) => {
onChange(value);
}}
onChange={(ev, value) => onChange(value)}
page={page}
className={paginationClassNames}
classes={{ ul: classes.ul }}
sx={{
ul: {
'& .MuiPaginationItem-root.Mui-selected': {
backgroundColor: '#44a9f8',
color: '#ffffff',
},
'& .MuiPaginationItem-root': { color: themeColors.textColor },
'& .MuiPaginationItem-ellipsis': { cursor: 'pointer' },
'& .Mui-disabled': { pointerEvents: 'none' },
},
}}
showFirstButton
showLastButton
disabled={isDataFetching}
renderItem={(item) => {
if (item.type === 'start-ellipsis') {
return (
<div
className={classes.ellipsis}
onClick={() => handleEllipsisClick(item.type)}
>
<PaginationItem {...item}>...</PaginationItem>
</div>
);
}
if (item.type === 'end-ellipsis') {
if (item.type === 'start-ellipsis' || item.type === 'end-ellipsis') {
return (
<div
className={classes.ellipsis}
style={{ cursor: 'pointer', pointerEvents: 'auto' }}
onClick={() => handleEllipsisClick(item.type)}
>
<PaginationItem {...item}>...</PaginationItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ const Mentor = (props: IMentorProps) => {
: styles.mentorMessage
}`}
>
<ReactMarkdown className={styles.markdownContent}>
{message.content}
</ReactMarkdown>
<div className={styles.markdownContent}>
<ReactMarkdown>{message.content}</ReactMarkdown>
</div>
</div>
</div>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const AdministrationPortal = () => {

const [ open, setOpen ] = useState(true);
const [ showMenu, setShowMenu ] = useState<boolean>(false);
const iconButtonRef = useRef(null);
const iconButtonRef = useRef<HTMLButtonElement>(null);

useEffect(() => {
const locationPathnameElements = location.pathname.split('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const SubmissionGridRow = ({
</Popover>
</td>
)
: <td />
: <td aria-hidden="true" />
: null
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,22 @@ const AdministrationThemeProvider: FC<IAdministrationThemeProviderProps> = ({ ch
},
},
},
MuiDataGrid: { styleOverrides: { root: { borderRadius: '14px', borderWidth: '1px' } } },
MuiDataGrid: {
styleOverrides: {
root: {
borderRadius: '14px',
borderWidth: '1px',
backgroundColor: getColors(themeMode).background.default,
'& .MuiDataGrid-cell': { backgroundColor: getColors(themeMode).background.default },
'& .MuiDataGrid-row': { backgroundColor: getColors(themeMode).background.default },
'& .MuiDataGrid-columnHeaders': {
backgroundColor: getColors(themeMode).background.default,
'& .MuiDataGrid-columnHeader': { backgroundColor: getColors(themeMode).background.default },
'& .MuiDataGrid-columnHeaderTitle': { color: getColors(themeMode).textColors.primary },
},
},
},
},
MuiButton: { styleOverrides: { root: { borderRadius: 8 } } },
MuiCssBaseline: {
styleOverrides: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const accessLogsFilterableColumns: AdministrationGridColDef[] = [
flex: 1,
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'ipAddress',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const categoriesFilterableColumns: AdministrationGridColDef[] = [
filterable: false,
align: 'center',
sortable: false,
valueFormatter: (params) => params.value.toString(),
valueFormatter: (_, row) => row.value?.toString(),
},
{
field: 'isDeleted',
Expand Down Expand Up @@ -136,7 +136,7 @@ const categoriesFilterableColumns: AdministrationGridColDef[] = [
type: 'date',
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'createdOn',
Expand All @@ -145,7 +145,7 @@ const categoriesFilterableColumns: AdministrationGridColDef[] = [
flex: 1,
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'modifiedOn',
Expand All @@ -154,7 +154,7 @@ const categoriesFilterableColumns: AdministrationGridColDef[] = [
flex: 1,
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
headerAlign: 'center',
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'endTime',
Expand All @@ -128,7 +128,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
headerAlign: 'center',
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'practiceStartTime',
Expand All @@ -139,7 +139,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
headerAlign: 'center',
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'practiceEndTime',
Expand All @@ -151,7 +151,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
filterable: false,
sortable: false,
hidden: true,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'limitBetweenSubmissions',
Expand Down Expand Up @@ -205,7 +205,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
filterable: false,
sortable: false,
hidden: true,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
{
field: 'createdOn',
Expand All @@ -214,7 +214,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
flex: 1,
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
hideable: true,
},
{
Expand All @@ -224,7 +224,7 @@ const contestFilterableColumns: AdministrationGridColDef[] = [
flex: 1,
filterable: false,
sortable: false,
valueFormatter: (params) => adminFormatDate(params.value),
valueFormatter: (_, row) => adminFormatDate(row.value),
},
];

Expand Down
Loading