From 4912b3f47e768045738cff7229a5bc68e7f5fded Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Mon, 21 Aug 2023 04:24:16 -0700 Subject: [PATCH] Fix bottom panel and make it resizable Summary: The bottom panel got broken during the virtualisation+ panel refactor, we need to tell the tree how much height is taken by the panel so it can size itself accordingly. Reviewed By: lblasa Differential Revision: D48313766 fbshipit-source-id: 849886101eb0869cc068fd0ad6dc1d053233043e --- .../public/ui-debugger/components/main.tsx | 108 +++++++++++------- .../ui-debugger/components/tree/Tree.tsx | 16 ++- 2 files changed, 80 insertions(+), 44 deletions(-) diff --git a/desktop/plugins/public/ui-debugger/components/main.tsx b/desktop/plugins/public/ui-debugger/components/main.tsx index eb35b3560..632ae8a5e 100644 --- a/desktop/plugins/public/ui-debugger/components/main.tsx +++ b/desktop/plugins/public/ui-debugger/components/main.tsx @@ -53,6 +53,8 @@ export function Component() { setBottomPanelComponent(undefined); }; + const [bottomPanelHeight, setBottomPanelHeight] = useState(400); + if (showPerfStats) return ( - - + - - - + + + + - { - instance.uiActions.setVisualiserWidth(width); - }} - gutter> - - - - - - - {bottomPanelComponent} - - + { + instance.uiActions.setVisualiserWidth(width); + }} + gutter> + + + + + + + {bottomPanelComponent && ( + + {bottomPanelComponent} + + )} + ); } @@ -166,8 +181,15 @@ export function Centered(props: {children: React.ReactNode}) { type BottomPanelProps = { dismiss: () => void; children: React.ReactNode; + height: number; + setHeight: (height: number) => void; }; -export function BottomPanel({dismiss, children}: BottomPanelProps) { +export function BottomPanel({ + dismiss, + children, + height, + setHeight, +}: BottomPanelProps) { const bottomPanelRef = useRef(null); useEffect(() => { @@ -191,9 +213,15 @@ export function BottomPanel({dismiss, children}: BottomPanelProps) { if (!children) { return <>; } + return (
- + setHeight(height)} + gutter> {children}