Bug fixes

This commit is contained in:
Nicolas Mowen 2024-03-05 15:38:40 -07:00
parent 7c4c21426f
commit 48d1ce19de
3 changed files with 18 additions and 12 deletions

View File

@ -29,7 +29,7 @@ type DynamicVideoPlayerProps = {
timeRange: { start: number; end: number }; timeRange: { start: number; end: number };
cameraPreviews: Preview[]; cameraPreviews: Preview[];
previewOnly?: boolean; previewOnly?: boolean;
onControllerReady?: (controller: DynamicVideoController) => void; onControllerReady: (controller: DynamicVideoController) => void;
onClick?: () => void; onClick?: () => void;
}; };
export default function DynamicVideoPlayer({ export default function DynamicVideoPlayer({
@ -86,14 +86,17 @@ export default function DynamicVideoPlayer({
}, [camera, config, previewOnly]); }, [camera, config, previewOnly]);
useEffect(() => { useEffect(() => {
if (!controller) { if (!playerRef.current && !previewRef.current) {
return; return;
} }
if (onControllerReady) { if (controller) {
onControllerReady(controller); onControllerReady(controller);
} }
}, [controller, onControllerReady]);
// we only want to fire once when players are ready
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [playerRef, previewRef]);
const [hasRecordingAtTime, setHasRecordingAtTime] = useState(true); const [hasRecordingAtTime, setHasRecordingAtTime] = useState(true);
@ -277,10 +280,6 @@ export default function DynamicVideoPlayer({
player.on("ended", () => player.on("ended", () =>
controller.fireClipChangeEvent("forward"), controller.fireClipChangeEvent("forward"),
); );
if (onControllerReady) {
onControllerReady(controller);
}
}} }}
onDispose={() => { onDispose={() => {
playerRef.current = undefined; playerRef.current = undefined;

View File

@ -9,7 +9,8 @@ const buttonVariants = cva(
{ {
variants: { variants: {
variant: { variant: {
default: "bg-selected text-primary-foreground hover:bg-opacity-60", default: "bg-primary text-primary-foreground hover:bg-primary/90",
select: "bg-select text-white hover:bg-select/90",
destructive: destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90", "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: outline:

View File

@ -212,9 +212,11 @@ export default function EventView({
<ToggleGroup <ToggleGroup
className="*:px-3 *:py-4 *:rounded-2xl" className="*:px-3 *:py-4 *:rounded-2xl"
type="single" type="single"
defaultValue="alert"
size="sm" size="sm"
onValueChange={(value: ReviewSeverity) => setSeverity(value)} value={severity}
onValueChange={(value: ReviewSeverity) =>
value ? setSeverity(value) : null
} // don't allow the severity to be unselected
> >
<ToggleGroupItem <ToggleGroupItem
className={`${severity == "alert" ? "" : "text-gray-500"}`} className={`${severity == "alert" ? "" : "text-gray-500"}`}
@ -510,7 +512,11 @@ function DetectionReview({
{currentItems && ( {currentItems && (
<div className="col-span-full flex justify-center items-center"> <div className="col-span-full flex justify-center items-center">
{reachedEnd ? ( {reachedEnd ? (
<Button className="text-white" onClick={markAllReviewed}> <Button
className="text-white"
variant="select"
onClick={markAllReviewed}
>
Mark all items as reviewed Mark all items as reviewed
</Button> </Button>
) : ( ) : (