Update dependencies react-router v6

This commit is contained in:
c-bata
2023-05-14 15:29:55 +00:00
parent 2704782adb
commit 3152259297
5 changed files with 420 additions and 446 deletions
+11 -13
View File
@@ -1,6 +1,6 @@
import React, { FC, useMemo, useState, useEffect } from "react"
import { RecoilRoot } from "recoil"
import { BrowserRouter as Router, Switch, Route } from "react-router-dom"
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"
import { SnackbarProvider } from "notistack"
import blue from "@mui/material/colors/blue"
import pink from "@mui/material/colors/pink"
@@ -50,10 +50,10 @@ export const App: FC = () => {
>
<SnackbarProvider maxSnack={3}>
<Router>
<Switch>
<Routes>
<Route
path={URL_PREFIX + "/studies/:studyId/analytics"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"analytics"}
@@ -62,7 +62,7 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/studies/:studyId/trials"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"trialList"}
@@ -71,7 +71,7 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/studies/:studyId/trials"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"trialList"}
@@ -80,7 +80,7 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/studies/:studyId/trialTable"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"trialTable"}
@@ -89,7 +89,7 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/studies/:studyId/note"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"note"}
@@ -98,7 +98,7 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/studies/:studyId"}
children={
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"history"}
@@ -107,15 +107,13 @@ export const App: FC = () => {
/>
<Route
path={URL_PREFIX + "/compare-studies"}
children={
<CompareStudies toggleColorMode={toggleColorMode} />
}
element={<CompareStudies toggleColorMode={toggleColorMode} />}
/>
<Route
path={URL_PREFIX + "/"}
children={<StudyList toggleColorMode={toggleColorMode} />}
element={<StudyList toggleColorMode={toggleColorMode} />}
/>
</Switch>
</Routes>
</Router>
</SnackbarProvider>
</Box>
@@ -28,7 +28,7 @@ import { studySummariesState, studyDetailsState } from "../state"
import { AppDrawer } from "./AppDrawer"
import { GraphEdfMultiStudies } from "./GraphEdf"
import { GraphHistoryMultiStudies } from "./GraphHistory"
import { useHistory, useLocation } from "react-router-dom"
import { useNavigate, useLocation } from "react-router-dom"
const useQuery = (): URLSearchParams => {
const { search } = useLocation()
@@ -79,7 +79,7 @@ export const CompareStudies: FC<{
const { enqueueSnackbar } = useSnackbar()
const theme = useTheme()
const query = useQuery()
const history = useHistory()
const navigate = useNavigate()
const action = actionCreator()
const studies = useRecoilValue<StudySummary[]>(studySummariesState)
@@ -183,9 +183,9 @@ export const CompareStudies: FC<{
next = [...selectedIds, study.study_id]
}
}
history.push(getStudyListLink(next))
navigate(getStudyListLink(next))
} else {
history.push(getStudyListLink([study.study_id]))
navigate(getStudyListLink([study.study_id]))
}
}}
selected={
+5 -5
View File
@@ -36,7 +36,7 @@ import DeleteIcon from "@mui/icons-material/Delete"
import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile"
import { TrialNote } from "./Note"
import { useHistory, useLocation } from "react-router-dom"
import { useNavigate, useLocation } from "react-router-dom"
import ListItemIcon from "@mui/material/ListItemIcon"
import { useRecoilValue } from "recoil"
import { artifactIsAvailable } from "../state"
@@ -634,7 +634,7 @@ export const TrialList: FC<{ studyDetail: StudyDetail | null }> = ({
}) => {
const theme = useTheme()
const query = useQuery()
const history = useHistory()
const navigate = useNavigate()
const excludedStates = useExcludedStates(query)
const trials = useTrials(studyDetail, excludedStates)
const isBestTrial = useIsBestTrial(studyDetail)
@@ -702,7 +702,7 @@ export const TrialList: FC<{ studyDetail: StudyDetail | null }> = ({
excludedStates.splice(index, 1)
}
const numbers = selected.map((t) => t.number)
history.push(
navigate(
getTrialListLink(studyDetail.id, excludedStates, numbers)
)
}}
@@ -737,11 +737,11 @@ export const TrialList: FC<{ studyDetail: StudyDetail | null }> = ({
} else {
next = [...selectedNumbers, trial.number]
}
history.push(
navigate(
getTrialListLink(trial.study_id, excludedStates, next)
)
} else {
history.push(
navigate(
getTrialListLink(trial.study_id, excludedStates, [
trial.number,
])
+389 -413
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -16,20 +16,20 @@
"author": "Masashi Shibata",
"license": "MIT",
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/icons-material": "^5.11.0",
"@mui/lab": "^5.0.0-alpha.114",
"@mui/material": "^5.11.2",
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@mui/icons-material": "^5.11.6",
"@mui/lab": "^5.0.0-alpha.128",
"@mui/material": "^5.12.1",
"axios": "^1.2.1",
"notistack": "^2.0.8",
"plotly.js-dist-min": "^2.17.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"notistack": "^3.0.1",
"plotly.js-dist-min": "^2.22.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.4",
"react-router-dom": "^5.3.4",
"react-router-dom": "^6.11.0",
"react-syntax-highlighter": "^15.5.0",
"recoil": "^0.7.6",
"recoil": "^0.7.7",
"rehype-mathjax": "^4.0.2",
"rehype-raw": "^6.1.1",
"remark-gfm": "^3.0.1",