@coorpacademy/app-review 0.0.3 → 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 +14 -5
- package/readme.md +4 -0
- package/src/actions/index.js +17 -0
- package/src/actions/navigation.js +14 -0
- package/src/configure-store.js +21 -0
- package/src/index.js +87 -0
- package/src/reducers/index.js +8 -0
- package/src/reducers/navigation.js +32 -0
|
@@ -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,27 +1,36 @@
|
|
|
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": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=16.15.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"author": "CoorpAcademy",
|
|
13
13
|
"files": [
|
|
14
|
+
"dist",
|
|
14
15
|
"src",
|
|
15
16
|
"readme.md"
|
|
16
17
|
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
17
24
|
"dependencies": {
|
|
25
|
+
"react": "^18.1.0",
|
|
18
26
|
"react-native": "^0.68.2",
|
|
19
27
|
"react-redux": "^8.0.1",
|
|
20
28
|
"redux": "^4.2.0"
|
|
21
29
|
},
|
|
22
30
|
"devDependencies": {
|
|
23
31
|
"@storybook/react-native": "^5.3.25",
|
|
24
|
-
"redux-devtools-extension": "^2.13.9"
|
|
32
|
+
"redux-devtools-extension": "^2.13.9",
|
|
33
|
+
"typescript": "^4.6.4"
|
|
25
34
|
},
|
|
26
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "8a5b90c6adac34b4624830d4dcef9581ba51e493"
|
|
27
36
|
}
|
package/readme.md
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
exports.__esModule = true;
|
|
17
|
+
__exportStar(require("./navigation"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.navigateBack = exports.navigateTo = exports.NAVIGATE_BACK = exports.NAVIGATE_TO = void 0;
|
|
4
|
+
exports.NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
5
|
+
exports.NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
6
|
+
var navigateTo = function (newPath) { return ({
|
|
7
|
+
type: exports.NAVIGATE_TO,
|
|
8
|
+
payload: newPath
|
|
9
|
+
}); };
|
|
10
|
+
exports.navigateTo = navigateTo;
|
|
11
|
+
var navigateBack = function () { return ({
|
|
12
|
+
type: exports.NAVIGATE_BACK
|
|
13
|
+
}); };
|
|
14
|
+
exports.navigateBack = navigateBack;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var redux_1 = require("redux");
|
|
4
|
+
var redux_thunk_1 = require("redux-thunk");
|
|
5
|
+
var redux_devtools_extension_1 = require("redux-devtools-extension");
|
|
6
|
+
var actionCreators = require("./actions");
|
|
7
|
+
var reducers_1 = require("./reducers");
|
|
8
|
+
var preloadedState = undefined;
|
|
9
|
+
function configureStore(services) {
|
|
10
|
+
var _compose = process.env.NODE_ENV !== 'production' ? redux_devtools_extension_1.composeWithDevTools : redux_1.compose;
|
|
11
|
+
var composeEnhancers = _compose({
|
|
12
|
+
actionCreators: actionCreators,
|
|
13
|
+
name: 'app-review',
|
|
14
|
+
trace: true,
|
|
15
|
+
traceLimit: 25
|
|
16
|
+
});
|
|
17
|
+
var composedEnhancer = composeEnhancers((0, redux_1.applyMiddleware)(redux_thunk_1["default"]));
|
|
18
|
+
var store = (0, redux_1.createStore)(reducers_1["default"], preloadedState, composedEnhancer);
|
|
19
|
+
return store;
|
|
20
|
+
}
|
|
21
|
+
exports["default"] = configureStore;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
exports.__esModule = true;
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
var react_native_1 = require("react-native");
|
|
16
|
+
var react_redux_1 = require("react-redux");
|
|
17
|
+
var configure_store_1 = require("./configure-store");
|
|
18
|
+
var navigation_1 = require("./actions/navigation");
|
|
19
|
+
var navigation_2 = require("./reducers/navigation");
|
|
20
|
+
// -----------------------------------------------------------------------------
|
|
21
|
+
var styles = react_native_1.StyleSheet.create({
|
|
22
|
+
rootView: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// -----------------------------------------------------------------------------
|
|
29
|
+
var NavText = function (_a) {
|
|
30
|
+
var viewName = _a.viewName, navigateTo = _a.navigateTo;
|
|
31
|
+
console.log({ viewName: viewName });
|
|
32
|
+
switch (viewName) {
|
|
33
|
+
case 'home':
|
|
34
|
+
return (<react_native_1.Pressable onPress={function () {
|
|
35
|
+
navigateTo('onboarding');
|
|
36
|
+
}}>
|
|
37
|
+
<react_native_1.Text>view home</react_native_1.Text>
|
|
38
|
+
</react_native_1.Pressable>);
|
|
39
|
+
case 'onboarding':
|
|
40
|
+
return (<react_native_1.Pressable onPress={function () { return navigateTo('quizzer'); }}>
|
|
41
|
+
<react_native_1.Text>view onboarding</react_native_1.Text>
|
|
42
|
+
</react_native_1.Pressable>);
|
|
43
|
+
case 'quizzer':
|
|
44
|
+
return (<react_native_1.Pressable onPress={function () { return navigateTo('home'); }}>
|
|
45
|
+
<react_native_1.Text>view quizzer</react_native_1.Text>
|
|
46
|
+
</react_native_1.Pressable>);
|
|
47
|
+
default:
|
|
48
|
+
return <react_native_1.Text>view (none selected)</react_native_1.Text>;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
// -----------------------------------------------------------------------------
|
|
52
|
+
var RootView = function (props) {
|
|
53
|
+
var backAction = function () {
|
|
54
|
+
props.navigateBack();
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
(0, react_1.useEffect)(function () {
|
|
58
|
+
// https://reactnative.dev/docs/backhandler
|
|
59
|
+
var backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', backAction);
|
|
60
|
+
return function () { return backHandler.remove(); };
|
|
61
|
+
}, []);
|
|
62
|
+
return (<react_native_1.View style={styles.rootView}>
|
|
63
|
+
<NavText viewName={props.viewName} navigateTo={props.navigateTo}/>
|
|
64
|
+
</react_native_1.View>);
|
|
65
|
+
};
|
|
66
|
+
// -----------------------------------------------------------------------------
|
|
67
|
+
var mapStateToProps = function (state, ownProps) {
|
|
68
|
+
return __assign(__assign({}, ownProps), { viewName: (0, navigation_2.getCurrentViewName)(state) });
|
|
69
|
+
};
|
|
70
|
+
var mapDispatchToProps = { navigateTo: navigation_1.navigateTo, navigateBack: navigation_1.navigateBack };
|
|
71
|
+
var App = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(RootView);
|
|
72
|
+
// -----------------------------------------------------------------------------
|
|
73
|
+
var AppRevision = function (_a) {
|
|
74
|
+
var services = _a.services;
|
|
75
|
+
var _b = (0, react_1.useState)(null), store = _b[0], setStore = _b[1];
|
|
76
|
+
(0, react_1.useEffect)(function () {
|
|
77
|
+
var store = (0, configure_store_1["default"])(services);
|
|
78
|
+
setStore(store);
|
|
79
|
+
}, []);
|
|
80
|
+
if (!store)
|
|
81
|
+
return null;
|
|
82
|
+
return (<react_redux_1.Provider store={store}>
|
|
83
|
+
<App />
|
|
84
|
+
</react_redux_1.Provider>);
|
|
85
|
+
};
|
|
86
|
+
// -----------------------------------------------------------------------------
|
|
87
|
+
exports["default"] = AppRevision;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
exports.__esModule = true;
|
|
12
|
+
exports.getCurrentViewName = exports.initialState = void 0;
|
|
13
|
+
var navigation_1 = require("../actions/navigation");
|
|
14
|
+
exports.initialState = ['home'];
|
|
15
|
+
var reducer = function (state, action) {
|
|
16
|
+
if (state === void 0) { state = exports.initialState; }
|
|
17
|
+
switch (action.type) {
|
|
18
|
+
case navigation_1.NAVIGATE_TO: {
|
|
19
|
+
return __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
20
|
+
}
|
|
21
|
+
case navigation_1.NAVIGATE_BACK: {
|
|
22
|
+
var newState = __spreadArray([], state, true);
|
|
23
|
+
newState.pop();
|
|
24
|
+
return newState;
|
|
25
|
+
}
|
|
26
|
+
default:
|
|
27
|
+
return state;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var getCurrentViewName = function (appState) { return appState.navigation[appState.navigation.length - 1]; };
|
|
31
|
+
exports.getCurrentViewName = getCurrentViewName;
|
|
32
|
+
exports["default"] = reducer;
|