UI Tweaks (#20403)
Some checks failed
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Stalebot / stale (push) Has been cancelled

* Fix context menu link to debug

* Use genai title for tooltip when available
This commit is contained in:
Nicolas Mowen 2025-10-09 08:49:42 -06:00 committed by GitHub
parent f4e7549311
commit 24a1874225
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 52 additions and 22 deletions

View File

@ -50,6 +50,27 @@ export function AnimatedEventCard({
fetchPreviews: !currentHour, fetchPreviews: !currentHour,
}); });
const tooltipText = useMemo(() => {
if (event?.data?.metadata?.title) {
return event.data.metadata.title;
}
return (
`${[
...new Set([
...(event.data.objects || []),
...(event.data.sub_labels || []),
...(event.data.audio || []),
]),
]
.filter((item) => item !== undefined && !item.includes("-verified"))
.map((text) => text.charAt(0).toUpperCase() + text.substring(1))
.sort()
.join(", ")
.replaceAll("-verified", "")} ` + t("detected")
);
}, [event, t]);
// visibility // visibility
const [windowVisible, setWindowVisible] = useState(true); const [windowVisible, setWindowVisible] = useState(true);
@ -220,20 +241,7 @@ export function AnimatedEventCard({
)} )}
</div> </div>
</TooltipTrigger> </TooltipTrigger>
<TooltipContent> <TooltipContent>{tooltipText}</TooltipContent>
{`${[
...new Set([
...(event.data.objects || []),
...(event.data.sub_labels || []),
...(event.data.audio || []),
]),
]
.filter((item) => item !== undefined && !item.includes("-verified"))
.map((text) => text.charAt(0).toUpperCase() + text.substring(1))
.sort()
.join(", ")
.replaceAll("-verified", "")} ` + t("detected")}
</TooltipContent>
</Tooltip> </Tooltip>
); );
} }

View File

@ -355,9 +355,7 @@ export default function LiveContextMenu({
<div <div
className="flex w-full cursor-pointer items-center justify-start gap-2" className="flex w-full cursor-pointer items-center justify-start gap-2"
onClick={ onClick={
isEnabled isEnabled ? () => navigate(`?debug=true#${camera}`) : undefined
? () => navigate(`/settings?page=debug&camera=${camera}`)
: undefined
} }
> >
<div className="text-primary"> <div className="text-primary">

View File

@ -112,7 +112,8 @@ export function useSearchEffect(
callback: (value: string) => boolean, callback: (value: string) => boolean,
) { ) {
const location = useLocation(); const location = useLocation();
const [searchParams, setSearchParams] = useSearchParams(); const navigate = useNavigate();
const [searchParams] = useSearchParams();
const param = useMemo(() => { const param = useMemo(() => {
const param = searchParams.get(key); const param = searchParams.get(key);
@ -132,7 +133,17 @@ export function useSearchEffect(
const remove = callback(param[1]); const remove = callback(param[1]);
if (remove) { if (remove) {
setSearchParams(undefined, { state: location.state, replace: true }); navigate(location.pathname + location.hash, {
state: location.state,
replace: true,
});
} }
}, [param, location.state, callback, setSearchParams]); }, [
param,
location.state,
location.pathname,
location.hash,
callback,
navigate,
]);
} }

View File

@ -30,7 +30,7 @@ type FrigateObjectState = {
}; };
export interface FrigateReview { export interface FrigateReview {
type: "new" | "update" | "end"; type: "new" | "update" | "end" | "genai";
before: ReviewSegment; before: ReviewSegment;
after: ReviewSegment; after: ReviewSegment;
} }

View File

@ -111,6 +111,7 @@ import { Trans, useTranslation } from "react-i18next";
import { useDocDomain } from "@/hooks/use-doc-domain"; import { useDocDomain } from "@/hooks/use-doc-domain";
import PtzControlPanel from "@/components/overlay/PtzControlPanel"; import PtzControlPanel from "@/components/overlay/PtzControlPanel";
import ObjectSettingsView from "../settings/ObjectSettingsView"; import ObjectSettingsView from "../settings/ObjectSettingsView";
import { useSearchEffect } from "@/hooks/use-overlay-state";
type LiveCameraViewProps = { type LiveCameraViewProps = {
config?: FrigateConfig; config?: FrigateConfig;
@ -274,6 +275,14 @@ export default function LiveCameraView({
const [showStats, setShowStats] = useState(false); const [showStats, setShowStats] = useState(false);
const [debug, setDebug] = useState(false); const [debug, setDebug] = useState(false);
useSearchEffect("debug", (value: string) => {
if (value === "true") {
setDebug(true);
}
return true;
});
const [fullResolution, setFullResolution] = useState<VideoResolutionType>({ const [fullResolution, setFullResolution] = useState<VideoResolutionType>({
width: 0, width: 0,
height: 0, height: 0,

View File

@ -114,7 +114,11 @@ export default function LiveDashboardView({
// if event is ended and was saved, update events list // if event is ended and was saved, update events list
if (eventUpdate.after.severity == "alert") { if (eventUpdate.after.severity == "alert") {
if (eventUpdate.type == "end" || eventUpdate.type == "new") { if (
eventUpdate.type == "end" ||
eventUpdate.type == "new" ||
eventUpdate.type == "genai"
) {
setTimeout( setTimeout(
() => updateEvents(), () => updateEvents(),
eventUpdate.type == "end" ? 1000 : 6000, eventUpdate.type == "end" ? 1000 : 6000,