diff --git a/web/src/hooks/use-handle-dragging.ts b/web/src/hooks/use-handle-dragging.ts index 23f808b75..06e6f4b6f 100644 --- a/web/src/hooks/use-handle-dragging.ts +++ b/web/src/hooks/use-handle-dragging.ts @@ -1,4 +1,4 @@ -import { useCallback } from "react"; +import { useCallback, useEffect } from "react"; interface DragHandlerProps { contentRef: React.RefObject; @@ -128,6 +128,17 @@ function useDraggableHandler({ ] ); + useEffect(() => { + // TODO: determine when we want to do this + const handlebar = scrollTimeRef.current; + if (handlebar && showHandlebar) { + // handlebar.scrollIntoView({ + // behavior: "smooth", + // block: "center", + // }); + } + }, []); + return { handleMouseDown, handleMouseUp, handleMouseMove }; } diff --git a/web/src/pages/UIPlayground.tsx b/web/src/pages/UIPlayground.tsx index bc06d98b3..2b218e5a6 100644 --- a/web/src/pages/UIPlayground.tsx +++ b/web/src/pages/UIPlayground.tsx @@ -170,101 +170,104 @@ function UIPlayground() { return ( <> -
-
- UI Playground +
+
+
+ UI Playground - - Scrubber - -

- Shows the 10 most recent events within the last 4 hours -

- - {!config && } - - {config && ( -
- {events && events.length > 0 && ( - <> - - - )} -
- )} - - {config && ( -
- {timeline && ( - <> - - - )} -
- )} - -
- Timeline - -

Handlebar timestamp: {handlebarTime}

-

- - -

- - Color scheme + Scrubber

- Colors as set by the current theme. See the{" "} - - shadcn theming docs - {" "} - for usage. + Shows the 10 most recent events within the last 4 hours

-
- {colors.map((color, index) => ( - - ))} + {!config && } + + {config && ( +
+ {events && events.length > 0 && ( + <> + + + )} +
+ )} + + {config && ( +
+ {timeline && ( + <> + + + )} +
+ )} + +
+ + Timeline + +

Handlebar timestamp: {handlebarTime}

+

+ + +

+ + Color scheme + +

+ Colors as set by the current theme. See the{" "} + + shadcn theming docs + {" "} + for usage. +

+ +
+ {colors.map((color, index) => ( + + ))} +
+ +
+ +
-
- -
); } diff --git a/web/src/views/events/DesktopEventView.tsx b/web/src/views/events/DesktopEventView.tsx index 052c125c0..02e8a8854 100644 --- a/web/src/views/events/DesktopEventView.tsx +++ b/web/src/views/events/DesktopEventView.tsx @@ -195,8 +195,8 @@ export default function DesktopEventView({ } return ( -
-
+
+
)} -
- {currentItems ? ( - currentItems.map((value, segIdx) => { - const lastRow = segIdx == reviewItems[severity].length - 1; - const relevantPreview = Object.values(relevantPreviews || []).find( - (preview) => - preview.camera == value.camera && - preview.start < value.start_time && - preview.end > value.end_time - ); +
+
+ {currentItems ? ( + currentItems.map((value, segIdx) => { + const lastRow = segIdx == reviewItems[severity].length - 1; + const relevantPreview = Object.values( + relevantPreviews || [] + ).find( + (preview) => + preview.camera == value.camera && + preview.start < value.start_time && + preview.end > value.end_time + ); - return ( -
-
- markItemAsReviewed(value.id)} - onClick={() => onSelectReview(value.id)} - /> + return ( +
+
+ markItemAsReviewed(value.id)} + onClick={() => onSelectReview(value.id)} + /> +
+ {lastRow && !reachedEnd && }
- {lastRow && !reachedEnd && } -
- ); - }) - ) : ( -
- )} -
-
- + ); + }) + ) : ( +
+ )} +
+
+ +
);