From 9bd0094753ea9fca7bbc8cceea212f0701bc782f Mon Sep 17 00:00:00 2001 From: niestrow Date: Mon, 2 Dec 2024 11:35:22 +0100 Subject: [PATCH 01/11] Simulations sidebar - no layout options selected by default --- frontend-v2/src/features/simulation/Simulations.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend-v2/src/features/simulation/Simulations.tsx b/frontend-v2/src/features/simulation/Simulations.tsx index 70deb949..29b1ac68 100644 --- a/frontend-v2/src/features/simulation/Simulations.tsx +++ b/frontend-v2/src/features/simulation/Simulations.tsx @@ -218,8 +218,7 @@ const Simulations: FC = () => { { value: "vertical", label: "Vertical" }, { value: "horizontal", label: "Horizontal" }, ]; - const defaultLayout = [layoutOptions[0]?.value, layoutOptions[1]?.value]; - const [layout, setLayout] = useState(defaultLayout); + const [layout, setLayout] = useState([]); // reset form and sliders if simulation changes useEffect(() => { From 0bf8e7bb9f114fd1b922912f1714420d1384ec36 Mon Sep 17 00:00:00 2001 From: niestrow Date: Mon, 2 Dec 2024 11:37:30 +0100 Subject: [PATCH 02/11] Simulations sidebar - selecting both layouts deselects both options --- frontend-v2/src/features/simulation/SimulationsSidePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend-v2/src/features/simulation/SimulationsSidePanel.tsx b/frontend-v2/src/features/simulation/SimulationsSidePanel.tsx index 0782b11a..56e90839 100644 --- a/frontend-v2/src/features/simulation/SimulationsSidePanel.tsx +++ b/frontend-v2/src/features/simulation/SimulationsSidePanel.tsx @@ -157,7 +157,7 @@ export const SimulationsSidePanel = ({ if (layout.includes(value)) { setLayout(layout.filter(layoutValue => value !== layoutValue)) } else { - setLayout([...layout, value]); + setLayout(layout?.length ? [] : [value]); } } From ac6007cf245f5a745eac3ec39b220ef7fd7c5a0f Mon Sep 17 00:00:00 2001 From: niestrow Date: Mon, 2 Dec 2024 12:11:53 +0100 Subject: [PATCH 03/11] Fix pkpd version overlap navigation buttons on high scales --- frontend-v2/src/features/main/Sidebar.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend-v2/src/features/main/Sidebar.tsx b/frontend-v2/src/features/main/Sidebar.tsx index 1caa5b97..88435f6c 100644 --- a/frontend-v2/src/features/main/Sidebar.tsx +++ b/frontend-v2/src/features/main/Sidebar.tsx @@ -301,7 +301,8 @@ export default function Sidebar() { ); const drawer = ( -
+
+
{isExpanded ? ( )} +
+
{isExpanded && ( )} +
+
); From c79c6e0d3433257b2c55ad4248ecf4cbce44452e Mon Sep 17 00:00:00 2001 From: niestrow Date: Mon, 2 Dec 2024 12:14:00 +0100 Subject: [PATCH 04/11] Simulation page - fix plots get smaller after each resize/sidebar collapse; Fix height of plots on ultra wide resolutions; Fix Simulation Sidebar view for high scales --- .../src/features/simulation/SimulationPlotView.tsx | 13 ++++++------- frontend-v2/src/features/simulation/Simulations.tsx | 2 +- .../features/simulation/SimulationsSidePanel.tsx | 11 ++++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/frontend-v2/src/features/simulation/SimulationPlotView.tsx b/frontend-v2/src/features/simulation/SimulationPlotView.tsx index 9b3e3a35..2b0312e8 100644 --- a/frontend-v2/src/features/simulation/SimulationPlotView.tsx +++ b/frontend-v2/src/features/simulation/SimulationPlotView.tsx @@ -22,7 +22,6 @@ import { import Plotly from "plotly.js-basic-dist-min"; import { Button, - debounce, Dialog, DialogActions, DialogContent, @@ -475,11 +474,11 @@ const SimulationPlotView: FC = ({ if (isVertical && !isHorizontal) { return dimensions.width > layoutBreakpoint ? { - height: dimensions.height / 2 - buffor, + height: dimensions.height / 2 , width: dimensions.width - buffor, } : { - height: dimensions.height / 1.5 - buffor, + height: dimensions.height / 1.5, width: dimensions.width - buffor, }; } @@ -487,22 +486,22 @@ const SimulationPlotView: FC = ({ if (!isVertical && isHorizontal) { return dimensions.width > layoutBreakpoint ? { - height: dimensions.height - buffor, + height: dimensions.height, width: dimensions.width / columnCount - buffor, } : { - height: dimensions.height - buffor, + height: dimensions.height, width: dimensions.width / 1.5 - buffor, }; } return dimensions.width > layoutBreakpoint ? { - height: dimensions.height / 2 - buffor, + height: dimensions.height / 2, width: dimensions.width / columnCount - buffor, } : { - height: dimensions.height / 2 - buffor, + height: dimensions.height / 2, width: dimensions.width / columnCount - buffor, }; }; diff --git a/frontend-v2/src/features/simulation/Simulations.tsx b/frontend-v2/src/features/simulation/Simulations.tsx index 29b1ac68..b1355163 100644 --- a/frontend-v2/src/features/simulation/Simulations.tsx +++ b/frontend-v2/src/features/simulation/Simulations.tsx @@ -448,7 +448,7 @@ const Simulations: FC = () => { } return ( - + Date: Mon, 2 Dec 2024 12:19:36 +0100 Subject: [PATCH 05/11] Simulation page - fix plots box having wrong dimensions on first plot render --- frontend-v2/src/features/simulation/Simulations.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend-v2/src/features/simulation/Simulations.tsx b/frontend-v2/src/features/simulation/Simulations.tsx index b1355163..80a824d2 100644 --- a/frontend-v2/src/features/simulation/Simulations.tsx +++ b/frontend-v2/src/features/simulation/Simulations.tsx @@ -419,6 +419,13 @@ const Simulations: FC = () => { }; }); + useEffect(() => { + setDimensions({ + width: containerRef?.current?.clientWidth || 0, + height: containerRef?.current?.clientHeight || 0 + }); + }, [plots?.length]) + const isHorizontal = layout.includes('horizontal') || layout?.length === 0; const isVertical = layout.includes('vertical') || layout?.length === 0; @@ -430,7 +437,7 @@ const Simulations: FC = () => { return screen.width > 2500 ? 4 : 6 } - const tableLayout = getXlLayout(); + const tableLayout = getXlLayout(); const loading = [ isProjectLoading, From 4d8a3275332b39a5d2ba9fc0e75540a55d7a9667 Mon Sep 17 00:00:00 2001 From: niestrow Date: Mon, 2 Dec 2024 13:15:58 +0100 Subject: [PATCH 06/11] Input width and table height adjustments for scales up to 200% --- .../src/features/data/DosingProtocols.tsx | 1 + frontend-v2/src/features/drug/Drug.tsx | 7 ++-- frontend-v2/src/features/projects/Project.tsx | 13 ++++-- .../src/features/projects/Projects.tsx | 42 ++++++++++++++++++- .../src/features/results/ResultsTab.tsx | 8 ++-- 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/frontend-v2/src/features/data/DosingProtocols.tsx b/frontend-v2/src/features/data/DosingProtocols.tsx index d77554c4..d1dddf7f 100644 --- a/frontend-v2/src/features/data/DosingProtocols.tsx +++ b/frontend-v2/src/features/data/DosingProtocols.tsx @@ -236,6 +236,7 @@ const DosingProtocols: FC = ({ label="Units" value={adminUnit} onChange={handleAmountUnitChange(adminId)} + sx={{ maxWidth: '10rem'}} size="small" margin="dense" > diff --git a/frontend-v2/src/features/drug/Drug.tsx b/frontend-v2/src/features/drug/Drug.tsx index 3fbc1f0c..6b4ba9a1 100644 --- a/frontend-v2/src/features/drug/Drug.tsx +++ b/frontend-v2/src/features/drug/Drug.tsx @@ -317,7 +317,7 @@ const Drug: FC = () => { 1300 ? "70%" : "100%", maxHeight: getTableHeight({ steps: DOUBLE_TABLE_SECOND_BREAKPOINTS }), }} > @@ -359,7 +359,7 @@ const Drug: FC = () => { {isEditIndex === index ? ( { {isEditIndex === index ? ( { {isEditIndex === index ? ( = ({ ? "Remove shared project from your list" : "Delete Project"; + const getRowNumber = () => { + if (window.innerHeight < 800) return Math.ceil(window.innerHeight / 100); + + return 15; + } + return ( <> = ({ textFieldProps={defaultProps} size="small" rules={{ required: true, validate: validateName }} - sx={{ ...defaultSx }} + sx={{ ...defaultSx, minWidth: '10rem' }} /> ) : ( {projects?.length === 0 ? ( diff --git a/frontend-v2/src/features/results/ResultsTab.tsx b/frontend-v2/src/features/results/ResultsTab.tsx index 493c1665..ee3ac7cd 100644 --- a/frontend-v2/src/features/results/ResultsTab.tsx +++ b/frontend-v2/src/features/results/ResultsTab.tsx @@ -277,7 +277,7 @@ const ResultsTab: FC<{ table: ResultsTableRead }> = ({ table }) => { try { return ( <> - + Columns - + Rows - + {rowFilter1?.label} - + {rowFilter2?.label}