Skip to content

Commit 2561740

Browse files
authored
Merge pull request #95 from CAHLR/allison-versionupdate
Version Update to 1.7 with default global language fix and mastery/completion toggle defined
2 parents 316dae2 + fe17303 commit 2561740

File tree

8 files changed

+415
-59
lines changed

8 files changed

+415
-59
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,3 +596,4 @@ mastery. Ties (of equal mastery) in the heuristic selection algorithm are broken
596596
- **giveStuBottomHint:** controls whether the suer should receive a bottom-out hint (last hint in the hint pathway that contains the answer)
597597
- **giveHintOnIncorrect:** controls whether an incorrect response should automatically force the user into the hint pathway
598598
- **keepMCOrder:** controls whether to preserve the order of MCQ choices in the spreadsheet
599+
- **enableCompletionMode:** controls whether the student finishes the lesson once mastery threshold is reached or once all problems exhausted

src/components/problem-layout/LessonSelection.js

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,26 @@ import withTranslation from "../../util/withTranslation.js";
1717
import Popup from '../Popup/Popup.js';
1818
import About from '../../pages/Posts/About.js';
1919
import MenuBookIcon from '@material-ui/icons/MenuBook';
20+
import { LocalizationConsumer } from '../../util/LocalizationContext';
2021

2122
class LessonSelection extends React.Component {
2223
static contextType = ThemeContext;
2324

2425
constructor(props, context) {
2526
super(props);
26-
const { courseNum, setLanguage } = this.props;
27+
// const { courseNum, setLanguage } = this.props;
2728

28-
if (courseNum == 6) {
29-
setLanguage('se')
30-
}
29+
// if (courseNum != null) {
30+
// const course = _coursePlansNoEditor[parseInt(courseNum)];
31+
// if (course && course.language) {
32+
// setLanguage(course.language);
33+
// }
34+
// }
3135

32-
if (props.history.location.pathname == '/') {
33-
const defaultLocale = localStorage.getItem('defaultLocale');
34-
setLanguage(defaultLocale)
35-
}
36+
// if (props.history.location.pathname == '/') {
37+
// const defaultLocale = localStorage.getItem('platformLanguage');
38+
// setLanguage(defaultLocale)
39+
// }
3640

3741
this.user = context.user || {}
3842
this.isPrivileged = !!this.user.privileged
@@ -63,6 +67,13 @@ class LessonSelection extends React.Component {
6367
this.setState({ preparedRemoveProgress: true });
6468
}
6569

70+
handleCourseSelect = (course, courseIndex) => {
71+
const { history } = this.props;
72+
// localStorage.setItem("defaultLocale", course.language);
73+
74+
history.push(`/courses/${courseIndex}`);
75+
};
76+
6677
render() {
6778
const { translate } = this.props;
6879
const { classes, courseNum } = this.props;
@@ -116,9 +127,11 @@ class LessonSelection extends React.Component {
116127
<IconButton aria-label={`View Course ${i}`}
117128
aria-roledescription={`Navigate to course ${i}'s page to view available lessons`}
118129
role={"link"}
119-
onClick={() => {
120-
this.props.history.push(`/courses/${i}`)
121-
}}>
130+
// onClick={() => {
131+
// this.props.history.push(`/courses/${i}`)
132+
// }}
133+
onClick={() => this.handleCourseSelect(course, i)}
134+
>
122135
<img
123136
src={`${process.env.PUBLIC_URL}/static/images/icons/folder.png`}
124137
width="64px"
@@ -206,4 +219,16 @@ class LessonSelection extends React.Component {
206219
}
207220
}
208221

209-
export default withStyles(styles)(withTranslation(LessonSelection));
222+
// export default withStyles(styles)(withTranslation(LessonSelection));
223+
224+
export default withStyles(styles)(withTranslation((props) => (
225+
<LocalizationConsumer>
226+
{({ language, platformLanguage }) => (
227+
<LessonSelection
228+
{...props}
229+
language={language}
230+
platformLanguage={platformLanguage}
231+
/>
232+
)}
233+
</LocalizationConsumer>
234+
)));

src/components/problem-layout/Problem.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class Problem extends React.Component {
4444
constructor(props, context) {
4545
super(props);
4646

47-
const { setLanguage } = props;
48-
if (props.lesson.courseName == "Matematik 4") {
49-
setLanguage('se')
50-
}
51-
47+
// const { setLanguage } = props;
48+
// if (props.lesson.courseName == "Matematik 4") {
49+
// setLanguage('se')
50+
// }
51+
5252
this.bktParams = context.bktParams;
5353
this.heuristic = context.heuristic;
5454

@@ -86,7 +86,9 @@ class Problem extends React.Component {
8686
}
8787

8888
componentDidMount() {
89-
const { lesson } = this.props;
89+
const { lesson, setLanguage } = this.props;
90+
setLanguage(lesson.language);
91+
9092
document["oats-meta-courseName"] = lesson?.courseName || "";
9193
document["oats-meta-textbookName"] =
9294
lesson?.courseName
@@ -770,4 +772,4 @@ class Problem extends React.Component {
770772
}
771773
}
772774

773-
export default withStyles(styles)(withTranslation(Problem));
775+
export default withTranslation(withStyles(styles)(Problem));

src/config/config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ const SITE_VERSION = "1.6";
1010

1111
const CURRENT_SEMESTER = calculateSemester(Date.now());
1212

13+
/**
14+
* Default language for the platform
15+
* @type {string}
16+
*/
17+
const DEFAULT_LANGUAGE = "en"; // Supported Options: 'en', 'es', 'se'
18+
19+
/**
20+
* Available languages for the platform
21+
* @type {string[]}
22+
*/
23+
const AVAILABLE_LANGUAGES = ["en", "es", "se"];
24+
1325
/**
1426
* If user does not access the website through Canvas, show a warning (for the first time).
1527
* @type {boolean}
@@ -156,4 +168,6 @@ export {
156168
DO_FOCUS_TRACKING,
157169
findLessonById,
158170
SHOW_NOT_CANVAS_WARNING,
171+
DEFAULT_LANGUAGE,
172+
AVAILABLE_LANGUAGES
159173
};

src/content-sources/oatutor

Submodule oatutor updated 177 files

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ import ReactDOM from 'react-dom';
33
import './index.css';
44
import App from './App';
55
import * as serviceWorker from './serviceWorker';
6+
import { LocalizationProvider } from './util/LocalizationContext';
67

7-
ReactDOM.render(<App/>, document.getElementById('root'));
8+
ReactDOM.render(
9+
<LocalizationProvider>
10+
<App />
11+
</LocalizationProvider>,
12+
document.getElementById('root')
13+
);
814

915
// If you want your app to work offline and load faster, you can change
1016
// unregister() to register() below. Note this comes with some pitfalls.

0 commit comments

Comments
 (0)