mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-17 18:46:42 +03:00
* tweak api to fetch multiple timelines * support multiple selected objects in context * rework context provider * use toggle in detail stream * use toggle in menu * plot multiple object tracks * verified icon, recognized plate, and clicking tweaks * add plate to object lifecycle * close menu before opening frigate+ dialog * clean up * normal text case for tooltip * capitalization * use flexbox for recording view
83 lines
2.4 KiB
TypeScript
83 lines
2.4 KiB
TypeScript
import { ObjectLifecycleSequence } from "@/types/timeline";
|
|
import { t } from "i18next";
|
|
import { getTranslatedLabel } from "./i18n";
|
|
import { capitalizeFirstLetter } from "./stringUtil";
|
|
|
|
export function getLifecycleItemDescription(
|
|
lifecycleItem: ObjectLifecycleSequence,
|
|
) {
|
|
const rawLabel = Array.isArray(lifecycleItem.data.sub_label)
|
|
? lifecycleItem.data.sub_label[0]
|
|
: lifecycleItem.data.sub_label || lifecycleItem.data.label;
|
|
|
|
const label = lifecycleItem.data.sub_label
|
|
? capitalizeFirstLetter(rawLabel)
|
|
: getTranslatedLabel(rawLabel);
|
|
|
|
switch (lifecycleItem.class_type) {
|
|
case "visible":
|
|
return t("objectLifecycle.lifecycleItemDesc.visible", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
case "entered_zone":
|
|
return t("objectLifecycle.lifecycleItemDesc.entered_zone", {
|
|
ns: "views/explore",
|
|
label,
|
|
zones: lifecycleItem.data.zones.join(" and ").replaceAll("_", " "),
|
|
});
|
|
case "active":
|
|
return t("objectLifecycle.lifecycleItemDesc.active", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
case "stationary":
|
|
return t("objectLifecycle.lifecycleItemDesc.stationary", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
case "attribute": {
|
|
let title = "";
|
|
if (
|
|
lifecycleItem.data.attribute == "face" ||
|
|
lifecycleItem.data.attribute == "license_plate"
|
|
) {
|
|
title = t(
|
|
"objectLifecycle.lifecycleItemDesc.attribute.faceOrLicense_plate",
|
|
{
|
|
ns: "views/explore",
|
|
label,
|
|
attribute: getTranslatedLabel(
|
|
lifecycleItem.data.attribute.replaceAll("_", " "),
|
|
),
|
|
},
|
|
);
|
|
} else {
|
|
title = t("objectLifecycle.lifecycleItemDesc.attribute.other", {
|
|
ns: "views/explore",
|
|
label: lifecycleItem.data.label,
|
|
attribute: getTranslatedLabel(
|
|
lifecycleItem.data.attribute.replaceAll("_", " "),
|
|
),
|
|
});
|
|
}
|
|
return title;
|
|
}
|
|
case "gone":
|
|
return t("objectLifecycle.lifecycleItemDesc.gone", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
case "heard":
|
|
return t("objectLifecycle.lifecycleItemDesc.heard", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
case "external":
|
|
return t("objectLifecycle.lifecycleItemDesc.external", {
|
|
ns: "views/explore",
|
|
label,
|
|
});
|
|
}
|
|
}
|