;
+ return
;
});
Graph.displayName = 'Graph';
diff --git a/src/app/components/List.tsx b/src/app/components/List.tsx
index 2c156a5..235a62a 100644
--- a/src/app/components/List.tsx
+++ b/src/app/components/List.tsx
@@ -1,9 +1,8 @@
/* eslint-disable no-magic-numbers */
-import type {FC, ElementType, ReactElement} from 'react';
-import type {Theme} from '@material-ui/core/styles';
-import React, {memo, useEffect} from 'react';
-import {makeStyles, createStyles} from '@material-ui/core/styles';
+import type { FC, ElementType, ReactElement } from 'react';
+import React, { memo, useEffect } from 'react';
import {
+ Box,
Table,
TableBody,
TableCell,
@@ -13,49 +12,35 @@ import {
TableRow,
Paper,
IconButton,
-} from '@material-ui/core';
-import {TablePaginationActionsProps} from '@material-ui/core/TablePagination/TablePaginationActions';
+} from '@mui/material';
+import { TablePaginationActionsProps } from '@mui/material/TablePagination/TablePaginationActions';
import {
FirstPage as FirstPageIcon,
KeyboardArrowLeft,
KeyboardArrowRight,
LastPage as LastPageIcon,
-} from '@material-ui/icons';
-import {useStoreContext, useDispatchContext} from '@/Store';
-
-const useStyles1 = makeStyles((theme: Theme) => createStyles({
- root: {
- flexShrink: 0,
- marginLeft: theme.spacing(2),
- },
-}));
-const useStyles2 = makeStyles({
- table: {
- minWidth: 500,
- },
-});
-
-const TablePaginationActions: ElementType = ({count, page, rowsPerPage, onChangePage}) => {
- const classes = useStyles1();
+} from '@mui/icons-material';
+import { useStoreContext, useDispatchContext } from '@/Store';
+const TablePaginationActions: ElementType = ({ count, page, rowsPerPage, onPageChange }) => {
const handleFirstPageButtonClick = (event): void => {
- onChangePage(event, 0);
+ onPageChange(event, 0);
};
const handleBackButtonClick = (event): void => {
- onChangePage(event, page - 1);
+ onPageChange(event, page - 1);
};
const handleNextButtonClick = (event): void => {
- onChangePage(event, page + 1);
+ onPageChange(event, page + 1);
};
const handleLastPageButtonClick = (event): void => {
- onChangePage(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
+ onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
};
return (
-
+
= ({count
>
-
+
);
};
@@ -90,36 +75,35 @@ const List: FC<{
render: (any, index: number) => ReactElement;
rowsPerPageOptions?: Array
;
defaultPerPage?: number;
-}> = memo(({population, render, rowsPerPageOptions, defaultPerPage}) => {
- const classes = useStyles2();
- const {store: {pagination: {page, rowsPerPage, initialized}}} = useStoreContext();
- const {dispatch} = useDispatchContext();
+}> = memo(({ population, render, rowsPerPageOptions, defaultPerPage }) => {
+ const { store: { pagination: { page, rowsPerPage, initialized } } } = useStoreContext();
+ const { dispatch } = useDispatchContext();
const emptyRows = rowsPerPage - Math.min(rowsPerPage, population.length - page * rowsPerPage);
const handlePageChange = (event, newPage) => {
- dispatch({type: 'PAGINATION_PAGE', page: newPage});
+ dispatch({ type: 'PAGINATION_PAGE', page: newPage });
};
const handleRowsPerPageChange = (event) => {
- dispatch({type: 'PAGINATION_PER_PAGE', rowsPerPage: parseInt(event.target.value, 10)});
- dispatch({type: 'PAGINATION_PAGE', page: 0});
+ dispatch({ type: 'PAGINATION_PER_PAGE', rowsPerPage: parseInt(event.target.value, 10) });
+ dispatch({ type: 'PAGINATION_PAGE', page: 0 });
};
useEffect(() => {
if (!initialized) {
if (defaultPerPage) {
if (defaultPerPage !== rowsPerPage) {
- dispatch({type: 'PAGINATION_PER_PAGE', rowsPerPage: defaultPerPage});
+ dispatch({ type: 'PAGINATION_PER_PAGE', rowsPerPage: defaultPerPage });
}
} else if (rowsPerPageOptions && rowsPerPageOptions[0] !== rowsPerPage) {
- dispatch({type: 'PAGINATION_PER_PAGE', rowsPerPage: rowsPerPageOptions[0]});
+ dispatch({ type: 'PAGINATION_PER_PAGE', rowsPerPage: rowsPerPageOptions[0] });
}
- dispatch({type: 'PAGINATION_INITIALIZED'});
+ dispatch({ type: 'PAGINATION_INITIALIZED' });
}
}, []);
return
-
+
{(rowsPerPage > 0 ? population.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) : population).map((row, index) => (
@@ -128,7 +112,7 @@ const List: FC<{
))}
{emptyRows > 0 && (
-
+
)}
@@ -142,7 +126,7 @@ const List: FC<{
rowsPerPage={rowsPerPage}
page={page}
SelectProps={{
- inputProps: {'aria-label': 'rows per page'},
+ inputProps: { 'aria-label': 'rows per page' },
native: true,
}}
onPageChange={handlePageChange}
diff --git a/src/app/components/LoadingAnimation.tsx b/src/app/components/LoadingAnimation.tsx
index 03a5adc..6fb2c8c 100644
--- a/src/app/components/LoadingAnimation.tsx
+++ b/src/app/components/LoadingAnimation.tsx
@@ -1,19 +1,11 @@
-import type {FC} from 'react';
-import React, {memo} from 'react';
-import {makeStyles} from '@material-ui/core/styles';
-
-const useStyles = makeStyles(() => ({
- loading: {
- textAlign: 'center',
- },
-}));
+import type { FC } from 'react';
+import React, { memo } from 'react';
+import Box from '@mui/material/Box';
const LoadingAnimation: FC = memo(() => {
- const classes = useStyles();
-
- return
+ return
- ;
+ ;
});
LoadingAnimation.displayName = 'LoadingAnimation';
diff --git a/src/app/components/SnackbarContentWrapper.tsx b/src/app/components/SnackbarContentWrapper.tsx
index 08c2398..d7159be 100644
--- a/src/app/components/SnackbarContentWrapper.tsx
+++ b/src/app/components/SnackbarContentWrapper.tsx
@@ -1,18 +1,15 @@
-import type {FC, MouseEventHandler} from 'react';
-import type {Theme} from '@material-ui/core/styles';
-import React, {memo} from 'react';
-import clsx from 'clsx';
+import type { FC, MouseEventHandler } from 'react';
+import React, { memo } from 'react';
import {
CheckCircle as CheckCircleIcon,
Error as ErrorIcon,
Info as InfoIcon,
Close as CloseIcon,
Warning as WarningIcon,
-} from '@material-ui/icons';
-import {amber, green} from '@material-ui/core/colors';
-import IconButton from '@material-ui/core/IconButton';
-import SnackbarContent from '@material-ui/core/SnackbarContent';
-import {makeStyles, createStyles} from '@material-ui/core/styles';
+} from '@mui/icons-material';
+import { Box, IconButton } from '@mui/material';
+import { amber, green } from '@mui/material/colors';
+import SnackbarContent from '@mui/material/SnackbarContent';
const variantIcon = {
success: CheckCircleIcon,
@@ -21,57 +18,36 @@ const variantIcon = {
info: InfoIcon,
};
-const useStyles = makeStyles((theme: Theme) => createStyles({
- success: {
- backgroundColor: green[600],
- },
- error: {
- backgroundColor: theme.palette.error.dark,
- },
- info: {
- backgroundColor: theme.palette.primary.main,
- },
- warning: {
- backgroundColor: amber[700],
- },
- icon: {
- fontSize: 20,
- },
- iconVariant: {
- opacity: 0.9,
- // eslint-disable-next-line no-magic-numbers
- marginRight: theme.spacing(1),
- },
- message: {
- display: 'flex',
- alignItems: 'center',
- },
-}));
-
const SnackbarContentWrapper: FC<{
- className: string;
+ className?: string;
message: string;
onClose: MouseEventHandler;
variant: 'error' | 'info' | 'success' | 'warning';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
other?: any;
-}> = memo(({className, message, onClose, variant, ...other}) => {
+}> = memo(({ className, message, onClose, variant, ...other }) => {
const Icon = variantIcon[variant];
- const classes = useStyles();
+ const colors = {
+ success: green[600],
+ error: 'error.dark',
+ info: 'primary.main',
+ warning: amber[700],
+ };
return (
-
+
+
{message}
-
+
}
action={[
-
+
,
]}
{...other}
diff --git a/src/app/components/SnackbarWrapper.tsx b/src/app/components/SnackbarWrapper.tsx
index 4432be3..f1d5005 100644
--- a/src/app/components/SnackbarWrapper.tsx
+++ b/src/app/components/SnackbarWrapper.tsx
@@ -1,27 +1,19 @@
-import type {FC} from 'react';
-import React, {memo, useCallback} from 'react';
-import Snackbar from '@material-ui/core/Snackbar';
-import {makeStyles, createStyles} from '@material-ui/core/styles';
+import type { FC } from 'react';
+import React, { memo, useCallback } from 'react';
+import { Snackbar } from '@mui/material';
import SnackbarContentWrapper from './SnackbarContentWrapper';
-import {useDispatchContext, useStoreContext} from '@/Store';
-import {closeNotice} from '@/common';
-
-const useStyles = makeStyles(() => createStyles({
- snackbar: {},
- content: {},
-}));
+import { useDispatchContext, useStoreContext } from '@/Store';
+import { closeNotice } from '@/common';
const SnackbarWrapper: FC = memo(() => {
- const {store: {notice}} = useStoreContext();
- const {dispatch} = useDispatchContext();
- const classes = useStyles();
+ const { store: { notice } } = useStoreContext();
+ const { dispatch } = useDispatchContext();
const handleClose = useCallback((): void => {
closeNotice(dispatch);
}, []);
return {
onClose={handleClose}
>
= memo(({options}) => {
- const {store: {page, status}, store} = useStoreContext();
- const {dispatch} = useDispatchContext();
- const [nextPage, setNextPage] = useState(null);
- const [components, setComponents] = useState({});
+}> = memo(({ options }) => {
+ const { store: { page, status }, store } = useStoreContext();
+ const { dispatch } = useDispatchContext();
+ const [nextPage, setNextPage] = useState(null);
+ const [components, setComponents] = useState({});
const hidePages = useMemo(() => options.hidePages ? options.hidePages(store) : null, [store]);
const searchValidPage = () => {
@@ -42,13 +42,13 @@ const Switching: FC<{
// eslint-disable-next-line no-magic-numbers
window.scrollTo(0, 0);
if (!page) {
- dispatch({type: 'PAGE', page: Object.keys(options.pages)[0]});
+ dispatch({ type: 'PAGE', page: Object.keys(options.pages)[0] });
return;
}
if (page in options.pages) {
if (hidePages && hidePages.includes(page)) {
- dispatch({type: 'PAGE', page: searchValidPage()});
+ dispatch({ type: 'PAGE', page: searchValidPage() });
return;
}
@@ -56,7 +56,7 @@ const Switching: FC<{
setNextPage(components[page]);
} else {
const component = options.pages[page].component();
- setComponents({...components, ...{[page]: component}});
+ setComponents({ ...components, ...{ [page]: component } });
setNextPage(component);
}
}
diff --git a/src/app/components/Timeline.tsx b/src/app/components/Timeline.tsx
index 629a194..deed683 100644
--- a/src/app/components/Timeline.tsx
+++ b/src/app/components/Timeline.tsx
@@ -1,26 +1,18 @@
-import type {FC} from 'react';
-import type {ScatterDataPoint} from 'chart.js';
-import React, {memo, useRef, useState, useEffect} from 'react';
-import {makeStyles, createStyles, Theme} from '@material-ui/core/styles';
-import {Chart} from 'chart.js';
+import type { FC } from 'react';
+import type { ScatterDataPoint } from 'chart.js';
+import React, { memo, useRef, useState, useEffect } from 'react';
+import Box from '@mui/material/Box';
+import { Chart } from 'chart.js';
import useTheme from '@/hooks/useTheme';
-import {useStoreContext} from '@/Store';
-
-const useStyles = makeStyles((theme: Theme) => createStyles({
- root: {
- // eslint-disable-next-line no-magic-numbers
- padding: theme.spacing(0, 2),
- },
-}));
+import { useStoreContext } from '@/Store';
const Timeline: FC<{
data: Array;
-}> = memo(({data}) => {
- const classes = useStyles();
- const [chart, setChart] = useState(null);
- const container = useRef(null);
- const {store: {themeColor}} = useStoreContext();
- const themeObject = useTheme(themeColor);
+}> = memo(({ data }) => {
+ const [chart, setChart] = useState(null);
+ const container = useRef(null);
+ const { store: { themeColor } } = useStoreContext();
+ const themeObject = useTheme(themeColor);
useEffect(() => {
if (!container.current) {
@@ -48,7 +40,7 @@ const Timeline: FC<{
},
options: {
plugins: {
- legend: {display: false},
+ legend: { display: false },
},
scales: {
x: {
@@ -90,7 +82,9 @@ const Timeline: FC<{
}
}, [data]);
- return