mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-29 15:19:00 +03:00
fix fast refresh
This commit is contained in:
@@ -18,58 +18,58 @@ export type SingleSectionPageOptions = {
|
||||
showOverrideIndicator?: boolean;
|
||||
};
|
||||
|
||||
export function createSingleSectionPage({
|
||||
export type SingleSectionPageProps = SettingsPageProps &
|
||||
SingleSectionPageOptions;
|
||||
|
||||
export function SingleSectionPage({
|
||||
sectionKey,
|
||||
level,
|
||||
sectionConfig,
|
||||
requiresRestart,
|
||||
showOverrideIndicator = true,
|
||||
}: SingleSectionPageOptions) {
|
||||
return function SingleSectionPage({
|
||||
selectedCamera,
|
||||
setUnsavedChanges,
|
||||
}: SettingsPageProps) {
|
||||
const sectionNamespace =
|
||||
level === "camera" ? "config/cameras" : "config/global";
|
||||
const { t, i18n } = useTranslation([
|
||||
sectionNamespace,
|
||||
"views/settings",
|
||||
"common",
|
||||
]);
|
||||
|
||||
if (level === "camera" && !selectedCamera) {
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center text-muted-foreground">
|
||||
{t("configForm.camera.noCameras", { ns: "views/settings" })}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
selectedCamera,
|
||||
setUnsavedChanges,
|
||||
}: SingleSectionPageProps) {
|
||||
const sectionNamespace =
|
||||
level === "camera" ? "config/cameras" : "config/global";
|
||||
const { t, i18n } = useTranslation([
|
||||
sectionNamespace,
|
||||
"views/settings",
|
||||
"common",
|
||||
]);
|
||||
|
||||
if (level === "camera" && !selectedCamera) {
|
||||
return (
|
||||
<div className="flex size-full flex-col pr-2">
|
||||
<div className="mb-4">
|
||||
<Heading as="h3">
|
||||
{t(`${sectionKey}.label`, { ns: sectionNamespace })}
|
||||
</Heading>
|
||||
{i18n.exists(`${sectionKey}.description`, {
|
||||
ns: sectionNamespace,
|
||||
}) && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t(`${sectionKey}.description`, { ns: sectionNamespace })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<ConfigSectionTemplate
|
||||
sectionKey={sectionKey}
|
||||
level={level}
|
||||
cameraName={level === "camera" ? selectedCamera : undefined}
|
||||
showOverrideIndicator={showOverrideIndicator}
|
||||
onSave={() => setUnsavedChanges?.(false)}
|
||||
showTitle={false}
|
||||
sectionConfig={sectionConfig}
|
||||
requiresRestart={requiresRestart}
|
||||
/>
|
||||
<div className="flex h-full items-center justify-center text-muted-foreground">
|
||||
{t("configForm.camera.noCameras", { ns: "views/settings" })}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex size-full flex-col pr-2">
|
||||
<div className="mb-4">
|
||||
<Heading as="h3">
|
||||
{t(`${sectionKey}.label`, { ns: sectionNamespace })}
|
||||
</Heading>
|
||||
{i18n.exists(`${sectionKey}.description`, {
|
||||
ns: sectionNamespace,
|
||||
}) && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t(`${sectionKey}.description`, { ns: sectionNamespace })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<ConfigSectionTemplate
|
||||
sectionKey={sectionKey}
|
||||
level={level}
|
||||
cameraName={level === "camera" ? selectedCamera : undefined}
|
||||
showOverrideIndicator={showOverrideIndicator}
|
||||
onSave={() => setUnsavedChanges?.(false)}
|
||||
showTitle={false}
|
||||
sectionConfig={sectionConfig}
|
||||
requiresRestart={requiresRestart}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user