Merge pull request #264 from sartography/feature/ui-tweaks
Force all pages back to the top, rather than just a few of them.
This commit is contained in:
commit
de6b51f05b
|
@ -15,6 +15,8 @@ import { AbilityContext } from './contexts/Can';
|
|||
import UserService from './services/UserService';
|
||||
import ErrorDisplay from './components/ErrorDisplay';
|
||||
import APIErrorProvider from './contexts/APIErrorContext';
|
||||
import ScrollToTop from "./components/ScrollToTop";
|
||||
import React from "react";
|
||||
|
||||
export default function App() {
|
||||
if (!UserService.isLoggedIn()) {
|
||||
|
@ -32,6 +34,7 @@ export default function App() {
|
|||
<BrowserRouter>
|
||||
<NavigationBar />
|
||||
<Content>
|
||||
<ScrollToTop />
|
||||
<ErrorDisplay />
|
||||
<ErrorBoundary>
|
||||
<Routes>
|
||||
|
|
|
@ -109,7 +109,6 @@ export default function ErrorDisplay() {
|
|||
|
||||
if (errorObject) {
|
||||
const title = 'Error:';
|
||||
window.scrollTo(0, 0); // Scroll back to the top of the page
|
||||
|
||||
errorTag = (
|
||||
<Notification title={title} onClose={() => removeError()} type="error">
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
export default function ScrollToTop() {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
}
|
|
@ -116,7 +116,6 @@ export default function TaskShow() {
|
|||
if (!result.can_complete) {
|
||||
navigateToInterstitial(result);
|
||||
}
|
||||
window.scrollTo(0, 0); // Scroll back to the top of the page
|
||||
|
||||
/* Disable call to load previous tasks -- do not display menu.
|
||||
const url = `/v1.0/process-instances/for-me/${modifyProcessIdentifierForPathParam(
|
||||
|
|
Loading…
Reference in New Issue