From dfe786ee457ecc294caff80858921bd5b6838d59 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 29 Sep 2022 11:37:58 +0200 Subject: [PATCH] (quality) Remove auto scroll and filter header --- .../src/javascript/components/store/store.tsx | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/frontend/src/javascript/components/store/store.tsx b/app/frontend/src/javascript/components/store/store.tsx index 990cc7d0b..1aab1da17 100644 --- a/app/frontend/src/javascript/components/store/store.tsx +++ b/app/frontend/src/javascript/components/store/store.tsx @@ -28,7 +28,6 @@ import { ActiveFiltersTags } from './filters/active-filters-tags'; import ProductLib from '../../lib/product'; import { UIRouter } from '@uirouter/angularjs'; import SettingAPI from '../../api/setting'; -import { CaretDoubleDown } from 'phosphor-react'; declare const Application: IApplication; @@ -57,13 +56,14 @@ const Store: React.FC = ({ onError, onSuccess, currentUser, uiRouter const [resources, setResources] = useImmer(initialResources); const [machinesModule, setMachinesModule] = useState(false); const [categoriesTree, setCategoriesTree] = useState([]); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const [filtersPanel, setFiltersPanel] = useState(false); const [pageCount, setPageCount] = useState(0); const [productsCount, setProductsCount] = useState(0); const [currentPage, setCurrentPage] = useState(1); useEffect(() => { - fetchProducts().then(scrollToProducts); + fetchProducts(); ProductLib.fetchInitialResources(setResources, onError, formatCategories); SettingAPI.get('machines_module').then(data => { setMachinesModule(data.value === 'true'); @@ -72,7 +72,7 @@ const Store: React.FC = ({ onError, onSuccess, currentUser, uiRouter useEffect(() => { if (resources.filters.ready) { - fetchProducts().then(scrollToProducts); + fetchProducts(); uiRouter.stateService.transitionTo(uiRouter.globals.current, ProductLib.indexFiltersToRouterParams(resources.filters.data)); } }, [resources.filters]); @@ -208,13 +208,6 @@ const Store: React.FC = ({ onError, onSuccess, currentUser, uiRouter } }; - /** - * Scroll the view to the product list - */ - const scrollToProducts = () => { - window.document.getElementById('content-main').scrollTo({ top: 100, behavior: 'smooth' }); - }; - const selectedCategory = resources.filters.data.categories[0]; const parent = resources.categories.data.find(c => c.id === selectedCategory?.parent_id); return ( @@ -239,13 +232,6 @@ const Store: React.FC = ({ onError, onSuccess, currentUser, uiRouter }