From 2e0629ad0d01b90cb724e47bf201486b526437ce Mon Sep 17 00:00:00 2001 From: Maxi Date: Mon, 18 Nov 2024 15:28:03 +0100 Subject: [PATCH 1/3] fix --- src/management-system-v2/components/process-list.tsx | 2 +- src/management-system-v2/lib/useColumnWidth.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/management-system-v2/components/process-list.tsx b/src/management-system-v2/components/process-list.tsx index 548c6673f..0b14a605f 100644 --- a/src/management-system-v2/components/process-list.tsx +++ b/src/management-system-v2/components/process-list.tsx @@ -410,7 +410,7 @@ const ProcessManagementList: FC = ({ processActions={processActions} tableProps={{ scroll: { - y: `${window?.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, + y: `${window!.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, }, pagination: { position: ['bottomCenter'], pageSize: 20 }, onRow: (item) => ({ diff --git a/src/management-system-v2/lib/useColumnWidth.tsx b/src/management-system-v2/lib/useColumnWidth.tsx index ba044eb2d..068ce2819 100644 --- a/src/management-system-v2/lib/useColumnWidth.tsx +++ b/src/management-system-v2/lib/useColumnWidth.tsx @@ -30,7 +30,7 @@ export const useResizeableColumnWidth = ( const initialisedWithHydratedValues = useRef( false, - ); /* Basically a switch to check whther the state was updated once with the saved values, once hydrated */ + ); /* Basically a switch to check whether the state was updated once with the saved values, once hydrated */ const convertedWidthsToNumbers = useRef(false); /* Similar switch */ const computeNewColumns = useCallback(() => { @@ -58,13 +58,13 @@ export const useResizeableColumnWidth = ( initialisedWithHydratedValues.current = true; // console.debug('Updated columns with hydrated values'); setResizeableColumns(newColumns); - }, [hydrated, computeNewColumns, initialisedWithHydratedValues.current]); + }, [hydrated, computeNewColumns]); /* If the user selects different columns (i.e. columnsInPreferences change) update the state with new columns */ useEffect(() => { if (!hydrated) return; - /* This should onl run if the length of the arrays is dfferent */ + /* This should only run if the length of the arrays is dfferent */ if (columnsInPreferences.length === resizeableColumns.length) return; const newColumns = computeNewColumns(); From 8d22a7e8a8f9f0761877bd3736937d731f8f2ff0 Mon Sep 17 00:00:00 2001 From: Maxi Date: Mon, 18 Nov 2024 18:56:07 +0100 Subject: [PATCH 2/3] revert nullcheck --- src/management-system-v2/components/process-list.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/management-system-v2/components/process-list.tsx b/src/management-system-v2/components/process-list.tsx index 0b14a605f..548c6673f 100644 --- a/src/management-system-v2/components/process-list.tsx +++ b/src/management-system-v2/components/process-list.tsx @@ -410,7 +410,7 @@ const ProcessManagementList: FC = ({ processActions={processActions} tableProps={{ scroll: { - y: `${window!.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, + y: `${window?.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, }, pagination: { position: ['bottomCenter'], pageSize: 20 }, onRow: (item) => ({ From 95f1d1298f7a6c87710fe07c99b4a756e94aa2e4 Mon Sep 17 00:00:00 2001 From: Maxi Date: Mon, 18 Nov 2024 19:24:43 +0100 Subject: [PATCH 3/3] Scroll on client --- .../components/process-list.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/management-system-v2/components/process-list.tsx b/src/management-system-v2/components/process-list.tsx index 548c6673f..4862146e3 100644 --- a/src/management-system-v2/components/process-list.tsx +++ b/src/management-system-v2/components/process-list.tsx @@ -9,6 +9,8 @@ import { SetStateAction, Key, ReactElement, + useEffect, + useState, } from 'react'; import { CopyOutlined, @@ -35,6 +37,7 @@ import FavouriteStar from './favouriteStar'; import { contextMenuStore } from './processes/context-menu'; import { DraggableElementGenerator } from './processes/draggable-element'; import classNames from 'classnames'; +import { set } from 'zod'; /** respects sorting function, but always keeps folders at the beginning */ function folderAwareSort(sortFunction: (a: ProcessListProcess, b: ProcessListProcess) => number) { @@ -400,6 +403,14 @@ const ProcessManagementList: FC = ({ const setContextMenuItem = contextMenuStore((store) => store.setSelected); const metaPanelisOpened = useUserPreferences.use['process-meta-data']().open; + const [scrollY, setScrollY] = useState('400px'); + useEffect(() => { + if (window) + setScrollY( + `${window.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, + ); + }, []); + return ( = ({ processActions={processActions} tableProps={{ scroll: { - y: `${window?.innerHeight - 32 /* Footer */ - 64 /* Header */ - 82 /* Table-Search etc */ - 60 /* Table-head */ - 60 /* Table-Footer / Pagination */}px`, + y: scrollY, }, pagination: { position: ['bottomCenter'], pageSize: 20 }, onRow: (item) => ({