From 1dd904d89a46f55dfea8fa3b07f1a40176c86dd8 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 26 Feb 2024 11:31:21 -0700 Subject: [PATCH] Don't show minimap when view is not scrollable (#10062) --- web/src/views/events/DesktopEventView.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/views/events/DesktopEventView.tsx b/web/src/views/events/DesktopEventView.tsx index ef8d2e58b..631dcd83a 100644 --- a/web/src/views/events/DesktopEventView.tsx +++ b/web/src/views/events/DesktopEventView.tsx @@ -86,6 +86,14 @@ export default function DesktopEventView({ return current; }, [reviewItems, severity]); + const showMinimap = useMemo(() => { + if (!contentRef.current) { + return false; + } + + return contentRef.current.scrollHeight > contentRef.current.clientHeight + }, [contentRef.current?.scrollHeight]) + // review interaction const pagingObserver = useRef(); @@ -310,7 +318,7 @@ export default function DesktopEventView({ timestampSpread={15} timelineStart={timeRange.before} timelineEnd={timeRange.after} - showMinimap + showMinimap={showMinimap} minimapStartTime={minimapBounds.start} minimapEndTime={minimapBounds.end} events={reviewItems.all}