@ornikar/kitt-universal 27.7.0 → 27.9.0
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/CHANGELOG.md +19 -0
- package/dist/definitions/TopNavBar/TopNavBar.d.ts +21 -0
- package/dist/definitions/TopNavBar/TopNavBar.d.ts.map +1 -0
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/story-components/StoryDecorator.d.ts +1 -1
- package/dist/definitions/story-components/StoryDecorator.d.ts.map +1 -1
- package/dist/definitions/utils/storybook/KittThemeDecorator.d.ts +1 -1
- package/dist/definitions/utils/storybook/KittThemeDecorator.d.ts.map +1 -1
- package/dist/index-metro.es.android.js +81 -4
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +81 -4
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.17.cjs.js +82 -2
- package/dist/index-node-22.17.cjs.js.map +1 -1
- package/dist/index-node-22.17.cjs.web.js +82 -2
- package/dist/index-node-22.17.cjs.web.js.map +1 -1
- package/dist/index-node-22.17.es.mjs +83 -4
- package/dist/index-node-22.17.es.mjs.map +1 -1
- package/dist/index-node-22.17.es.web.mjs +83 -4
- package/dist/index-node-22.17.es.web.mjs.map +1 -1
- package/dist/index.es.js +86 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +86 -4
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +3 -3
- package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.input.tsx +11 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/decorator.output.tsx +17 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/default.input.tsx +88 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/default.output.tsx +94 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/multiple-add.input.tsx +77 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/multiple-add.output.tsx +92 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.input.tsx +21 -0
- package/scripts/codemods/__testfixtures__/csf1-csf2/parameters.output.tsx +28 -0
- package/scripts/codemods/__tests__/csf1-csf2.test.js +10 -0
- package/scripts/codemods/codemod-template.js +27 -0
- package/scripts/codemods/csf1-csf2.js +323 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/kitt-universal",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.9.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "@ornikar/kitt-universal",
|
|
@@ -164,9 +164,9 @@
|
|
|
164
164
|
"@phosphor-icons/core": "2.1.1",
|
|
165
165
|
"@react-native-picker/picker": "2.7.5",
|
|
166
166
|
"@types/googlemaps": "3.43.3",
|
|
167
|
-
"@types/react": "18.3.
|
|
167
|
+
"@types/react": "18.3.25",
|
|
168
168
|
"@types/react-portal": "4.0.7",
|
|
169
|
-
"@types/react-transition-group": "4.
|
|
169
|
+
"@types/react-transition-group": "4.4.12",
|
|
170
170
|
"diff": "8.0.2",
|
|
171
171
|
"expo-document-picker": "12.0.2",
|
|
172
172
|
"expo-image-picker": "15.1.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { storiesOf } from '@storybook/react-native';
|
|
2
|
+
import {
|
|
3
|
+
NativeStoryDecorator,
|
|
4
|
+
AnotherDecorator,
|
|
5
|
+
} from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
|
|
6
|
+
import { NotificationEnablerScreenView } from './NotificationEnablerScreenView';
|
|
7
|
+
|
|
8
|
+
storiesOf('LNA/shared/components', module)
|
|
9
|
+
.addDecorator(NativeStoryDecorator)
|
|
10
|
+
.addDecorator(AnotherDecorator)
|
|
11
|
+
.add('NotificationEnablerScreen', () => <NotificationEnablerScreenView firstname="Michael" />);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
|
|
2
|
+
import {
|
|
3
|
+
NativeStoryDecorator,
|
|
4
|
+
AnotherDecorator,
|
|
5
|
+
} from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
|
|
6
|
+
import { NotificationEnablerScreenView } from './NotificationEnablerScreenView';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'LNA/shared/components',
|
|
10
|
+
component: NotificationEnablerScreenView,
|
|
11
|
+
decorators: [NativeStoryDecorator, AnotherDecorator],
|
|
12
|
+
} satisfies ComponentMeta<typeof NotificationEnablerScreenView>;
|
|
13
|
+
|
|
14
|
+
export const NotificationEnablerScreenStory: ComponentStory<typeof NotificationEnablerScreenView> = () => (
|
|
15
|
+
<NotificationEnablerScreenView firstname="Michael" />
|
|
16
|
+
);
|
|
17
|
+
NotificationEnablerScreenStory.storyName = 'NotificationEnablerScreen';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { storiesOf } from '@storybook/react-native';
|
|
2
|
+
import { InfoRegularIcon } from '@ornikar/kitt-icons/phosphor';
|
|
3
|
+
import { HStack, IconButton, Story, StorySection, Typography, VStack } from '@ornikar/kitt-universal';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import { useVisibility } from '../../hooks/useVisibility';
|
|
6
|
+
import { CustomTooltip } from './CustomTooltip';
|
|
7
|
+
|
|
8
|
+
function CustomTooltipWrapper(): ReactNode {
|
|
9
|
+
const { visible, toggle } = useVisibility(true);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Story title="CustomTooltip">
|
|
13
|
+
<StorySection title="Top (Default) | Right (Default)">
|
|
14
|
+
<CustomTooltip visible={visible} onTooltipPress={toggle}>
|
|
15
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
16
|
+
</CustomTooltip>
|
|
17
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
18
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
19
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
20
|
+
</HStack>
|
|
21
|
+
</StorySection>
|
|
22
|
+
|
|
23
|
+
<StorySection title="Top | Center">
|
|
24
|
+
<CustomTooltip visible={visible} alignment="center" onTooltipPress={toggle}>
|
|
25
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
26
|
+
</CustomTooltip>
|
|
27
|
+
<VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
28
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
29
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
30
|
+
</VStack>
|
|
31
|
+
</StorySection>
|
|
32
|
+
|
|
33
|
+
<StorySection title="Top | Left">
|
|
34
|
+
<CustomTooltip visible={visible} alignment="flex-start" onTooltipPress={toggle}>
|
|
35
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
36
|
+
</CustomTooltip>
|
|
37
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
38
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
39
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
40
|
+
</HStack>
|
|
41
|
+
</StorySection>
|
|
42
|
+
|
|
43
|
+
<StorySection title="Bottom | Right (Default)">
|
|
44
|
+
<CustomTooltip visible={visible} position="bottom" positionOffset={56} onTooltipPress={toggle}>
|
|
45
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
46
|
+
</CustomTooltip>
|
|
47
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
48
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
49
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
50
|
+
</HStack>
|
|
51
|
+
</StorySection>
|
|
52
|
+
|
|
53
|
+
<StorySection title="Bottom | Center">
|
|
54
|
+
<CustomTooltip
|
|
55
|
+
visible={visible}
|
|
56
|
+
position="bottom"
|
|
57
|
+
positionOffset={56}
|
|
58
|
+
alignment="center"
|
|
59
|
+
onTooltipPress={toggle}
|
|
60
|
+
>
|
|
61
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
62
|
+
</CustomTooltip>
|
|
63
|
+
<VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
64
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
65
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
66
|
+
</VStack>
|
|
67
|
+
</StorySection>
|
|
68
|
+
|
|
69
|
+
<StorySection title="Bottom | Left">
|
|
70
|
+
<CustomTooltip
|
|
71
|
+
visible={visible}
|
|
72
|
+
position="bottom"
|
|
73
|
+
positionOffset={56}
|
|
74
|
+
alignment="flex-start"
|
|
75
|
+
onTooltipPress={toggle}
|
|
76
|
+
>
|
|
77
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
78
|
+
</CustomTooltip>
|
|
79
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
80
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
81
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
82
|
+
</HStack>
|
|
83
|
+
</StorySection>
|
|
84
|
+
</Story>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
storiesOf('LAS/shared/components', module).add('CustomTooltip (default)', () => <CustomTooltipWrapper />);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
|
|
2
|
+
import { InfoRegularIcon } from '@ornikar/kitt-icons/phosphor';
|
|
3
|
+
import { HStack, IconButton, Story, StorySection, Typography, VStack } from '@ornikar/kitt-universal';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import { useVisibility } from '../../hooks/useVisibility';
|
|
6
|
+
import { CustomTooltip } from './CustomTooltip';
|
|
7
|
+
|
|
8
|
+
function CustomTooltipWrapper(): ReactNode {
|
|
9
|
+
const { visible, toggle } = useVisibility(true);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Story title="CustomTooltip">
|
|
13
|
+
<StorySection title="Top (Default) | Right (Default)">
|
|
14
|
+
<CustomTooltip visible={visible} onTooltipPress={toggle}>
|
|
15
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
16
|
+
</CustomTooltip>
|
|
17
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
18
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
19
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
20
|
+
</HStack>
|
|
21
|
+
</StorySection>
|
|
22
|
+
|
|
23
|
+
<StorySection title="Top | Center">
|
|
24
|
+
<CustomTooltip visible={visible} alignment="center" onTooltipPress={toggle}>
|
|
25
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
26
|
+
</CustomTooltip>
|
|
27
|
+
<VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
28
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
29
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
30
|
+
</VStack>
|
|
31
|
+
</StorySection>
|
|
32
|
+
|
|
33
|
+
<StorySection title="Top | Left">
|
|
34
|
+
<CustomTooltip visible={visible} alignment="flex-start" onTooltipPress={toggle}>
|
|
35
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
36
|
+
</CustomTooltip>
|
|
37
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
38
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
39
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
40
|
+
</HStack>
|
|
41
|
+
</StorySection>
|
|
42
|
+
|
|
43
|
+
<StorySection title="Bottom | Right (Default)">
|
|
44
|
+
<CustomTooltip visible={visible} position="bottom" positionOffset={56} onTooltipPress={toggle}>
|
|
45
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
46
|
+
</CustomTooltip>
|
|
47
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
48
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
49
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
50
|
+
</HStack>
|
|
51
|
+
</StorySection>
|
|
52
|
+
|
|
53
|
+
<StorySection title="Bottom | Center">
|
|
54
|
+
<CustomTooltip
|
|
55
|
+
visible={visible}
|
|
56
|
+
position="bottom"
|
|
57
|
+
positionOffset={56}
|
|
58
|
+
alignment="center"
|
|
59
|
+
onTooltipPress={toggle}
|
|
60
|
+
>
|
|
61
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
62
|
+
</CustomTooltip>
|
|
63
|
+
<VStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
64
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
65
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
66
|
+
</VStack>
|
|
67
|
+
</StorySection>
|
|
68
|
+
|
|
69
|
+
<StorySection title="Bottom | Left">
|
|
70
|
+
<CustomTooltip
|
|
71
|
+
visible={visible}
|
|
72
|
+
position="bottom"
|
|
73
|
+
positionOffset={56}
|
|
74
|
+
alignment="flex-start"
|
|
75
|
+
onTooltipPress={toggle}
|
|
76
|
+
>
|
|
77
|
+
<Typography.Text>Press on this tooltip area to dismiss it.</Typography.Text>
|
|
78
|
+
</CustomTooltip>
|
|
79
|
+
<HStack paddingX="kitt.4" paddingY="kitt.2" space="kitt.2" alignItems="center" backgroundColor="kitt.amber.100">
|
|
80
|
+
<IconButton icon={<InfoRegularIcon />} onPress={toggle} />
|
|
81
|
+
<Typography.Text flexGrow={1}>Press the info button to toggle CustomTooltip.</Typography.Text>
|
|
82
|
+
</HStack>
|
|
83
|
+
</StorySection>
|
|
84
|
+
</Story>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
title: 'LAS/shared/components',
|
|
90
|
+
component: CustomTooltipWrapper,
|
|
91
|
+
} satisfies ComponentMeta<typeof CustomTooltipWrapper>;
|
|
92
|
+
|
|
93
|
+
export const CustomTooltipStory: ComponentStory<typeof CustomTooltipWrapper> = () => <CustomTooltipWrapper />;
|
|
94
|
+
CustomTooltipStory.storyName = 'CustomTooltip (default)';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { storiesOf } from '@storybook/react-native';
|
|
3
|
+
import { ApolloError } from '@apollo/client';
|
|
4
|
+
import { StoryDecorator } from '@ornikar/kitt-universal';
|
|
5
|
+
import { NotificationProvider } from '@ornikar/react-notification';
|
|
6
|
+
import {
|
|
7
|
+
ThirdPartyServiceStatusEnum,
|
|
8
|
+
ThirdPartyServiceTypeEnum,
|
|
9
|
+
} from '@ornikar/learner-apps-shared/src/__generated__/globalTypes';
|
|
10
|
+
import {
|
|
11
|
+
mockLearningChaptersEmptyError,
|
|
12
|
+
mockLearningChaptersWithCourses,
|
|
13
|
+
mockLearningChaptersWithCoursesQueryBuilder,
|
|
14
|
+
} from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/learningChaptersWithCoursesMock';
|
|
15
|
+
import {
|
|
16
|
+
getThirdPartyService,
|
|
17
|
+
mockThirdPartyServiceQueryBuilder,
|
|
18
|
+
} from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/thirdPartyService';
|
|
19
|
+
import { ApolloDecorator } from '../../../../../../../storybook/decorators/ApolloDecorator';
|
|
20
|
+
import {
|
|
21
|
+
DrivingDashboardLearningChaptersModalView,
|
|
22
|
+
LearningChaptersModalBodyWrapper,
|
|
23
|
+
} from './DrivingDashboardLearningChaptersModalView';
|
|
24
|
+
|
|
25
|
+
storiesOf('LAS/driving/dashboard/components/DrivingDashboardLearningChaptersModal', module)
|
|
26
|
+
.addDecorator(StoryDecorator as any)
|
|
27
|
+
.addDecorator(ApolloDecorator)
|
|
28
|
+
.add('Default', () => <DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />, {
|
|
29
|
+
apollo: {
|
|
30
|
+
mocks: [
|
|
31
|
+
mockThirdPartyServiceQueryBuilder(
|
|
32
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
33
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
|
|
34
|
+
),
|
|
35
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersWithCourses),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
jest: {
|
|
39
|
+
ignore: true,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
.add('Empty chapters', () => <LearningChaptersModalBodyWrapper visible />, {
|
|
43
|
+
apollo: {
|
|
44
|
+
mocks: [
|
|
45
|
+
mockThirdPartyServiceQueryBuilder(
|
|
46
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
47
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
|
|
48
|
+
),
|
|
49
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError),
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
jest: {
|
|
53
|
+
ignore: true,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
.add(
|
|
57
|
+
'Error',
|
|
58
|
+
() => (
|
|
59
|
+
<NotificationProvider>
|
|
60
|
+
<DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
|
|
61
|
+
</NotificationProvider>
|
|
62
|
+
),
|
|
63
|
+
{
|
|
64
|
+
apollo: {
|
|
65
|
+
mocks: [
|
|
66
|
+
mockThirdPartyServiceQueryBuilder(
|
|
67
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
68
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.DOWN),
|
|
69
|
+
),
|
|
70
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError, new ApolloError({})),
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
jest: {
|
|
74
|
+
ignore: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
|
|
3
|
+
import { ApolloError } from '@apollo/client';
|
|
4
|
+
import { StoryDecorator } from '@ornikar/kitt-universal';
|
|
5
|
+
import { NotificationProvider } from '@ornikar/react-notification';
|
|
6
|
+
import {
|
|
7
|
+
ThirdPartyServiceStatusEnum,
|
|
8
|
+
ThirdPartyServiceTypeEnum,
|
|
9
|
+
} from '@ornikar/learner-apps-shared/src/__generated__/globalTypes';
|
|
10
|
+
import {
|
|
11
|
+
mockLearningChaptersEmptyError,
|
|
12
|
+
mockLearningChaptersWithCourses,
|
|
13
|
+
mockLearningChaptersWithCoursesQueryBuilder,
|
|
14
|
+
} from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/learningChaptersWithCoursesMock';
|
|
15
|
+
import {
|
|
16
|
+
getThirdPartyService,
|
|
17
|
+
mockThirdPartyServiceQueryBuilder,
|
|
18
|
+
} from '@ornikar/learner-apps-shared/src/shared/apollo/mocks/thirdPartyService';
|
|
19
|
+
import { ApolloDecorator } from '../../../../../../../storybook/decorators/ApolloDecorator';
|
|
20
|
+
import {
|
|
21
|
+
DrivingDashboardLearningChaptersModalView,
|
|
22
|
+
LearningChaptersModalBodyWrapper,
|
|
23
|
+
} from './DrivingDashboardLearningChaptersModalView';
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
title: 'LAS/driving/dashboard/components/DrivingDashboardLearningChaptersModal',
|
|
27
|
+
component: DrivingDashboardLearningChaptersModalView,
|
|
28
|
+
decorators: [StoryDecorator, ApolloDecorator],
|
|
29
|
+
} satisfies ComponentMeta<typeof DrivingDashboardLearningChaptersModalView>;
|
|
30
|
+
|
|
31
|
+
export const DefaultStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
|
|
32
|
+
<DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
|
|
33
|
+
);
|
|
34
|
+
DefaultStory.storyName = 'Default';
|
|
35
|
+
|
|
36
|
+
DefaultStory.parameters = {
|
|
37
|
+
apollo: {
|
|
38
|
+
mocks: [
|
|
39
|
+
mockThirdPartyServiceQueryBuilder(
|
|
40
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
41
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
|
|
42
|
+
),
|
|
43
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersWithCourses),
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
jest: {
|
|
47
|
+
ignore: true,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const EmptyChaptersStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
|
|
52
|
+
<LearningChaptersModalBodyWrapper visible />
|
|
53
|
+
);
|
|
54
|
+
EmptyChaptersStory.storyName = 'Empty chapters';
|
|
55
|
+
|
|
56
|
+
EmptyChaptersStory.parameters = {
|
|
57
|
+
apollo: {
|
|
58
|
+
mocks: [
|
|
59
|
+
mockThirdPartyServiceQueryBuilder(
|
|
60
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
61
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.UP),
|
|
62
|
+
),
|
|
63
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError),
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
jest: {
|
|
67
|
+
ignore: true,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const ErrorStory: ComponentStory<typeof DrivingDashboardLearningChaptersModalView> = () => (
|
|
72
|
+
<NotificationProvider>
|
|
73
|
+
<DrivingDashboardLearningChaptersModalView visible onClose={action('onClose')} />
|
|
74
|
+
</NotificationProvider>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
ErrorStory.storyName = 'Error';
|
|
78
|
+
|
|
79
|
+
ErrorStory.parameters = {
|
|
80
|
+
apollo: {
|
|
81
|
+
mocks: [
|
|
82
|
+
mockThirdPartyServiceQueryBuilder(
|
|
83
|
+
ThirdPartyServiceTypeEnum.NORTHPASS,
|
|
84
|
+
getThirdPartyService(ThirdPartyServiceTypeEnum.NORTHPASS, ThirdPartyServiceStatusEnum.DOWN),
|
|
85
|
+
),
|
|
86
|
+
mockLearningChaptersWithCoursesQueryBuilder(mockLearningChaptersEmptyError, new ApolloError({})),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
jest: {
|
|
90
|
+
ignore: true,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { storiesOf } from '@storybook/react-native';
|
|
2
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
3
|
+
import { NativeStoryDecorator } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
|
|
4
|
+
import { WelcomePageView } from './WelcomePageView';
|
|
5
|
+
|
|
6
|
+
storiesOf('Learner Native App/Authentication/Pages/WelcomePageView', module)
|
|
7
|
+
.addDecorator(NativeStoryDecorator)
|
|
8
|
+
.addParameters({
|
|
9
|
+
chromatic: { disable: true },
|
|
10
|
+
jest: {
|
|
11
|
+
createBeforeAfterEachCallbacks: () => ({
|
|
12
|
+
before: () => jest.useFakeTimers({ legacyFakeTimers: true }),
|
|
13
|
+
after: () => jest.useRealTimers(),
|
|
14
|
+
}),
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
.add('WelcomePageView', () => (
|
|
18
|
+
<GestureHandlerRootView>
|
|
19
|
+
<WelcomePageView topInset={60} bottomInset={0} />
|
|
20
|
+
</GestureHandlerRootView>
|
|
21
|
+
));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
|
|
2
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
3
|
+
import { NativeStoryDecorator } from '@ornikar/learner-apps-shared/src/storybook/decorators/NativeStoryDecorator';
|
|
4
|
+
import { WelcomePageView } from './WelcomePageView';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'LNA/authentication/pages',
|
|
8
|
+
component: WelcomePageView,
|
|
9
|
+
decorators: [NativeStoryDecorator],
|
|
10
|
+
|
|
11
|
+
parameters: {
|
|
12
|
+
chromatic: { disable: true },
|
|
13
|
+
jest: {
|
|
14
|
+
createBeforeAfterEachCallbacks: () => ({
|
|
15
|
+
before: () => jest.useFakeTimers({ legacyFakeTimers: true }),
|
|
16
|
+
after: () => jest.useRealTimers(),
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} satisfies ComponentMeta<typeof WelcomePageView>;
|
|
21
|
+
|
|
22
|
+
export const WelcomePageStory: ComponentStory<typeof WelcomePageView> = () => (
|
|
23
|
+
<GestureHandlerRootView>
|
|
24
|
+
<WelcomePageView topInset={60} bottomInset={0} />
|
|
25
|
+
</GestureHandlerRootView>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
WelcomePageStory.storyName = 'WelcomePage';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
jest.autoMockOff();
|
|
4
|
+
const { defineTest } = require('jscodeshift/dist/testUtils');
|
|
5
|
+
|
|
6
|
+
const tests = ['default', 'decorator', 'parameters', 'multiple-add'];
|
|
7
|
+
|
|
8
|
+
describe('CSF1-CSF2 Migration', () => {
|
|
9
|
+
tests.forEach((test) => defineTest(__dirname, 'csf1-csf2', null, `csf1-csf2/${test}`, { parser: 'tsx' }));
|
|
10
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Use local jscodeshift instance directly
|
|
4
|
+
const jscodeshift = require('jscodeshift');
|
|
5
|
+
const prettier = require('prettier');
|
|
6
|
+
|
|
7
|
+
module.exports = async function transformer(fileInfo, api) {
|
|
8
|
+
// Use the jscodeshift API to parse the file
|
|
9
|
+
const j = api.jscodeshift || jscodeshift;
|
|
10
|
+
|
|
11
|
+
// Parse the source code of the file
|
|
12
|
+
const root = j(fileInfo.source);
|
|
13
|
+
|
|
14
|
+
// ----------- Start of transformer logic
|
|
15
|
+
|
|
16
|
+
// ----------- End of transformer logic
|
|
17
|
+
|
|
18
|
+
// Return the modified source code after transformation
|
|
19
|
+
const output = root.toSource({ quote: 'single' });
|
|
20
|
+
|
|
21
|
+
const prettierConfig = await prettier.resolveConfig(fileInfo.path);
|
|
22
|
+
|
|
23
|
+
return prettier.format(output, {
|
|
24
|
+
...prettierConfig,
|
|
25
|
+
filepath: fileInfo.path,
|
|
26
|
+
});
|
|
27
|
+
};
|