@coorpacademy/app-review 0.0.4 → 0.0.5
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/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/navigation.d.ts +13 -0
- package/dist/actions/navigation.d.ts.map +1 -0
- package/dist/actions/navigation.js +9 -0
- package/dist/components/revision-home.d.ts +10 -0
- package/dist/components/revision-home.d.ts.map +1 -0
- package/dist/components/revision-home.js +92 -0
- package/dist/components/revision-home.stories.d.ts +2 -0
- package/dist/components/revision-home.stories.d.ts.map +1 -0
- package/dist/components/revision-home.stories.js +14 -0
- package/dist/components/revision-onboarding.d.ts +4 -0
- package/dist/components/revision-onboarding.d.ts.map +1 -0
- package/dist/components/revision-onboarding.js +72 -0
- package/dist/components/revision-quizzer.d.ts +19 -0
- package/dist/components/revision-quizzer.d.ts.map +1 -0
- package/dist/components/revision-quizzer.js +129 -0
- package/dist/configure-store.d.ts +2 -0
- package/dist/configure-store.d.ts.map +1 -0
- package/dist/configure-store.js +18 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/reducers/index.d.ts +3 -0
- package/dist/reducers/index.d.ts.map +1 -0
- package/dist/reducers/index.js +6 -0
- package/dist/reducers/navigation.d.ts +7 -0
- package/dist/reducers/navigation.d.ts.map +1 -0
- package/dist/reducers/navigation.js +18 -0
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './navigation';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionCreator } from 'redux';
|
|
2
|
+
export declare const NAVIGATE_TO = "@@navigation/NAVIGATE_TO";
|
|
3
|
+
export declare const NAVIGATE_BACK = "@@navigation/NAVIGATE_BACK";
|
|
4
|
+
export declare type $NAVIGATE_TO = {
|
|
5
|
+
type: '@@navigation/NAVIGATE_TO';
|
|
6
|
+
payload: string;
|
|
7
|
+
};
|
|
8
|
+
export declare type $NAVIGATE_BACK = {
|
|
9
|
+
type: '@@navigation/NAVIGATE_BACK';
|
|
10
|
+
};
|
|
11
|
+
export declare const navigateTo: ActionCreator<$NAVIGATE_TO>;
|
|
12
|
+
export declare const navigateBack: ActionCreator<$NAVIGATE_BACK>;
|
|
13
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAEpC,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAE1D,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,YAAY,CAGjD,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,cAAc,CAErD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
2
|
+
export const NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
3
|
+
export const navigateTo = (newPath) => ({
|
|
4
|
+
type: NAVIGATE_TO,
|
|
5
|
+
payload: newPath
|
|
6
|
+
});
|
|
7
|
+
export const navigateBack = () => ({
|
|
8
|
+
type: NAVIGATE_BACK
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../src/components/revision-home.tsx"],"names":[],"mappings":";AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, FlatList, Pressable, StyleSheet, Text } from 'react-native';
|
|
3
|
+
import { NovaCompositionNavigationArrowRight as ArrowRight } from '@coorpacademy/nova-icons';
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flex: 1,
|
|
7
|
+
padding: 20
|
|
8
|
+
// paddingTop: HEADER_HEIGHT + 20,
|
|
9
|
+
// backgroundColor: theme.colors.white
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
// fontSize: theme.fontSize.xlarge,
|
|
13
|
+
// fontWeight: theme.fontWeight.bold,
|
|
14
|
+
lineHeight: 28
|
|
15
|
+
// color: theme.colors.text.primary,
|
|
16
|
+
// marginBottom: theme.spacing.base,
|
|
17
|
+
// marginTop: theme.spacing.small
|
|
18
|
+
},
|
|
19
|
+
subtitle: {
|
|
20
|
+
// fontSize: theme.fontSize.xlarge,
|
|
21
|
+
// color: theme.colors.text.primary,
|
|
22
|
+
// marginBottom: theme.spacing.tiny
|
|
23
|
+
},
|
|
24
|
+
text: {
|
|
25
|
+
fontSize: 16,
|
|
26
|
+
lineHeight: 22,
|
|
27
|
+
// color: theme.colors.text.primary,
|
|
28
|
+
opacity: 0.7
|
|
29
|
+
// marginBottom: theme.spacing.base
|
|
30
|
+
},
|
|
31
|
+
noSkillsImage: {
|
|
32
|
+
flex: 1,
|
|
33
|
+
alignSelf: 'center',
|
|
34
|
+
width: 320,
|
|
35
|
+
height: 300
|
|
36
|
+
},
|
|
37
|
+
skills: {},
|
|
38
|
+
skill: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
height: 118,
|
|
44
|
+
borderRadius: 8
|
|
45
|
+
// backgroundColor: theme.colors.gray.lighter,
|
|
46
|
+
// marginTop: theme.spacing.micro,
|
|
47
|
+
// marginBottom: theme.spacing.micro,
|
|
48
|
+
// padding: theme.spacing.base
|
|
49
|
+
},
|
|
50
|
+
skillTexts: {
|
|
51
|
+
flex: 1,
|
|
52
|
+
flexDirection: 'column'
|
|
53
|
+
},
|
|
54
|
+
skillTitle: {
|
|
55
|
+
fontSize: 18,
|
|
56
|
+
fontWeight: '600',
|
|
57
|
+
lineHeight: 22
|
|
58
|
+
// color: theme.colors.text.primary,
|
|
59
|
+
// marginBottom: theme.spacing.tiny
|
|
60
|
+
},
|
|
61
|
+
skillInfo: {
|
|
62
|
+
fontSize: 12,
|
|
63
|
+
lineHeight: 16
|
|
64
|
+
// color: theme.colors.gray.medium
|
|
65
|
+
},
|
|
66
|
+
extraSpace: {
|
|
67
|
+
height: 100
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const onSelectSkill = (title) => () => {
|
|
71
|
+
console.log('pressed on', { title });
|
|
72
|
+
};
|
|
73
|
+
const ExtraSpace = () => <View style={styles.extraSpace}></View>;
|
|
74
|
+
const Skill = ({ title, info }) => (<Pressable style={styles.skill} onPress={onSelectSkill(title)}>
|
|
75
|
+
<View style={styles.skillTexts}>
|
|
76
|
+
<Text style={styles.skillTitle}>{title}</Text>
|
|
77
|
+
<Text style={styles.skillInfo}>{info}</Text>
|
|
78
|
+
</View>
|
|
79
|
+
<ArrowRight color="#ededed" height={20} width={20}/>
|
|
80
|
+
</Pressable>);
|
|
81
|
+
const renderSkill = ({ item: { title, info, isExtraSpace = false } }) => isExtraSpace ? <ExtraSpace /> : <Skill title={title} info={info}/>;
|
|
82
|
+
const Skills = (props) => (<FlatList contentContainerStyle={styles.skills} data={props.skills} renderItem={renderSkill}/>);
|
|
83
|
+
const NoSkills = () => (<>
|
|
84
|
+
{/* <Text style={styles.subtitle}>{translations.revision.home.noSkills}</Text>
|
|
85
|
+
<Text style={styles.text}>{translations.revision.home.noSkillsDetails}</Text>
|
|
86
|
+
<ImageBackground source={noSkillsImage} style={styles.noSkillsImage} /> */}
|
|
87
|
+
</>);
|
|
88
|
+
const RevisionHome = (props) => (<View style={styles.container}>
|
|
89
|
+
{/* <Text style={styles.title}>{translations.revision.home.title}</Text> */}
|
|
90
|
+
{!props.skillsToRevise || props.skillsToRevise.length === 0 ? (<NoSkills />) : (<Skills skills={[...props.skillsToRevise, { isExtraSpace: true }]}/>)}
|
|
91
|
+
</View>);
|
|
92
|
+
export default RevisionHome;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-home.stories.d.ts","sourceRoot":"","sources":["../../src/components/revision-home.stories.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react-native';
|
|
3
|
+
import RevisionHome from './revision-home';
|
|
4
|
+
const emptySkills = [];
|
|
5
|
+
const skillsToRevise = [
|
|
6
|
+
{ title: 'Negotiation and powers of persuasion', info: '75 questions to revise' },
|
|
7
|
+
{ title: 'Negotiation and powers of persuasion', info: '75 questions to revise' },
|
|
8
|
+
{ title: 'Negotiation and powers of persuasion', info: '75 questions to revise' },
|
|
9
|
+
{ title: 'Negotiation and powers of persuasion', info: '75 questions to revise' },
|
|
10
|
+
{ title: 'Creativity and innovation', info: '75 questions to revise' }
|
|
11
|
+
];
|
|
12
|
+
storiesOf('RevisionHome', module)
|
|
13
|
+
.add('No skills', () => <RevisionHome skillsToRevise={emptySkills}/>)
|
|
14
|
+
.add('Few skills', () => <RevisionHome skillsToRevise={skillsToRevise}/>);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../src/components/revision-onboarding.tsx"],"names":[],"mappings":";AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Text } from 'react-native';
|
|
3
|
+
// import theme from '../../../modules/theme';
|
|
4
|
+
// import translations from '../../../translations';
|
|
5
|
+
// import Button from '../../../app-shared/components/button';
|
|
6
|
+
// import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
justifyContent: 'space-between',
|
|
10
|
+
flex: 1,
|
|
11
|
+
padding: 20
|
|
12
|
+
// paddingTop: HEADER_HEIGHT + 20
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
height: 72,
|
|
16
|
+
width: 268,
|
|
17
|
+
// fontSize: theme.fontSize.xxlarge,
|
|
18
|
+
// fontWeight: theme.fontWeight.bold,
|
|
19
|
+
lineHeight: 36
|
|
20
|
+
// color: theme.colors.text.primary,
|
|
21
|
+
// marginBottom: theme.spacing.small
|
|
22
|
+
},
|
|
23
|
+
text: {
|
|
24
|
+
// fontSize: theme.fontSize.large,
|
|
25
|
+
// color: theme.colors.text.primary,
|
|
26
|
+
opacity: 0.7
|
|
27
|
+
// marginBottom: theme.spacing.small
|
|
28
|
+
},
|
|
29
|
+
tip: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
height: 54,
|
|
34
|
+
borderRadius: 8
|
|
35
|
+
// backgroundColor: theme.colors.gray.extra,
|
|
36
|
+
// marginTop: theme.spacing.micro,
|
|
37
|
+
// marginBottom: theme.spacing.micro
|
|
38
|
+
},
|
|
39
|
+
tipText: {
|
|
40
|
+
// fontSize: theme.fontSize.large,
|
|
41
|
+
// color: theme.colors.text.primary
|
|
42
|
+
},
|
|
43
|
+
icon: {
|
|
44
|
+
margin: 10
|
|
45
|
+
},
|
|
46
|
+
button: {
|
|
47
|
+
height: 52,
|
|
48
|
+
borderRadius: 7
|
|
49
|
+
// marginBottom: theme.spacing.large,
|
|
50
|
+
// marginTop: theme.spacing.large
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const onButtonPress = () => { };
|
|
54
|
+
const Tip = ({ Icon, text }) => (<View style={styles.tip}>
|
|
55
|
+
{/* <Icon height={16} width={16} style={styles.icon} color={theme.colors.text.primary} /> */}
|
|
56
|
+
<Text style={styles.tipText}>{text}</Text>
|
|
57
|
+
</View>);
|
|
58
|
+
const RevisionOnboarding = () => (<View style={styles.container}>
|
|
59
|
+
{/* <Text style={styles.title}>{translations.revision.onboarding.title}</Text>
|
|
60
|
+
<Text style={styles.text}>{translations.revision.onboarding.intro1}</Text>
|
|
61
|
+
<Text style={styles.text}>{translations.revision.onboarding.intro2}</Text>
|
|
62
|
+
|
|
63
|
+
<Tip Icon={TargetIcon} text={translations.revision.onboarding.tip1} />
|
|
64
|
+
<Tip Icon={TargetIcon} text={translations.revision.onboarding.tip2} />
|
|
65
|
+
<Tip Icon={TargetIcon} text={translations.revision.onboarding.tip3} />
|
|
66
|
+
<Tip Icon={TargetIcon} text={translations.revision.onboarding.tip4} /> */}
|
|
67
|
+
|
|
68
|
+
{/* <Button style={styles.button} onPress={onButtonPress} testID={`button-quit-revision-onboarding`}>
|
|
69
|
+
{translations.revision.onboarding.validate}
|
|
70
|
+
</Button> */}
|
|
71
|
+
</View>);
|
|
72
|
+
export default RevisionOnboarding;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type _Choice_ = {
|
|
3
|
+
text?: string;
|
|
4
|
+
selected: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare type _Slide_ = {
|
|
7
|
+
category: string;
|
|
8
|
+
question: string;
|
|
9
|
+
instruction: string;
|
|
10
|
+
type: 'multiSelection' | 'singleSelection' | 'trueOrFalse';
|
|
11
|
+
choices?: _Choice_[];
|
|
12
|
+
};
|
|
13
|
+
interface Props {
|
|
14
|
+
slide: _Slide_;
|
|
15
|
+
num: number;
|
|
16
|
+
}
|
|
17
|
+
declare const RevisionQuizzer: ({ slide }: Props) => JSX.Element;
|
|
18
|
+
export default RevisionQuizzer;
|
|
19
|
+
//# sourceMappingURL=revision-quizzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../src/components/revision-quizzer.tsx"],"names":[],"mappings":";AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Text, useWindowDimensions } from 'react-native';
|
|
3
|
+
const quizzerStyle = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
padding: 20,
|
|
7
|
+
// paddingTop: HEADER_HEIGHT + 20, @todo with props
|
|
8
|
+
// backgroundColor: theme.colors.white, @todo with props
|
|
9
|
+
justifyContent: 'space-between',
|
|
10
|
+
alignItems: 'center'
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const SLIDE_HEIGHT = () => useWindowDimensions().height * 0.75;
|
|
14
|
+
const creatSlideStyle = (num) => StyleSheet.create({
|
|
15
|
+
slide: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
// backgroundColor: theme.colors.white, @todo with props
|
|
18
|
+
top: useWindowDimensions().height / 2 - SLIDE_HEIGHT() / 2 - num * 4,
|
|
19
|
+
flex: 1,
|
|
20
|
+
height: SLIDE_HEIGHT(),
|
|
21
|
+
width: useWindowDimensions().width - 40 - num * 8,
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
padding: 25,
|
|
25
|
+
shadowColor: '#000',
|
|
26
|
+
shadowOffset: { width: 0, height: -1 },
|
|
27
|
+
shadowOpacity: 0.05,
|
|
28
|
+
shadowRadius: 16,
|
|
29
|
+
elevation: 10 - num * 1,
|
|
30
|
+
borderRadius: 16
|
|
31
|
+
},
|
|
32
|
+
category: {
|
|
33
|
+
fontSize: 12,
|
|
34
|
+
lineHeight: 16,
|
|
35
|
+
// color: theme.colors.text.primary, @todo with props
|
|
36
|
+
// marginBottom: theme.spacing.tiny, @todo with props
|
|
37
|
+
// marginTop: theme.spacing.small, @todo with props
|
|
38
|
+
textAlign: 'center'
|
|
39
|
+
},
|
|
40
|
+
question: {
|
|
41
|
+
fontSize: 16,
|
|
42
|
+
lineHeight: 22,
|
|
43
|
+
fontWeight: '700',
|
|
44
|
+
// color: theme.colors.text.primary, @todo with props
|
|
45
|
+
textAlign: 'center'
|
|
46
|
+
},
|
|
47
|
+
instruction: {
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
lineHeight: 16,
|
|
50
|
+
// color: theme.colors.gray.medium, @todo with props
|
|
51
|
+
// marginBottom: theme.spacing.base, @todo with props
|
|
52
|
+
// marginTop: theme.spacing.small, @todo with props
|
|
53
|
+
textAlign: 'center'
|
|
54
|
+
},
|
|
55
|
+
button: {
|
|
56
|
+
width: 287,
|
|
57
|
+
height: 52,
|
|
58
|
+
borderRadius: 7
|
|
59
|
+
// marginTop: theme.spacing.base @todo with props
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const createOptionStyle = (selected) => {
|
|
63
|
+
// const brandTheme = React.useContext(BrandThemeContext); @todo with props
|
|
64
|
+
return StyleSheet.create({
|
|
65
|
+
box: {
|
|
66
|
+
width: '100%',
|
|
67
|
+
// https://stackoverflow.com/a/66561995/959219
|
|
68
|
+
shadowColor: '#000',
|
|
69
|
+
shadowOffset: { width: 0, height: -1 },
|
|
70
|
+
shadowOpacity: 0.2,
|
|
71
|
+
shadowRadius: 16,
|
|
72
|
+
elevation: 8,
|
|
73
|
+
// backgroundColor: selected ? brandTheme.colors.primary : theme.colors.white, @todo with props
|
|
74
|
+
padding: 12,
|
|
75
|
+
marginTop: 4,
|
|
76
|
+
marginBottom: 4,
|
|
77
|
+
borderRadius: 8
|
|
78
|
+
},
|
|
79
|
+
text: {
|
|
80
|
+
fontSize: 15,
|
|
81
|
+
fontWeight: 'bold',
|
|
82
|
+
lineHeight: 24,
|
|
83
|
+
// color: selected ? theme.colors.white : theme.colors.text.primary, @todo with props
|
|
84
|
+
textAlign: 'center'
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
const choicesStyle = StyleSheet.create({
|
|
89
|
+
container: {
|
|
90
|
+
flex: 1,
|
|
91
|
+
width: '100%',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
alignItems: 'center'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const onButtonPress = () => { };
|
|
97
|
+
const Choices = ({ choices }) => (<View style={choicesStyle.container}>
|
|
98
|
+
{choices.map(({ text, selected = false }) => {
|
|
99
|
+
const optionStyle = createOptionStyle(selected);
|
|
100
|
+
return (<View style={optionStyle.box}>
|
|
101
|
+
<Text style={optionStyle.text}>
|
|
102
|
+
{text} {selected}
|
|
103
|
+
</Text>
|
|
104
|
+
</View>);
|
|
105
|
+
})}
|
|
106
|
+
</View>);
|
|
107
|
+
const Slide = ({ slide, num }) => {
|
|
108
|
+
const slideStyle = creatSlideStyle(num);
|
|
109
|
+
return (<View style={slideStyle.slide}>
|
|
110
|
+
<Text style={slideStyle.category}>
|
|
111
|
+
{slide.category} {num}
|
|
112
|
+
</Text>
|
|
113
|
+
<Text style={slideStyle.question}>{slide.question}</Text>
|
|
114
|
+
<Text style={slideStyle.instruction}>{slide.instruction}</Text>
|
|
115
|
+
|
|
116
|
+
<Choices choices={slide.choices}/>
|
|
117
|
+
|
|
118
|
+
{/* <Button style={slideStyle.button} onPress={onButtonPress} testID={`button-quizzer-validate`}>
|
|
119
|
+
{translations.validate}
|
|
120
|
+
</Button> */}
|
|
121
|
+
</View>);
|
|
122
|
+
};
|
|
123
|
+
const RevisionQuizzer = ({ slide }) => {
|
|
124
|
+
const slides = [slide, slide, slide, slide, slide];
|
|
125
|
+
return (<View style={quizzerStyle.container}>
|
|
126
|
+
{slides.reverse().map((slide, index) => (<Slide slide={slide} num={slides.length - index}/>))}
|
|
127
|
+
</View>);
|
|
128
|
+
};
|
|
129
|
+
export default RevisionQuizzer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,KAAA,OAc9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { applyMiddleware, compose, createStore } from 'redux';
|
|
2
|
+
import thunk from 'redux-thunk';
|
|
3
|
+
import { composeWithDevTools } from 'redux-devtools-extension';
|
|
4
|
+
import * as actionCreators from './actions';
|
|
5
|
+
import rootReducer from './reducers';
|
|
6
|
+
const preloadedState = undefined;
|
|
7
|
+
export default function configureStore(services) {
|
|
8
|
+
const _compose = process.env.NODE_ENV !== 'production' ? composeWithDevTools : compose;
|
|
9
|
+
const composeEnhancers = _compose({
|
|
10
|
+
actionCreators,
|
|
11
|
+
name: 'app-review',
|
|
12
|
+
trace: true,
|
|
13
|
+
traceLimit: 25
|
|
14
|
+
});
|
|
15
|
+
const composedEnhancer = composeEnhancers(applyMiddleware(thunk));
|
|
16
|
+
const store = createStore(rootReducer, preloadedState, composedEnhancer);
|
|
17
|
+
return store;
|
|
18
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAmFA,QAAA,MAAM,WAAW;;iBAehB,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Text, StyleSheet, Pressable, View, BackHandler } from 'react-native';
|
|
3
|
+
import { connect, Provider } from 'react-redux';
|
|
4
|
+
import configureStore from './configure-store';
|
|
5
|
+
import { navigateTo, navigateBack } from './actions/navigation';
|
|
6
|
+
import { getCurrentViewName } from './reducers/navigation';
|
|
7
|
+
// -----------------------------------------------------------------------------
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
rootView: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
// -----------------------------------------------------------------------------
|
|
16
|
+
const NavText = ({ viewName, navigateTo }) => {
|
|
17
|
+
console.log({ viewName });
|
|
18
|
+
switch (viewName) {
|
|
19
|
+
case 'home':
|
|
20
|
+
return (<Pressable onPress={() => {
|
|
21
|
+
navigateTo('onboarding');
|
|
22
|
+
}}>
|
|
23
|
+
<Text>view home</Text>
|
|
24
|
+
</Pressable>);
|
|
25
|
+
case 'onboarding':
|
|
26
|
+
return (<Pressable onPress={() => navigateTo('quizzer')}>
|
|
27
|
+
<Text>view onboarding</Text>
|
|
28
|
+
</Pressable>);
|
|
29
|
+
case 'quizzer':
|
|
30
|
+
return (<Pressable onPress={() => navigateTo('home')}>
|
|
31
|
+
<Text>view quizzer</Text>
|
|
32
|
+
</Pressable>);
|
|
33
|
+
default:
|
|
34
|
+
return <Text>view (none selected)</Text>;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// -----------------------------------------------------------------------------
|
|
38
|
+
const RootView = (props) => {
|
|
39
|
+
const backAction = () => {
|
|
40
|
+
props.navigateBack();
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
// https://reactnative.dev/docs/backhandler
|
|
45
|
+
const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);
|
|
46
|
+
return () => backHandler.remove();
|
|
47
|
+
}, []);
|
|
48
|
+
return (<View style={styles.rootView}>
|
|
49
|
+
<NavText viewName={props.viewName} navigateTo={props.navigateTo}/>
|
|
50
|
+
</View>);
|
|
51
|
+
};
|
|
52
|
+
// -----------------------------------------------------------------------------
|
|
53
|
+
const mapStateToProps = (state, ownProps) => {
|
|
54
|
+
return Object.assign(Object.assign({}, ownProps), { viewName: getCurrentViewName(state) });
|
|
55
|
+
};
|
|
56
|
+
const mapDispatchToProps = { navigateTo, navigateBack };
|
|
57
|
+
const App = connect(mapStateToProps, mapDispatchToProps)(RootView);
|
|
58
|
+
// -----------------------------------------------------------------------------
|
|
59
|
+
const AppRevision = ({ services }) => {
|
|
60
|
+
const [store, setStore] = useState(null);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const store = configureStore(services);
|
|
63
|
+
setStore(store);
|
|
64
|
+
}, []);
|
|
65
|
+
if (!store)
|
|
66
|
+
return null;
|
|
67
|
+
return (<Provider store={store}>
|
|
68
|
+
<App />
|
|
69
|
+
</Provider>);
|
|
70
|
+
};
|
|
71
|
+
// -----------------------------------------------------------------------------
|
|
72
|
+
export default AppRevision;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reducers/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW,KAEf,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { $NAVIGATE_TO, $NAVIGATE_BACK } from '../actions/navigation';
|
|
2
|
+
export declare type State = Array<string>;
|
|
3
|
+
export declare const initialState: State;
|
|
4
|
+
declare const reducer: (state: State, action: $NAVIGATE_TO | $NAVIGATE_BACK) => State;
|
|
5
|
+
export declare const getCurrentViewName: (appState: any) => any;
|
|
6
|
+
export default reducer;
|
|
7
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAExE,oBAAY,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAElC,eAAO,MAAM,YAAY,EAAE,KAAgB,CAAC;AAE5C,QAAA,MAAM,OAAO,yBAAyC,YAAY,GAAG,cAAc,UAalF,CAAC;AAEF,eAAO,MAAM,kBAAkB,wBAAkE,CAAC;AAClG,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NAVIGATE_BACK, NAVIGATE_TO } from '../actions/navigation';
|
|
2
|
+
export const initialState = ['home'];
|
|
3
|
+
const reducer = (state = initialState, action) => {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case NAVIGATE_TO: {
|
|
6
|
+
return [...state, action.payload];
|
|
7
|
+
}
|
|
8
|
+
case NAVIGATE_BACK: {
|
|
9
|
+
const newState = [...state];
|
|
10
|
+
newState.pop();
|
|
11
|
+
return newState;
|
|
12
|
+
}
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const getCurrentViewName = appState => appState.navigation[appState.navigation.length - 1];
|
|
18
|
+
export default reducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
},
|
|
12
12
|
"author": "CoorpAcademy",
|
|
13
13
|
"files": [
|
|
14
|
+
"dist",
|
|
14
15
|
"src",
|
|
15
16
|
"readme.md"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
|
-
"import": "./
|
|
20
|
-
"types": "./
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
@@ -31,5 +32,5 @@
|
|
|
31
32
|
"redux-devtools-extension": "^2.13.9",
|
|
32
33
|
"typescript": "^4.6.4"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "8a5b90c6adac34b4624830d4dcef9581ba51e493"
|
|
35
36
|
}
|