diff --git a/assets/js/templates/App.jsx b/assets/js/templates/App.jsx index 5fcabf1c44..a8170d3c5c 100644 --- a/assets/js/templates/App.jsx +++ b/assets/js/templates/App.jsx @@ -3,13 +3,14 @@ import PropTypes from 'prop-types'; import nullable from 'prop-types-nullable'; import { BrowserRouter as Router, - Switch, + Routes, Route, Link, Redirect, useHistory, useLocation, - useRouteMatch, + useMatch, + useNavigate, } from 'react-router-dom'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import Collapse from '@kunukn/react-collapse'; @@ -147,10 +148,15 @@ function PureApp({ }, []); // TODO: move stuff that depends on this to the App. - const history = useHistory(); + const navigate = useNavigate(); + React.useEffect(() => { + selfoss.navigate = navigate; + }, [navigate]); + + const entriesPageMatch = useMatch(ENTRIES_ROUTE_PATTERN); React.useEffect(() => { - selfoss.history = history; - }, [history]); + selfoss.entriesPageMatch = entriesPageMatch; + }, [entriesPageMatch]); // Prepare path of the homepage for redirecting from / let homePagePath = configuration.homepage.split('/'); @@ -181,97 +187,113 @@ function PureApp({ - - - {/* menu open for smartphone */} -
- -
-
- - - -