-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added customizable text for correct and incorrect tasks
- Loading branch information
1 parent
8a0b046
commit 9c6c8ab
Showing
4 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* eslint-disable react/jsx-curly-newline */ | ||
/* eslint-disable react/jsx-wrap-multilines */ | ||
import { | ||
ListItemText, | ||
ListItemSecondaryAction, | ||
List, | ||
ListItem, | ||
ListSubheader, | ||
TextField, | ||
} from '@material-ui/core'; | ||
import React from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { | ||
CorrectionSettings, | ||
selectSettingsCorrection, | ||
settingsSetCorrection, | ||
} from '../../model/SettingsSlice'; | ||
|
||
const CorrectionSettingsList = () => { | ||
const dispatch = useDispatch(); | ||
const settings: CorrectionSettings = useSelector(selectSettingsCorrection); | ||
|
||
if (!settings) { | ||
// set default | ||
dispatch( | ||
settingsSetCorrection({ | ||
taskCorrectText: 'korrekt!', | ||
taskIncorrectText: 'fehlt', | ||
}) | ||
); | ||
return null; | ||
} | ||
|
||
return ( | ||
<List subheader={<ListSubheader disableSticky>Correction</ListSubheader>}> | ||
<ListItem> | ||
<ListItemText | ||
primary="Task Correct Text" | ||
secondary="Comment text for a correct task" | ||
/> | ||
<ListItemSecondaryAction> | ||
<TextField | ||
label="Text" | ||
InputLabelProps={{ | ||
shrink: true, | ||
}} | ||
variant="outlined" | ||
size="small" | ||
value={settings.taskCorrectText} | ||
onChange={(event) => | ||
dispatch( | ||
settingsSetCorrection({ | ||
...settings, | ||
taskCorrectText: event.target.value, | ||
}) | ||
) | ||
} | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary="Task Incorrect Text" | ||
secondary="Comment text for a incorrect/missing task" | ||
/> | ||
<ListItemSecondaryAction> | ||
<TextField | ||
label="Text" | ||
InputLabelProps={{ | ||
shrink: true, | ||
}} | ||
variant="outlined" | ||
size="small" | ||
value={settings.taskIncorrectText} | ||
onChange={(event) => | ||
dispatch( | ||
settingsSetCorrection({ | ||
...settings, | ||
taskIncorrectText: event.target.value, | ||
}) | ||
) | ||
} | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
</List> | ||
); | ||
}; | ||
|
||
export default CorrectionSettingsList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters