@coorpacademy/components 11.10.0 → 11.10.2-alpha.6
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/atom/provider/web-context.d.ts +2 -2
- package/es/atom/provider/web-context.d.ts.map +1 -1
- package/es/atom/provider/web-context.js +1 -4
- package/es/atom/provider/web-context.js.map +1 -1
- package/es/atom/review-header-step-item/index.d.ts.map +1 -1
- package/es/atom/review-header-step-item/index.js +8 -3
- package/es/atom/review-header-step-item/index.js.map +1 -1
- package/es/molecule/answer/index.d.ts +3 -0
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +9 -3
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/answer/style.css +6 -5
- package/es/molecule/questions/qcm-drag/index.d.ts.map +1 -1
- package/es/molecule/questions/qcm-drag/index.js +13 -7
- package/es/molecule/questions/qcm-drag/index.js.map +1 -1
- package/es/molecule/questions/qcm-drag/style.css +3 -0
- package/es/molecule/questions/qcm-graphic/index.d.ts.map +1 -1
- package/es/molecule/questions/qcm-graphic/index.js +12 -5
- package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/style.css +3 -0
- package/es/molecule/questions/types.d.ts +25 -0
- package/es/molecule/questions/types.d.ts.map +1 -1
- package/es/molecule/questions/types.js.map +1 -1
- package/es/molecule/video-player-mobile/index.native.d.ts +8 -0
- package/es/molecule/video-player-mobile/index.native.d.ts.map +1 -0
- package/es/molecule/video-player-mobile/index.native.js +45 -0
- package/es/molecule/video-player-mobile/index.native.js.map +1 -0
- package/es/organism/review-header/index.d.ts +23 -0
- package/es/organism/review-header/index.d.ts.map +1 -1
- package/es/organism/review-header/index.js +4 -0
- package/es/organism/review-header/index.js.map +1 -1
- package/es/organism/review-slide/index.native.d.ts.map +1 -1
- package/es/organism/review-slide/index.native.js +48 -2
- package/es/organism/review-slide/index.native.js.map +1 -1
- package/es/template/activity/engine-stars.d.ts +1 -0
- package/es/template/activity/engine-stars.js +2 -1
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/activity/index.d.ts +1 -0
- package/es/template/activity/index.js +2 -1
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/stars-summary.d.ts +1 -0
- package/es/template/activity/stars-summary.js +2 -1
- package/es/template/activity/stars-summary.js.map +1 -1
- package/es/util/render-with-context.d.ts.map +1 -1
- package/es/util/render-with-context.js +13 -6
- package/es/util/render-with-context.js.map +1 -1
- package/lib/atom/provider/web-context.d.ts +2 -2
- package/lib/atom/provider/web-context.d.ts.map +1 -1
- package/lib/atom/provider/web-context.js +1 -5
- package/lib/atom/provider/web-context.js.map +1 -1
- package/lib/atom/review-header-step-item/index.d.ts.map +1 -1
- package/lib/atom/review-header-step-item/index.js +12 -3
- package/lib/atom/review-header-step-item/index.js.map +1 -1
- package/lib/molecule/answer/index.d.ts +3 -0
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +9 -3
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/answer/style.css +6 -5
- package/lib/molecule/questions/qcm-drag/index.d.ts.map +1 -1
- package/lib/molecule/questions/qcm-drag/index.js +13 -7
- package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
- package/lib/molecule/questions/qcm-drag/style.css +3 -0
- package/lib/molecule/questions/qcm-graphic/index.d.ts.map +1 -1
- package/lib/molecule/questions/qcm-graphic/index.js +12 -5
- package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/style.css +3 -0
- package/lib/molecule/questions/types.d.ts +25 -0
- package/lib/molecule/questions/types.d.ts.map +1 -1
- package/lib/molecule/questions/types.js.map +1 -1
- package/lib/molecule/video-player-mobile/index.native.d.ts +8 -0
- package/lib/molecule/video-player-mobile/index.native.d.ts.map +1 -0
- package/lib/molecule/video-player-mobile/index.native.js +56 -0
- package/lib/molecule/video-player-mobile/index.native.js.map +1 -0
- package/lib/organism/review-header/index.d.ts +23 -0
- package/lib/organism/review-header/index.d.ts.map +1 -1
- package/lib/organism/review-header/index.js +5 -0
- package/lib/organism/review-header/index.js.map +1 -1
- package/lib/organism/review-slide/index.native.d.ts.map +1 -1
- package/lib/organism/review-slide/index.native.js +49 -1
- package/lib/organism/review-slide/index.native.js.map +1 -1
- package/lib/template/activity/engine-stars.d.ts +1 -0
- package/lib/template/activity/engine-stars.js +2 -1
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/activity/index.d.ts +1 -0
- package/lib/template/activity/index.js +2 -1
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/stars-summary.d.ts +1 -0
- package/lib/template/activity/stars-summary.js +2 -1
- package/lib/template/activity/stars-summary.js.map +1 -1
- package/lib/util/render-with-context.d.ts.map +1 -1
- package/lib/util/render-with-context.js +18 -6
- package/lib/util/render-with-context.js.map +1 -1
- package/locales/tr/global.json +1 -0
- package/locales/uk/global.json +1 -0
- package/locales/vi/global.json +1 -0
- package/package.json +3 -2
- package/locales/.mtslconfig.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","correctionPopinWrapper","position","bottom","width","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","type","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","justifyContent","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","alignItems","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {\n Animated,\n Easing,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAGA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBC,KAAK,E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Ae,KAAK,EAAE,CAACE,UAAU,CAACd,KAAZ,EAAmBtC,aAAnB;EAAtB,gBACE,6BAAC,QAAD;IACE,cAAc,EAAEsD,kBADlB;IAEE,YAAY,EAAEpC,YAFhB;IAGE,QAAQ,EAAEW,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,6BAAC,eAAD;IACE,QAAQ,EAAEqB,cAAc,CAACM,QAD3B;IAEE,WAAW,EAAEN,cAAc,CAAC3D,KAF9B;IAGE,OAAO,EAAEgE,mBAHX;IAIE,MAAM,EAAG,yBAAwBjF,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDeyE,K"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","TYPE_VIDEO","TYPE_IMAGE","uri","url","split","TYPE_AUDIO","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n marginTop: 20,\n width: '100%',\n minHeight: 150,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media}: {media: Media}) => {\n switch (media.type) {\n case TYPE_VIDEO:\n return <Video media={media} />;\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={styles.image} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return <Text>{`media type ${media.type} is not handled`}</Text>;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n {answerUI.media ? (\n <View style={styles.mediaContainer}>\n <MediaView media={answerUI.media} />\n </View>\n ) : null}\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AAEA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CADQ;IAEdC,UAAU,EAAE,QAFE;IAGdC,cAAc,EAAE,QAHF;IAIdC,SAAS,EAAE,EAJG;IAKdC,KAAK,EAAE,MALO;IAMdC,SAAS,EAAE,GANG;IAOdC,YAAY,EAAE,EAPA;IAQdC,QAAQ,EAAE;EARI,CADe;EAW/BC,KAAK,EAAE;IACLR,IAAI,EAAE,CADD;IAELI,KAAK,EAAE;EAFF,CAXwB;EAe/BK,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBP,KAAK,EAAE;EAHe;AAfO,CAAlB,CAAf;;AAsBA,MAAMQ,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAA6B;EAC7C,QAAQA,KAAK,CAACC,IAAd;IACE,KAAKC,qBAAL;MACE,oBAAO,6BAAC,eAAD;QAAO,KAAK,EAAEF;MAAd,EAAP;;IACF,KAAKG,qBAAL;MAAiB;QACf,MAAMC,GAAG,GAAI,WAAUJ,KAAK,CAACK,GAAN,EAAWC,KAAX,CAAiB,IAAjB,EAAuB,CAAvB,CAA0B,EAAjD;QACA,oBAAO,6BAAC,kBAAD;U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AAGhB,gBAAgB,CAACC,GAAD,EAAM7E,KAAN,CAAnC;EAEA,MAAM;IACJ6F,OADI;IAEJC,kBAFI;IAGJlC,YAHI;IAIJW,QAJI;IAKJnD,mBALI;IAMJC;EANI,IAOF2D,KAPJ;;EASA,IAAIa,OAAJ,EAAa;IACX,oBAAO,6BAAC,iBAAD;MAAM,KAAK,EAAED,UAAU,CAACZ;IAAxB,EAAP;EACD;;EAED,MAAM;IAACxC,OAAO,EAAEuD;EAAV,IAAiCL,cAAvC;EAEA,oBACE,6BAAC,qBAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACE,UAAU,CAACZ,KAAZ,EAAmBpC,aAAnB;EAAtB,gBACE,6BAAC,QAAD;IACE,cAAc,EAAEkD,kBADlB;IAEE,YAAY,EAAElC,YAFhB;IAGE,QAAQ,EAAEW,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,6BAAC,eAAD;IACE,QAAQ,EAAEmB,cAAc,CAACM,QAD3B;IAEE,WAAW,EAAEN,cAAc,CAACtD,KAF9B;IAGE,OAAO,EAAE2D,mBAHX;IAIE,MAAM,EAAG,yBAAwB5E,UAAW;EAJ9C,EAPF,EAaGD,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDeoE,K"}
|
|
@@ -188,7 +188,8 @@ EngineStars.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
188
188
|
})
|
|
189
189
|
} : {};
|
|
190
190
|
EngineStars.contextTypes = {
|
|
191
|
-
skin: _provider.default.childContextTypes.skin
|
|
191
|
+
skin: _provider.default.childContextTypes.skin,
|
|
192
|
+
translate: _provider.default.childContextTypes.translate
|
|
192
193
|
};
|
|
193
194
|
var _default = EngineStars;
|
|
194
195
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stars.js","names":["ICONS","microlearning","TimerIcon","learner","LearnerIcon","battle","BoltIcon","certifications","CertificationIcon","bonus","BonusIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ToolTipContent","preMessage","linkMessage","endMessage","onClick","color","handleContentMouseOver","style","toolTipContent","propTypes","PropTypes","string","func","EngineStars","props","legacyContext","skin","GetSkinFromContext","translate","GetTranslateFromContext","toolTip","disabled","type","stars","title","active","className","handleClick","e","stopPropagation","preventDefault","dark","light","IconType","primary","engineStarsContentId","useState","uuidV5","URL","undefined","toolTipIsVisible","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","buttonRef","useRef","handleKeyPress","useCallback","event","toggleStateOnKeyPress","handleMouseOver","clearTimeout","handleMouseLeave","setTimeout","toolTipContentProps","useMemo","toolTipProps","closeToolTipInformationTextAriaLabel","TooltipContent","_props","classnames","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","isRequired","number","bool","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React, {useCallback, useMemo, useState, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {v5 as uuidV5} from 'uuid';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTipContent = ({\n preMessage,\n linkMessage,\n endMessage,\n onClick,\n color,\n handleContentMouseOver\n}) => (\n <p\n className={style.toolTipContent}\n onMouseOver={handleContentMouseOver}\n data-testid=\"react-tooltip-content\"\n >\n <span>{preMessage}</span>\n <Link\n onClick={onClick}\n style={{\n color\n }}\n >\n {linkMessage}\n </Link>\n <span>{endMessage}</span>\n </p>\n);\n\nToolTipContent.propTypes = {\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n color: PropTypes.string,\n onClick: PropTypes.func,\n handleContentMouseOver: PropTypes.func\n};\n\nconst EngineStars = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const {\n toolTip = null,\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n className\n } = props;\n\n const handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n };\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const IconType = ICONS[type];\n\n const primary = get('common.primary', skin);\n\n // to replace by useId when React17 is bumped to React18\n const [engineStarsContentId] = useState(\n disabled ? uuidV5('engine-stars', uuidV5.URL) : undefined\n );\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n const buttonRef = useRef(null);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));\n }, []);\n\n const toolTipContentProps = useMemo(\n () =>\n toolTip\n ? {\n preMessage: toolTip.preMessage,\n linkMessage: toolTip.linkMessage,\n endMessage: toolTip.endMessage,\n color: primary,\n onClick: toolTip.onClick\n }\n : null,\n [primary, toolTip]\n );\n\n const toolTipProps = {\n closeToolTipInformationTextAriaLabel: translate(\n 'Press the escape key to close the information text'\n )\n };\n\n const TooltipContent = useCallback(\n _props => (\n <ToolTipContent\n {...{...toolTipContentProps, ..._props}}\n handleContentMouseOver={handleContentMouseOver}\n />\n ),\n [handleContentMouseOver, toolTipContentProps]\n );\n\n return (\n <button\n ref={buttonRef}\n data-tip={disabled}\n data-engine={type}\n data-testid={`engine-stars-${type}`}\n // eslint-disable-next-line no-nested-ternary\n onClick={disabled ? handleKeyPress : active ? noop : handleClick}\n data-for={engineStarsContentId}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null,\n className\n ])}\n type=\"button\"\n data-tooltip-place=\"left\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {disabled ? (\n <ToolTip\n {...toolTipProps}\n anchorId={engineStarsContentId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n mouseLeaveTimer={mouseLeaveTimer}\n />\n ) : null}\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon className={style.iconStar} color={active ? primary : dark} />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </button>\n );\n};\n\nEngineStars.propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nEngineStars.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default EngineStars;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,aAAa,EAAEC,2CADH;EAEZC,OAAO,EAAEC,uCAFG;EAGZC,MAAM,EAAEC,0CAHI;EAIZC,cAAc,EAAEC,8CAJJ;EAKZC,KAAK,EAAEC,4CALK;EAMZC,OAAO,EAAEC,6CANG;EAOZC,KAAK,EAAEC,2CAPK;EAQZC,KAAK,EAAEC,2CARK;EASZC,OAAO,EAAEC,gDATG;EAUZC,MAAM,EAAEC;AAVI,CAAd;;AAaA,MAAMC,cAAc,GAAG,CAAC;EACtBC,UADsB;EAEtBC,WAFsB;EAGtBC,UAHsB;EAItBC,OAJsB;EAKtBC,KALsB;EAMtBC;AANsB,CAAD,kBAQrB;EACE,SAAS,EAAEC,oBAAA,CAAMC,cADnB;EAEE,WAAW,EAAEF,sBAFf;EAGE,eAAY;AAHd,gBAKE,2CAAOL,UAAP,CALF,eAME,6BAAC,aAAD;EACE,OAAO,EAAEG,OADX;EAEE,KAAK,EAAE;IACLC;EADK;AAFT,GAMGH,WANH,CANF,eAcE,2CAA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1
|
+
{"version":3,"file":"engine-stars.js","names":["ICONS","microlearning","TimerIcon","learner","LearnerIcon","battle","BoltIcon","certifications","CertificationIcon","bonus","BonusIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ToolTipContent","preMessage","linkMessage","endMessage","onClick","color","handleContentMouseOver","style","toolTipContent","propTypes","PropTypes","string","func","EngineStars","props","legacyContext","skin","GetSkinFromContext","translate","GetTranslateFromContext","toolTip","disabled","type","stars","title","active","className","handleClick","e","stopPropagation","preventDefault","dark","light","IconType","primary","engineStarsContentId","useState","uuidV5","URL","undefined","toolTipIsVisible","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","buttonRef","useRef","handleKeyPress","useCallback","event","toggleStateOnKeyPress","handleMouseOver","clearTimeout","handleMouseLeave","setTimeout","toolTipContentProps","useMemo","toolTipProps","closeToolTipInformationTextAriaLabel","TooltipContent","_props","classnames","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","isRequired","number","bool","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React, {useCallback, useMemo, useState, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {v5 as uuidV5} from 'uuid';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTipContent = ({\n preMessage,\n linkMessage,\n endMessage,\n onClick,\n color,\n handleContentMouseOver\n}) => (\n <p\n className={style.toolTipContent}\n onMouseOver={handleContentMouseOver}\n data-testid=\"react-tooltip-content\"\n >\n <span>{preMessage}</span>\n <Link\n onClick={onClick}\n style={{\n color\n }}\n >\n {linkMessage}\n </Link>\n <span>{endMessage}</span>\n </p>\n);\n\nToolTipContent.propTypes = {\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n color: PropTypes.string,\n onClick: PropTypes.func,\n handleContentMouseOver: PropTypes.func\n};\n\nconst EngineStars = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const {\n toolTip = null,\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n className\n } = props;\n\n const handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n };\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const IconType = ICONS[type];\n\n const primary = get('common.primary', skin);\n\n // to replace by useId when React17 is bumped to React18\n const [engineStarsContentId] = useState(\n disabled ? uuidV5('engine-stars', uuidV5.URL) : undefined\n );\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n const buttonRef = useRef(null);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));\n }, []);\n\n const toolTipContentProps = useMemo(\n () =>\n toolTip\n ? {\n preMessage: toolTip.preMessage,\n linkMessage: toolTip.linkMessage,\n endMessage: toolTip.endMessage,\n color: primary,\n onClick: toolTip.onClick\n }\n : null,\n [primary, toolTip]\n );\n\n const toolTipProps = {\n closeToolTipInformationTextAriaLabel: translate(\n 'Press the escape key to close the information text'\n )\n };\n\n const TooltipContent = useCallback(\n _props => (\n <ToolTipContent\n {...{...toolTipContentProps, ..._props}}\n handleContentMouseOver={handleContentMouseOver}\n />\n ),\n [handleContentMouseOver, toolTipContentProps]\n );\n\n return (\n <button\n ref={buttonRef}\n data-tip={disabled}\n data-engine={type}\n data-testid={`engine-stars-${type}`}\n // eslint-disable-next-line no-nested-ternary\n onClick={disabled ? handleKeyPress : active ? noop : handleClick}\n data-for={engineStarsContentId}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null,\n className\n ])}\n type=\"button\"\n data-tooltip-place=\"left\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {disabled ? (\n <ToolTip\n {...toolTipProps}\n anchorId={engineStarsContentId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n mouseLeaveTimer={mouseLeaveTimer}\n />\n ) : null}\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon className={style.iconStar} color={active ? primary : dark} />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </button>\n );\n};\n\nEngineStars.propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nEngineStars.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default EngineStars;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,aAAa,EAAEC,2CADH;EAEZC,OAAO,EAAEC,uCAFG;EAGZC,MAAM,EAAEC,0CAHI;EAIZC,cAAc,EAAEC,8CAJJ;EAKZC,KAAK,EAAEC,4CALK;EAMZC,OAAO,EAAEC,6CANG;EAOZC,KAAK,EAAEC,2CAPK;EAQZC,KAAK,EAAEC,2CARK;EASZC,OAAO,EAAEC,gDATG;EAUZC,MAAM,EAAEC;AAVI,CAAd;;AAaA,MAAMC,cAAc,GAAG,CAAC;EACtBC,UADsB;EAEtBC,WAFsB;EAGtBC,UAHsB;EAItBC,OAJsB;EAKtBC,KALsB;EAMtBC;AANsB,CAAD,kBAQrB;EACE,SAAS,EAAEC,oBAAA,CAAMC,cADnB;EAEE,WAAW,EAAEF,sBAFf;EAGE,eAAY;AAHd,gBAKE,2CAAOL,UAAP,CALF,eAME,6BAAC,aAAD;EACE,OAAO,EAAEG,OADX;EAEE,KAAK,EAAE;IACLC;EADK;AAFT,GAMGH,WANH,CANF,eAcE,2CAAOC,UAAP,CAdF,CARF;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AA2BzD;AAFb,CAA3B;eAKeL,W"}
|
|
@@ -140,7 +140,8 @@ const Progression = (props, legacyContext) => {
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
Progression.contextTypes = {
|
|
143
|
-
skin: _provider.default.childContextTypes.skin
|
|
143
|
+
skin: _provider.default.childContextTypes.skin,
|
|
144
|
+
translate: _provider.default.childContextTypes.translate
|
|
144
145
|
};
|
|
145
146
|
Progression.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
146
147
|
mainTitle: _propTypes.default.string.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mapWithIndex","map","convert","cap","Progression","props","legacyContext","mainTitle","mainSubtitle","recommendation","progressions","adaptiveAriaLabel","total","engines","themeFilter","loading","skin","GetSkinFromContext","onChange","themeFilterOnChange","handleClick","useCallback","e","stopPropagation","preventDefault","onClick","noop","handleSelectTheme","primary","get","loader","style","allProgressions","progression","index","omit","ref","coreProgression","core","themeSelect","isEmpty","options","selectBorder","select","recommendationSection","recommendationWrapper","title","subtitle","classnames","course","innerHTML","__html","courseTitle","cta","backgroundColor","default","headerProgression","wrapperCta","wrapperProgression","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","isRequired","shape","label","stars","number","arrayOf","EngineStars","bool","ProgressionItem","Select","func"],"sources":["../../../src/template/activity/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport get from 'lodash/fp/get';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport noop from 'lodash/fp/noop';\nimport omit from 'lodash/fp/omit';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport Button from '../../atom/button';\nimport Select from '../../atom/select';\nimport Loader from '../../atom/loader';\nimport ProgressionItem from './progression-item';\nimport EngineStars from './engine-stars';\nimport StarsSummary from './stars-summary';\nimport style from './style.css';\n\nconst mapWithIndex = map.convert({cap: false});\n\nconst Progression = (props, legacyContext) => {\n const {\n mainTitle,\n mainSubtitle,\n recommendation = {},\n progressions = [],\n adaptiveAriaLabel,\n total,\n engines = [],\n themeFilter = {},\n loading\n } = props;\n const skin = GetSkinFromContext(legacyContext);\n const {onChange: themeFilterOnChange} = themeFilter;\n\n const handleClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n const {onClick = noop} = recommendation;\n onClick(e);\n },\n [recommendation]\n );\n\n const handleSelectTheme = useCallback(\n e => {\n themeFilterOnChange && themeFilterOnChange(e);\n },\n [themeFilterOnChange]\n );\n\n const primary = get('common.primary', skin);\n const loader = loading ? (\n <div className={style.loader}>\n <Loader />\n </div>\n ) : null;\n const allProgressions = mapWithIndex(\n (progression, index) => (\n <ProgressionItem\n {...omit(['ref'], progression)}\n key={`${index}-${progression.ref}`}\n adaptiveAriaLabel={adaptiveAriaLabel}\n />\n ),\n progressions\n );\n\n const coreProgression = (\n <div data-name=\"activityCore\" className={style.core}>\n {allProgressions}\n </div>\n );\n const themeSelect = !isEmpty(themeFilter.options) ? (\n <Select\n borderClassName={style.selectBorder}\n className={style.select}\n theme=\"thematiques\"\n options={themeFilter.options}\n onChange={handleSelectTheme}\n />\n ) : null;\n const recommendationSection = !isEmpty(recommendation) ? (\n <div className={style.recommendationWrapper}>\n <p className={style.recommendationSection}>{recommendation.title} </p>\n <p className={style.recommendationSection}>\n <span>{recommendation.subtitle} </span>\n <span\n className={classnames(style.course, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: recommendation.courseTitle}}\n />\n </p>\n <Button\n type=\"link\"\n onClick={handleClick}\n submitValue={recommendation.cta}\n style={{\n backgroundColor: primary\n }}\n className={style.cta}\n />\n </div>\n ) : null;\n\n return (\n <div className={style.default}>\n <div data-name=\"activity-header\" tabIndex={0}>\n <div className={style.mainTitle} tabIndex={0}>\n <span>{mainTitle}</span> {mainSubtitle}\n </div>\n <div className={style.headerProgression} tabIndex={0}>\n <div className={style.wrapperCta} tabIndex={0}>\n {themeSelect}\n {recommendationSection}\n </div>\n <StarsSummary engines={engines} total={total} />\n </div>\n </div>\n <div className={style.wrapperProgression} data-name=\"activityList\">\n {coreProgression}\n {loader}\n </div>\n </div>\n );\n};\n\nProgression.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nProgression.propTypes = {\n mainTitle: PropTypes.string.isRequired,\n mainSubtitle: PropTypes.string.isRequired,\n adaptiveAriaLabel: PropTypes.string,\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n loading: PropTypes.bool.isRequired,\n progressions: PropTypes.arrayOf(\n PropTypes.shape({...ProgressionItem.propTypes, ref: PropTypes.string.isRequired})\n ),\n themeFilter: PropTypes.shape({\n options: Select.propTypes.options.isRequired,\n onChange: Select.propTypes.onChange\n }),\n recommendation: PropTypes.shape({\n cta: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n courseTitle: PropTypes.string.isRequired,\n onClick: PropTypes.func\n })\n};\n\nexport default Progression;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,YAAA,CAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAArB;;AAEA,MAAMC,WAAW,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EAC5C,MAAM;IACJC,SADI;IAEJC,YAFI;IAGJC,cAAc,GAAG,EAHb;IAIJC,YAAY,GAAG,EAJX;IAKJC,iBALI;IAMJC,KANI;IAOJC,OAAO,GAAG,EAPN;IAQJC,WAAW,GAAG,EARV;IASJC;EATI,IAUFV,KAVJ;EAWA,MAAMW,IAAI,GAAG,IAAAC,4BAAA,EAAmBX,aAAnB,CA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AAO,EAAE/B,OAAvB;IAAgC,KAAK,EAAED;EAAvC,EALF,CAJF,CADF,eAaE;IAAK,SAAS,EAAEmB,cAAA,CAAM2B,kBAAtB;IAA0C,aAAU;EAApD,GACGrB,eADH,EAEGP,MAFH,CAbF,CADF;AAoBD,CA1GD;;AA4GA1B,WAAW,CAACuD,YAAZ,GAA2B;EACzB3C,IAAI,EAAE4C,iBAAA,CAASC,iBAAT,CAA2B7C;
|
|
1
|
+
{"version":3,"file":"index.js","names":["mapWithIndex","map","convert","cap","Progression","props","legacyContext","mainTitle","mainSubtitle","recommendation","progressions","adaptiveAriaLabel","total","engines","themeFilter","loading","skin","GetSkinFromContext","onChange","themeFilterOnChange","handleClick","useCallback","e","stopPropagation","preventDefault","onClick","noop","handleSelectTheme","primary","get","loader","style","allProgressions","progression","index","omit","ref","coreProgression","core","themeSelect","isEmpty","options","selectBorder","select","recommendationSection","recommendationWrapper","title","subtitle","classnames","course","innerHTML","__html","courseTitle","cta","backgroundColor","default","headerProgression","wrapperCta","wrapperProgression","contextTypes","Provider","childContextTypes","translate","propTypes","PropTypes","string","isRequired","shape","label","stars","number","arrayOf","EngineStars","bool","ProgressionItem","Select","func"],"sources":["../../../src/template/activity/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport get from 'lodash/fp/get';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport noop from 'lodash/fp/noop';\nimport omit from 'lodash/fp/omit';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport Button from '../../atom/button';\nimport Select from '../../atom/select';\nimport Loader from '../../atom/loader';\nimport ProgressionItem from './progression-item';\nimport EngineStars from './engine-stars';\nimport StarsSummary from './stars-summary';\nimport style from './style.css';\n\nconst mapWithIndex = map.convert({cap: false});\n\nconst Progression = (props, legacyContext) => {\n const {\n mainTitle,\n mainSubtitle,\n recommendation = {},\n progressions = [],\n adaptiveAriaLabel,\n total,\n engines = [],\n themeFilter = {},\n loading\n } = props;\n const skin = GetSkinFromContext(legacyContext);\n const {onChange: themeFilterOnChange} = themeFilter;\n\n const handleClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n const {onClick = noop} = recommendation;\n onClick(e);\n },\n [recommendation]\n );\n\n const handleSelectTheme = useCallback(\n e => {\n themeFilterOnChange && themeFilterOnChange(e);\n },\n [themeFilterOnChange]\n );\n\n const primary = get('common.primary', skin);\n const loader = loading ? (\n <div className={style.loader}>\n <Loader />\n </div>\n ) : null;\n const allProgressions = mapWithIndex(\n (progression, index) => (\n <ProgressionItem\n {...omit(['ref'], progression)}\n key={`${index}-${progression.ref}`}\n adaptiveAriaLabel={adaptiveAriaLabel}\n />\n ),\n progressions\n );\n\n const coreProgression = (\n <div data-name=\"activityCore\" className={style.core}>\n {allProgressions}\n </div>\n );\n const themeSelect = !isEmpty(themeFilter.options) ? (\n <Select\n borderClassName={style.selectBorder}\n className={style.select}\n theme=\"thematiques\"\n options={themeFilter.options}\n onChange={handleSelectTheme}\n />\n ) : null;\n const recommendationSection = !isEmpty(recommendation) ? (\n <div className={style.recommendationWrapper}>\n <p className={style.recommendationSection}>{recommendation.title} </p>\n <p className={style.recommendationSection}>\n <span>{recommendation.subtitle} </span>\n <span\n className={classnames(style.course, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: recommendation.courseTitle}}\n />\n </p>\n <Button\n type=\"link\"\n onClick={handleClick}\n submitValue={recommendation.cta}\n style={{\n backgroundColor: primary\n }}\n className={style.cta}\n />\n </div>\n ) : null;\n\n return (\n <div className={style.default}>\n <div data-name=\"activity-header\" tabIndex={0}>\n <div className={style.mainTitle} tabIndex={0}>\n <span>{mainTitle}</span> {mainSubtitle}\n </div>\n <div className={style.headerProgression} tabIndex={0}>\n <div className={style.wrapperCta} tabIndex={0}>\n {themeSelect}\n {recommendationSection}\n </div>\n <StarsSummary engines={engines} total={total} />\n </div>\n </div>\n <div className={style.wrapperProgression} data-name=\"activityList\">\n {coreProgression}\n {loader}\n </div>\n </div>\n );\n};\n\nProgression.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nProgression.propTypes = {\n mainTitle: PropTypes.string.isRequired,\n mainSubtitle: PropTypes.string.isRequired,\n adaptiveAriaLabel: PropTypes.string,\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n loading: PropTypes.bool.isRequired,\n progressions: PropTypes.arrayOf(\n PropTypes.shape({...ProgressionItem.propTypes, ref: PropTypes.string.isRequired})\n ),\n themeFilter: PropTypes.shape({\n options: Select.propTypes.options.isRequired,\n onChange: Select.propTypes.onChange\n }),\n recommendation: PropTypes.shape({\n cta: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n courseTitle: PropTypes.string.isRequired,\n onClick: PropTypes.func\n })\n};\n\nexport default Progression;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,YAAA,CAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAArB;;AAEA,MAAMC,WAAW,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EAC5C,MAAM;IACJC,SADI;IAEJC,YAFI;IAGJC,cAAc,GAAG,EAHb;IAIJC,YAAY,GAAG,EAJX;IAKJC,iBALI;IAMJC,KANI;IAOJC,OAAO,GAAG,EAPN;IAQJC,WAAW,GAAG,EARV;IASJC;EATI,IAUFV,KAVJ;EAWA,MAAMW,IAAI,GAAG,IAAAC,4BAAA,EAAmBX,aAAnB,CAAb;EACA,MAAM;IAACY,QAAQ,EAAEC;EAAX,IAAkCL,WAAxC;EAE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D,kBAAA,CAAUG,KAAV,CAAgB;IAC9Bd,GAAG,EAAEW,kBAAA,CAAUC,MAAV,CAAiBC,UADQ;IAE9BpB,KAAK,EAAEkB,kBAAA,CAAUC,MAAV,CAAiBC,UAFM;IAG9BnB,QAAQ,EAAEiB,kBAAA,CAAUC,MAAV,CAAiBC,UAHG;IAI9Bd,WAAW,EAAEY,kBAAA,CAAUC,MAAV,CAAiBC,UAJA;IAK9BzC,OAAO,EAAEuC,kBAAA,CAAUY;EALW,CAAhB;AAjBM,CAAxB;eA0BexE,W"}
|
|
@@ -167,7 +167,8 @@ StarsSummary.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
167
167
|
engines: _propTypes.default.arrayOf(_propTypes.default.shape(_engineStars.default.propTypes)).isRequired
|
|
168
168
|
} : {};
|
|
169
169
|
StarsSummary.contextTypes = {
|
|
170
|
-
skin: _provider.default.childContextTypes.skin
|
|
170
|
+
skin: _provider.default.childContextTypes.skin,
|
|
171
|
+
translate: _provider.default.childContextTypes.translate
|
|
171
172
|
};
|
|
172
173
|
var _default = StarsSummary;
|
|
173
174
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stars-summary.js","names":["EngineTab","engine","engineIndex","firstItemIndex","type","state","useMemo","dataName","style","hidden","active","propTypes","PropTypes","shape","EngineStars","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","GetSkinFromContext","setFirstItemIndex","useState","totalItems","length","dark","primary","scrollTo","useCallback","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n key={type}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <button\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n type=\"button\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </button>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars} tabIndex={0}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n tabIndex={0}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n tabIndex={0}\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default StarsSummary;\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAG,CAAC;EAACC,MAAD;EAASC,WAAT;EAAsB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ACE,2CAAOxB,KAAK,CAACyB,KAAb,CADF,eAEE;IAAG,aAAU;EAAb,GAA6BzB,KAAK,CAAC0B,KAAnC,CAFF,eAGE;IAAK,SAAS,EAAE3C,qBAAA,CAAM4C;EAAtB,gBACE,6BAAC,0CAAD;IAAU,SAAS,EAAE5C,qBAAA,CAAM6C,UAA3B;IAAuC,KAAK,EAAEpB;EAA9C,EADF,CAHF,CANF,eAaE;IAAK,SAAS,EAAEzB,qBAAA,CAAM8C;EAAtB,GAAuCf,aAAvC,CAbF,eAcE;IAAK,SAAS,EAAE/B,qBAAA,CAAM+C;EAAtB,GAAwCb,cAAxC,CAdF,CAdF,CADF,CADF;AAmCD,CApFD;;AAsFApB,YAAY,CAACX,SAAb,2CAAyB;EACvBc,KAAK,EAAEb,kBAAA,CAAUC,KAAV,CAAgB;IACrBqC,KAAK,EAAEtC,kBAAA,CAAU4C,MAAV,CAAiBC,UADH;IAErBN,KAAK,EAAEvC,kBAAA,CAAUG,MAAV,CAAiB0C;EAFH,CAAhB,EAGJA,UAJoB;EAKvBxC,OAAO,EAAEL,kBAAA,CAAUS,OAAV,CAAkBT,kBAAA,CAAUC,KAAV,CAAgBC,oBAAA,CAAYH,SAA5B,CAAlB,EAA0D8C;AAL5C,CAAzB;AAQAnC,YAAY,CAACoC,YAAb,GAA4B;EAC1BhC,IAAI,EAAEiC,iBAAA,CAASC,iBAAT,CAA2BlC;
|
|
1
|
+
{"version":3,"file":"stars-summary.js","names":["EngineTab","engine","engineIndex","firstItemIndex","type","state","useMemo","dataName","style","hidden","active","propTypes","PropTypes","shape","EngineStars","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","GetSkinFromContext","setFirstItemIndex","useState","totalItems","length","dark","primary","scrollTo","useCallback","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","Provider","childContextTypes","translate"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n key={type}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <button\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n type=\"button\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </button>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars} tabIndex={0}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n tabIndex={0}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n tabIndex={0}\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.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names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-with-context.d.ts","sourceRoot":"","sources":["../../src/util/render-with-context.js"],"names":[],"mappings":"AAOO,8LA0BN"}
|
|
@@ -9,13 +9,19 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _react2 = require("@testing-library/react");
|
|
11
11
|
|
|
12
|
+
var _has = _interopRequireDefault(require("lodash/fp/has"));
|
|
13
|
+
|
|
12
14
|
var _translate = require("@coorpacademy/translate");
|
|
13
15
|
|
|
14
|
-
var _provider =
|
|
16
|
+
var _provider = _interopRequireWildcard(require("../atom/provider"));
|
|
15
17
|
|
|
16
|
-
const _excluded = ["context"],
|
|
18
|
+
const _excluded = ["context", "useLegacyProvider"],
|
|
17
19
|
_excluded2 = ["translate"];
|
|
18
20
|
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
|
|
19
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
26
|
|
|
21
27
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -24,7 +30,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
24
30
|
|
|
25
31
|
const renderWithContext = (component, options = {}) => {
|
|
26
32
|
const {
|
|
27
|
-
context = {}
|
|
33
|
+
context = {},
|
|
34
|
+
useLegacyProvider = false
|
|
28
35
|
} = options,
|
|
29
36
|
renderOptions = _objectWithoutPropertiesLoose(options, _excluded); // uses mockTranslate as a default translate function
|
|
30
37
|
|
|
@@ -36,9 +43,14 @@ const renderWithContext = (component, options = {}) => {
|
|
|
36
43
|
|
|
37
44
|
const wrapper = ({
|
|
38
45
|
children
|
|
39
|
-
}) =>
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
}) => {
|
|
47
|
+
const hasContextTypes = useLegacyProvider || (0, _has.default)(['type', 'contextTypes'], children);
|
|
48
|
+
return hasContextTypes ? /*#__PURE__*/_react.default.createElement(_provider.default, _extends({}, rest, {
|
|
49
|
+
translate: translate
|
|
50
|
+
}), children) : /*#__PURE__*/_react.default.createElement(_provider.WebContext, _extends({}, rest, {
|
|
51
|
+
translate: translate
|
|
52
|
+
}), children);
|
|
53
|
+
};
|
|
42
54
|
|
|
43
55
|
wrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
44
56
|
children: _propTypes.default.node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-with-context.js","names":["renderWithContext","component","options","context","renderOptions","translate","mockTranslate","rest","wrapper","children","propTypes","PropTypes","node","render"],"sources":["../../src/util/render-with-context.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {render} from '@testing-library/react';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport Provider from '../atom/provider';\n\nexport const renderWithContext = (component, options = {}) => {\n const {context = {}, ...renderOptions} = options;\n // uses mockTranslate as a default translate function\n const {translate = mockTranslate, ...rest} = context;\n\n const wrapper = ({children}) => (\n
|
|
1
|
+
{"version":3,"file":"render-with-context.js","names":["renderWithContext","component","options","context","useLegacyProvider","renderOptions","translate","mockTranslate","rest","wrapper","children","hasContextTypes","has","propTypes","PropTypes","node","render"],"sources":["../../src/util/render-with-context.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {render} from '@testing-library/react';\nimport has from 'lodash/fp/has';\nimport {mockTranslate} from '@coorpacademy/translate';\nimport Provider, {WebContext} from '../atom/provider';\n\nexport const renderWithContext = (component, options = {}) => {\n const {context = {}, useLegacyProvider = false, ...renderOptions} = options;\n // uses mockTranslate as a default translate function\n const {translate = mockTranslate, ...rest} = context;\n\n const wrapper = ({children}) => {\n const hasContextTypes = useLegacyProvider || has(['type', 'contextTypes'], children);\n return hasContextTypes ? (\n <Provider {...rest} translate={translate}>\n {children}\n </Provider>\n ) : (\n <WebContext {...rest} translate={translate}>\n {children}\n </WebContext>\n );\n };\n\n wrapper.propTypes = {\n children: PropTypes.node\n };\n\n return render(component, {\n ...renderOptions,\n wrapper\n });\n};\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;AAEO,MAAMA,iBAAiB,GAAG,CAACC,SAAD,EAAYC,OAAO,GAAG,EAAtB,KAA6B;EAC5D,MAAM;IAACC,OAAO,GAAG,EAAX;IAAeC,iBAAiB,GAAG;EAAnC,IAA8DF,OAApE;EAAA,MAAmDG,aAAnD,iCAAoEH,OAApE,aAD4D,CAE5D;;;EACA,MAAM;IAACI,SAAS,GAAGC;EAAb,IAAuCJ,OAA7C;EAAA,MAAqCK,IAArC,iCAA6CL,OAA7C;;EAEA,MAAMM,OAAO,GAAG,CAAC;IAACC;EAAD,CAAD,KAAgB;IAC9B,MAAMC,eAAe,GAAGP,iBAAiB,IAAI,IAAAQ,YAAA,EAAI,CAAC,MAAD,EAAS,cAAT,CAAJ,EAA8BF,QAA9B,CAA7C;IACA,OAAOC,eAAe,gBACpB,6BAAC,iBAAD,eAAcH,IAAd;MAAoB,SAAS,EAAEF;IAA/B,IACGI,QADH,CADoB,gBAKpB,6BAAC,oBAAD,eAAgBF,IAAhB;MAAsB,SAAS,EAAEF;IAAjC,IACGI,QADH,CALF;EASD,CAXD;;EAaAD,OAAO,CAACI,SAAR,2CAAoB;IAClBH,QAAQ,EAAEI,kBAAA,CAAUC;EADF,CAApB;EAIA,OAAO,IAAAC,cAAA,EAAOf,SAAP,eACFI,aADE;IAELI;EAFK,GAAP;AAID,CA1BM"}
|
package/locales/tr/global.json
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"payment_form_submit": "Coorpacademy aboneliğini başlat",
|
|
39
39
|
"Post": "Postala",
|
|
40
40
|
"premium_unsubscribe_confirmation": "Önümüzdeki aydan itibaren geçerli olacak abonelik iptalinizi onaylıyoruz.\\n\\nBu arada, Coorpacademy platformundaki içeriğimizden faydalanmaya devam edebilirsiniz.",
|
|
41
|
+
"Press the escape key to close the information text": "Bilgi metnini kapatmak için escape tuşuna basın",
|
|
41
42
|
"product_cancel": "İstediğiniz zaman iptal edin.",
|
|
42
43
|
"product_desc_battle": "Mücadele modu",
|
|
43
44
|
"product_desc_certificates": "Coorpacademy sertifikaları",
|
package/locales/uk/global.json
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"payment_form_submit": "Активувати підписку Coorpacademy",
|
|
39
39
|
"Post": "Опублікувати",
|
|
40
40
|
"premium_unsubscribe_confirmation": "Ми підтверджуємо скасування вашої підписки з наступного місяця.\\n\\nТим часом ви можете продовжувати користуватися нашим контентом на платформі Coorpacademy.",
|
|
41
|
+
"Press the escape key to close the information text": "Натисніть клавішу escape, щоб закрити інформаційний текст",
|
|
41
42
|
"product_cancel": "Можна скасувати у будь-який час.",
|
|
42
43
|
"product_desc_battle": "Режим бою",
|
|
43
44
|
"product_desc_certificates": "Сертифікати Coorpacademy",
|
package/locales/vi/global.json
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"payment_form_submit": "Bắt đầu đăng ký Coorpacademy",
|
|
39
39
|
"Post": "Bài đăng",
|
|
40
40
|
"premium_unsubscribe_confirmation": "Chúng tôi xác nhận việc hủy đăng ký. Việc hủy đăng ký sẽ có hiệu lực kể từ tháng sau.\\n\\nIn Trong thời gian chờ đợi, bạn có thể tiếp tục tận hưởng nội dung của chúng tôi trên nền tảng Coorpacademy.",
|
|
41
|
+
"Press the escape key to close the information text": "Nhấn phím thoát để đóng văn bản thông tin",
|
|
41
42
|
"product_cancel": "Hủy bất cứ lúc nào.",
|
|
42
43
|
"product_desc_battle": "Chế độ chiến đấu",
|
|
43
44
|
"product_desc_certificates": "Chứng chỉ Coorpacademy",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "11.10.
|
|
3
|
+
"version": "11.10.2-alpha.6+add25c0df9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
"react": "^17.0.2",
|
|
147
147
|
"react-dom": "^17.0.2",
|
|
148
148
|
"react-native": "^0.68.2",
|
|
149
|
+
"react-native-jw-media-player": "^0.2.34",
|
|
149
150
|
"react-native-linear-gradient": "^2.6.2",
|
|
150
151
|
"react-native-modal": "11.5.6",
|
|
151
152
|
"react-native-render-html": "^6.3.4",
|
|
@@ -161,5 +162,5 @@
|
|
|
161
162
|
"last 2 versions",
|
|
162
163
|
"IE 11"
|
|
163
164
|
],
|
|
164
|
-
"gitHead": "
|
|
165
|
+
"gitHead": "add25c0df9e762177daba3a4ed4fa400f0b308f5"
|
|
165
166
|
}
|
package/locales/.mtslconfig.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"ignore_dirs":[]}
|