Spaces:
Configuration error
Configuration error
File size: 1,322 Bytes
a7060a0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import { inject, observer } from "mobx-react";
import { useEffect } from "react";
import { Space } from "../../common/Space/Space";
import { Toggle } from "@humansignal/ui";
import ToolsManager from "../../tools/Manager";
import { cn } from "../../utils/bem";
import "./DynamicPreannotationsToggle.prefix.css";
export const DynamicPreannotationsToggle = inject("store")(
observer(({ store }) => {
const enabled = store.hasInterface("auto-annotation") && !store.forceAutoAnnotation;
useEffect(() => {
if (!enabled) store.setAutoAnnotation(false);
}, [enabled]);
return enabled ? (
<div className={cn("dynamic-preannotations").toClassName()}>
<div className={cn("dynamic-preannotations").elem("wrapper").toClassName()}>
<Space spread>
<Toggle
checked={store.autoAnnotation}
onChange={(e) => {
const checked = e.target.checked;
store.setAutoAnnotation(checked);
if (!checked) {
ToolsManager.allInstances().forEach((inst) => inst.selectDefault());
}
}}
label="Auto-Annotation"
data-testid="bottombar-auto-annotation-toggle"
/>
</Space>
</div>
</div>
) : null;
}),
);
|