student-review-screen 0.0.24 → 0.0.27
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.
|
@@ -28,6 +28,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const react_2 = require("@chakra-ui/react");
|
|
30
30
|
const common_utils_1 = require("../../../utils/common-utils");
|
|
31
|
+
const crypto_1 = require("../../../utils/crypto");
|
|
31
32
|
const LearningPathUtils_1 = require("../../../utils/LearningPathUtils");
|
|
32
33
|
const tutor_utils_1 = require("../../../utils/tutor-utils");
|
|
33
34
|
const TeacherEvaluation_styles_1 = require("./TeacherEvaluation.styles");
|
|
@@ -42,33 +43,45 @@ exports.SCQ_FAMILY = [
|
|
|
42
43
|
];
|
|
43
44
|
const isScqFamily = (questionType) => exports.SCQ_FAMILY.includes(String(questionType));
|
|
44
45
|
exports.isScqFamily = isScqFamily;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/* Figma 230:10799 puts a green tick on the correct option. Parked for now —
|
|
47
|
+
uncomment this and the block in the option row below to restore it. */
|
|
48
|
+
// const CheckTick = () => (
|
|
49
|
+
// <svg width="10" height="8" viewBox="0 0 10 8" fill="none" aria-hidden="true">
|
|
50
|
+
// <path
|
|
51
|
+
// d="M1 4.2 3.5 6.7 9 1.2"
|
|
52
|
+
// stroke="#ffffff"
|
|
53
|
+
// strokeWidth="1.6"
|
|
54
|
+
// strokeLinecap="round"
|
|
55
|
+
// strokeLinejoin="round"
|
|
56
|
+
// />
|
|
57
|
+
// </svg>
|
|
58
|
+
// );
|
|
52
59
|
const StudentOptionList = ({ question = {}, currentQuestion = {}, theme = TeacherEvaluation_styles_1.THEMES.LIGHT, }) => {
|
|
53
60
|
const styles = (0, react_1.useMemo)(() => (0, TeacherEvaluation_styles_1.getStyles)(theme), [theme]);
|
|
54
61
|
const options = currentQuestion?.options_layout || [];
|
|
55
62
|
const optionImages = currentQuestion?.option_image_details || [];
|
|
56
63
|
const correctAnswers = (0, react_1.useMemo)(() => currentQuestion?.answers_layout || [], [currentQuestion]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
const hashedKeys = currentQuestion?.answers_index_hashed_keys;
|
|
65
|
+
const isHashed = (0, common_utils_1.isNotEmptyOrNull)(hashedKeys);
|
|
66
|
+
const value = (0, react_1.useMemo)(() => (0, common_utils_1.isNotEmptyOrNull)(question?.userAnswer)
|
|
67
|
+
? (0, common_utils_1.handleRemoveExtraSpaceInBubbles)((0, common_utils_1.extractGivenAnswers)(question.userAnswer)?.[0])
|
|
68
|
+
: "", [question]);
|
|
60
69
|
if (!options.length)
|
|
61
70
|
return null;
|
|
62
71
|
return ((0, jsx_runtime_1.jsx)(react_2.Flex, { sx: styles.optionList, "data-testid": "student-option-list", children: options.map((option, index) => {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
const item = isHashed
|
|
73
|
+
? (0, crypto_1.answers_index_hashed_keys)(`${currentQuestion?.uuid}${common_utils_1.passphrase}${index}`)
|
|
74
|
+
: option;
|
|
75
|
+
const isCorrect = isHashed
|
|
76
|
+
? item === hashedKeys?.[0]
|
|
77
|
+
: item === correctAnswers?.[0];
|
|
78
|
+
const isWrongPick = !isCorrect && item === value;
|
|
66
79
|
const state = isCorrect
|
|
67
80
|
? styles.optionCorrect
|
|
68
81
|
: isWrongPick
|
|
69
82
|
? styles.optionWrong
|
|
70
83
|
: undefined;
|
|
71
|
-
return ((0, jsx_runtime_1.
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Flex, { sx: { ...styles.option, ...(state || {}) }, "data-testid": `student-option-${index}`, children: (0, jsx_runtime_1.jsxs)(react_2.Flex, { sx: styles.optionLeft, children: [(0, jsx_runtime_1.jsx)(react_2.Box, { sx: styles.optionBadge, "data-testid": `student-option-label-${index}`, children: (0, jsx_runtime_1.jsx)(react_2.Box, { as: "span", sx: styles.optionBadgeText, children: (0, common_utils_1.getCharacterFromNumber)(index) }) }), (0, jsx_runtime_1.jsxs)(react_2.Box, { sx: styles.optionText, "data-testid": `student-option-content-${index}`, children: [(0, tutor_utils_1.renderContent)(option), optionImages?.[index]?.url && ((0, jsx_runtime_1.jsx)(react_2.Box, { as: "img", sx: styles.optionImage, src: optionImages[index].url, alt: "" }))] })] }) }, index));
|
|
72
85
|
}) }));
|
|
73
86
|
};
|
|
74
87
|
exports.default = StudentOptionList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StudentOptionList.js","sourceRoot":"","sources":["../../../../src/components/Organisms/TeacherEvaluation/StudentOptionList.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,4CAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"StudentOptionList.js","sourceRoot":"","sources":["../../../../src/components/Organisms/TeacherEvaluation/StudentOptionList.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,4CAA6C;AAC7C,8DAMqC;AACrC,kDAAkE;AAClE,wEAAiE;AACjE,4DAA2D;AAC3D,yEAA+D;AAElD,QAAA,UAAU,GAAG;IACxB,iCAAa,CAAC,GAAG;IACjB,iCAAa,CAAC,KAAK;IACnB,iCAAa,CAAC,EAAE;IAChB,iCAAa,CAAC,gBAAgB;IAC9B,iCAAa,CAAC,OAAO;IACrB,iCAAa,CAAC,GAAG;IACjB,iCAAa,CAAC,EAAE;CACjB,CAAC;AAEK,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,EAAE,CAC1C,kBAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AAD/B,QAAA,WAAW,eACoB;AAE5C;yEACyE;AACzE,4BAA4B;AAC5B,kFAAkF;AAClF,YAAY;AACZ,iCAAiC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