@edx/frontend-app-subscription-learner-dashboard 1.27.1 → 1.27.2
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.
|
@@ -5,21 +5,17 @@ import { ActionRow, Row, Col, Badge } from '@openedx/paragon';
|
|
|
5
5
|
import { useIntl } from '@openedx/frontend-base';
|
|
6
6
|
import { useCourseData, useEntitlementInfo } from '../../../../hooks';
|
|
7
7
|
import CourseCardActionSlot from '../../../../slots/CourseCardActionSlot';
|
|
8
|
-
import SelectSessionButton from './SelectSessionButton';
|
|
9
8
|
import BeginCourseButton from './BeginCourseButton';
|
|
10
9
|
import ResumeButton from './ResumeButton';
|
|
11
|
-
import ViewCourseButton from './ViewCourseButton';
|
|
12
10
|
import messages from './messages';
|
|
13
11
|
export const CourseCardActions = ({ cardId, verifiedCourse, isHistoryTab }) => {
|
|
14
12
|
var _a, _b;
|
|
15
13
|
const cardData = useCourseData(cardId);
|
|
16
14
|
const { formatMessage } = useIntl();
|
|
17
15
|
const hasStarted = ((_a = cardData === null || cardData === void 0 ? void 0 : cardData.enrollment) === null || _a === void 0 ? void 0 : _a.hasStarted) || false;
|
|
18
|
-
const { isEntitlement
|
|
16
|
+
const { isEntitlement } = useEntitlementInfo(cardData);
|
|
19
17
|
const isArchived = ((_b = cardData === null || cardData === void 0 ? void 0 : cardData.courseRun) === null || _b === void 0 ? void 0 : _b.isArchived) || false;
|
|
20
|
-
return (_jsxs(Row, { className: "align-items-center mt-3", children: [_jsx(Col, { xs: 12, sm: 6, className: "mb-2 mb-lg-0", children: verifiedCourse && !isHistoryTab ? (_jsx(Badge, { variant: "success", className: "px-3 py-2", children: formatMessage(messages.subsVerifiedCourseText) })) : (!isHistoryTab && (_jsx("span", { className: "small text-info", children: formatMessage(messages.subsIncludedCourseText) }))) }), _jsx(Col, { xs: 12, className: "d-flex justify-content-end", sm: 6, children: !isHistoryTab && (_jsxs(ActionRow, { "data-testid": "CourseCardActions", children: [_jsx(CourseCardActionSlot, { cardId: cardId }), isEntitlement && (
|
|
21
|
-
? _jsx(ViewCourseButton, { cardId: cardId })
|
|
22
|
-
: _jsx(SelectSessionButton, { cardId: cardId })), (isArchived && !isEntitlement) && (_jsx(ViewCourseButton, { cardId: cardId })), !(isArchived || isEntitlement) && (hasStarted
|
|
18
|
+
return (_jsxs(Row, { className: "align-items-center mt-3", children: [_jsx(Col, { xs: 12, sm: 6, className: "mb-2 mb-lg-0", children: verifiedCourse && !isHistoryTab ? (_jsx(Badge, { variant: "success", className: "px-3 py-2", children: formatMessage(messages.subsVerifiedCourseText) })) : (!isHistoryTab && (_jsx("span", { className: "small text-info", children: formatMessage(messages.subsIncludedCourseText) }))) }), _jsx(Col, { xs: 12, className: "d-flex justify-content-end", sm: 6, children: !isHistoryTab && (_jsxs(ActionRow, { "data-testid": "CourseCardActions", children: [_jsx(CourseCardActionSlot, { cardId: cardId }), !(isArchived || isEntitlement) && (hasStarted
|
|
23
19
|
? _jsx(ResumeButton, { cardId: cardId })
|
|
24
20
|
: _jsx(BeginCourseButton, { cardId: cardId }))] })) })] }));
|
|
25
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/CourseCard/components/CourseCardActions/index.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAG,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/CourseCard/components/CourseCardActions/index.jsx"],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Aa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,GAC3C,CACX,CAAC,CAAC,CAAC,CACA,CAAC,YAAY,IAAI,CACf,eAAM,SAAS,EAAC,iBAAiB,YAC5B,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,GAC5C,CACR,CACJ,GACC,EAEN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,4BAA4B,EAAC,EAAE,EAAE,CAAC,YACxD,CAAC,YAAY,IAAI,CACd,MAAC,SAAS,mBAAa,mBAAmB,aACxC,KAAC,oBAAoB,IAAC,MAAM,EAAE,MAAM,GAAI,EAWvC,CAAC,CAAC,UAAU,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU;4BAC5C,CAAC,CAAC,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI;4BAClC,CAAC,CAAC,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,GAAI,CACxC,IACS,CACb,GACG,IACJ,CAEP,CAAC;AACJ,CAAC,CAAC;AACF,iBAAiB,CAAC,SAAS,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,YAAY,EAAE,SAAS,CAAC,IAAI;CAC7B,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { ActionRow, Row, Col, Badge } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { useCourseData, useEntitlementInfo } from '@src/hooks';\n\nimport CourseCardActionSlot from '@src/slots/CourseCardActionSlot';\nimport BeginCourseButton from './BeginCourseButton';\nimport ResumeButton from './ResumeButton';\nimport messages from './messages';\n\nexport const CourseCardActions = ({ cardId, verifiedCourse, isHistoryTab }) => {\n const cardData = useCourseData(cardId);\n const { formatMessage } = useIntl();\n const hasStarted = cardData?.enrollment?.hasStarted || false;\n const { isEntitlement } = useEntitlementInfo(cardData);\n const isArchived = cardData?.courseRun?.isArchived || false;\n\n return (\n <Row className=\"align-items-center mt-3\">\n <Col xs={12} sm={6} className=\"mb-2 mb-lg-0\">\n {/* TODO [TEMP]: Showing 2 types of badges for now. After backend connection, can anticipate 3rd type of badge as well\n Reason: Development before backend connection\n Action: Revisit after backend connection and finalize badge types and conditions for each type\n */}\n {verifiedCourse && !isHistoryTab ? (\n <Badge variant=\"success\" className=\"px-3 py-2\">\n {formatMessage(messages.subsVerifiedCourseText)}\n </Badge>\n ) : (\n !isHistoryTab && (\n <span className=\"small text-info\">\n {formatMessage(messages.subsIncludedCourseText)}\n </span>\n )\n )}\n </Col>\n\n <Col xs={12} className=\"d-flex justify-content-end\" sm={6}>\n {!isHistoryTab && (\n <ActionRow data-testid=\"CourseCardActions\">\n <CourseCardActionSlot cardId={cardId} />\n {/* Currently, only the Begin and Resume actions are supported as per the Figma design.\n Keep the following actions commented out for now; they can be enabled in the future\n if the corresponding functionality is required. */}\n {/* {isEntitlement && (isFulfilled\n ? <ViewCourseButton cardId={cardId} />\n : <SelectSessionButton cardId={cardId} />\n )}\n {(isArchived && !isEntitlement) && (\n <ViewCourseButton cardId={cardId} />\n )} */}\n {!(isArchived || isEntitlement) && (hasStarted\n ? <ResumeButton cardId={cardId} />\n : <BeginCourseButton cardId={cardId} />\n )}\n </ActionRow>\n )}\n </Col>\n </Row>\n \n );\n};\nCourseCardActions.propTypes = {\n cardId: PropTypes.string.isRequired,\n verifiedCourse: PropTypes.bool,\n isHistoryTab: PropTypes.bool,\n};\n\nexport default CourseCardActions;\n"]}
|