chore(deps): update react router from v5 to v6 (#280)

* chore(deps): update react router from v5 to v6

* fix: correctly choose navigate target if there is no history
This commit is contained in:
Vojtech Simetka
2022-01-17 14:47:26 +01:00
committed by GitHub
parent 2187b9001c
commit a90b4c439b
18 changed files with 110 additions and 246 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { ArrowForward, OpenInNewSharp } from '@material-ui/icons'
import { ReactElement, useState } from 'react'
import CopyToClipboard from 'react-copy-to-clipboard'
import { useHistory } from 'react-router'
import { useNavigate } from 'react-router'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -61,7 +61,7 @@ export default function ExpandableListItemLink({
}: Props): ReactElement | null {
const classes = useStyles()
const [copied, setCopied] = useState(false)
const history = useHistory()
const navigate = useNavigate()
const tooltipClickHandler = () => setCopied(true)
const tooltipCloseHandler = () => setCopied(false)
@@ -72,7 +72,7 @@ export default function ExpandableListItemLink({
if (navigationType === 'NEW_WINDOW') {
window.open(link || value)
} else {
history.push(link || value)
navigate(link || value)
}
}
+3 -3
View File
@@ -1,7 +1,7 @@
import { Box, createStyles, Grid, makeStyles, Typography } from '@material-ui/core'
import { ArrowBack } from '@material-ui/icons'
import { ReactElement } from 'react'
import { useHistory } from 'react-router-dom'
import { useNavigate } from 'react-router-dom'
interface Props {
children: string
@@ -20,10 +20,10 @@ const useStyles = makeStyles(() =>
export function HistoryHeader({ children }: Props): ReactElement {
const classes = useStyles()
const history = useHistory()
const navigate = useNavigate()
function goBack() {
history.goBack()
navigate(-1)
}
return (
+1 -1
View File
@@ -50,7 +50,7 @@ interface Props {
export default function SideBarItem({ iconStart, iconEnd, path, label }: Props): ReactElement {
const classes = useStyles()
const location = useLocation()
const isSelected = Boolean(matchPath(location.pathname, { path, exact: true }))
const isSelected = Boolean(path && matchPath(location.pathname, path))
return (
<StyledListItem button selected={isSelected} disableRipple>
+1 -1
View File
@@ -56,7 +56,7 @@ export default function SideBarItem({ path }: Props): ReactElement {
const { status, isLoading } = useContext(Context)
const classes = useStyles()
const location = useLocation()
const isSelected = Boolean(matchPath(location.pathname, { path, exact: true }))
const isSelected = Boolean(path && matchPath(location.pathname, path))
return (
<ListItem