From 4d3b68d28743f4530c56608b36ea5d25a122eca4 Mon Sep 17 00:00:00 2001
From: Chris Deery <3932645+cdeery@users.noreply.github.com>
Date: Tue, 21 Sep 2021 15:02:26 -0400
Subject: [PATCH] feat: [AA-906] implemented review feedback
---
.../data/__snapshots__/redux.test.js.snap | 2 +-
src/course-home/outline-tab/OutlineTab.jsx | 33 ++++------
src/course-home/outline-tab/messages.js | 34 ++++++-----
.../outline-tab/widgets/FlagButton.jsx | 12 ++--
...meCard.jsx => StartOrResumeCourseCard.jsx} | 6 +-
.../widgets/WeeklyLearningGoal.jsx | 60 ++++++++++---------
6 files changed, 75 insertions(+), 72 deletions(-)
rename src/course-home/outline-tab/widgets/{StartResumeCard.jsx => StartOrResumeCourseCard.jsx} (90%)
diff --git a/src/course-home/data/__snapshots__/redux.test.js.snap b/src/course-home/data/__snapshots__/redux.test.js.snap
index adfd7389..1be1b0eb 100644
--- a/src/course-home/data/__snapshots__/redux.test.js.snap
+++ b/src/course-home/data/__snapshots__/redux.test.js.snap
@@ -434,7 +434,7 @@ Object {
"courseGoals": Object {
"daysPerWeek": null,
"goalOptions": Array [],
- "numberOfDaysGoalsEnabled": false,
+ "weeklyLearningGoalEnabled": false,
"selectedGoal": null,
"subscribedToReminders": null,
},
diff --git a/src/course-home/outline-tab/OutlineTab.jsx b/src/course-home/outline-tab/OutlineTab.jsx
index 5a845028..d3b1cb45 100644
--- a/src/course-home/outline-tab/OutlineTab.jsx
+++ b/src/course-home/outline-tab/OutlineTab.jsx
@@ -10,7 +10,7 @@ import { AlertList } from '../../generic/user-messages';
import CourseDates from './widgets/CourseDates';
import CourseGoalCard from './widgets/CourseGoalCard';
import CourseHandouts from './widgets/CourseHandouts';
-import StartResumeCard from './widgets/StartResumeCard';
+import StartOrResumeCourseCard from './widgets/StartOrResumeCourseCard';
import CourseTools from './widgets/CourseTools';
import { fetchOutlineTab } from '../data';
import genericMessages from '../../generic/messages';
@@ -56,7 +56,7 @@ function OutlineTab({ intl }) {
courseGoals: {
goalOptions,
selectedGoal,
- numberOfDaysGoalsEnabled,
+ weeklyLearningGoalEnabled,
} = {},
datesBannerInfo,
datesWidget: {
@@ -71,7 +71,7 @@ function OutlineTab({ intl }) {
verifiedMode,
} = useModel('outline', courseId);
- const [courseGoalToDisplay, setCourseGoalToDisplay] = useState(selectedGoal);
+ const [deprecatedCourseGoalToDisplay, setDeprecatedCourseGoalToDisplay] = useState(selectedGoal);
const [goalToastHeader, setGoalToastHeader] = useState('');
const [expandAll, setExpandAll] = useState(false);
@@ -135,13 +135,6 @@ function OutlineTab({ intl }) {
- {resumeCourseUrl && !numberOfDaysGoalsEnabled && (
-
-
-
- )}
{/** [MM-P2P] Experiment (className for optimizely trigger) */}
@@ -175,17 +168,17 @@ function OutlineTab({ intl }) {
>
)}
- {!courseGoalToDisplay && goalOptions && goalOptions.length > 0 && (
+ {!deprecatedCourseGoalToDisplay && goalOptions && goalOptions.length > 0 && (
{ setCourseGoalToDisplay(newGoal); }}
+ setGoalToDisplay={(newGoal) => { setDeprecatedCourseGoalToDisplay(newGoal); }}
setGoalToastHeader={(newHeader) => { setGoalToastHeader(newHeader); }}
/>
)}
- {resumeCourseUrl && numberOfDaysGoalsEnabled && (
-
- {courseGoalToDisplay && goalOptions && goalOptions.length > 0 && (
+ {deprecatedCourseGoalToDisplay && goalOptions && goalOptions.length > 0 && (
{ setCourseGoalToDisplay(newGoal); }}
+ selectedGoal={deprecatedCourseGoalToDisplay}
+ setGoalToDisplay={(newGoal) => { setDeprecatedCourseGoalToDisplay(newGoal); }}
setGoalToastHeader={(newHeader) => { setGoalToastHeader(newHeader); }}
/>
)}
- {numberOfDaysGoalsEnabled && (
+ {weeklyLearningGoalEnabled && (
)}
diff --git a/src/course-home/outline-tab/messages.js b/src/course-home/outline-tab/messages.js
index da013da9..57deea15 100644
--- a/src/course-home/outline-tab/messages.js
+++ b/src/course-home/outline-tab/messages.js
@@ -73,6 +73,7 @@ const messages = defineMessages({
resumeBlurb: {
id: 'learning.outline.resumeBlurb',
defaultMessage: 'Pick up where you left off',
+ description: 'Text describing to the learner that they can return to the last section they visited within the course.',
},
resume: {
id: 'learning.outline.resume',
@@ -88,7 +89,7 @@ const messages = defineMessages({
},
setWeeklyGoalDetail: {
id: 'learning.outline.setWeeklyGoalDetail',
- defaultMessage: 'Setting a goal motivates you to finish the course. You can always change it later',
+ defaultMessage: 'Setting a goal motivates you to finish the course. You can always change it later.',
},
start: {
id: 'learning.outline.start',
@@ -128,28 +129,33 @@ const messages = defineMessages({
defaultMessage: 'Welcome to',
description: 'This precedes the title of the course',
},
- goalButtonTitleCasual: {
- id: 'learning.outline.goalButtonTitleCasual',
+ setLearningGoalButtonScreenReaderText: {
+ id: 'learning.outline.goalButton.casual.title',
+ defaultMessage: 'Set a learning goal style.',
+ description: 'screen reader text informing learner they can select an intensity of learning goal',
+ },
+ casualGoalButtonTitle: {
+ id: 'learning.outline.goalButton.screenReader.text',
defaultMessage: 'Casual',
},
- goalButtonTextCasual: {
- id: 'learning.outline.goalButtonTextCasual',
+ casualGoalButtonText: {
+ id: 'learning.outline.goalButton.casual.text',
defaultMessage: '1 day a week',
},
- goalButtonTitleRegular: {
- id: 'learning.outline.goalButtonTitleRegular',
+ regularGoalButtonTitle: {
+ id: 'learning.outline.goalButton.regular.title',
defaultMessage: 'Regular',
},
- goalButtonTextRegular: {
- id: 'learning.outline.goalButtonTextRegular',
+ regularGoalButtonText: {
+ id: 'learning.outline.goalButton.regular.text',
defaultMessage: '3 days a week',
},
- goalButtonTitleIntense: {
- id: 'learning.outline.goalButtonTitleIntense',
+ intenseGoalButtonTitle: {
+ id: 'learning.outline.goalButton.intense.title',
defaultMessage: 'Intense',
},
- goalButtonTextIntense: {
- id: 'learning.outline.goalButtonTextIntense',
+ intenseGoalButtonText: {
+ id: 'learning.outline.goalButton.intense.text',
defaultMessage: '5 days a week',
},
setGoalReminder: {
@@ -158,7 +164,7 @@ const messages = defineMessages({
},
goalReminderDetail: {
id: 'learning.outline.goalReminderDetail',
- defaultMessage: 'If we notice you\'re not quite at your goal, we\'ll send you an email reminder.',
+ defaultMessage: 'If we notice you’re not quite at your goal, we’ll send you an email reminder.',
},
proctoringInfoPanel: {
id: 'learning.proctoringPanel.header',
diff --git a/src/course-home/outline-tab/widgets/FlagButton.jsx b/src/course-home/outline-tab/widgets/FlagButton.jsx
index 3eafb820..7db7a321 100644
--- a/src/course-home/outline-tab/widgets/FlagButton.jsx
+++ b/src/course-home/outline-tab/widgets/FlagButton.jsx
@@ -1,26 +1,22 @@
import React, { useState } from 'react';
+import classNames from 'classnames';
import PropTypes from 'prop-types';
function FlagButton({
icon,
+ srText,
title,
text,
isEnabled,
handleSelect,
}) {
- const baseOutlineStyle = 'col flex-grow-1 p-3 border border-light rounded bg-white';
- const selectedOutlineStyle = 'col flex-grow-1 p-3 border border-dark rounded bg-white';
const [isHighlight, setHighlight] = useState(false);
- function getOutlineStyle() {
- return isEnabled || isHighlight ? selectedOutlineStyle : baseOutlineStyle;
- }
-
return (