Skip to content

Commit 74cc915

Browse files
author
Madelyn Kasula
authored
Merge pull request code-dot-org#26940 from code-dot-org/styling-fixes
New teacher dashboard styling fixes
2 parents 5193674 + 4bb7302 commit 74cc915

File tree

13 files changed

+100
-44
lines changed

13 files changed

+100
-44
lines changed

apps/src/sites/studio/pages/teacher_dashboard/show.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@ $(document).ready(function () {
7373
<Router basename={baseUrl}>
7474
<Route
7575
path="/"
76-
component={props => <TeacherDashboard {...props} studioUrlPrefix={scriptData.studioUrlPrefix} pegasusUrlPrefix={scriptData.pegasusUrlPrefix}/>}
76+
component={props =>
77+
<TeacherDashboard
78+
{...props}
79+
studioUrlPrefix={scriptData.studioUrlPrefix}
80+
pegasusUrlPrefix={scriptData.pegasusUrlPrefix}
81+
sectionName={section.name}
82+
/>
83+
}
7784
/>
7885
</Router>
7986
</Provider>,

apps/src/templates/NavigationBarLink.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class NavigationBarLink extends React.Component {
3131

3232
return (
3333
<NavLink
34-
to={`/${url}`}
34+
to={url}
3535
style={styles.link}
3636
activeStyle={styles.activeLink}
3737
>

apps/src/templates/SmallChevronLink.jsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import PropTypes from 'prop-types';
2-
import React, { Component } from 'react';
2+
import React, {Component} from 'react';
33
import FontAwesome from './FontAwesome';
44
import color from "../util/color";
5+
import {makeEnum} from '@cdo/apps/utils';
56

67
const styles = {
78
link: {
@@ -32,28 +33,43 @@ const styles = {
3233
},
3334
};
3435

36+
const ChevronSide = makeEnum('left', 'right');
37+
3538
export default class SmallChevronLink extends Component {
3639
static propTypes = {
3740
linkText: PropTypes.string.isRequired,
3841
link: PropTypes.string.isRequired,
3942
isRtl: PropTypes.bool.isRequired,
43+
chevronSide: PropTypes.oneOf(Object.values(ChevronSide)),
4044
};
4145

42-
render() {
43-
const { link, linkText, isRtl }= this.props;
44-
46+
renderChevron = () => {
47+
const {isRtl} = this.props;
4548
const icon = isRtl ? "chevron-left" : "chevron-right";
4649

50+
return (
51+
<FontAwesome
52+
icon={icon}
53+
style={isRtl ? styles.chevronRtl : styles.chevron}
54+
/>
55+
);
56+
};
57+
58+
render() {
59+
const {link, linkText, chevronSide} = this.props;
60+
4761
return (
4862
<div style={styles.linkBox}>
4963
<a href={link} style={styles.link}>
64+
{chevronSide === ChevronSide.left &&
65+
this.renderChevron()
66+
}
5067
<h3 style={styles.link}>
5168
{linkText}
5269
</h3>
53-
<FontAwesome
54-
icon={icon}
55-
style={isRtl? styles.chevronRtl : styles.chevron}
56-
/>
70+
{(!chevronSide || chevronSide === ChevronSide.right) &&
71+
this.renderChevron()
72+
}
5773
</a>
5874
</div>
5975
);

apps/src/templates/manageStudents/ManageStudentsAgeCell.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class ManageStudentAgeCell extends Component {
3535
}
3636
{this.props.isEditing &&
3737
<select
38+
style={{width: 50}}
3839
name="age"
3940
value={editedValue}
4041
onChange={this.onChangeAge}

apps/src/templates/manageStudents/ManageStudentsTable.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const styles = {
4949
buttonWithMargin: {
5050
marginRight: 5
5151
},
52+
verticalAlign: {
53+
display: 'flex',
54+
alignItems: 'center',
55+
},
5256
};
5357

5458
const LOGIN_TYPES_WITH_PASSWORD_COLUMN = [
@@ -276,7 +280,7 @@ class ManageStudentsTable extends Component {
276280
/>
277281
}
278282
{numberOfEditingRows <= 1 &&
279-
<span>
283+
<span style={styles.verticalAlign}>
280284
<div style={styles.headerName}>
281285
{i18n.actions()}
282286
</div>
@@ -294,7 +298,7 @@ class ManageStudentsTable extends Component {
294298

295299
projectSharingHeaderFormatter = () => {
296300
return (
297-
<span>
301+
<span style={styles.verticalAlign}>
298302
<div
299303
style={styles.headerName}
300304
data-for="explain-sharing"

apps/src/templates/projects/SectionProjectsList.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ const styles = {
99
float: 'right',
1010
},
1111
filterRow: {
12-
backgroundColor: 'transparent',
13-
padding: 10,
12+
paddingBottom: 10,
1413
},
1514
clearDiv: {
1615
clear: 'both'

apps/src/templates/sectionAssessments/SectionAssessments.jsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class SectionAssessments extends Component {
188188
</div>
189189
}
190190
{totalStudentSubmissions <= 0 &&
191-
<h3>{i18n.emptyAssessmentSubmissions()}</h3>
191+
<div>{i18n.emptyAssessmentSubmissions()}</div>
192192
}
193193
<SubmissionStatusAssessmentsContainer />
194194
{totalStudentSubmissions > 0 &&
@@ -224,8 +224,8 @@ class SectionAssessments extends Component {
224224
/>
225225
</div>
226226
}
227-
{totalStudentSubmissions <=0 &&
228-
<h3>{i18n.emptySurveyOverviewTable()}</h3>
227+
{totalStudentSubmissions <= 0 &&
228+
<div>{i18n.emptySurveyOverviewTable()}</div>
229229
}
230230
</div>
231231
}
@@ -245,11 +245,7 @@ class SectionAssessments extends Component {
245245
</div>
246246
}
247247
{(!isLoading && assessmentList.length === 0) &&
248-
<div style={styles.empty}>
249-
<h3>
250-
{i18n.noAssessments()}
251-
</h3>
252-
</div>
248+
<div style={styles.empty}>{i18n.noAssessments()}</div>
253249
}
254250
</div>
255251
);

apps/src/templates/teacherDashboard/SelectSectionDropdown.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const styles = {
88
container: {
99
display: 'flex',
1010
alignItems: 'center',
11-
justifyContent: 'flex-end',
12-
marginBottom: 10,
1311
},
1412
dropdown: {
1513
marginLeft: 10,

apps/src/templates/teacherDashboard/TeacherDashboard.jsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, {Component} from 'react';
22
import PropTypes from 'prop-types';
33
import {Route, Switch} from 'react-router-dom';
4-
import SelectSectionDropdown from './SelectSectionDropdown';
5-
import TeacherDashboardNavigation from './TeacherDashboardNavigation';
4+
import TeacherDashboardHeader from './TeacherDashboardHeader';
65
import StatsTableWithData from './StatsTableWithData';
76
import SectionProgress from '@cdo/apps/templates/sectionProgress/SectionProgress';
87
import ManageStudents from '@cdo/apps/templates/manageStudents/ManageStudents';
@@ -15,23 +14,22 @@ export default class TeacherDashboard extends Component {
1514
static propTypes = {
1615
studioUrlPrefix: PropTypes.string.isRequired,
1716
pegasusUrlPrefix: PropTypes.string.isRequired,
17+
sectionName: PropTypes.string.isRequired,
1818

1919
// Provided by React router in parent.
2020
location: PropTypes.object.isRequired,
2121
};
2222

2323
render() {
24-
const {location, studioUrlPrefix, pegasusUrlPrefix} = this.props;
24+
const {location, studioUrlPrefix, pegasusUrlPrefix, sectionName} = this.props;
25+
2526
// Include header components unless we are on the /print_login_cards page.
2627
const includeHeader = location.pathname !== "/print_login_cards";
2728

2829
return (
2930
<div>
3031
{includeHeader &&
31-
<div>
32-
<SelectSectionDropdown/>
33-
<TeacherDashboardNavigation/>
34-
</div>
32+
<TeacherDashboardHeader sectionName={sectionName}/>
3533
}
3634
<Switch>
3735
<Route
@@ -62,8 +60,8 @@ export default class TeacherDashboard extends Component {
6260
path="/print_login_cards"
6361
component={props => <PrintLoginCards studioUrlPrefix={studioUrlPrefix} pegasusUrlPrefix={pegasusUrlPrefix}/>}
6462
/>
65-
{/* Render <SectionProgress/> by default */}
66-
<Route component={props => <SectionProgress/>} />
63+
{/* Render <ManageStudents/> by default */}
64+
<Route component={props => <ManageStudents studioUrlPrefix={studioUrlPrefix}/>} />
6765
</Switch>
6866
</div>
6967
);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import i18n from '@cdo/locale';
4+
import SmallChevronLink from '../SmallChevronLink';
5+
import SelectSectionDropdown from './SelectSectionDropdown';
6+
import TeacherDashboardNavigation from './TeacherDashboardNavigation';
7+
8+
const styles = {
9+
headerContainer: {
10+
display: 'flex',
11+
justifyContent: 'space-between',
12+
},
13+
};
14+
15+
export default class TeacherDashboardHeader extends React.Component {
16+
static propTypes = {
17+
sectionName: PropTypes.string.isRequired,
18+
};
19+
20+
render() {
21+
return (
22+
<div>
23+
<SmallChevronLink
24+
link="/home#classroom-sections"
25+
linkText={i18n.viewAllSections()}
26+
isRtl={true}
27+
chevronSide="left"
28+
/>
29+
<div style={styles.headerContainer}>
30+
<h1>{this.props.sectionName}</h1>
31+
<SelectSectionDropdown/>
32+
</div>
33+
<TeacherDashboardNavigation/>
34+
</div>
35+
);
36+
}
37+
}

apps/src/templates/teacherDashboard/TeacherDashboardNavigation.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ import i18n from "@cdo/locale";
55
const teacherDashboardLinks = [
66
{
77
label: i18n.teacherTabManageStudents(),
8-
url: "manage_students"
8+
url: "/manage_students"
99
},
1010
{
1111
label: i18n.teacherTabProjects(),
12-
url: "projects"
12+
url: "/projects"
1313
},
1414
{
1515
label: i18n.teacherTabStats(),
16-
url: "stats"
16+
url: "/stats"
1717
},
1818
{
1919
label: i18n.teacherTabStatsTextResponses(),
20-
url: "text_responses"
20+
url: "/text_responses"
2121
},
2222
{
2323
label: i18n.teacherTabProgress(),
24-
url: "progress"
24+
url: "/progress"
2525
},
2626
{
2727
label: i18n.teacherTabAssessments(),
28-
url: "assessments"
28+
url: "/assessments"
2929
},
3030
];
3131

dashboard/test/ui/features/teacher_dashboard.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Feature: Using the teacher dashboard
3535
# Assessments and surveys tab
3636
When I click selector "#learn-tabs a:contains('Assessments/Surveys')" once I see it
3737
And I wait until element "#uitest-course-dropdown" is visible
38-
And I wait until element "h3:contains(no submissions for this assessment)" is visible
39-
And I wait until element "h3:contains(this survey is anonymous)" is not visible
38+
And I wait until element "div:contains(no submissions for this assessment)" is visible
39+
And I wait until element "div:contains(this survey is anonymous)" is not visible
4040
And I select the "Lesson 30: Anonymous student survey" option in dropdown "assessment-selector"
41-
And I wait until element "h3:contains(this survey is anonymous)" is visible
42-
And I wait until element "h3:contains(no submissions for this assessment)" is not visible
41+
And I wait until element "div:contains(this survey is anonymous)" is visible
42+
And I wait until element "div:contains(no submissions for this assessment)" is not visible
4343

4444
Scenario: Loading section projects
4545
Given I create a teacher-associated student named "Sally"

dashboard/test/ui/features/teacher_dashboard_assessments1.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ Feature: Using the assessments tab in the teacher dashboard
2929
# Assessments tab
3030
When I click selector "#learn-tabs a:contains('Assessments/Surveys')" once I see it
3131
And I wait until element "#uitest-course-dropdown" is visible
32-
Then I wait until element "h3:contains(this survey is anonymous)" is visible
32+
Then I wait until element "div:contains(this survey is anonymous)" is visible

0 commit comments

Comments
 (0)