@instructure/quiz-core 22.16.0 → 22.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/banks/components/BankEntry/presenter.js +1 -1
- package/es/banks/components/SharingModal/presenter.js +1 -1
- package/es/building/api/quizEntries.js +25 -5
- package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/es/common/actions/modal.js +2 -1
- package/es/common/components/ApiFeatureFlagInitializer/index.js +1 -1
- package/es/common/components/ConfirmationModal/index.js +1 -1
- package/es/common/components/ConfirmationModal/presenter.js +49 -169
- package/es/common/components/RceConfigProvider/presenter.js +1 -1
- package/es/common/components/SDKApp/index.js +38 -39
- package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/es/common/components/resources/item/ItemEdit/index.js +5 -3
- package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/es/common/components/resources/item/ItemShow/index.js +2 -1
- package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/es/common/components/shared/PaginatedCollection/presenter.js +1 -1
- package/es/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/es/common/components/shared/spinner/Spinner.js +15 -16
- package/es/common/middleware/appSyncMiddleware.js +19 -0
- package/es/common/records/Quiz.js +8 -1
- package/es/common/records/QuizEntry.js +8 -1
- package/es/common/records/SessionItem.js +2 -1
- package/es/common/records/SessionItemResult.js +24 -0
- package/es/common/util/interactionTypePropsHelper.js +4 -2
- package/es/common/util/isMissing.js +4 -0
- package/es/configureStore.js +3 -1
- package/es/index.js +6 -4
- package/es/moderating/components/resources/ModerateTable/presenter.js +15 -10
- package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/es/reduxStore.js +4 -0
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- package/es/taking/api/taking.js +45 -10
- package/lib/banks/components/BankEntry/presenter.js +1 -1
- package/lib/banks/components/SharingModal/presenter.js +1 -1
- package/lib/building/api/quizEntries.js +25 -5
- package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/lib/common/actions/modal.js +2 -1
- package/lib/common/components/ApiFeatureFlagInitializer/index.js +1 -1
- package/lib/common/components/ConfirmationModal/index.js +1 -1
- package/lib/common/components/ConfirmationModal/presenter.js +49 -169
- package/lib/common/components/RceConfigProvider/presenter.js +1 -1
- package/lib/common/components/SDKApp/index.js +38 -39
- package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
- package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/lib/common/components/resources/item/ItemShow/index.js +2 -1
- package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/lib/common/components/shared/PaginatedCollection/presenter.js +1 -1
- package/lib/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/lib/common/components/shared/spinner/Spinner.js +15 -16
- package/lib/common/middleware/appSyncMiddleware.js +19 -0
- package/lib/common/records/Quiz.js +8 -1
- package/lib/common/records/QuizEntry.js +8 -1
- package/lib/common/records/SessionItem.js +2 -1
- package/lib/common/records/SessionItemResult.js +24 -0
- package/lib/common/util/interactionTypePropsHelper.js +4 -2
- package/lib/common/util/isMissing.js +4 -0
- package/lib/configureStore.js +3 -1
- package/lib/index.js +6 -4
- package/lib/moderating/components/resources/ModerateTable/presenter.js +15 -10
- package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/lib/reduxStore.js +4 -0
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- package/lib/taking/api/taking.js +45 -10
- package/package.json +10 -10
- package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
3
|
+
import { Text } from '@instructure/ui-text';
|
|
4
|
+
import { View } from '@instructure/ui-view';
|
|
5
|
+
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
6
|
+
export function TotalPointsPossible(param) {
|
|
7
|
+
var sidebarOpen = param.sidebarOpen, totalPointsPossible = param.totalPointsPossible;
|
|
8
|
+
if (typeof totalPointsPossible !== 'number') {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
var pointsText = /*#__PURE__*/ React.createElement(Text, {
|
|
12
|
+
key: "pointsText",
|
|
13
|
+
size: "small",
|
|
14
|
+
weight: "bold"
|
|
15
|
+
}, t("{\n totalPointsPossible, plural,\n one {# pt}\n other {# pts}\n }", {
|
|
16
|
+
totalPointsPossible: totalPointsPossible
|
|
17
|
+
}));
|
|
18
|
+
var responsiveText = pointsText;
|
|
19
|
+
if (sidebarOpen) {
|
|
20
|
+
responsiveText = /*#__PURE__*/ React.createElement(Text, {
|
|
21
|
+
size: "small"
|
|
22
|
+
}, t.rich('Total question points = <points/>', {
|
|
23
|
+
points: function() {
|
|
24
|
+
return pointsText;
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
29
|
+
borderWidth: "0 0 small 0",
|
|
30
|
+
padding: "small x-small",
|
|
31
|
+
textAlign: sidebarOpen ? 'start' : 'center'
|
|
32
|
+
}, /*#__PURE__*/ React.createElement(AccessibleContent, {
|
|
33
|
+
alt: t('Total question points = {totalPointsPossible}', {
|
|
34
|
+
totalPointsPossible: totalPointsPossible
|
|
35
|
+
})
|
|
36
|
+
}, responsiveText));
|
|
37
|
+
}
|
|
@@ -99,18 +99,12 @@ function _is_native_reflect_construct() {
|
|
|
99
99
|
return !!result;
|
|
100
100
|
})();
|
|
101
101
|
}
|
|
102
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
103
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
104
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
105
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
106
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
107
|
-
}
|
|
108
102
|
import { Component } from 'react';
|
|
109
103
|
import PropTypes from 'prop-types';
|
|
110
104
|
import { List } from 'immutable';
|
|
111
105
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
112
106
|
import { IconMoveStartLine, IconMoveEndLine, IconPinSolid, IconQuizInstructionsLine, IconQuizTitleLine } from '@instructure/ui-icons';
|
|
113
|
-
import {
|
|
107
|
+
import { PresentationContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
114
108
|
import { IconButton } from '@instructure/ui-buttons';
|
|
115
109
|
import { Link } from '@instructure/ui-link';
|
|
116
110
|
import { Text } from '@instructure/ui-text';
|
|
@@ -124,15 +118,18 @@ import { onPhone } from '../../../../util/windowChecks';
|
|
|
124
118
|
import CustomPropTypes from '../../../../util/CustomPropTypes';
|
|
125
119
|
import noop from '../../../../util/noop';
|
|
126
120
|
import Pin from './Pin';
|
|
121
|
+
import { TotalPointsPossible } from './components/TotalPointsPossible';
|
|
122
|
+
import { connect } from '../../../../react-redux';
|
|
123
|
+
import { getActiveQuiz } from '../../../../../common/selectors/quizzes';
|
|
127
124
|
import generateStyle from './styles';
|
|
128
125
|
import generateComponentTheme from './theme';
|
|
129
|
-
|
|
126
|
+
var BaseSidebar = /*#__PURE__*/ function(Component) {
|
|
130
127
|
"use strict";
|
|
131
|
-
_inherits(
|
|
132
|
-
function
|
|
133
|
-
_class_call_check(this,
|
|
128
|
+
_inherits(BaseSidebar, Component);
|
|
129
|
+
function BaseSidebar() {
|
|
130
|
+
_class_call_check(this, BaseSidebar);
|
|
134
131
|
var _this;
|
|
135
|
-
_this = _call_super(this,
|
|
132
|
+
_this = _call_super(this, BaseSidebar, arguments), _define_property(_this, "scrollToTitle", function(e) {
|
|
136
133
|
e.preventDefault(); // prevent default link navigation
|
|
137
134
|
_this.props.scrollToItem(null)(TITLE_SCROLL_KEY);
|
|
138
135
|
}), _define_property(_this, "scrollToInfo", function(e) {
|
|
@@ -158,7 +155,7 @@ export var Sidebar = /*#__PURE__*/ function(Component) {
|
|
|
158
155
|
});
|
|
159
156
|
return _this;
|
|
160
157
|
}
|
|
161
|
-
_create_class(
|
|
158
|
+
_create_class(BaseSidebar, [
|
|
162
159
|
{
|
|
163
160
|
key: "componentDidMount",
|
|
164
161
|
value: function componentDidMount() {
|
|
@@ -317,41 +314,6 @@ export var Sidebar = /*#__PURE__*/ function(Component) {
|
|
|
317
314
|
})));
|
|
318
315
|
}
|
|
319
316
|
},
|
|
320
|
-
{
|
|
321
|
-
key: "renderTotalPointsPossible",
|
|
322
|
-
value: function renderTotalPointsPossible() {
|
|
323
|
-
var _this_props = this.props, sidebarOpen = _this_props.sidebarOpen, totalPointsPossible = _this_props.totalPointsPossible;
|
|
324
|
-
if (typeof totalPointsPossible !== 'number') {
|
|
325
|
-
return null;
|
|
326
|
-
}
|
|
327
|
-
var pointsText = /*#__PURE__*/ jsx(Text, {
|
|
328
|
-
key: "pointsText",
|
|
329
|
-
size: "small",
|
|
330
|
-
weight: "bold"
|
|
331
|
-
}, t("{\n totalPointsPossible, plural,\n one {# pt}\n other {# pts}\n }", {
|
|
332
|
-
totalPointsPossible: totalPointsPossible
|
|
333
|
-
}));
|
|
334
|
-
var responsiveText = pointsText;
|
|
335
|
-
if (sidebarOpen) {
|
|
336
|
-
responsiveText = /*#__PURE__*/ jsx(Text, {
|
|
337
|
-
size: "small"
|
|
338
|
-
}, t.rich('Total question points = <points/>', {
|
|
339
|
-
points: function() {
|
|
340
|
-
return pointsText;
|
|
341
|
-
}
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
return /*#__PURE__*/ jsx(View, {
|
|
345
|
-
borderWidth: "0 0 small 0",
|
|
346
|
-
padding: "small x-small",
|
|
347
|
-
textAlign: sidebarOpen ? 'start' : 'center'
|
|
348
|
-
}, /*#__PURE__*/ jsx(AccessibleContent, {
|
|
349
|
-
alt: t('Total question points = {totalPointsPossible}', {
|
|
350
|
-
totalPointsPossible: totalPointsPossible
|
|
351
|
-
})
|
|
352
|
-
}, responsiveText));
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
317
|
{
|
|
356
318
|
key: "renderPinned",
|
|
357
319
|
value: function renderPinned() {
|
|
@@ -390,6 +352,7 @@ export var Sidebar = /*#__PURE__*/ function(Component) {
|
|
|
390
352
|
{
|
|
391
353
|
key: "render",
|
|
392
354
|
value: function render() {
|
|
355
|
+
var _this_props = this.props, sidebarOpen = _this_props.sidebarOpen, totalPointsPossible = _this_props.totalPointsPossible, isSurvey = _this_props.isSurvey;
|
|
393
356
|
return /*#__PURE__*/ jsx(View, null, /*#__PURE__*/ jsx("div", {
|
|
394
357
|
css: this.props.styles.commonContainer,
|
|
395
358
|
id: "sidebar-wrapper",
|
|
@@ -410,17 +373,20 @@ export var Sidebar = /*#__PURE__*/ function(Component) {
|
|
|
410
373
|
onClick: noop,
|
|
411
374
|
id: SIDEBAR_NAV_ID,
|
|
412
375
|
"aria-label": t('Question Navigator')
|
|
413
|
-
}, this.renderSidebarHeader(),
|
|
376
|
+
}, this.renderSidebarHeader(), !isSurvey && /*#__PURE__*/ jsx(TotalPointsPossible, {
|
|
377
|
+
sidebarOpen: sidebarOpen,
|
|
378
|
+
totalPointsPossible: totalPointsPossible
|
|
379
|
+
}), this.renderPinned(), this.renderTitle(), this.renderInstructions(), this.renderResults(), /*#__PURE__*/ jsx("div", {
|
|
414
380
|
css: this.props.styles.sidebarContent
|
|
415
381
|
}, this.props.children)))));
|
|
416
382
|
}
|
|
417
383
|
}
|
|
418
384
|
]);
|
|
419
|
-
return
|
|
385
|
+
return BaseSidebar;
|
|
420
386
|
}(Component);
|
|
421
|
-
_define_property(
|
|
422
|
-
_define_property(
|
|
423
|
-
_define_property(
|
|
387
|
+
_define_property(BaseSidebar, "displayName", 'Sidebar');
|
|
388
|
+
_define_property(BaseSidebar, "componentId", "Quizzes".concat(BaseSidebar.displayName));
|
|
389
|
+
_define_property(BaseSidebar, "propTypes", {
|
|
424
390
|
children: PropTypes.oneOfType([
|
|
425
391
|
PropTypes.element,
|
|
426
392
|
PropTypes.arrayOf(PropTypes.element),
|
|
@@ -430,6 +396,7 @@ _define_property(Sidebar, "propTypes", {
|
|
|
430
396
|
taking: PropTypes.bool,
|
|
431
397
|
scrollToItem: CustomPropTypes.higherOrderFunction.isRequired,
|
|
432
398
|
sidebarOpen: PropTypes.bool.isRequired,
|
|
399
|
+
isSurvey: PropTypes.bool.isRequired,
|
|
433
400
|
pinnedItems: ImmutablePropTypes.listOf(PropTypes.shape({
|
|
434
401
|
sessionItemId: PropTypes.string.isRequired,
|
|
435
402
|
position: PropTypes.number.isRequired
|
|
@@ -443,7 +410,7 @@ _define_property(Sidebar, "propTypes", {
|
|
|
443
410
|
makeStyles: PropTypes.func,
|
|
444
411
|
styles: PropTypes.object
|
|
445
412
|
});
|
|
446
|
-
_define_property(
|
|
413
|
+
_define_property(BaseSidebar, "defaultProps", {
|
|
447
414
|
grading: false,
|
|
448
415
|
taking: false,
|
|
449
416
|
title: null,
|
|
@@ -452,7 +419,12 @@ _define_property(Sidebar, "defaultProps", {
|
|
|
452
419
|
totalPointsPossible: null,
|
|
453
420
|
shouldCloseOnBlur: onPhone()
|
|
454
421
|
});
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
422
|
+
export var UnconnectedSidebar = withStyleOverrides(generateStyle, generateComponentTheme)(BaseSidebar);
|
|
423
|
+
function mapStateToProps(state) {
|
|
424
|
+
var quiz = getActiveQuiz(state);
|
|
425
|
+
return {
|
|
426
|
+
isSurvey: quiz.isSurvey()
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
export var Sidebar = connect(mapStateToProps)(UnconnectedSidebar);
|
|
458
430
|
export default Sidebar;
|
|
@@ -4,14 +4,18 @@ import { fileUploading } from '../../../../selectors/calls';
|
|
|
4
4
|
import { connect } from '../../../../react-redux';
|
|
5
5
|
import { SidebarItem as SidebarItemPresenter } from './presenter';
|
|
6
6
|
import { scrollToItem as scrollToItemAction } from '../../../../actions/scrolling';
|
|
7
|
+
import { getActiveQuiz } from '../../../../../common/selectors/quizzes';
|
|
7
8
|
import t from '@instructure/quiz-i18n/format-message';
|
|
8
9
|
export var mapStateToProps = function(state, props) {
|
|
10
|
+
var quiz = getActiveQuiz(state);
|
|
9
11
|
var displayPosition = props.quizEntry ? props.quizEntry.positionToDisplay(props.position) : t('{position, number}', {
|
|
10
12
|
position: props.position
|
|
11
13
|
});
|
|
12
14
|
return {
|
|
13
15
|
displayPosition: displayPosition,
|
|
14
|
-
preventScrollToItem: fileUploading(state) && isOneQuestionAtATime(state)
|
|
16
|
+
preventScrollToItem: fileUploading(state) && isOneQuestionAtATime(state),
|
|
17
|
+
isSurvey: quiz.isSurvey(),
|
|
18
|
+
isRequired: props.quizEntry ? props.quizEntry.isRequired : false
|
|
15
19
|
};
|
|
16
20
|
};
|
|
17
21
|
export var mapDispatchToProps = function(dispatch, props) {
|
|
@@ -93,8 +93,10 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
93
93
|
import { Component } from 'react';
|
|
94
94
|
import PropTypes from 'prop-types';
|
|
95
95
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
96
|
+
import { View } from '@instructure/ui-view';
|
|
96
97
|
import { Link } from '@instructure/ui-link';
|
|
97
98
|
import { jsx } from '@instructure/emotion';
|
|
99
|
+
import { IconArrowNestLine } from '@instructure/ui-icons';
|
|
98
100
|
import PositionSummary from '../PositionSummary';
|
|
99
101
|
import t from '@instructure/quiz-i18n/format-message';
|
|
100
102
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
@@ -103,6 +105,20 @@ import generateComponentTheme from './theme';
|
|
|
103
105
|
import { Flex, END_EDITING_TRIGGER_CLASSNAME, withStyleOverrides } from '@instructure/quiz-common';
|
|
104
106
|
import { Tooltip } from '@instructure/ui-tooltip';
|
|
105
107
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
108
|
+
import { RequiredIndicator } from '../../../../../building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader';
|
|
109
|
+
function SideBarItemRightContent(param) {
|
|
110
|
+
var isSurvey = param.isSurvey, isRequired = param.isRequired, pointPossibleText = param.pointPossibleText;
|
|
111
|
+
if (!isSurvey) {
|
|
112
|
+
return /*#__PURE__*/ jsx(View, {
|
|
113
|
+
as: "div",
|
|
114
|
+
width: "40%"
|
|
115
|
+
}, pointPossibleText);
|
|
116
|
+
}
|
|
117
|
+
if (!isRequired) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
return /*#__PURE__*/ jsx(RequiredIndicator, null);
|
|
121
|
+
}
|
|
106
122
|
export var SidebarItem = /*#__PURE__*/ function(Component) {
|
|
107
123
|
"use strict";
|
|
108
124
|
_inherits(SidebarItem, Component);
|
|
@@ -169,25 +185,35 @@ export var SidebarItem = /*#__PURE__*/ function(Component) {
|
|
|
169
185
|
{
|
|
170
186
|
key: "renderButton",
|
|
171
187
|
value: function renderButton() {
|
|
172
|
-
var _this_props = this.props, displayPosition = _this_props.displayPosition, itemId = _this_props.itemId, isAnswered = _this_props.isAnswered;
|
|
173
|
-
var
|
|
188
|
+
var _this_props = this.props, displayPosition = _this_props.displayPosition, itemId = _this_props.itemId, isAnswered = _this_props.isAnswered, inStimulus = _this_props.inStimulus, sidebarOpen = _this_props.sidebarOpen;
|
|
189
|
+
var baseContent = !isAnswered && isAnswered !== null ? t('Navigate to question at position {displayPosition}, unanswered', {
|
|
174
190
|
displayPosition: displayPosition
|
|
175
191
|
}) : t('Navigate to question at position {displayPosition}', {
|
|
176
192
|
displayPosition: displayPosition
|
|
177
193
|
});
|
|
194
|
+
var stimulusContent = !isAnswered && isAnswered !== null ? t('Navigate to stimulus question at position {displayPosition}, unanswered', {
|
|
195
|
+
displayPosition: displayPosition
|
|
196
|
+
}) : t('Navigate to stimulus question at position {displayPosition}', {
|
|
197
|
+
displayPosition: displayPosition
|
|
198
|
+
});
|
|
199
|
+
var content = inStimulus ? stimulusContent : baseContent;
|
|
178
200
|
return /*#__PURE__*/ jsx(Tooltip, {
|
|
179
|
-
renderTip:
|
|
201
|
+
renderTip: sidebarOpen ? '' : /*#__PURE__*/ jsx("span", {
|
|
180
202
|
"aria-hidden": "true"
|
|
181
203
|
}, content),
|
|
182
204
|
placement: "start",
|
|
183
|
-
on:
|
|
205
|
+
on: sidebarOpen ? [] : [
|
|
184
206
|
'hover',
|
|
185
207
|
'focus'
|
|
186
208
|
]
|
|
187
|
-
}, /*#__PURE__*/ jsx(
|
|
209
|
+
}, inStimulus && !sidebarOpen ? /*#__PURE__*/ jsx(IconArrowNestLine, {
|
|
210
|
+
css: {
|
|
211
|
+
margin: '-10px 5px 0 -8px'
|
|
212
|
+
}
|
|
213
|
+
}) : null, /*#__PURE__*/ jsx(Link, {
|
|
188
214
|
href: "#",
|
|
189
215
|
size: "small",
|
|
190
|
-
margin:
|
|
216
|
+
margin: inStimulus && !sidebarOpen ? '0 0 0 -5px 0' : '0 small',
|
|
191
217
|
isWithinText: false,
|
|
192
218
|
forceButtonRole: false,
|
|
193
219
|
onClick: this.scrollToItem,
|
|
@@ -210,7 +236,7 @@ export var SidebarItem = /*#__PURE__*/ function(Component) {
|
|
|
210
236
|
{
|
|
211
237
|
key: "renderOpen",
|
|
212
238
|
value: function renderOpen() {
|
|
213
|
-
var _this_props = this.props, children = _this_props.children, itemName = _this_props.itemName, pointsPossible = _this_props.pointsPossible, styles = _this_props.styles;
|
|
239
|
+
var _this_props = this.props, children = _this_props.children, itemName = _this_props.itemName, pointsPossible = _this_props.pointsPossible, styles = _this_props.styles, isSurvey = _this_props.isSurvey, isRequired = _this_props.isRequired;
|
|
214
240
|
var parentDivClass = "sidebarIsOpen ".concat(END_EDITING_TRIGGER_CLASSNAME);
|
|
215
241
|
return /*#__PURE__*/ jsx("div", {
|
|
216
242
|
className: parentDivClass,
|
|
@@ -229,10 +255,11 @@ export var SidebarItem = /*#__PURE__*/ function(Component) {
|
|
|
229
255
|
}, /*#__PURE__*/ jsx("div", {
|
|
230
256
|
className: "interactionType",
|
|
231
257
|
css: this.props.styles.interactionType
|
|
232
|
-
}, itemName), /*#__PURE__*/ jsx(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
258
|
+
}, itemName), /*#__PURE__*/ jsx(SideBarItemRightContent, {
|
|
259
|
+
isSurvey: isSurvey,
|
|
260
|
+
isRequired: isRequired,
|
|
261
|
+
pointPossibleText: this.getPointsText(pointsPossible || 0)
|
|
262
|
+
})), /*#__PURE__*/ jsx("div", {
|
|
236
263
|
css: this.props.styles.itemBody
|
|
237
264
|
}, /*#__PURE__*/ jsx(RichContentRenderer, {
|
|
238
265
|
content: this.props.itemBody
|
|
@@ -266,6 +293,8 @@ _define_property(SidebarItem, "propTypes", {
|
|
|
266
293
|
preventScrollToItem: PropTypes.bool.isRequired,
|
|
267
294
|
quizEntry: ImmutablePropTypes.record,
|
|
268
295
|
sidebarOpen: PropTypes.bool.isRequired,
|
|
296
|
+
isSurvey: PropTypes.bool.isRequired,
|
|
297
|
+
isRequired: PropTypes.bool.isRequired,
|
|
269
298
|
// from connect
|
|
270
299
|
scrollToItem: PropTypes.func.isRequired,
|
|
271
300
|
styles: PropTypes.object,
|
|
@@ -58,7 +58,10 @@ var generateStyle = function(componentTheme, props) {
|
|
|
58
58
|
displayNumber: {
|
|
59
59
|
color: componentTheme.darkTextColor,
|
|
60
60
|
fontSize: componentTheme.numberFontSize,
|
|
61
|
-
fontWeight: componentTheme.numberFontWeight
|
|
61
|
+
fontWeight: componentTheme.numberFontWeight,
|
|
62
|
+
minWidth: '2ch',
|
|
63
|
+
display: 'inline-block',
|
|
64
|
+
textAlign: 'center'
|
|
62
65
|
},
|
|
63
66
|
itemBody: {
|
|
64
67
|
fontSize: componentTheme.itemBodyFontSize,
|
|
@@ -231,10 +231,28 @@ export var SidebarStimulus = /*#__PURE__*/ function(Component) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
},
|
|
234
|
+
{
|
|
235
|
+
key: "renderStimulusItems",
|
|
236
|
+
value: function renderStimulusItems() {
|
|
237
|
+
var _this_props = this.props, childEntries = _this_props.childEntries, displayPosition = _this_props.displayPosition, renderSidebarItem = _this_props.renderSidebarItem;
|
|
238
|
+
var nextDisplayPosition = displayPosition;
|
|
239
|
+
return childEntries.toArray().map(function(item, i) {
|
|
240
|
+
var itemDisplayPosition = nextDisplayPosition;
|
|
241
|
+
nextDisplayPosition += item.displayPositionSlots;
|
|
242
|
+
return /*#__PURE__*/ jsx(View, {
|
|
243
|
+
key: item.id,
|
|
244
|
+
padding: "0 0 0 small",
|
|
245
|
+
borderWidth: "0 0 small 0",
|
|
246
|
+
borderColor: "primary",
|
|
247
|
+
as: "div"
|
|
248
|
+
}, renderSidebarItem(item, itemDisplayPosition, false));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
},
|
|
234
252
|
{
|
|
235
253
|
key: "renderClosed",
|
|
236
254
|
value: function renderClosed() {
|
|
237
|
-
|
|
255
|
+
var stimulusContainer = /*#__PURE__*/ jsx(View, {
|
|
238
256
|
borderWidth: "0 0 small 0",
|
|
239
257
|
borderColor: "primary",
|
|
240
258
|
as: "div"
|
|
@@ -246,6 +264,13 @@ export var SidebarStimulus = /*#__PURE__*/ function(Component) {
|
|
|
246
264
|
css: this.stimulusHoverCss(),
|
|
247
265
|
as: "div"
|
|
248
266
|
}, this.renderButton()), this.renderCollection());
|
|
267
|
+
// For passages or when dragging, just return the stimulus container
|
|
268
|
+
if (this.stimulusIsPassage() || this.props.isDragging) {
|
|
269
|
+
return stimulusContainer;
|
|
270
|
+
}
|
|
271
|
+
// For non-passage stimuli in closed sidebar, return stimulus + child items separately
|
|
272
|
+
var childItems = this.renderStimulusItems();
|
|
273
|
+
return /*#__PURE__*/ jsx("div", null, stimulusContainer, childItems);
|
|
249
274
|
}
|
|
250
275
|
},
|
|
251
276
|
{
|
|
@@ -84,12 +84,6 @@ function _is_native_reflect_construct() {
|
|
|
84
84
|
return !!result;
|
|
85
85
|
})();
|
|
86
86
|
}
|
|
87
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
88
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
90
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
91
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
92
|
-
}
|
|
93
87
|
import { Component } from 'react';
|
|
94
88
|
import PropTypes from 'prop-types';
|
|
95
89
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
@@ -100,13 +94,13 @@ import t from '@instructure/quiz-i18n/format-message';
|
|
|
100
94
|
import generateStyle from './styles';
|
|
101
95
|
import generateComponentTheme from './theme';
|
|
102
96
|
import { withStyleOverrides } from '@instructure/quiz-common';
|
|
103
|
-
export var
|
|
97
|
+
export var BaseQuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
104
98
|
"use strict";
|
|
105
|
-
_inherits(
|
|
106
|
-
function
|
|
107
|
-
_class_call_check(this,
|
|
99
|
+
_inherits(BaseQuizSessionResultHeader, Component);
|
|
100
|
+
function BaseQuizSessionResultHeader() {
|
|
101
|
+
_class_call_check(this, BaseQuizSessionResultHeader);
|
|
108
102
|
var _this;
|
|
109
|
-
_this = _call_super(this,
|
|
103
|
+
_this = _call_super(this, BaseQuizSessionResultHeader, arguments), _define_property(_this, "renderRegradeAlert", function() {
|
|
110
104
|
if (_this.props.regradedSessionItemResults && _this.props.regradedSessionItemResults.size > 0) {
|
|
111
105
|
var questions = _this.props.regradedSessionItemResults.map(function(rsi) {
|
|
112
106
|
return rsi.position;
|
|
@@ -121,7 +115,7 @@ export var QuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
|
121
115
|
});
|
|
122
116
|
return _this;
|
|
123
117
|
}
|
|
124
|
-
_create_class(
|
|
118
|
+
_create_class(BaseQuizSessionResultHeader, [
|
|
125
119
|
{
|
|
126
120
|
key: "studentName",
|
|
127
121
|
value: function studentName() {
|
|
@@ -143,27 +137,25 @@ export var QuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
|
143
137
|
}, t('Results'))), /*#__PURE__*/ jsx("div", {
|
|
144
138
|
css: this.props.styles.resultListDescription,
|
|
145
139
|
className: "fs-mask"
|
|
146
|
-
}, this.props.studentDescription || this.studentName()))), /*#__PURE__*/ jsx("div", {
|
|
140
|
+
}, this.props.studentDescription || this.studentName()))), !this.props.isSurvey && /*#__PURE__*/ jsx("div", {
|
|
147
141
|
css: this.props.styles.regradeAlert
|
|
148
142
|
}, this.renderRegradeAlert()));
|
|
149
143
|
}
|
|
150
144
|
}
|
|
151
145
|
]);
|
|
152
|
-
return
|
|
146
|
+
return BaseQuizSessionResultHeader;
|
|
153
147
|
}(Component);
|
|
154
|
-
_define_property(
|
|
155
|
-
_define_property(
|
|
156
|
-
_define_property(
|
|
148
|
+
_define_property(BaseQuizSessionResultHeader, "displayName", 'QuizSessionResultHeader');
|
|
149
|
+
_define_property(BaseQuizSessionResultHeader, "componentId", "Quizzes".concat(BaseQuizSessionResultHeader.displayName));
|
|
150
|
+
_define_property(BaseQuizSessionResultHeader, "propTypes", {
|
|
157
151
|
quizSession: ImmutablePropTypes.record.isRequired,
|
|
158
152
|
regradedSessionItemResults: ImmutablePropTypes.list,
|
|
159
153
|
studentDescription: PropTypes.node,
|
|
160
|
-
styles: PropTypes.object
|
|
154
|
+
styles: PropTypes.object,
|
|
155
|
+
isSurvey: PropTypes.bool.isRequired
|
|
161
156
|
});
|
|
162
|
-
_define_property(
|
|
157
|
+
_define_property(BaseQuizSessionResultHeader, "defaultProps", {
|
|
163
158
|
regradedSessionItemResults: null,
|
|
164
159
|
studentDescription: null
|
|
165
160
|
});
|
|
166
|
-
QuizSessionResultHeader =
|
|
167
|
-
withStyleOverrides(generateStyle, generateComponentTheme)
|
|
168
|
-
], QuizSessionResultHeader);
|
|
169
|
-
export default QuizSessionResultHeader;
|
|
161
|
+
export var QuizSessionResultHeader = withStyleOverrides(generateStyle, generateComponentTheme)(BaseQuizSessionResultHeader);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
4
|
+
import { View } from '@instructure/ui-view';
|
|
5
|
+
import { Text } from '@instructure/ui-text';
|
|
6
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
7
|
+
import { scoreToLetterGrade } from '@instructure/grading-utils';
|
|
8
|
+
export var LetterGrade = function(param) {
|
|
9
|
+
var percentage = param.percentage, gradingScheme = param.gradingScheme;
|
|
10
|
+
var letterGrade = scoreToLetterGrade(percentage * 100, gradingScheme);
|
|
11
|
+
var gradeText = t('Grade for this attempt');
|
|
12
|
+
var alt = t('Grade for this attempt: { grade }', {
|
|
13
|
+
grade: letterGrade
|
|
14
|
+
});
|
|
15
|
+
return /*#__PURE__*/ React.createElement(AccessibleContent, {
|
|
16
|
+
alt: alt
|
|
17
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
18
|
+
as: "div"
|
|
19
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
20
|
+
size: "xx-large",
|
|
21
|
+
weight: "bold",
|
|
22
|
+
color: "primary"
|
|
23
|
+
}, letterGrade)), /*#__PURE__*/ React.createElement(Text, {
|
|
24
|
+
color: "secondary"
|
|
25
|
+
}, gradeText));
|
|
26
|
+
};
|
|
27
|
+
LetterGrade.propTypes = {
|
|
28
|
+
percentage: PropTypes.oneOfType([
|
|
29
|
+
PropTypes.number,
|
|
30
|
+
PropTypes.string
|
|
31
|
+
]),
|
|
32
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
name: PropTypes.string,
|
|
34
|
+
value: PropTypes.number
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
4
|
+
import { Text } from '@instructure/ui-text';
|
|
5
|
+
import { Flex } from '@instructure/quiz-common';
|
|
6
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
7
|
+
import { isMissing } from '../../../../../../util/isMissing';
|
|
8
|
+
var mainPointsText = function(points, pointsPossible) {
|
|
9
|
+
if (isMissing(points) && isMissing(pointsPossible)) {
|
|
10
|
+
return '--';
|
|
11
|
+
}
|
|
12
|
+
var valueToUse = !isMissing(points) ? points : pointsPossible;
|
|
13
|
+
return t.number(valueToUse);
|
|
14
|
+
};
|
|
15
|
+
var subPointsText = function(points, pointsPossible) {
|
|
16
|
+
if (!isMissing(points) && !isMissing(pointsPossible)) {
|
|
17
|
+
return t("Out of {\n points, plural,\n one {# point}\n other {# points}\n }", {
|
|
18
|
+
points: pointsPossible
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!isMissing(points)) {
|
|
22
|
+
return t("Earned {points, plural,\n one {point}\n other {points}\n }", {
|
|
23
|
+
points: points
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// We use "Points Possible" when only points is present or when nothing is present
|
|
27
|
+
return t("{points, plural,\n one {Point}\n other {Points}\n } possible", {
|
|
28
|
+
points: pointsPossible
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var pointsText = function(points, pointsPossible) {
|
|
32
|
+
if (!isMissing(points) && !isMissing(pointsPossible)) {
|
|
33
|
+
return t("{points, number} out of {\n total, plural,\n one {# point}\n other {# points}\n }", {
|
|
34
|
+
points: points,
|
|
35
|
+
total: pointsPossible
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!isMissing(points)) {
|
|
39
|
+
return t("Earned {points, plural,\n one {# point}\n other {# points}\n }", {
|
|
40
|
+
points: points
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// We use "Points Possible" when only points is present or when nothing is present
|
|
44
|
+
if (!isMissing(pointsPossible)) {
|
|
45
|
+
return t("{points, plural,\n one {# point}\n other {# points}\n } possible", {
|
|
46
|
+
points: pointsPossible
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return t('Unknown Score');
|
|
50
|
+
};
|
|
51
|
+
export var PointsDisplay = function(param) {
|
|
52
|
+
var points = param.points, pointsPossible = param.pointsPossible;
|
|
53
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
54
|
+
margin: "small",
|
|
55
|
+
padding: "0 0 0 small"
|
|
56
|
+
}, /*#__PURE__*/ React.createElement(AccessibleContent, {
|
|
57
|
+
alt: pointsText(points, pointsPossible)
|
|
58
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
59
|
+
as: "div",
|
|
60
|
+
color: "primary",
|
|
61
|
+
size: "xx-large",
|
|
62
|
+
weight: "bold"
|
|
63
|
+
}, mainPointsText(points, pointsPossible)), /*#__PURE__*/ React.createElement(Text, {
|
|
64
|
+
color: "secondary"
|
|
65
|
+
}, subPointsText(points, pointsPossible))));
|
|
66
|
+
};
|
|
67
|
+
PointsDisplay.propTypes = {
|
|
68
|
+
points: PropTypes.string,
|
|
69
|
+
pointsPossible: PropTypes.string
|
|
70
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Text } from '@instructure/ui-text';
|
|
4
|
+
import { Flex } from '@instructure/quiz-common';
|
|
5
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
6
|
+
import { ProgressCircle } from '@instructure/ui-progress';
|
|
7
|
+
import { formatPercentMax2FractionDigits } from '@instructure/quiz-i18n';
|
|
8
|
+
import { isMissing, UNKNOWN_PERCENTAGE_VALUE } from '../../../../../../util/isMissing';
|
|
9
|
+
var progressTextFormatter = function(param) {
|
|
10
|
+
var valueNow = param.valueNow;
|
|
11
|
+
var percentageUnknown = valueNow === UNKNOWN_PERCENTAGE_VALUE;
|
|
12
|
+
return percentageUnknown ? t('Unknown Score') : t('Your score was {percentage}.', {
|
|
13
|
+
percentage: formatPercentMax2FractionDigits(valueNow)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var progressDisplayFormatter = function(param) {
|
|
17
|
+
var valueNow = param.valueNow;
|
|
18
|
+
var valueToShow = valueNow === UNKNOWN_PERCENTAGE_VALUE ? t({
|
|
19
|
+
id: 'progress_display',
|
|
20
|
+
default: '?',
|
|
21
|
+
description: 'placeholder for an unknown percentage value'
|
|
22
|
+
}) : formatPercentMax2FractionDigits(valueNow);
|
|
23
|
+
return /*#__PURE__*/ React.createElement(Text, {
|
|
24
|
+
size: "large",
|
|
25
|
+
weight: "bold",
|
|
26
|
+
"data-automation": "sdk-quiz-score-percentage"
|
|
27
|
+
}, valueToShow);
|
|
28
|
+
};
|
|
29
|
+
export var Progress = function(param) {
|
|
30
|
+
var percentage = param.percentage, points = param.points, pointsPossible = param.pointsPossible;
|
|
31
|
+
if (isMissing(points) || isMissing(pointsPossible)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
height: "150px",
|
|
37
|
+
width: "150px",
|
|
38
|
+
margin: "small",
|
|
39
|
+
"data-automation": "sdk-info-score"
|
|
40
|
+
}, /*#__PURE__*/ React.createElement(ProgressCircle, {
|
|
41
|
+
shouldAnimateOnMount: true,
|
|
42
|
+
size: "large",
|
|
43
|
+
screenReaderLabel: t('Your Score'),
|
|
44
|
+
formatScreenReaderValue: progressTextFormatter,
|
|
45
|
+
renderValue: progressDisplayFormatter,
|
|
46
|
+
valueNow: percentage,
|
|
47
|
+
valueMax: 1
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
Progress.propTypes = {
|
|
51
|
+
percentage: PropTypes.oneOfType([
|
|
52
|
+
PropTypes.number,
|
|
53
|
+
PropTypes.string
|
|
54
|
+
]),
|
|
55
|
+
points: PropTypes.string,
|
|
56
|
+
pointsPossible: PropTypes.string
|
|
57
|
+
};
|