2026-02-01 05:44:53 +03:00
|
|
|
import type { ComponentType } from "react";
|
|
|
|
|
import SemanticSearchReindex from "./SemanticSearchReindex.tsx";
|
2026-02-03 18:21:47 +03:00
|
|
|
import CameraReviewSettingsView from "@/views/settings/CameraReviewSettingsView.tsx";
|
2026-02-01 05:44:53 +03:00
|
|
|
|
2026-02-03 18:21:47 +03:00
|
|
|
// Props that will be injected into all section renderers
|
|
|
|
|
export type SectionRendererProps = {
|
|
|
|
|
selectedCamera?: string;
|
|
|
|
|
setUnsavedChanges?: (hasChanges: boolean) => void;
|
|
|
|
|
[key: string]: unknown; // Allow additional props from uiSchema
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type RendererComponent = ComponentType<SectionRendererProps>;
|
2026-02-01 05:44:53 +03:00
|
|
|
|
|
|
|
|
export type SectionRenderers = Record<
|
|
|
|
|
string,
|
|
|
|
|
Record<string, RendererComponent>
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
// Section renderers registry
|
|
|
|
|
// Used to register custom renderer components for specific config sections.
|
|
|
|
|
// Maps a section key (e.g., `semantic_search`) to a mapping of renderer
|
|
|
|
|
// names to React components. These names are referenced from `uiSchema`
|
|
|
|
|
// descriptors (e.g., `{ "ui:after": { render: "SemanticSearchReindex" } }`) and
|
|
|
|
|
// are resolved by `FieldTemplate` through `formContext.renderers`.
|
2026-02-03 18:21:47 +03:00
|
|
|
//
|
|
|
|
|
// RUNTIME PROPS INJECTION:
|
|
|
|
|
// All renderers automatically receive the following props from BaseSection:
|
|
|
|
|
// - selectedCamera?: string - The current camera name (camera-level only)
|
|
|
|
|
// - setUnsavedChanges?: (hasChanges: boolean) => void - Callback to signal unsaved state
|
|
|
|
|
//
|
|
|
|
|
// Additional static props can be passed via uiSchema:
|
|
|
|
|
// { "ui:after": { render: "MyRenderer", props: { customProp: "value" } } }
|
|
|
|
|
//
|
|
|
|
|
// ADDING NEW RENDERERS:
|
|
|
|
|
// 1. Create your component accepting SectionRendererProps
|
|
|
|
|
// 2. Import and add it to the appropriate section in this registry
|
|
|
|
|
// 3. Reference it in your section's uiSchema using the { render: "ComponentName" } syntax
|
2026-02-01 05:44:53 +03:00
|
|
|
export const sectionRenderers: SectionRenderers = {
|
|
|
|
|
semantic_search: {
|
|
|
|
|
SemanticSearchReindex,
|
|
|
|
|
},
|
2026-02-03 18:21:47 +03:00
|
|
|
review: {
|
|
|
|
|
CameraReviewSettingsView,
|
|
|
|
|
},
|
2026-02-01 05:44:53 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default sectionRenderers;
|