Skip to content

Commit 8d9a01d

Browse files
committed
Improve C4E dashboard schedule tab empty states
Updates the C4E dashboard schedule tab to use the homeroom tab empty state when a user has no enrollments at all, and updates the text associated with the C4E planner preview to make it work for admins as well as teachers. fixes LS-2220 flag = none Test plan: - You may need to enable the "canvas for elementary" setting on your root account to allow the C4E dashboard to show up for users with no enrollments prior to testing this. - On the C4E dashboard schedule tab, expect: * As a non-admin with no enrollments, an empty state with the "You don't have any active courses yet message." * As an admin with no enrollments, the "You don't have any active courses yet" empty state * As a student with enrollments, the weekly planner * As a teacher or admin with enrollments, the "Schedule Preview" empty state with some mock planner items Change-Id: I77f1afead44d86f25526959e2b3748ab7d6b6bbd Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265888 Tested-by: Service Cloud Jenkins <[email protected]> Reviewed-by: Jackson Howe <[email protected]> QA-Review: Jackson Howe <[email protected]> Product-Review: Peyton Craighill <[email protected]>
1 parent 195e16a commit 8d9a01d

File tree

16 files changed

+406
-79
lines changed

16 files changed

+406
-79
lines changed

packages/canvas-planner/src/components/PlannerItem/__tests__/__snapshots__/PlannerItem.spec.js.snap

Lines changed: 266 additions & 38 deletions
Large diffs are not rendered by default.

packages/canvas-planner/src/components/PlannerItem/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ export class PlannerItem extends Component {
560560
>
561561
<Checkbox
562562
ref={this.registerFocusElementRef}
563-
aria-label={checkboxLabel}
563+
label={<ScreenReaderContent>{checkboxLabel}</ScreenReaderContent>}
564564
checked={this.props.toggleAPIPending ? !this.state.completed : this.state.completed}
565565
onChange={this.props.toggleCompletion}
566566
disabled={this.props.toggleAPIPending}

packages/canvas-planner/src/components/TeacherPreview/index.js renamed to packages/canvas-planner/src/components/PlannerPreview/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const ITEMS = [
106106
}
107107
]
108108

109-
export default function TeacherPreview({timeZone}) {
109+
export default function PlannerPreview({timeZone}) {
110110
return (
111111
<View as="section">
112112
<View as="section" margin="x-large large">
@@ -116,11 +116,11 @@ export default function TeacherPreview({timeZone}) {
116116
</View>
117117
<Text letterSpacing="expanded">
118118
<Heading as="h2" level="h3" margin="small">
119-
{formatMessage('Teacher Schedule Preview')}
119+
{formatMessage('Schedule Preview')}
120120
</Heading>
121121
</Text>
122122
<Text>
123-
{formatMessage('Below is an example of how your students will see their schedule')}
123+
{formatMessage('Below is an example of how students will see their schedule')}
124124
</Text>
125125
</Flex>
126126
</View>
@@ -137,6 +137,6 @@ export default function TeacherPreview({timeZone}) {
137137
)
138138
}
139139

140-
TeacherPreview.propTypes = {
140+
PlannerPreview.propTypes = {
141141
timeZone: string.isRequired
142142
}
File renamed without changes.

packages/canvas-planner/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {initializeDateTimeFormatters} from './utilities/dateUtils'
4040
import {DynamicUiManager, DynamicUiProvider, specialFallbackFocusId} from './dynamic-ui'
4141
import responsiviser from './components/responsiviser'
4242

43-
const TeacherPreview = React.lazy(() => import('./components/TeacherPreview'))
43+
const PlannerPreview = React.lazy(() => import('./components/PlannerPreview'))
4444
const ToDoSidebar = React.lazy(() => import('./components/ToDoSidebar'))
4545
const PlannerApp = React.lazy(() => import('./components/PlannerApp'))
4646
const PlannerHeader = React.lazy(() => import('./components/PlannerHeader'))
@@ -52,10 +52,10 @@ export {loadThisWeekItems, startLoadingAllOpportunities, toggleMissingItems}
5252

5353
export {responsiviser}
5454

55-
export function createTeacherPreview(timeZone) {
55+
export function createPlannerPreview(timeZone) {
5656
return (
5757
<Suspense fallback={loading()}>
58-
<TeacherPreview timeZone={timeZone} />
58+
<PlannerPreview timeZone={timeZone} />
5959
</Suspense>
6060
)
6161
}

spec/selenium/dashboard/elementary/k5_dashboard_admin_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@
110110
end
111111

112112
context 'admin schedule' do
113-
it 'shows a sample preview for admin (teacher) view of the schedule tab' do
113+
it 'shows an empty state for the admin (teacher) view of the course schedule tab with no enrollments' do
114114
get "/#schedule"
115115

116-
expect(teacher_preview).to be_displayed
116+
expect(empty_dashboard).to be_displayed
117117
end
118118

119119
it 'shows a sample preview for admin (teacher) view of the course schedule tab' do

spec/selenium/dashboard/pages/k5_dashboard_page.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ def week_date_selector
145145
end
146146

147147
def teacher_preview_selector
148-
"h2:contains('Teacher Schedule Preview')"
148+
"h2:contains('Schedule Preview')"
149+
end
150+
151+
def empty_dashboard_selector
152+
"[data-testid = 'empty-dash-panda']:visible"
149153
end
150154

151155
def previous_week_button_selector
@@ -522,6 +526,10 @@ def teacher_preview
522526
fj(teacher_preview_selector)
523527
end
524528

529+
def empty_dashboard
530+
fj(empty_dashboard_selector)
531+
end
532+
525533
def beginning_of_week_date
526534
date_block = ff(week_date_selector)
527535
date_block[0].text == 'Today' ? date_block[1].text : date_block[0].text

spec/selenium/dashboard/pages/student_planner_page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def list_view_planner_item(text)
220220
end
221221

222222
def planner_item_status_checkbox(object_type, object_name)
223-
fj("input[aria-label='#{object_type} #{object_name} is not marked as done.'] + label")
223+
fj("input + label:contains('#{object_type} #{object_name} is not marked as done.')")
224224
end
225225

226226
def course_page_recent_activity

spec/selenium/dashboard/planner/student_planner_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
go_to_list_view
193193
mark_peer_review_as_complete(@course.name)
194194

195-
expect(peer_review_item(@course.name)).to contain_css("[aria-label='Peer Review #{@assignment.name} is marked as done.']")
195+
expect(peer_review_item(@course.name)).to contain_jqcss("label:contains('Peer Review #{@assignment.name} is marked as done.')")
196196
end
197197
end
198198

ui/features/k5_course/react/K5Course.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ import {connect, Provider} from 'react-redux'
2121
import I18n from 'i18n!k5_course'
2222
import PropTypes from 'prop-types'
2323

24-
import {
25-
createTeacherPreview,
26-
startLoadingAllOpportunities,
27-
store
28-
} from '@instructure/canvas-planner'
24+
import {startLoadingAllOpportunities, store} from '@instructure/canvas-planner'
2925
import {
3026
IconBankLine,
3127
IconCalendarMonthLine,
@@ -304,8 +300,13 @@ export function K5Course({
304300
/>
305301
)}
306302
{currentTab === TAB_IDS.HOME && <OverviewPage content={courseOverview} />}
307-
{plannerInitialized && <SchedulePage visible={currentTab === TAB_IDS.SCHEDULE} />}
308-
{!plannerEnabled && currentTab === TAB_IDS.SCHEDULE && createTeacherPreview(timeZone)}
303+
<SchedulePage
304+
plannerEnabled={plannerEnabled}
305+
plannerInitialized={plannerInitialized}
306+
timeZone={timeZone}
307+
userHasEnrollments
308+
visible={currentTab === TAB_IDS.SCHEDULE}
309+
/>
309310
{currentTab === TAB_IDS.GRADES && (
310311
<GradesPage
311312
courseId={id}

0 commit comments

Comments
 (0)