Skip to content
Snippets Groups Projects
Commit 7c082fe3 authored by chris's avatar chris
Browse files

set disabled and found

parent 8785aaf5
No related branches found
No related tags found
1 merge request!339new toolgroup files
......@@ -52,6 +52,7 @@ class MultipleChoiceQuestion extends Tools {
title = 'Add Multiple Choice Question';
icon = 'multipleChoice';
name = 'Multiple Choice';
label = 'Multiple Choice';
get run() {
return (view, main, context) => {
......@@ -64,7 +65,7 @@ class MultipleChoiceQuestion extends Tools {
return state => {};
}
select = (state, activeViewId, activeView) => {
select = (state, activeView) => {
const { disallowedTools } = activeView.props;
if (disallowedTools.includes('MultipleChoice')) return false;
let status = true;
......
......@@ -18,12 +18,6 @@ class MultipleDropDown extends ToolGroup {
renderTools(view) {
if (isEmpty(view)) return null;
const context = useContext(WaxContext);
const {
activeViewId,
view: { main },
} = context;
const Wrapper = styled.div`
${ReactDropDownStyles};
......@@ -57,11 +51,18 @@ class MultipleDropDown extends ToolGroup {
}
`;
const { dispatch, state } = view;
const context = useContext(WaxContext);
const {
activeView,
view: { main },
} = context;
const { state } = view;
const dropDownOptions = [
{ label: 'Multiple choice ', value: '0', item: this._tools[0] },
{ label: 'Multiple Choice ', value: '0', item: this._tools[0] },
{
label: 'Multiple choice (single correct) ',
label: 'Multiple Choice (single correct) ',
value: '1',
item: this._tools[0],
},
......@@ -73,8 +74,13 @@ class MultipleDropDown extends ToolGroup {
},
];
const isDisabled = true;
const isDisabled = this._tools[0].select(state, activeView);
let found = '';
dropDownOptions.forEach((item, i) => {
if (item.item.select(state, activeView) === false) {
found = item.item.label;
}
});
return (
<Wrapper key={uuidv4()}>
......
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