@eohjsc/react-native-smart-city 0.3.89 → 0.3.91

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 (166) hide show
  1. package/package.json +1 -1
  2. package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +1 -1
  3. package/src/commons/ActionTemplate/CurtainAction.js +2 -2
  4. package/src/commons/ActionTemplate/OnOffButtonAction.js +2 -2
  5. package/src/commons/ActionTemplate/OnOffSimpleAction.js +2 -2
  6. package/src/commons/ActionTemplate/OnOffSmartLockAction.js +2 -2
  7. package/src/commons/ActionTemplate/OneButtonAction.js +2 -2
  8. package/src/commons/ActionTemplate/ThreeButtonAction.js +2 -2
  9. package/src/commons/ActionTemplate/__test__/CurtainAction.test.js +1 -1
  10. package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +1 -1
  11. package/src/commons/ActionTemplate/__test__/OnOffSimpleAction.test.js +1 -1
  12. package/src/commons/ActionTemplate/__test__/OnOffSmartLockAction.test.js +1 -1
  13. package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +1 -1
  14. package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +1 -1
  15. package/src/commons/ActionTemplate/__test__/index.test.js +21 -70
  16. package/src/commons/ActionTemplate/index.js +19 -55
  17. package/src/commons/Alert/__test__/Alert.test.js +1 -1
  18. package/src/commons/Auth/__test__/OtpInputList.test.js +4 -2
  19. package/src/commons/Auth/__test__/SocialButton.test.js +4 -2
  20. package/src/commons/BackDefault/__test__/BackDefault.test.js +1 -1
  21. package/src/commons/Button/__test__/Button.test.js +1 -1
  22. package/src/commons/ButtonPopup/__test__/ButtonPopup.test.js +1 -1
  23. package/src/commons/Calendar/__test__/Calendar.test.js +1 -1
  24. package/src/commons/ChartLoading/__test__/ChartLoading.test.js +1 -1
  25. package/src/commons/CircleButton/__test__/CircleButton.test.js +1 -1
  26. package/src/commons/CircleView/__test__/CircleView.test.js +1 -1
  27. package/src/commons/DateTimeRangeChange/__test__/DateTimeButton.test.js +4 -2
  28. package/src/commons/DateTimeRangeChange/index.js +31 -48
  29. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +2 -2
  30. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +1 -1
  31. package/src/commons/Device/FlatListItems.js +1 -1
  32. package/src/commons/Device/Hanet/ItemHanetDevice.test.js +2 -2
  33. package/src/commons/Device/HistoryChart.js +6 -49
  34. package/src/commons/Device/LinearChart/LinearChart.test.js +1 -1
  35. package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +3 -4
  36. package/src/commons/Device/ProgressBar/index.js +6 -4
  37. package/src/commons/Device/ProgressBar/styles.js +9 -6
  38. package/src/commons/Device/RainningSensor/__test__/CurrentRainSensor.test.js +5 -5
  39. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +3 -3
  40. package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
  41. package/src/commons/Device/WindSpeed/LinearChart/index.js +1 -1
  42. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +3 -3
  43. package/src/commons/Device/__test__/DisconnectedView.test.js +2 -2
  44. package/src/commons/Device/__test__/FlatListItems.test.js +1 -1
  45. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +1 -1
  46. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +1 -1
  47. package/src/commons/Form/__test__/CurrencyInput.test.js +2 -2
  48. package/src/commons/Form/__test__/TextInput.test.js +2 -2
  49. package/src/commons/Form/__test__/TextInputPassword.test.js +2 -2
  50. package/src/commons/FullLoading/__test__/index.test.js +2 -2
  51. package/src/commons/ImageButton/__test__/ImageButton.test.js +1 -1
  52. package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +2 -2
  53. package/src/commons/OneTapTemplate/OptionsDropdownActionTemplate.js +4 -4
  54. package/src/commons/OneTapTemplate/StatesGridActionTemplate.js +4 -4
  55. package/src/commons/OneTapTemplate/__test__/NumberUpDownActionTemplate.test.js +2 -2
  56. package/src/commons/OneTapTemplate/__test__/OptionsDropdownActionTemplate.test.js +1 -1
  57. package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +2 -2
  58. package/src/commons/RowItem/__test__/RowItem.test.js +1 -1
  59. package/src/commons/RowUser/__test__/RowUser.test.js +1 -1
  60. package/src/commons/Section/Section.test.js +2 -2
  61. package/src/commons/SelectSubUnit/__test__/SelectSubUnit.test.js +1 -1
  62. package/src/commons/SelectUnit/__test__/SelectUnit.test.js +3 -3
  63. package/src/commons/Sharing/__test__/ButtonRemoveMember.test.js +1 -1
  64. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +1 -1
  65. package/src/commons/Sharing/__test__/MemberList.test.js +6 -4
  66. package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
  67. package/src/commons/Sharing/__test__/StationDevicePermission.test.js +3 -3
  68. package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +4 -2
  69. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +2 -10
  70. package/src/commons/SubUnit/OneTap/index.js +3 -1
  71. package/src/commons/TextButton/__test__/TextButton.test.js +2 -2
  72. package/src/commons/Today/__test__/Today.test.js +1 -1
  73. package/src/commons/TouchableScale/__test__/TouchableScale.test.js +1 -1
  74. package/src/commons/UnitSummary/AirQuality/index.js +2 -2
  75. package/src/commons/UnitSummary/ConfigHistoryChart/index.js +0 -6
  76. package/src/commons/UnitSummary/__test__/TotalPowerBox.test.js +1 -1
  77. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +1 -1
  78. package/src/commons/ViewButtonBottom/__test__/ViewButtonBottom.test.js +1 -1
  79. package/src/configs/API.js +9 -32
  80. package/src/configs/Constants.js +2 -30
  81. package/src/context/reducer.ts +3 -1
  82. package/src/hoc/__test__/withRemoteControl.test.js +1 -1
  83. package/src/navigations/UnitStack.js +23 -13
  84. package/src/screens/ActivityLog/FilterPopup.js +4 -4
  85. package/src/screens/ActivityLog/__test__/FilterPopup.test.js +2 -2
  86. package/src/screens/ActivityLog/__test__/index.test.js +2 -2
  87. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +3 -3
  88. package/src/screens/AddCommon/__test__/SelectUnit.test.js +5 -5
  89. package/src/screens/AddNewAction/ChooseAction.js +180 -0
  90. package/src/screens/AddNewAction/ChooseConfig.js +207 -0
  91. package/src/screens/AddNewAction/Components/SelectDevices.js +75 -0
  92. package/src/screens/AddNewAction/Device/__test__/index.test.js +1 -1
  93. package/src/screens/AddNewAction/NewActionWrapper.js +55 -0
  94. package/src/screens/AddNewAction/SelectControlDevices.js +107 -0
  95. package/src/screens/AddNewAction/SelectMonitorDevices.js +142 -0
  96. package/src/screens/AddNewAction/SetupConfigCondition.js +245 -0
  97. package/src/screens/AddNewAction/Styles/SetupSensorStyles.js +1 -1
  98. package/src/screens/AddNewAction/__test__/{SelectAction.test.js → ChooseAction.test.js} +94 -114
  99. package/src/screens/AddNewAction/__test__/ChooseConfig.test.js +211 -0
  100. package/src/screens/AddNewAction/__test__/{SelectSensorDevices.test.js → SelectControlDevices.test.js} +32 -83
  101. package/src/screens/AddNewAction/__test__/SelectMonitorDevices.test.js +92 -0
  102. package/src/screens/AddNewAction/__test__/SetupSensor.test.js +9 -22
  103. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +2 -3
  104. package/src/screens/AddNewAutoSmart/index.js +13 -33
  105. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +1 -1
  106. package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
  107. package/src/screens/AddNewGateway/PlugAndPlay/__test__/ZigbeeDeviceConnectGuide.test.js +1 -1
  108. package/src/screens/AddNewGateway/__test__/ConnectingWifiGuide.test.js +1 -1
  109. package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +2 -2
  110. package/src/screens/AddNewGateway/__test__/ScanModbusQR.test.js +3 -3
  111. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +2 -2
  112. package/src/screens/AddNewGateway/__test__/SelectDeviceSubUnit.test.js +3 -3
  113. package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +1 -1
  114. package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +1 -1
  115. package/src/screens/AddNewOneTap/index.js +16 -7
  116. package/src/screens/AllCamera/__test__/index.test.js +18 -57
  117. package/src/screens/AllCamera/index.js +98 -30
  118. package/src/screens/Automate/MultiUnits.js +2 -2
  119. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  120. package/src/screens/Automate/__test__/index.test.js +19 -38
  121. package/src/screens/Automate/index.js +8 -3
  122. package/src/screens/Device/__test__/DetailHistoryChart.test.js +2 -2
  123. package/src/screens/Device/__test__/EmergencyCountdown.test.js +4 -2
  124. package/src/screens/Device/__test__/sensorDisplayItem.test.js +10 -10
  125. package/src/screens/Device/components/ChartWrapper.js +3 -3
  126. package/src/screens/Device/components/VisualChart.js +1 -1
  127. package/src/screens/Device/components/__test__/VisualChart.test.js +1 -1
  128. package/src/screens/Device/hooks/useEvaluateValue.js +8 -0
  129. package/src/screens/DeviceInfo/__test__/index.test.js +16 -18
  130. package/src/screens/DeviceInfo/index.js +6 -5
  131. package/src/screens/EditActionsList/__tests__/index.test.js +14 -6
  132. package/src/screens/Notification/__test__/Notification.test.js +65 -74
  133. package/src/screens/Notification/index.js +14 -14
  134. package/src/screens/ScriptDetail/__test__/index.test.js +2 -8
  135. package/src/screens/ScriptDetail/index.js +9 -88
  136. package/src/screens/ScriptDetail/utils.js +112 -0
  137. package/src/screens/SelectUnit/__test__/index.test.js +0 -5
  138. package/src/screens/SelectUnit/index.js +1 -2
  139. package/src/screens/Sharing/Components/TitleCheckBox.js +2 -2
  140. package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +3 -3
  141. package/src/screens/SmartAccount/__test__/Connecting.test.js +1 -1
  142. package/src/screens/SmartAccount/__test__/SmartAccount.test.js +3 -3
  143. package/src/screens/SmartIr/__test__/ButtonsBottom.test.js +1 -1
  144. package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +5 -5
  145. package/src/screens/SmartIr/__test__/SelectBrand.test.js +2 -2
  146. package/src/screens/SmartIr/__test__/SelectDeviceType.test.js +2 -2
  147. package/src/screens/SmartIr/__test__/SmartIr.test.js +2 -2
  148. package/src/screens/Template/__test__/detail.test.js +10 -2
  149. package/src/screens/Unit/__test__/Detail.test.js +7 -13
  150. package/src/screens/Unit/components/__test__/Header.test.js +4 -4
  151. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +1 -1
  152. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +14 -6
  153. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +1 -1
  154. package/src/screens/UnitSummary/components/Temperature/index.js +2 -2
  155. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -2
  156. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -2
  157. package/src/screens/UnitSummary/components/__test__/TotalPowerBox.test.js +1 -1
  158. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +1 -1
  159. package/src/screens/UnitSummary/components/__test__/index.test.js +2 -2
  160. package/src/utils/Apis/axios.js +3 -0
  161. package/src/utils/I18n/translations/en.json +1 -0
  162. package/src/utils/I18n/translations/vi.json +1 -0
  163. package/src/utils/Route/index.js +6 -3
  164. package/src/screens/AddNewAction/SelectAction.js +0 -570
  165. package/src/screens/AddNewAction/SelectSensorDevices.js +0 -236
  166. package/src/screens/AddNewAction/SetupSensor.js +0 -263
@@ -38,7 +38,7 @@ describe('Test SmartAccount', () => {
38
38
  },
39
39
  };
40
40
  await act(async () => {
41
- tree = renderer.create(wrapComponent(route));
41
+ tree = await renderer.create(wrapComponent(route));
42
42
  });
43
43
  const instance = tree.root;
44
44
  const scrollView = instance.findAllByType(ScrollView);
@@ -58,7 +58,7 @@ describe('Test SmartAccount', () => {
58
58
  },
59
59
  };
60
60
  await act(async () => {
61
- tree = renderer.create(wrapComponent(route));
61
+ tree = await renderer.create(wrapComponent(route));
62
62
  });
63
63
  const instance = tree.root;
64
64
  const touchableOpacity = instance.find(
@@ -229,7 +229,7 @@ describe('Test SmartAccount', () => {
229
229
  },
230
230
  };
231
231
  await act(async () => {
232
- tree = renderer.create(wrapComponent(route));
232
+ tree = await renderer.create(wrapComponent(route));
233
233
  });
234
234
  const instance = tree.root;
235
235
  const touchSupplierItem = instance.findAll(
@@ -16,7 +16,7 @@ describe('Test ButtonsBottom', () => {
16
16
 
17
17
  it('render ButtonsBottom', async () => {
18
18
  await act(async () => {
19
- tree = renderer.create(wrapComponent());
19
+ tree = await renderer.create(wrapComponent());
20
20
  });
21
21
  const instance = tree.root;
22
22
  const touchableOpacity = instance.findAllByType(TouchableOpacity);
@@ -37,7 +37,7 @@ describe('Test GroupButtonByType', () => {
37
37
  },
38
38
  };
39
39
  await act(async () => {
40
- tree = renderer.create(wrapComponent(route));
40
+ tree = await renderer.create(wrapComponent(route));
41
41
  });
42
42
  const instance = tree.root;
43
43
  const bottomButton = instance.findAllByType(ButtonsBottom)[0];
@@ -70,7 +70,7 @@ describe('Test GroupButtonByType', () => {
70
70
  },
71
71
  };
72
72
  await act(async () => {
73
- tree = renderer.create(wrapComponent(route));
73
+ tree = await renderer.create(wrapComponent(route));
74
74
  });
75
75
  const instance = tree.root;
76
76
  const bottomButton = instance.findAllByType(ButtonsBottom)[0];
@@ -88,7 +88,7 @@ describe('Test GroupButtonByType', () => {
88
88
  },
89
89
  };
90
90
  await act(async () => {
91
- tree = renderer.create(wrapComponent(route));
91
+ tree = await renderer.create(wrapComponent(route));
92
92
  });
93
93
  const instance = tree.root;
94
94
  const bottomButton = instance.findAllByType(ButtonsBottom)[0];
@@ -106,7 +106,7 @@ describe('Test GroupButtonByType', () => {
106
106
  },
107
107
  };
108
108
  await act(async () => {
109
- tree = renderer.create(wrapComponent(route));
109
+ tree = await renderer.create(wrapComponent(route));
110
110
  });
111
111
 
112
112
  const instance = tree.root;
@@ -129,7 +129,7 @@ describe('Test GroupButtonByType', () => {
129
129
  },
130
130
  };
131
131
  await act(async () => {
132
- tree = renderer.create(wrapComponent(route));
132
+ tree = await renderer.create(wrapComponent(route));
133
133
  });
134
134
 
135
135
  const instance = tree.root;
@@ -31,7 +31,7 @@ describe('Test SelectBrand', () => {
31
31
  },
32
32
  };
33
33
  await act(async () => {
34
- tree = renderer.create(wrapComponent(route));
34
+ tree = await renderer.create(wrapComponent(route));
35
35
  });
36
36
  const instance = tree.root;
37
37
  const scrollView = instance.findAllByType(ScrollView);
@@ -45,7 +45,7 @@ describe('Test SelectBrand', () => {
45
45
  },
46
46
  };
47
47
  await act(async () => {
48
- tree = renderer.create(wrapComponent(route));
48
+ tree = await renderer.create(wrapComponent(route));
49
49
  });
50
50
  const instance = tree.root;
51
51
  const scrollView = instance.findAllByType(ScrollView);
@@ -27,7 +27,7 @@ describe('Test SelectIrDeviceType', () => {
27
27
 
28
28
  it('render SelectIrDeviceType', async () => {
29
29
  await act(async () => {
30
- tree = renderer.create(wrapComponent());
30
+ tree = await renderer.create(wrapComponent());
31
31
  });
32
32
  const instance = tree.root;
33
33
  const scrollView = instance.findAllByType(ScrollView);
@@ -36,7 +36,7 @@ describe('Test SelectIrDeviceType', () => {
36
36
 
37
37
  it('itemDevice SelectIrDeviceType onPress', async () => {
38
38
  await act(async () => {
39
- tree = renderer.create(wrapComponent());
39
+ tree = await renderer.create(wrapComponent());
40
40
  });
41
41
  const instance = tree.root;
42
42
  const scrollView = instance.findAllByType(ScrollView);
@@ -34,7 +34,7 @@ describe('Test SmartIr', () => {
34
34
  type: 'smart_ir',
35
35
  };
36
36
  await act(async () => {
37
- tree = renderer.create(wrapComponent(item));
37
+ tree = await renderer.create(wrapComponent(item));
38
38
  });
39
39
  const instance = tree.root;
40
40
  const itemAddNewList = instance.findAll(
@@ -55,7 +55,7 @@ describe('Test SmartIr', () => {
55
55
  type: 'smart_ir',
56
56
  };
57
57
  await act(async () => {
58
- tree = renderer.create(wrapComponent(item));
58
+ tree = await renderer.create(wrapComponent(item));
59
59
  });
60
60
  const instance = tree.root;
61
61
  const itemAddNew = instance.find(
@@ -57,7 +57,11 @@ describe('Test Detail', () => {
57
57
  await act(async () => {
58
58
  tree = await create(wrapComponent());
59
59
  });
60
- jest.runAllTimers();
60
+
61
+ await act(async () => {
62
+ jest.runAllTimers();
63
+ });
64
+
61
65
  const instance = tree.root;
62
66
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
63
67
  await TouchableOpacities[0].props.onPress();
@@ -78,7 +82,11 @@ describe('Test Detail', () => {
78
82
  await act(async () => {
79
83
  tree = await create(wrapComponent());
80
84
  });
81
- jest.runAllTimers();
85
+
86
+ await act(async () => {
87
+ jest.runAllTimers();
88
+ });
89
+
82
90
  const instance = tree.root;
83
91
  const TouchableOpacities = instance.findAllByType(TouchableOpacity);
84
92
  await act(async () => {
@@ -4,7 +4,11 @@ import MockAdapter from 'axios-mock-adapter';
4
4
  import renderer, { act } from 'react-test-renderer';
5
5
  import ParallaxScrollView from '../../../libs/react-native-parallax-scroll-view';
6
6
  import { BleManager } from 'react-native-ble-plx';
7
- import { useIsFocused } from '@react-navigation/native';
7
+ import {
8
+ useIsFocused,
9
+ useNavigation,
10
+ useFocusEffect,
11
+ } from '@react-navigation/native';
8
12
  import AsyncStorage from '@react-native-community/async-storage';
9
13
  import UnitDetail from '../Detail';
10
14
  import { API } from '../../../configs';
@@ -37,18 +41,6 @@ jest.mock('react-redux', () => {
37
41
  };
38
42
  });
39
43
 
40
- const mockedNavigate = jest.fn();
41
- jest.mock('@react-navigation/native', () => {
42
- return {
43
- ...jest.requireActual('@react-navigation/native'),
44
- useIsFocused: jest.fn(),
45
- useNavigation: () => ({
46
- navigate: mockedNavigate,
47
- }),
48
- useFocusEffect: jest.fn(),
49
- };
50
- });
51
-
52
44
  const mockConnectHomeAssistant = jest.fn();
53
45
  jest.mock('../../../hooks/IoT', () => {
54
46
  return {
@@ -66,6 +58,7 @@ jest.mock('react-native-onesignal', () => {
66
58
  });
67
59
 
68
60
  const mock = new MockAdapter(api.axiosInstance);
61
+ useFocusEffect.mockImplementation((f) => f());
69
62
 
70
63
  describe('Test UnitDetail', () => {
71
64
  const route = {
@@ -81,6 +74,7 @@ describe('Test UnitDetail', () => {
81
74
  const getAutomates = API.UNIT.AUTOMATE(1);
82
75
 
83
76
  let tree;
77
+ const mockedNavigate = useNavigation().navigate;
84
78
 
85
79
  beforeEach(() => {
86
80
  jest.clearAllTimers();
@@ -34,7 +34,7 @@ describe('Test Header', () => {
34
34
  let tree;
35
35
  it('test hideModal', async () => {
36
36
  await act(async () => {
37
- tree = renderer.create(wrapComponent());
37
+ tree = await renderer.create(wrapComponent());
38
38
  });
39
39
  const instance = tree.root;
40
40
  const modal = instance.findAllByType(ModalCustom);
@@ -46,7 +46,7 @@ describe('Test Header', () => {
46
46
 
47
47
  it('test onItemClick', async () => {
48
48
  await act(async () => {
49
- tree = renderer.create(wrapComponent());
49
+ tree = await renderer.create(wrapComponent());
50
50
  });
51
51
  const instance = tree.root;
52
52
  const modal = instance.findAllByType(ModalCustom);
@@ -76,7 +76,7 @@ describe('Test Header', () => {
76
76
 
77
77
  it('test Popover Close Menu', async () => {
78
78
  await act(async () => {
79
- tree = renderer.create(wrapComponent());
79
+ tree = await renderer.create(wrapComponent());
80
80
  });
81
81
  const instance = tree.root;
82
82
  const popover = instance.findByType(Popover);
@@ -88,7 +88,7 @@ describe('Test Header', () => {
88
88
 
89
89
  it('test onpress touchableOpacity', async () => {
90
90
  await act(async () => {
91
- tree = renderer.create(wrapComponent());
91
+ tree = await renderer.create(wrapComponent());
92
92
  });
93
93
  const instance = tree.root;
94
94
  const popover = instance.findByType(HeaderCustom);
@@ -38,7 +38,7 @@ describe('Test 3PPowerConsumption', () => {
38
38
  listConfigs: [1, 2, 3],
39
39
  };
40
40
  await act(async () => {
41
- tree = renderer.create(wrapComponent(summaryDetail));
41
+ tree = await renderer.create(wrapComponent(summaryDetail));
42
42
  });
43
43
  const instance = tree.root;
44
44
  const listIndicator = instance.find(
@@ -6,7 +6,7 @@ import moment from 'moment';
6
6
  import { Section, Today } from '../../../../commons';
7
7
  import ListQualityIndicator from '../../../../commons/Device/WaterQualitySensor/ListQualityIndicator';
8
8
  import PMSensorIndicator from '../../../../commons/Device/PMSensor/PMSensorIndicator';
9
- import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
9
+ import VisualChart from '../../../Device/components/VisualChart';
10
10
  import { useTranslations } from '../../../../hooks/Common/useTranslations';
11
11
  import HistoryChart from '../../../../commons/Device/HistoryChart';
12
12
  import { axiosGet } from '../../../../utils/Apis/axios';
@@ -222,6 +222,18 @@ const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
222
222
  fetchData();
223
223
  }
224
224
  }, [startDate, endDate, listConfigs?.total_power, groupBy]);
225
+
226
+ const renderVisualChart = useMemo(() => {
227
+ if (!showBoxHistory) {
228
+ return null;
229
+ }
230
+ return (
231
+ <View>
232
+ <VisualChart item={{ configuration: { configs } }} />
233
+ </View>
234
+ );
235
+ }, [configs, showBoxHistory]);
236
+
225
237
  return (
226
238
  <>
227
239
  <Section type={'border'}>
@@ -231,11 +243,7 @@ const ThreePhasePowerConsumption = memo(({ summaryDetail }) => {
231
243
  style={styles.styleList}
232
244
  accessibilityLabel={AccessibilityLabel.LIST_QUALITY_INDICATOR_3PC}
233
245
  />
234
- {showBoxHistory && (
235
- <View>
236
- <ConfigHistoryChart configs={configs} />
237
- </View>
238
- )}
246
+ {renderVisualChart}
239
247
  </Section>
240
248
 
241
249
  <Section type={'border'}>
@@ -32,7 +32,7 @@ describe('Test PowerConsumption', () => {
32
32
  listConfigs: [1, 2, 3],
33
33
  };
34
34
  await act(async () => {
35
- tree = renderer.create(wrapComponent(summaryDetail));
35
+ tree = await renderer.create(wrapComponent(summaryDetail));
36
36
  });
37
37
  const instance = tree.root;
38
38
  const listIndicator = instance.find(
@@ -5,7 +5,7 @@ import { useTranslations } from '../../../../hooks/Common/useTranslations';
5
5
  import { Colors } from '../../../../configs';
6
6
  import { Section, Today } from '../../../../commons';
7
7
  import ItemTemperature from './ItemTemperature';
8
- import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
8
+ import VisualChart from '../../../Device/components/VisualChart';
9
9
  import SvgHumidity from '../../../../../assets/images/Device/humidity.svg';
10
10
  import SvgRain from '../../../../../assets/images/Device/rain-outline.svg';
11
11
  import SvgTemperature from '../../../../../assets/images/Device/temperature.svg';
@@ -92,7 +92,7 @@ const Temperature = memo(({ summaryDetail }) => {
92
92
  </Section>
93
93
  {showBoxHistory && (
94
94
  <Section type={'border'}>
95
- <ConfigHistoryChart configs={configs} />
95
+ <VisualChart item={{ configuration: { configs } }} />
96
96
  </Section>
97
97
  )}
98
98
  </>
@@ -6,7 +6,7 @@ import { useTranslations } from '../../../../hooks/Common/useTranslations';
6
6
  import { Colors } from '../../../../configs';
7
7
  import Text from '../../../../commons/Text';
8
8
  import { Section, Today } from '../../../../commons';
9
- import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
9
+ import VisualChart from '../../../Device/components/VisualChart';
10
10
  import SegmentedRoundDisplay from '../../../../commons/UnitSummary/AirQuality/SegmentedRoundDisplay';
11
11
 
12
12
  const UvIndex = memo(({ summaryDetail }) => {
@@ -75,7 +75,7 @@ const UvIndex = memo(({ summaryDetail }) => {
75
75
  </Section>
76
76
  {showBoxHistory && (
77
77
  <Section type={'border'}>
78
- <ConfigHistoryChart configs={configs} />
78
+ <VisualChart item={{ configuration: { configs } }} />
79
79
  </Section>
80
80
  )}
81
81
  </>
@@ -3,7 +3,7 @@ import { StyleSheet, View } from 'react-native';
3
3
  import { useTranslations } from '../../../../hooks/Common/useTranslations';
4
4
  import { Today, Section } from '../../../../commons';
5
5
  import Text from '../../../../commons/Text';
6
- import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
6
+ import VisualChart from '../../../Device/components/VisualChart';
7
7
  import Item from './Item';
8
8
 
9
9
  const WaterQuality = memo(({ summaryDetail }) => {
@@ -60,7 +60,7 @@ const WaterQuality = memo(({ summaryDetail }) => {
60
60
  </Section>
61
61
  {showBoxHistory && (
62
62
  <Section type={'border'}>
63
- <ConfigHistoryChart configs={configs} />
63
+ <VisualChart item={{ configuration: { configs } }} />
64
64
  </Section>
65
65
  )}
66
66
  </>
@@ -8,7 +8,7 @@ describe('Test Total Power Box', () => {
8
8
 
9
9
  it('render Total Power Box', async () => {
10
10
  await act(async () => {
11
- tree = renderer.create(<TotalPowerBox title={'titleTest'} />);
11
+ tree = await renderer.create(<TotalPowerBox title={'titleTest'} />);
12
12
  });
13
13
  const instance = tree.root;
14
14
  const item = instance.find(
@@ -20,7 +20,7 @@ describe('Test Total Power Consumption', () => {
20
20
 
21
21
  it('render Total Power Consumption', async () => {
22
22
  await act(async () => {
23
- tree = renderer.create(wrapComponent());
23
+ tree = await renderer.create(wrapComponent());
24
24
  });
25
25
  const instance = tree.root;
26
26
  const item = instance.find(
@@ -14,7 +14,7 @@ describe('UnitSummary components', () => {
14
14
  right_text: 'right_text test',
15
15
  };
16
16
  await act(async () => {
17
- tree = renderer.create(<UnitSummary summary={summary} />);
17
+ tree = await renderer.create(<UnitSummary summary={summary} />);
18
18
  });
19
19
  const instance = tree.root;
20
20
  const textElement = instance.findAllByType(Text);
@@ -34,7 +34,7 @@ describe('UnitSummary components', () => {
34
34
  };
35
35
  const mockFuntion = jest.fn();
36
36
  await act(async () => {
37
- tree = renderer.create(
37
+ tree = await renderer.create(
38
38
  <UnitSummary summary={summary} goToSummary={mockFuntion} />
39
39
  );
40
40
  });
@@ -75,6 +75,9 @@ const parseErrorResponse = async (error) => {
75
75
  if (message?.message) {
76
76
  message = message.message;
77
77
  }
78
+ if (firstKey !== 'non_field_errors') {
79
+ message = `${firstKey}: ${message}`;
80
+ }
78
81
  } else {
79
82
  message = error.data || error.problem;
80
83
  }
@@ -389,6 +389,7 @@
389
389
  "south": "South",
390
390
  "west": "West",
391
391
  "condition": "Condition",
392
+ "no_condition": "No condition",
392
393
  "north_east": "North East",
393
394
  "south_east": "South East",
394
395
  "south_west": "South West",
@@ -369,6 +369,7 @@
369
369
  "from": "Từ",
370
370
  "to": "đến",
371
371
  "condition": "Điều kiện",
372
+ "no_condition": "Không điều kiện",
372
373
  "shared_unit": "Khu vực được chia sẻ",
373
374
  "owner_unit": "Chủ khu vực",
374
375
  "sensor_device": "Thiết bị cảm biến",
@@ -114,15 +114,18 @@ const Routes = {
114
114
  Browser: 'Browser',
115
115
  ManageAccess: 'ManageAccess',
116
116
  MoveToAnotherSubUnit: 'MoveToAnotherSubUnit',
117
- SelectSensorDevices: 'SelectSensorDevices',
118
- SelectAction: 'SelectAction',
117
+ SelectMonitorDevices: 'SelectMonitorDevices',
118
+ SelectControlDevices: 'SelectControlDevices',
119
+ ChooseEvent: 'ChooseEvent',
120
+ ChooseAction: 'ChooseAction',
121
+ ChooseConfig: 'ChooseConfig',
119
122
  GuestInfo: 'GuestInfo',
120
123
  AddLGDevice: 'AddLGDevice',
121
124
  AddLGDeviceStack: 'AddLGDeviceStack',
122
125
  ScriptDetail: 'ScriptDetail',
123
126
  EditActionsList: 'EditActionsList',
124
127
  PlaybackCamera: 'PlaybackCamera',
125
- SetUpSensor: 'SetUpSensor',
128
+ SetupConfigCondition: 'SetupConfigCondition',
126
129
  AddNewAutoSmart: 'AddNewAutoSmart',
127
130
  AllCamera: 'AllCamera',
128
131
  AddNewOneTap: 'AddNewOneTap',