Skip to content

Commit

Permalink
UI tweaks (#16813)
Browse files Browse the repository at this point in the history
* Add escape to close review details

* Refresh review page automatically if there are currently no items to review
  • Loading branch information
NickM-27 authored Feb 26, 2025
1 parent 7ce1b35 commit 7eb3c87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions web/src/components/overlay/detail/ReviewDetailDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { useOverlayState } from "@/hooks/use-overlay-state";
import { DownloadVideoButton } from "@/components/button/DownloadVideoButton";
import { TooltipPortal } from "@radix-ui/react-tooltip";
import { LuSearch } from "react-icons/lu";
import useKeyboardListener from "@/hooks/use-keyboard-listener";

type ReviewDetailDialogProps = {
review?: ReviewSegment;
Expand Down Expand Up @@ -133,6 +134,14 @@ export default function ReviewDetailDialog({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [review]);

// keyboard listener

useKeyboardListener(["Esc"], (key, modifiers) => {
if (key == "Esc" && modifiers.down && !modifiers.repeat) {
setIsOpen(false);
}
});

const Overlay = isDesktop ? Sheet : MobilePage;
const Content = isDesktop ? SheetContent : MobilePageContent;
const Header = isDesktop ? SheetHeader : MobilePageHeader;
Expand Down
10 changes: 10 additions & 0 deletions web/src/views/events/EventView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,16 @@ function DetectionReview({

// existing review item

useEffect(() => {
if (loading || currentItems == null || itemsToReview == undefined) {
return;
}

if (currentItems.length == 0 && itemsToReview > 0) {
pullLatestData();
}
}, [loading, currentItems, itemsToReview, pullLatestData]);

useEffect(() => {
if (!startTime || !currentItems || currentItems.length == 0) {
return;
Expand Down

0 comments on commit 7eb3c87

Please sign in to comment.