@eohjsc/react-native-smart-city 0.3.26 → 0.3.29

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.
Files changed (108) hide show
  1. package/index.js +2 -0
  2. package/package.json +1 -1
  3. package/src/Images/Common/device_icon.png +0 -0
  4. package/src/Images/DevMode/gateway.png +0 -0
  5. package/src/Images/DevMode/gateway@2x.png +0 -0
  6. package/src/Images/DevMode/gateway@3x.png +0 -0
  7. package/src/Images/DevMode/menu.png +0 -0
  8. package/src/Images/DevMode/menu@2x.png +0 -0
  9. package/src/Images/DevMode/menu@3x.png +0 -0
  10. package/src/Images/DevMode/search.png +0 -0
  11. package/src/Images/DevMode/search@2x.png +0 -0
  12. package/src/Images/DevMode/search@3x.png +0 -0
  13. package/src/Images/DevMode/smart.png +0 -0
  14. package/src/Images/DevMode/smart@2x.png +0 -0
  15. package/src/Images/DevMode/smart@3x.png +0 -0
  16. package/src/Images/DevMode/template.png +0 -0
  17. package/src/Images/DevMode/template@2x.png +0 -0
  18. package/src/Images/DevMode/template@3x.png +0 -0
  19. package/src/commons/ActionGroup/CurtainButtonTemplate.js +1 -2
  20. package/src/commons/ActionGroup/OnOffTemplate/OnOffButtonTemplate.js +2 -0
  21. package/src/commons/ActionTemplate/CurtainAction.js +60 -0
  22. package/src/commons/ActionTemplate/CurtainActionStyles.js +11 -0
  23. package/src/commons/ActionTemplate/OnOffSmartLockAction.js +44 -0
  24. package/src/commons/ActionTemplate/OnOffSmartLockActionStyles.js +11 -0
  25. package/src/commons/ActionTemplate/index.js +18 -0
  26. package/src/commons/CameraDevice/index.js +1 -2
  27. package/src/commons/ConnectingProcess/DeviceItem/DeviceItem.js +20 -12
  28. package/src/commons/ConnectingProcess/DeviceItem/DeviceItemStyles.js +2 -0
  29. package/src/commons/ConnectingProcess/__test__/DeviceItem.test.js +1 -1
  30. package/src/commons/ConnectingProcess/index.js +11 -0
  31. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +55 -5
  32. package/src/commons/Dashboard/MyUnit/index.js +59 -12
  33. package/src/commons/DevMode/Label.js +10 -0
  34. package/src/commons/DevMode/Search.js +20 -0
  35. package/src/commons/DevMode/Styles/LabelStyles.js +8 -0
  36. package/src/commons/DevMode/Styles/SearchStyles.js +21 -0
  37. package/src/commons/DevMode/index.js +3 -0
  38. package/src/commons/Device/ItemDevice.js +1 -0
  39. package/src/commons/Form/TextInput.js +4 -0
  40. package/src/commons/HeaderAni/index.js +1 -0
  41. package/src/commons/MediaPlayerDetail/index.js +0 -20
  42. package/src/commons/MenuActionMore/index.js +12 -4
  43. package/src/commons/Modal/index.js +1 -2
  44. package/src/commons/NavBar/index.js +12 -1
  45. package/src/commons/Popover/index.js +26 -0
  46. package/src/commons/SubUnit/ShortDetail.js +1 -0
  47. package/src/commons/SummaryItem/index.js +2 -1
  48. package/src/commons/Tabbar/Styles/indexStyles.js +51 -0
  49. package/src/commons/Tabbar/index.js +110 -0
  50. package/src/commons/Unit/HeaderUnit/index.js +2 -0
  51. package/src/commons/Unit/SharedUnit.js +1 -0
  52. package/src/commons/WrapParallaxScrollView/index.js +16 -2
  53. package/src/configs/Colors.js +4 -0
  54. package/src/configs/Constants.js +5 -0
  55. package/src/configs/Images.js +6 -0
  56. package/src/context/actionType.ts +2 -0
  57. package/src/context/reducer.ts +10 -0
  58. package/src/hooks/Common/useGGHomeDeviceConnected.js +9 -2
  59. package/src/hooks/Common/usePopover.js +0 -8
  60. package/src/hooks/IoT/useGGHomeConnection.js +0 -1
  61. package/src/navigations/GatewayStack.js +23 -0
  62. package/src/navigations/Main.js +144 -0
  63. package/src/navigations/SmartStack.js +23 -0
  64. package/src/navigations/TemplateStack.js +23 -0
  65. package/src/navigations/UnitStack.js +10 -2
  66. package/src/screens/AddNewAction/SelectAction.js +6 -1
  67. package/src/screens/AllCamera/__test__/index.test.js +1 -8
  68. package/src/screens/AllCamera/index.js +0 -13
  69. package/src/screens/Device/hooks/__test__/useEmergencyButton.test.js +37 -0
  70. package/src/screens/Drawer/Drawer.test.js +24 -0
  71. package/src/screens/Drawer/index.js +198 -0
  72. package/src/screens/Gateway/__test__/index.test.js +16 -0
  73. package/src/screens/Gateway/index.js +8 -0
  74. package/src/screens/Notification/__test__/NotificationItem.test.js +79 -85
  75. package/src/screens/Notification/components/NotificationItem.js +37 -220
  76. package/src/screens/ScriptDetail/__test__/index.test.js +39 -3
  77. package/src/screens/ScriptDetail/index.js +7 -10
  78. package/src/screens/Smart/__test__/index.test.js +16 -0
  79. package/src/screens/Smart/index.js +8 -0
  80. package/src/screens/SubUnit/AddSubUnit.js +1 -1
  81. package/src/screens/SubUnit/EditSubUnit.js +4 -1
  82. package/src/screens/Template/Styles/indexStyles.js +51 -0
  83. package/src/screens/Template/__test__/index.test.js +16 -0
  84. package/src/screens/Template/index.js +84 -0
  85. package/src/screens/Unit/Detail.js +10 -27
  86. package/src/screens/Unit/MoreMenu.js +16 -1
  87. package/src/screens/Unit/SmartAccount.js +7 -6
  88. package/src/screens/Unit/Station/__test__/index.test.js +41 -0
  89. package/src/screens/Unit/Station/index.js +0 -1
  90. package/src/screens/Unit/Summaries.js +14 -2
  91. package/src/screens/Unit/__test__/Detail.test.js +1 -5
  92. package/src/screens/Unit/components/Header/index.js +1 -1
  93. package/src/screens/Unit/components/MyUnitDevice/index.js +29 -12
  94. package/src/screens/Unit/components/__test__/Header.test.js +1 -1
  95. package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
  96. package/src/screens/Unit/hook/useUnitConnectRemoteDevices.js +6 -5
  97. package/src/utils/Converter/__test__/timer.test.js +99 -0
  98. package/src/utils/Functions/Search.js +17 -0
  99. package/src/utils/Functions/ShortEmail.js +4 -0
  100. package/src/utils/Functions/__test__/Search.test.js +6 -0
  101. package/src/utils/Functions/__test__/ShortEmail.test.js +6 -0
  102. package/src/utils/I18n/translations/en.json +32 -42
  103. package/src/utils/I18n/translations/vi.json +32 -44
  104. package/src/utils/Route/index.js +6 -0
  105. package/src/commons/Modal/ModalFullVideo.js +0 -48
  106. package/src/commons/Modal/Styles/ModalFullVideoStyles.js +0 -26
  107. package/src/screens/Unit/components/MyUnit/index.js +0 -136
  108. package/src/screens/Unit/components/__test__/MyUnit.test.js +0 -35
@@ -1,136 +0,0 @@
1
- import React, { useMemo, useCallback } from 'react';
2
- import {
3
- View,
4
- Image,
5
- TouchableOpacity,
6
- StyleSheet,
7
- Dimensions,
8
- } from 'react-native';
9
- import Carousel from 'react-native-snap-carousel';
10
- import { useNavigation } from '@react-navigation/native';
11
- import { useTranslations } from '../../../../hooks/Common/useTranslations';
12
-
13
- import { Colors, Images } from '../../../../configs';
14
- import { TESTID } from '../../../../configs/Constants';
15
- import Text from '../../../../commons/Text';
16
- import MyUnitDevice from '../MyUnitDevice';
17
- import Routes from '../../../../utils/Route';
18
- import { colorOpacity } from '../../../../utils/Converter/color';
19
-
20
- let screenWidth = Dimensions.get('window').width;
21
-
22
- const MyUnit = ({ myUnits }) => {
23
- const t = useTranslations();
24
- const navigation = useNavigation();
25
- const carouselItems = useMemo(() => myUnits, [myUnits]);
26
- const goToDetail = useCallback(
27
- (item) => {
28
- navigation.navigate(Routes.UnitStack, {
29
- screen: Routes.UnitDetail,
30
- params: {
31
- unitId: item.id,
32
- unitData: item,
33
- },
34
- });
35
- },
36
- [navigation]
37
- );
38
- const _renderItem = useCallback(
39
- ({ item, index }) => {
40
- const paddingLeft = index === 0 ? 0 : 8;
41
- const paddingRight = index === carouselItems.length - 1 ? 0 : 8;
42
- return (
43
- <View
44
- style={{
45
- paddingLeft: paddingLeft,
46
- paddingRight: paddingRight,
47
- }}
48
- >
49
- <TouchableOpacity
50
- onPress={() => goToDetail(item)}
51
- style={styles.btnItem}
52
- activeOpacity={0.75}
53
- testID={TESTID.MY_UNIT_GO_TO_DETAIL}
54
- >
55
- <View style={styles.overlay} />
56
- <Image
57
- style={styles.bgMyUnit}
58
- source={{ uri: item.background }}
59
- defaultSource={Images.BgUnit}
60
- resizeMode="cover"
61
- />
62
- <Text style={styles.title}>{item.name}</Text>
63
- </TouchableOpacity>
64
- {item.abstract_sensors.map((sensor, indexSensor) => (
65
- <MyUnitDevice key={indexSensor} sensor={sensor} />
66
- ))}
67
- </View>
68
- );
69
- },
70
- [carouselItems.length, goToDetail]
71
- );
72
-
73
- return (
74
- <View style={styles.container}>
75
- {carouselItems.length ? (
76
- <Carousel
77
- layout={'default'}
78
- data={carouselItems}
79
- sliderWidth={screenWidth}
80
- itemWidth={screenWidth - 32}
81
- renderItem={_renderItem}
82
- inactiveSlideScale={1}
83
- />
84
- ) : (
85
- <View>
86
- <Text testID={TESTID.MY_UNIT_NO_UNIT}>{t('text_no_units')}</Text>
87
- </View>
88
- )}
89
- </View>
90
- );
91
- };
92
-
93
- const styles = StyleSheet.create({
94
- container: {
95
- flex: 1,
96
- backgroundColor: Colors.White,
97
- flexDirection: 'row',
98
- justifyContent: 'center',
99
- paddingBottom: 16,
100
- },
101
- overlay: {
102
- backgroundColor: colorOpacity(Colors.Black, 0.4),
103
- zIndex: 2,
104
- left: 0,
105
- top: 0,
106
- position: 'absolute',
107
- width: '100%',
108
- height: '100%',
109
- borderRadius: 10,
110
- },
111
- bgMyUnit: {
112
- position: 'absolute',
113
- left: 0,
114
- top: 0,
115
- right: 0,
116
- width: '100%',
117
- height: '100%',
118
- borderRadius: 10,
119
- },
120
- title: {
121
- position: 'absolute',
122
- zIndex: 3,
123
- fontWeight: 'bold',
124
- fontSize: 20,
125
- lineHeight: 28,
126
- color: Colors.White,
127
- bottom: 16,
128
- left: 16,
129
- },
130
- btnItem: {
131
- height: 121,
132
- marginBottom: 16,
133
- },
134
- });
135
-
136
- export default MyUnit;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import Carousel from 'react-native-snap-carousel';
3
- import { act, create } from 'react-test-renderer';
4
- import MyUnit from '../MyUnit';
5
- import { SCProvider } from '../../../../context';
6
- import { mockSCStore } from '../../../../context/mockStore';
7
-
8
- const wrapComponent = (units) => (
9
- <SCProvider initState={mockSCStore({})}>
10
- <MyUnit myUnits={units} />
11
- </SCProvider>
12
- );
13
- jest.mock('react', () => {
14
- return {
15
- ...jest.requireActual('react'),
16
- memo: (x) => x,
17
- };
18
- });
19
-
20
- describe('Test MyUnit', () => {
21
- let tree;
22
-
23
- it('render MyUnit carousel', async () => {
24
- const units = [
25
- { id: 1, name: '', abstract_sensors: [{ id: 1, name: '' }] },
26
- { id: 2, name: '', abstract_sensors: [{ id: 1, name: '' }] },
27
- ];
28
- await act(() => {
29
- tree = create(wrapComponent(units));
30
- });
31
- const instance = tree.root;
32
- const carousel = instance.findAllByType(Carousel);
33
- expect(carousel).toHaveLength(1);
34
- });
35
- });