Skip to content
Snippets Groups Projects
Commit 8bc10573 authored by victor mutai's avatar victor mutai
Browse files

chore: hide on settings off/on

parent b5f1c696
No related branches found
No related tags found
1 merge request!540Allow book owner to set AI use
......@@ -6,9 +6,12 @@ const ToggleAiComponent = ({ item }) => {
const [checked, setChecked] = useState(false);
const context = useContext(WaxContext);
const {
app,
pmViews: { main },
} = context;
const enableService = app.config.get('config.AskAiContentService');
let isDisabled = false;
const isEditable = main.props.editable(editable => {
return editable;
......@@ -24,16 +27,17 @@ const ToggleAiComponent = ({ item }) => {
};
return useMemo(
() => (
<MenuButton
active={checked}
disabled={!isEditable}
iconName={item.icon}
onMouseDown={onMouseDown}
title={item.title}
/>
),
[checked, isDisabled],
() =>
enableService.AiOn ? (
<MenuButton
active={checked}
disabled={!isEditable}
iconName={item.icon}
onMouseDown={onMouseDown}
title={item.title}
/>
) : null,
[checked, isDisabled, enableService.AiOn],
);
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment