fix: fix mobile bottom bar reindexing embeddings i18n wrong

This commit is contained in:
ZhaiSoul 2025-04-16 05:06:40 +00:00
parent d71637327b
commit 371e9b41f8

View File

@ -16,6 +16,7 @@ import { Link } from "react-router-dom";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { isIOS, isMobile } from "react-device-detect"; import { isIOS, isMobile } from "react-device-detect";
import { isPWA } from "@/utils/isPWA"; import { isPWA } from "@/utils/isPWA";
import { useTranslation } from "react-i18next";
function Bottombar() { function Bottombar() {
const navItems = useNavigation("secondary"); const navItems = useNavigation("secondary");
@ -43,6 +44,7 @@ type StatusAlertNavProps = {
className?: string; className?: string;
}; };
function StatusAlertNav({ className }: StatusAlertNavProps) { function StatusAlertNav({ className }: StatusAlertNavProps) {
const { t } = useTranslation(["views/system"]);
const { data: initialStats } = useSWR<FrigateStats>("stats", { const { data: initialStats } = useSWR<FrigateStats>("stats", {
revalidateOnFocus: false, revalidateOnFocus: false,
}); });
@ -82,14 +84,19 @@ function StatusAlertNav({ className }: StatusAlertNavProps) {
clearMessages("embeddings-reindex"); clearMessages("embeddings-reindex");
addMessage( addMessage(
"embeddings-reindex", "embeddings-reindex",
`Reindexing embeddings (${Math.floor((reindexState.processed_objects / reindexState.total_objects) * 100)}% complete)`, t("stats.reindexingEmbeddings", {
processed: Math.floor(
(reindexState.processed_objects / reindexState.total_objects) *
100,
),
}),
); );
} }
if (reindexState.status === "completed") { if (reindexState.status === "completed") {
clearMessages("embeddings-reindex"); clearMessages("embeddings-reindex");
} }
} }
}, [reindexState, addMessage, clearMessages]); }, [reindexState, addMessage, clearMessages, t]);
if (!messages || Object.keys(messages).length === 0) { if (!messages || Object.keys(messages).length === 0) {
return; return;