diff --git a/src/components/ScrollToTop.tsx b/src/components/ScrollToTop.tsx index 93ee406e1..2c3d7937e 100644 --- a/src/components/ScrollToTop.tsx +++ b/src/components/ScrollToTop.tsx @@ -14,7 +14,24 @@ import { useLocation } from 'react-router'; export function ScrollToTop(props: any) { const location = useLocation(); + const pathSegments = location.pathname.split('/'); + const id = pathSegments?.[2] || ''; + + const isClientShowPage = + id && + location.pathname.startsWith(`/clients/${id}`) && + !location.pathname.endsWith('/edit'); + + const isVendorShowPage = + id && + location.pathname.startsWith(`/vendors/${id}`) && + !location.pathname.endsWith('/edit'); + useEffect(() => { + if (isClientShowPage || isVendorShowPage) { + return; + } + window.scrollTo(0, 0); }, [location]); diff --git a/src/components/TabLoader.tsx b/src/components/TabLoader.tsx new file mode 100644 index 000000000..5a55adefc --- /dev/null +++ b/src/components/TabLoader.tsx @@ -0,0 +1,19 @@ +/** + * Invoice Ninja (https://invoiceninja.com). + * + * @link https://github.com/invoiceninja/invoiceninja source repository + * + * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com) + * + * @license https://www.elastic.co/licensing/elastic-license + */ + +import { Spinner } from '$app/components/Spinner'; + +export function TabLoader() { + return ( +