mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 00:18:57 +03:00
feat: document locale url (#18409)
* feat: document locale url * fix: remove debug code * fix readme_cn line * feat: add menu document locale url
This commit is contained in:
@@ -18,6 +18,7 @@ import { LogChip } from "../indicators/Chip";
|
||||
import { useMemo } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
|
||||
type LogInfoDialogProps = {
|
||||
logLine?: LogLine;
|
||||
@@ -105,23 +106,25 @@ export default function LogInfoDialog({
|
||||
}
|
||||
|
||||
function useHelpfulLinks(content: string | undefined) {
|
||||
const { getLocaleDocUrl } = useDocDomain();
|
||||
return useMemo(() => {
|
||||
if (!content) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const links = [];
|
||||
|
||||
if (/Could not clear [\d.]* currently [\d.]*/.exec(content)) {
|
||||
links.push({
|
||||
link: "https://docs.frigate.video/configuration/record#will-frigate-delete-old-recordings-if-my-storage-runs-out",
|
||||
link: getLocaleDocUrl(
|
||||
"configuration/record#will-frigate-delete-old-recordings-if-my-storage-runs-out",
|
||||
),
|
||||
text: "Frigate Automatic Storage Cleanup",
|
||||
});
|
||||
}
|
||||
|
||||
if (/Did not detect hwaccel/.exec(content)) {
|
||||
links.push({
|
||||
link: "https://docs.frigate.video/configuration/hardware_acceleration",
|
||||
link: getLocaleDocUrl("configuration/hardware_acceleration"),
|
||||
text: "Setup Hardware Acceleration",
|
||||
});
|
||||
}
|
||||
@@ -139,25 +142,27 @@ function useHelpfulLinks(content: string | undefined) {
|
||||
content.includes("No VA display found for device /dev/dri/renderD128")
|
||||
) {
|
||||
links.push({
|
||||
link: "https://docs.frigate.video/configuration/hardware_acceleration",
|
||||
link: getLocaleDocUrl("configuration/hardware_acceleration"),
|
||||
text: "Verify Hardware Acceleration Setup",
|
||||
});
|
||||
}
|
||||
|
||||
if (content.includes("No EdgeTPU was detected")) {
|
||||
links.push({
|
||||
link: "https://docs.frigate.video/troubleshooting/edgetpu",
|
||||
link: getLocaleDocUrl("troubleshooting/edgetpu"),
|
||||
text: "Troubleshoot Coral",
|
||||
});
|
||||
}
|
||||
|
||||
if (content.includes("The current SHM size of")) {
|
||||
links.push({
|
||||
link: "https://docs.frigate.video/frigate/installation/#calculating-required-shm-size",
|
||||
link: getLocaleDocUrl(
|
||||
"frigate/installation/#calculating-required-shm-size",
|
||||
),
|
||||
text: "Calculate Correct SHM Size",
|
||||
});
|
||||
}
|
||||
|
||||
return links;
|
||||
}, [content]);
|
||||
}, [content, getLocaleDocUrl]);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import ActivityIndicator from "@/components/indicators/activity-indicator";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
|
||||
type AnnotationSettingsPaneProps = {
|
||||
event: Event;
|
||||
@@ -43,6 +44,7 @@ export function AnnotationSettingsPane({
|
||||
setAnnotationOffset,
|
||||
}: AnnotationSettingsPaneProps) {
|
||||
const { t } = useTranslation(["views/explore"]);
|
||||
const { getLocaleDocUrl } = useDocDomain();
|
||||
|
||||
const { data: config, mutate: updateConfig } =
|
||||
useSWR<FrigateConfig>("config");
|
||||
@@ -180,7 +182,7 @@ export function AnnotationSettingsPane({
|
||||
</Trans>
|
||||
<div className="mt-2 flex items-center text-primary">
|
||||
<Link
|
||||
to="https://docs.frigate.video/configuration/reference"
|
||||
to={getLocaleDocUrl("configuration/reference")}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline"
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Trans, useTranslation } from "react-i18next";
|
||||
import { LuExternalLink } from "react-icons/lu";
|
||||
import { Link } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
import { useDocDomain } from "@/hooks/use-doc-domain";
|
||||
|
||||
const STEPS = ["steps.faceName", "steps.uploadFace", "steps.nextSteps"];
|
||||
|
||||
@@ -38,7 +39,7 @@ export default function CreateFaceWizardDialog({
|
||||
onFinish,
|
||||
}: CreateFaceWizardDialogProps) {
|
||||
const { t } = useTranslation("views/faceLibrary");
|
||||
|
||||
const { getLocaleDocUrl } = useDocDomain();
|
||||
// wizard
|
||||
|
||||
const [step, setStep] = useState(0);
|
||||
@@ -155,7 +156,7 @@ export default function CreateFaceWizardDialog({
|
||||
</p>
|
||||
<div className="my-2 flex items-center text-sm text-primary">
|
||||
<Link
|
||||
to="https://docs.frigate.video/configuration/face_recognition"
|
||||
to={getLocaleDocUrl("configuration/face_recognition")}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline"
|
||||
|
||||
Reference in New Issue
Block a user