-
Notifications
You must be signed in to change notification settings - Fork 482
/
TeacherHomepage.jsx
99 lines (92 loc) · 2.9 KB
/
TeacherHomepage.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import React, {PropTypes, Component} from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import HeaderBanner from '../HeaderBanner';
import Notification from '../Notification';
import RecentCourses from './RecentCourses';
import TeacherSections from './TeacherSections';
import StudentSections from './StudentSections';
import TeacherResources from './TeacherResources';
import ProjectWidgetWithData from '@cdo/apps/templates/projects/ProjectWidgetWithData';
import shapes from './shapes';
import ProtectedStatefulDiv from '../ProtectedStatefulDiv';
import i18n from "@cdo/locale";
const styles = {
clear: {
clear: 'both',
height: 30
}
};
export default class TeacherHomepage extends Component {
static propTypes = {
joinedSections: shapes.sections,
courses: shapes.courses,
topCourse: shapes.topCourse,
announcements: PropTypes.array.isRequired,
isRtl: PropTypes.bool.isRequired,
queryStringOpen: PropTypes.string,
canViewAdvancedTools: PropTypes.bool,
isEnglish: PropTypes.bool.isRequired
};
componentDidMount() {
// The component used here is implemented in legacy HAML/CSS rather than React.
$('#terms_reminder').appendTo(ReactDOM.findDOMNode(this.refs.termsReminder)).show();
$('#flashes').appendTo(ReactDOM.findDOMNode(this.refs.flashes)).show();
}
render() {
const { courses, topCourse, announcements, isRtl, queryStringOpen, joinedSections } = this.props;
const { canViewAdvancedTools } = this.props;
return (
<div>
<HeaderBanner
headingText={i18n.homepageHeading()}
short={true}
/>
<ProtectedStatefulDiv
ref="flashes"
/>
<ProtectedStatefulDiv
ref="termsReminder"
/>
{announcements.length > 0 && (
<div>
<Notification
type={announcements[0].type || "bullhorn"}
notice={announcements[0].heading}
details={announcements[0].description}
dismissible={false}
buttonText={announcements[0].buttonText}
buttonLink={announcements[0].link}
newWindow={true}
analyticId={announcements[0].id}
/>
<div style={styles.clear}/>
</div>
)}
<TeacherSections
isRtl={isRtl}
queryStringOpen={queryStringOpen}
/>
<RecentCourses
courses={courses}
topCourse={topCourse}
showAllCoursesLink={true}
isTeacher={true}
isRtl={isRtl}
/>
<TeacherResources isRtl={isRtl}/>
<ProjectWidgetWithData
isRtl={isRtl}
canViewFullList={true}
canViewAdvancedTools={canViewAdvancedTools}
/>
<StudentSections
initialSections={joinedSections}
canLeave={true}
isRtl={isRtl}
isTeacher={true}
/>
</div>
);
}
}