Skip to content

Commit 5f92f33

Browse files
Merge pull request #68 from CAHLR/frontend-components
Implement popup
2 parents 1679d7d + 07e0037 commit 5f92f33

File tree

6 files changed

+149
-5
lines changed

6 files changed

+149
-5
lines changed
583 Bytes
Loading

src/components/Popup/Popup.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react";
2+
import Modal from "@material-ui/core/Modal";
3+
import Box from "@material-ui/core/Box";
4+
import IconButton from '@material-ui/core/IconButton';
5+
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
6+
import { withStyles } from "@material-ui/core/styles";
7+
import { popupStyles } from "./popup-styles.js";
8+
9+
const Popup = ({ classes, isOpen, onClose, children }) => {
10+
return (
11+
<Modal
12+
open={isOpen}
13+
onClose={onClose}
14+
>
15+
<Box className={classes.popupContent}>
16+
<IconButton
17+
onClick={onClose}
18+
className={classes.button}
19+
>
20+
<CloseRoundedIcon
21+
className={classes.iconButton}
22+
/>
23+
</IconButton>
24+
{children}
25+
</Box>
26+
</Modal>
27+
);
28+
};
29+
30+
export default withStyles(popupStyles)(Popup);

src/components/Popup/popup-styles.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export const popupStyles = {
2+
popupContent: {
3+
background: '#FFF',
4+
padding: '10px 20px 20px 20px',
5+
borderRadius: '8px',
6+
position: 'absolute',
7+
top: '50%',
8+
left: '50%',
9+
transform: 'translate(-50%, -50%)',
10+
width: '53%',
11+
height: '77%',
12+
fontSize: '9.5px',
13+
overflowY: 'scroll',
14+
scrollbarWidth: 'none',
15+
'& ul': {
16+
paddingLeft: '15px',
17+
},
18+
'& h2, & h3': {
19+
marginBottom: '5px',
20+
},
21+
},
22+
button: {
23+
position: 'absolute',
24+
top: '5px',
25+
right: '5px',
26+
fontSize: '20px',
27+
background: 'none',
28+
border: 'none',
29+
cursor: 'pointer',
30+
},
31+
iconButton: {
32+
backgroundColor: '#E5E5E5',
33+
color: '#4F4F4F',
34+
borderRadius: '50%',
35+
padding: '0.5px',
36+
fontSize: 18
37+
}
38+
};

src/components/problem-layout/LessonSelection.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import HelpOutlineOutlinedIcon from "@material-ui/icons/HelpOutlineOutlined";
1313
import { Typography } from "@material-ui/core";
1414
import { IS_STAGING_OR_DEVELOPMENT } from "../../util/getBuildType";
1515
import BuildTimeIndicator from "@components/BuildTimeIndicator";
16-
import withTranslation from "../../util/withTranslation.js"
16+
import withTranslation from "../../util/withTranslation.js";
17+
import Popup from '../Popup/Popup.js';
18+
import About from '../../pages/Posts/About.js';
1719

1820
class LessonSelection extends React.Component {
1921
static contextType = ThemeContext;
@@ -35,12 +37,22 @@ class LessonSelection extends React.Component {
3537
this.isPrivileged = !!this.user.privileged
3638

3739
this.coursePlans = _coursePlansNoEditor;
40+
this.togglePopup = this.togglePopup.bind(this);
41+
3842
this.state = {
3943
preparedRemoveProgress: false,
40-
removedProgress: false
44+
removedProgress: false,
45+
showPopup: false
4146
}
4247
}
4348

49+
togglePopup = () => {
50+
console.log("Toggling popup visibility");
51+
this.setState((prevState) => ({
52+
showPopup: !prevState.showPopup,
53+
}));
54+
};
55+
4456
removeProgress = () => {
4557
this.setState({ removedProgress: true });
4658
this.props.removeProgress();
@@ -54,6 +66,7 @@ class LessonSelection extends React.Component {
5466
const { translate } = this.props;
5567
const { classes, courseNum } = this.props;
5668
const selectionMode = courseNum == null ? "course" : "lesson"
69+
const { showPopup } = this.state;
5770

5871
if (selectionMode === "lesson" && courseNum >= this.coursePlans.length) {
5972
return <Box width={'100%'} textAlign={'center'} pt={4} pb={4}>
@@ -169,14 +182,17 @@ class LessonSelection extends React.Component {
169182
{SHOW_COPYRIGHT && <>© {new Date().getFullYear()} {SITE_NAME}</>}
170183
</div>
171184
<div style={{ display: "flex", flexGrow: 1, marginRight: 20, justifyContent: "flex-end" }}>
172-
<IconButton aria-label="help" title={`How to use ${SITE_NAME}?`}
173-
href={`${window.location.origin}${window.location.pathname}#/posts/how-to-use`}>
185+
<IconButton aria-label="about" title={`About ${SITE_NAME}`}
186+
onClick={this.togglePopup}>
174187
<HelpOutlineOutlinedIcon htmlColor={"#000"} style={{
175188
fontSize: 36,
176189
margin: -2
177190
}}/>
178191
</IconButton>
179192
</div>
193+
<Popup isOpen={showPopup} onClose={this.togglePopup}>
194+
<About />
195+
</Popup>
180196
</div>
181197
</footer>
182198
</>

src/components/problem-layout/ProblemCard.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@
3636
}
3737

3838
.image {
39-
z-index: 2;
39+
z-index: 0;
4040
}

src/pages/Posts/About.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from "react";
2+
import Spacer from "@components/Spacer";
3+
import { useStyles } from "./Posts";
4+
import { HELP_DOCUMENT, SITE_NAME } from "../../config/config";
5+
6+
const VPAT_LINK = `${process.env.PUBLIC_URL}/static/documents/OATutor_Sec508_WCAG.pdf`
7+
8+
const About = () => {
9+
const classes = useStyles()
10+
11+
return <>
12+
<h2>
13+
About {SITE_NAME}
14+
</h2>
15+
Open Adaptive Tutor ({SITE_NAME}) is an open-source adaptive tutoring system based on Intelligent Tutoring System (ITS) Principles.
16+
<h3>Question Input Types & Shortcuts</h3>
17+
18+
To learn more about how to fill in and submit {SITE_NAME} assignments,<span> </span>
19+
<a href={HELP_DOCUMENT} target={"_blank"} rel={"noreferrer"}>visit our help document</a>.
20+
21+
<h3>Contributors</h3>
22+
23+
OATutor was created and developed by a dedicated team from the Computational Approaches to Human Learning (CAHL) Research Lab at the UC Berkeley School of Education.
24+
25+
<h3>Learn more</h3>
26+
<ul>
27+
<li>Visit <a href="https:/cahlr.github.io/OATWeb/" target={"_blank"} rel={"noreferrer"}>https:/cahlr.github.io/OATWeb/</a> to explore more about OATutor, our mission, and how it can benefit you.</li>
28+
<li>Read our <a href="https://dl.acm.org/doi/10.1145/3544548.3581574" target={"_blank"} rel={"noreferrer"}>research paper</a> to learn more about the scientific foundation and methodology behind OATutor.</li>
29+
</ul>
30+
31+
<h3>Accessibility Standards</h3>
32+
33+
<p>
34+
{SITE_NAME} strives to ensure an easy and accessible experience for all users, regardless of disabilities.
35+
The site, {SITE_NAME}, is built with the most up-to-date HTML5 and CSS3 standards; all whilst complying with
36+
W3C's Web Accessibility Guidelines (WCAG) and Section 508 guidelines.
37+
</p>
38+
39+
<p className={classes["pt-2"]}>
40+
The Voluntary Product Accessibility Template, or VPAT, is a tool that administrators and decision-makers can
41+
use to evaluate {SITE_NAME}{SITE_NAME.match(/s$/i) ? "'" : "'s"} conformance with the accessibility
42+
standards under Section 508 of the Rehabilitation Act.
43+
</p>
44+
45+
<p className={classes["pt-2"]}>
46+
You may read our most recent publication of our Voluntary Product Accessibility Template at this
47+
url:<span> </span>
48+
<a href={VPAT_LINK} target={"_blank"} rel={"noreferrer"}>{VPAT_LINK.match(/\/[^/]*$/)[0].substr(1)}</a>
49+
</p>
50+
51+
<Spacer height={24 * 1}/>
52+
53+
<sub>
54+
<p>OATutor code is licensed under a MIT Open Source License, with its adaptive learning content made available under a CC BY 4.0 license.</p>
55+
<p>© 2024, CAHL Research Lab, UC Berkley School of Education.</p>
56+
</sub>
57+
</>
58+
}
59+
60+
export default About

0 commit comments

Comments
 (0)