revert: revert wrong label fix

This commit is contained in:
ZhaiSoul 2025-04-15 15:36:35 +00:00
parent 1c2bd5d419
commit e373b8adc7
9 changed files with 14 additions and 20 deletions

View File

@ -127,9 +127,7 @@ export default function SearchThumbnail({
.filter( .filter(
(item) => item !== undefined && !item.includes("-verified"), (item) => item !== undefined && !item.includes("-verified"),
) )
.map((text) => .map((text) => t(text, { ns: "objects" }))
t(text.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.sort() .sort()
.join(", ") .join(", ")
.replaceAll("-verified", "")} .replaceAll("-verified", "")}

View File

@ -248,7 +248,7 @@ function GeneralFilterButton({
} }
if (selectedLabels.length == 1) { if (selectedLabels.length == 1) {
return t(selectedLabels[0].replace(" ", "_").toLowerCase(), { return t(selectedLabels[0], {
ns: "objects", ns: "objects",
}); });
} }
@ -357,7 +357,7 @@ export function GeneralFilterContent({
{allLabels.map((item) => ( {allLabels.map((item) => (
<FilterSwitch <FilterSwitch
key={item} key={item}
label={t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })} label={t(item, { ns: "objects" })}
isChecked={currentLabels?.includes(item) ?? false} isChecked={currentLabels?.includes(item) ?? false}
onCheckedChange={(isChecked) => { onCheckedChange={(isChecked) => {
if (isChecked) { if (isChecked) {

View File

@ -419,7 +419,7 @@ export default function InputWithTags({
? t("button.yes", { ns: "common" }) ? t("button.yes", { ns: "common" })
: t("button.no", { ns: "common" }); : t("button.no", { ns: "common" });
} else if (filterType === "labels") { } else if (filterType === "labels") {
return t((filterValues as string).replace(" ", "_").toLowerCase(), { return t(filterValues as string, {
ns: "objects", ns: "objects",
}); });
} else if (filterType === "search_type") { } else if (filterType === "search_type") {
@ -809,7 +809,7 @@ export default function InputWithTags({
> >
{t("filter.label." + filterType)}:{" "} {t("filter.label." + filterType)}:{" "}
{filterType === "labels" {filterType === "labels"
? t(value.replace(" ", "_").toLowerCase(), { ? t(value, {
ns: "objects", ns: "objects",
}) })
: value.replaceAll("_", " ")} : value.replaceAll("_", " ")}

View File

@ -325,7 +325,7 @@ export default function ReviewDetailDialog({
values={{ values={{
objects: missingObjects objects: missingObjects
.map((x) => .map((x) =>
t(x.replace(" ", "_").toLowerCase(), { t(x, {
ns: "objects", ns: "objects",
}), }),
) )

View File

@ -690,7 +690,7 @@ function ObjectDetailsTab({
<div className="text-sm text-primary/40">{t("details.label")}</div> <div className="text-sm text-primary/40">{t("details.label")}</div>
<div className="flex flex-row items-center gap-2 text-sm capitalize"> <div className="flex flex-row items-center gap-2 text-sm capitalize">
{getIconForLabel(search.label, "size-4 text-primary")} {getIconForLabel(search.label, "size-4 text-primary")}
{t(search.label.replace(" ", "_").toLowerCase(), { {t(search.label, {
ns: "objects", ns: "objects",
})} })}
{search.sub_label && ` (${search.sub_label})`} {search.sub_label && ` (${search.sub_label})`}
@ -953,7 +953,7 @@ function ObjectDetailsTab({
description={ description={
search.label search.label
? t("details.editSubLabel.desc", { ? t("details.editSubLabel.desc", {
label: t(search.label.replace(" ", "_").toLowerCase(), { label: t(search.label, {
ns: "objects", ns: "objects",
}), }),
}) })
@ -970,7 +970,7 @@ function ObjectDetailsTab({
description={ description={
search.label search.label
? t("details.editLPR.desc", { ? t("details.editLPR.desc", {
label: t(search.label.replace(" ", "_").toLowerCase(), { label: t(search.label, {
ns: "objects", ns: "objects",
}), }),
}) })

View File

@ -448,7 +448,7 @@ export function ZoneObjectSelector({ camera }: ZoneObjectSelectorProps) {
<SelectSeparator className="bg-secondary" /> <SelectSeparator className="bg-secondary" />
{allLabels.map((item) => ( {allLabels.map((item) => (
<SelectItem key={item} value={item}> <SelectItem key={item} value={item}>
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })} {t(item, { ns: "objects" })}
</SelectItem> </SelectItem>
))} ))}
</SelectGroup> </SelectGroup>

View File

@ -936,7 +936,7 @@ export function ZoneObjectSelector({
className="w-full cursor-pointer capitalize text-primary" className="w-full cursor-pointer capitalize text-primary"
htmlFor={item} htmlFor={item}
> >
{t(item.replace(" ", "_").toLowerCase(), { ns: "objects" })} {t(item, { ns: "objects" })}
</Label> </Label>
<Switch <Switch
key={item} key={item}

View File

@ -152,7 +152,7 @@ function ThumbnailRow({
return ( return (
<div className="rounded-lg bg-background_alt p-2 md:px-4"> <div className="rounded-lg bg-background_alt p-2 md:px-4">
<div className="flex flex-row items-center text-lg capitalize"> <div className="flex flex-row items-center text-lg capitalize">
{t(objectType.replace(" ", "_").toLowerCase(), { ns: "objects" })} {t(objectType, { ns: "objects" })}
{searchResults && ( {searchResults && (
<span className="ml-3 text-sm text-secondary-foreground"> <span className="ml-3 text-sm text-secondary-foreground">
{t("trackedObjectsCount", { {t("trackedObjectsCount", {

View File

@ -79,9 +79,7 @@ export default function CameraSettingsView({
const alertsLabels = useMemo(() => { const alertsLabels = useMemo(() => {
return cameraConfig?.review.alerts.labels return cameraConfig?.review.alerts.labels
? cameraConfig.review.alerts.labels ? cameraConfig.review.alerts.labels
.map((label) => .map((label) => t(label, { ns: "objects" }))
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.join(", ") .join(", ")
: ""; : "";
}, [cameraConfig, t]); }, [cameraConfig, t]);
@ -89,9 +87,7 @@ export default function CameraSettingsView({
const detectionsLabels = useMemo(() => { const detectionsLabels = useMemo(() => {
return cameraConfig?.review.detections.labels return cameraConfig?.review.detections.labels
? cameraConfig.review.detections.labels ? cameraConfig.review.detections.labels
.map((label) => .map((label) => t(label, { ns: "objects" }))
t(label.replace(" ", "_").toLowerCase(), { ns: "objects" }),
)
.join(", ") .join(", ")
: ""; : "";
}, [cameraConfig, t]); }, [cameraConfig, t]);