@eohjsc/react-native-smart-city 0.2.19 → 0.2.23

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 (242) hide show
  1. package/assets/images/Add.svg +5 -0
  2. package/assets/images/AddLocationMaps/Point.svg +3 -0
  3. package/assets/images/CheckCircle.svg +4 -0
  4. package/assets/images/Close.svg +3 -0
  5. package/assets/images/Event.svg +9 -0
  6. package/assets/images/HowToStart.svg +14 -0
  7. package/assets/images/OneTap.svg +14 -0
  8. package/assets/images/Rearrange.svg +3 -0
  9. package/assets/images/Schedule.svg +39 -0
  10. package/assets/images/WeatherChange.svg +49 -0
  11. package/index.js +2 -0
  12. package/package.json +7 -4
  13. package/src/Images/Common/ActiveButton.png +0 -0
  14. package/src/Images/Common/ActiveButton@2x.png +0 -0
  15. package/src/Images/Common/ActiveButton@3x.png +0 -0
  16. package/src/Images/Common/file@2x.png +0 -0
  17. package/src/Images/Common/file@3x.png +0 -0
  18. package/src/Images/Common/fullscreen@2x.png +0 -0
  19. package/src/Images/Common/fullscreen@3x.png +0 -0
  20. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
  21. package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
  22. package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
  23. package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
  24. package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
  25. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +2 -1
  26. package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
  27. package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
  28. package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
  29. package/src/commons/Automate/ItemAutomate.js +63 -0
  30. package/src/commons/Automate/ItemAutomateStyles.js +30 -0
  31. package/src/commons/Automate/ItemScriptAction.js +41 -0
  32. package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
  33. package/src/commons/BottomScrollPicker/index.js +58 -0
  34. package/src/commons/BottomScrollPicker/styles.js +13 -0
  35. package/src/commons/BottomSheet/index.js +36 -0
  36. package/src/commons/BottomSheet/styles.js +37 -0
  37. package/src/commons/Button/index.js +6 -1
  38. package/src/commons/CameraDevice/index.js +22 -10
  39. package/src/commons/ChartLoading/index.js +2 -1
  40. package/src/commons/DateTimeRangeChange/index.js +2 -1
  41. package/src/commons/Device/ConnectedViewHeader.js +3 -1
  42. package/src/commons/Device/DeviceAlertStatus.js +2 -1
  43. package/src/commons/Device/DisconnectedView.js +34 -26
  44. package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
  45. package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
  46. package/src/commons/Device/FlatListItems.js +2 -1
  47. package/src/commons/Device/FooterInfo.js +2 -1
  48. package/src/commons/Device/HistoryChart.js +2 -1
  49. package/src/commons/Device/HorizontalBarChart.js +3 -3
  50. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
  51. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
  52. package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
  53. package/src/commons/Device/SensorConnectedStatus.js +2 -1
  54. package/src/commons/Device/WindDirection/Compass/index.js +1 -1
  55. package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
  56. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
  57. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
  58. package/src/commons/EmergencyButton/AlertSent.js +3 -2
  59. package/src/commons/Explore/CityItem/index.js +2 -1
  60. package/src/commons/Explore/HeaderExplore/index.js +2 -1
  61. package/src/commons/Explore/HeaderLabel/index.js +2 -1
  62. package/src/commons/Explore/SearchBox/index.js +2 -1
  63. package/src/commons/Header/HeaderCustom.js +36 -10
  64. package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
  65. package/src/commons/HeaderAni/index.js +6 -3
  66. package/src/commons/IconComponent/index.js +18 -3
  67. package/src/commons/ImagePicker/index.js +3 -1
  68. package/src/commons/MediaPlayer/index.js +118 -62
  69. package/src/commons/MediaPlayer/styles.js +56 -0
  70. package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
  71. package/src/commons/MediaPlayerDetail/index.js +149 -64
  72. package/src/commons/MenuActionAddnew/index.js +2 -1
  73. package/src/commons/Modal/ModalCustom.js +22 -0
  74. package/src/commons/Modal/ModalFullVideo.js +48 -0
  75. package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
  76. package/src/commons/Modal/index.js +4 -0
  77. package/src/commons/NavBar/index.js +2 -2
  78. package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
  79. package/src/commons/Sharing/MemberList.js +3 -1
  80. package/src/commons/Sharing/RowMember.js +3 -2
  81. package/src/commons/Sharing/StationDevicePermissions.js +2 -1
  82. package/src/commons/SubUnit/OneTap/ItemOneTap.js +86 -0
  83. package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
  84. package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
  85. package/src/commons/SubUnit/OneTap/index.js +29 -0
  86. package/src/commons/SubUnit/ShortDetail.js +3 -1
  87. package/src/commons/Today/index.js +2 -1
  88. package/src/commons/Unit/SharedUnit.js +2 -1
  89. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
  90. package/src/commons/UnitSummary/AirQuality/index.js +5 -120
  91. package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
  92. package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
  93. package/src/commons/WheelDateTimePicker/Picker.js +57 -0
  94. package/src/commons/WheelDateTimePicker/index.js +160 -0
  95. package/src/commons/WheelDateTimePicker/styles.js +21 -0
  96. package/src/configs/API.js +25 -3
  97. package/src/configs/Colors.js +1 -0
  98. package/src/configs/Constants.js +4 -0
  99. package/src/configs/Images.js +4 -0
  100. package/src/configs/SCConfig.js +94 -0
  101. package/src/context/SCContext.tsx +5 -11
  102. package/src/context/reducer.ts +2 -0
  103. package/src/hooks/Common/useStatusBar.js +3 -0
  104. package/src/hooks/Common/useTranslations.ts +34 -0
  105. package/src/iot/Monitor.js +2 -1
  106. package/src/iot/RemoteControl/Bluetooth.js +2 -6
  107. package/src/iot/RemoteControl/GoogleHome.js +1 -1
  108. package/src/iot/RemoteControl/Internet.js +1 -1
  109. package/src/iot/RemoteControl/LG.js +57 -15
  110. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +2 -1
  111. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
  112. package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
  113. package/src/iot/RemoteControl/__test__/index.test.js +2 -1
  114. package/src/iot/RemoteControl/index.js +1 -1
  115. package/src/iot/states.js +1 -0
  116. package/src/navigations/AddGatewayStack.js +5 -0
  117. package/src/navigations/AddNewActionStack.js +23 -0
  118. package/src/navigations/SharedStack.js +2 -1
  119. package/src/navigations/UnitStack.js +72 -1
  120. package/src/screens/AQIGuide/index.js +2 -2
  121. package/src/screens/ActivityLog/hooks/index.js +1 -1
  122. package/src/screens/ActivityLog/index.js +2 -1
  123. package/src/screens/AddCommon/SelectSubUnit.js +143 -0
  124. package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
  125. package/src/screens/AddCommon/SelectUnit.js +3 -2
  126. package/src/screens/AddLocationMaps/index.js +2 -1
  127. package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
  128. package/src/screens/AddNewAction/Device/index.js +33 -0
  129. package/src/screens/AddNewAction/SelectDevice.js +106 -0
  130. package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
  131. package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
  132. package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
  133. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +2 -1
  134. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
  135. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
  136. package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
  137. package/src/screens/AddNewDevice/index.js +23 -4
  138. package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
  139. package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
  140. package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
  141. package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
  142. package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
  143. package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
  144. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
  145. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
  146. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
  147. package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
  148. package/src/screens/AddNewGateway/index.js +28 -110
  149. package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
  150. package/src/screens/AddNewOneTap/index.js +67 -0
  151. package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
  152. package/src/screens/AddNewScriptAction/index.js +92 -0
  153. package/src/screens/AllCamera/Styles/index.js +101 -0
  154. package/src/screens/AllCamera/index.js +208 -0
  155. package/src/screens/Device/HeaderDevice/styles.js +2 -2
  156. package/src/screens/Device/__test__/detail.test.js +2 -1
  157. package/src/screens/Device/detail.js +66 -23
  158. package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
  159. package/src/screens/Device/styles.js +3 -0
  160. package/src/screens/DeviceInfo/index.js +3 -2
  161. package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
  162. package/src/screens/EditActionsList/index.js +122 -0
  163. package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
  164. package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
  165. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
  166. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +2 -1
  167. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
  168. package/src/screens/EmergencyContacts/hook.js +3 -2
  169. package/src/screens/Explore/index.js +3 -2
  170. package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
  171. package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
  172. package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
  173. package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
  174. package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
  175. package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
  176. package/src/screens/GuestInfo/constant.js +59 -0
  177. package/src/screens/GuestInfo/index.js +151 -0
  178. package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
  179. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
  180. package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
  181. package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
  182. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +82 -0
  183. package/src/screens/ManageAccess/hooks/index.js +32 -0
  184. package/src/screens/ManageAccess/index.js +126 -0
  185. package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
  186. package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
  187. package/src/screens/PlayBackCamera/Styles/index.js +81 -0
  188. package/src/screens/PlayBackCamera/Timer.js +127 -0
  189. package/src/screens/PlayBackCamera/index.js +233 -0
  190. package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
  191. package/src/screens/ScanChipQR/hooks/index.js +4 -11
  192. package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
  193. package/src/screens/ScriptDetail/index.js +241 -0
  194. package/src/screens/SharedUnit/TabHeader.js +2 -1
  195. package/src/screens/SharedUnit/index.js +3 -2
  196. package/src/screens/Sharing/MemberList.js +2 -1
  197. package/src/screens/Sharing/SelectPermission.js +2 -1
  198. package/src/screens/Sharing/SelectUser.js +3 -2
  199. package/src/screens/Sharing/__test__/MemberList.test.js +2 -1
  200. package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
  201. package/src/screens/Sharing/hooks/index.js +22 -17
  202. package/src/screens/SubUnit/AddSubUnit.js +14 -72
  203. package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
  204. package/src/screens/SubUnit/Detail.js +5 -63
  205. package/src/screens/SubUnit/DetailStyles.js +46 -0
  206. package/src/screens/SubUnit/ManageSubUnit.js +5 -4
  207. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
  208. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
  209. package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
  210. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
  211. package/src/screens/TDSGuide/index.js +2 -1
  212. package/src/screens/UVIndexGuide/index.js +2 -1
  213. package/src/screens/Unit/AddMenu.js +3 -2
  214. package/src/screens/Unit/Detail.js +75 -20
  215. package/src/screens/Unit/ManageUnit/index.js +4 -3
  216. package/src/screens/Unit/ManageUnit.js +4 -3
  217. package/src/screens/Unit/MoreMenu.js +3 -2
  218. package/src/screens/Unit/SelectLocation.js +10 -2
  219. package/src/screens/Unit/SelectLocationStyles.js +11 -0
  220. package/src/screens/Unit/components/Header/index.js +2 -1
  221. package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
  222. package/src/screens/Unit/components/MyUnit/index.js +2 -1
  223. package/src/screens/Unit/components/SearchLocation/index.js +2 -1
  224. package/src/screens/Unit/components/SharedUnit/index.js +2 -1
  225. package/src/screens/Unit/styles.js +4 -0
  226. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
  227. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
  228. package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
  229. package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
  230. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
  231. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
  232. package/src/screens/UnitSummary/index.js +2 -1
  233. package/src/screens/WaterQualityGuide/index.js +2 -1
  234. package/src/utils/Converter/__test__/time.test.js +3 -1
  235. package/src/utils/Converter/array.js +4 -0
  236. package/src/utils/Converter/time.js +29 -4
  237. package/src/utils/I18n/index.ts +6 -0
  238. package/src/utils/I18n/translations/en.json +51 -2
  239. package/src/utils/I18n/translations/vi.json +48 -1
  240. package/src/utils/I18n/translations.ts +45 -0
  241. package/src/utils/Route/index.js +11 -0
  242. package/src/utils/I18n/index.js +0 -19
@@ -1,6 +1,6 @@
1
1
  import { createConnection, getStates } from 'home-assistant-js-websocket';
2
2
  import Toast from 'react-native-toast-message';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
4
4
  import axios from 'axios';
5
5
  import {
6
6
  googleHomeConnect,
@@ -30,6 +30,7 @@ getStates.mockImplementation(() => []);
30
30
  createConnection.mockImplementation(() => connection);
31
31
 
32
32
  describe('Remote Control Google Home', () => {
33
+ const t = useTranslations();
33
34
  const options = [
34
35
  {
35
36
  auth: {},
@@ -1,4 +1,4 @@
1
- import { t } from 'i18n-js';
1
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
2
2
 
3
3
  import Toast from 'react-native-toast-message';
4
4
  import axios from 'axios';
@@ -7,6 +7,7 @@ import { sendCommandOverInternet } from '../Internet';
7
7
  jest.mock('axios');
8
8
 
9
9
  describe('Test IOT Remote Control Internet', () => {
10
+ const t = useTranslations();
10
11
  beforeEach(() => {
11
12
  Toast.show.mockClear();
12
13
  axios.post.mockClear();
@@ -6,10 +6,11 @@ import {
6
6
  } from './index.mock.js'; // need to be imported first in the file
7
7
  import { sendRemoteCommand } from '../index';
8
8
  import Toast from 'react-native-toast-message';
9
- import { t } from 'i18n-js';
9
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
10
10
  import { SEND_COMMAND_OVER_BLUETOOTH_FAIL } from '../Bluetooth';
11
11
 
12
12
  describe('Test Remote Control', () => {
13
+ const t = useTranslations();
13
14
  beforeEach(() => {
14
15
  Toast.show.mockClear();
15
16
  mockSendCommandOverBluetooth.mockClear();
@@ -5,7 +5,7 @@ import {
5
5
  import { sendCommandOverInternet } from './Internet';
6
6
  import { sendCommandOverGoogleHome } from './GoogleHome';
7
7
  import { ToastBottomHelper } from '../../utils/Utils';
8
- import { t } from 'i18n-js';
8
+ import t from '../../hooks/Common/useTranslations';
9
9
  import { sendCommandOverLGThinq } from './LG';
10
10
 
11
11
  export const sendRemoteCommand = async (sensor, action, data) => {
package/src/iot/states.js CHANGED
@@ -2,6 +2,7 @@ import { createGlobalState } from 'react-hooks-global-state';
2
2
 
3
3
  const { useGlobalState, setGlobalState, getGlobalState } = createGlobalState({
4
4
  configValues: {},
5
+ lang: 'en',
5
6
  });
6
7
 
7
8
  export const useConfigGlobalState = useGlobalState;
@@ -7,6 +7,7 @@ import Route from '../utils/Route';
7
7
  import ConnectedGateway from '../screens/AddNewGateway/ConnectedGateway';
8
8
  import ConnectingGateway from '../screens/AddNewGateway/ConnectingGateway';
9
9
  import SetupGatewayWifi from '../screens/AddNewGateway/SetupGatewayWifi';
10
+ import AddCommonSelectSubUnit from '../screens/AddCommon/SelectSubUnit';
10
11
 
11
12
  const Stack = createStackNavigator();
12
13
 
@@ -22,6 +23,10 @@ export const AddGatewayStack = memo(() => {
22
23
  component={SetupGatewayWifi}
23
24
  />
24
25
  <Stack.Screen name={Route.AddNewGateway} component={AddNewGateway} />
26
+ <Stack.Screen
27
+ name={Route.AddCommonSelectSubUnit}
28
+ component={AddCommonSelectSubUnit}
29
+ />
25
30
  <Stack.Screen name={Route.ScanChipQR} component={ScanChipQR} />
26
31
  <Stack.Screen
27
32
  name={Route.ConnectingGateway}
@@ -0,0 +1,23 @@
1
+ import { createStackNavigator } from '@react-navigation/stack';
2
+ import React, { memo } from 'react';
3
+
4
+ import SelectDevice from '../screens/AddNewAction/SelectDevice';
5
+ import Route from '../utils/Route';
6
+
7
+ const Stack = createStackNavigator();
8
+
9
+ export const AddNewActionStack = memo((props) => {
10
+ return (
11
+ <Stack.Navigator
12
+ screenOptions={{
13
+ headerShown: false,
14
+ }}
15
+ >
16
+ <Stack.Screen
17
+ name={Route.SelectDevice}
18
+ component={SelectDevice}
19
+ options={{ headerShown: false }}
20
+ />
21
+ </Stack.Navigator>
22
+ );
23
+ });
@@ -3,7 +3,7 @@ import { createStackNavigator } from '@react-navigation/stack';
3
3
  import { TouchableOpacity, StyleSheet } from 'react-native';
4
4
  import { useNavigation } from '@react-navigation/native';
5
5
  import { Icon } from '@ant-design/react-native';
6
- import { t } from 'i18n-js';
6
+ import { useTranslations } from '../hooks/Common/useTranslations';
7
7
 
8
8
  import Shared from '../screens/SharedUnit';
9
9
  import { Colors } from '../configs';
@@ -11,6 +11,7 @@ import Routes from '../utils/Route';
11
11
 
12
12
  const Stack = createStackNavigator();
13
13
  const SharedStack = memo(() => {
14
+ const t = useTranslations();
14
15
  const navigation = useNavigation();
15
16
  return (
16
17
  <Stack.Navigator>
@@ -2,7 +2,7 @@ import React, { memo } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { IconOutline } from '@ant-design/icons-react-native';
4
4
  import { createStackNavigator } from '@react-navigation/stack';
5
- import { t } from 'i18n-js';
5
+ import { useTranslations } from '../hooks/Common/useTranslations';
6
6
  import { Colors, Device } from '../configs';
7
7
  import Route from '../utils/Route';
8
8
  import ActivityLogScreen from '../screens/ActivityLog';
@@ -21,12 +21,22 @@ import UVIndexGuide from '../screens/UVIndexGuide';
21
21
  import TDSGuide from '../screens/TDSGuide';
22
22
  import WaterQualityGuide from '../screens/WaterQualityGuide';
23
23
  import DeviceInfo from '../screens/DeviceInfo';
24
+ import AddNewOneTap from '../screens/AddNewOneTap';
25
+ import AddNewScriptAction from '../screens/AddNewScriptAction';
26
+ import PlaybackCamera from '../screens/PlayBackCamera';
27
+ import AllCamera from '../screens/AllCamera';
28
+ import ManageAccessScreen from '../screens/ManageAccess';
29
+ import GuestInfo from '../screens/GuestInfo';
30
+ import ScriptDetail from '../screens/ScriptDetail';
31
+ import EditActionsList from '../screens/EditActionsList';
32
+ import SelectDevice from '../screens/AddNewAction/SelectDevice';
24
33
 
25
34
  import _ from 'lodash';
26
35
 
27
36
  const Stack = createStackNavigator();
28
37
 
29
38
  export const UnitStack = memo((props) => {
39
+ const t = useTranslations();
30
40
  return (
31
41
  <Stack.Navigator
32
42
  screenOptions={{
@@ -149,6 +159,67 @@ export const UnitStack = memo((props) => {
149
159
  headerShown: false,
150
160
  }}
151
161
  />
162
+ <Stack.Screen
163
+ name={Route.PlaybackCamera}
164
+ component={PlaybackCamera}
165
+ options={{
166
+ headerShown: false,
167
+ }}
168
+ />
169
+ <Stack.Screen
170
+ name={Route.AllCamera}
171
+ component={AllCamera}
172
+ options={{
173
+ headerShown: false,
174
+ }}
175
+ />
176
+ <Stack.Screen
177
+ name={Route.ManageAccess}
178
+ component={ManageAccessScreen}
179
+ options={{
180
+ headerShown: false,
181
+ }}
182
+ />
183
+ <Stack.Screen
184
+ name={Route.GuestInfo}
185
+ component={GuestInfo}
186
+ options={{
187
+ headerShown: false,
188
+ }}
189
+ />
190
+ <Stack.Screen
191
+ name={Route.AddNewOneTap}
192
+ component={AddNewOneTap}
193
+ options={{
194
+ headerShown: false,
195
+ }}
196
+ />
197
+ <Stack.Screen
198
+ name={Route.ScriptDetail}
199
+ component={ScriptDetail}
200
+ options={{
201
+ headerShown: false,
202
+ }}
203
+ />
204
+ <Stack.Screen
205
+ name={Route.EditActionsList}
206
+ component={EditActionsList}
207
+ options={{
208
+ headerShown: false,
209
+ }}
210
+ />
211
+ <Stack.Screen
212
+ name={Route.AddNewScriptAction}
213
+ component={AddNewScriptAction}
214
+ options={{
215
+ headerShown: false,
216
+ }}
217
+ />
218
+ <Stack.Screen
219
+ name={Route.SelectDevice}
220
+ component={SelectDevice}
221
+ options={{ headerShown: false }}
222
+ />
152
223
  </Stack.Navigator>
153
224
  );
154
225
  });
@@ -6,7 +6,7 @@ import {
6
6
  TouchableOpacity,
7
7
  SafeAreaView,
8
8
  } from 'react-native';
9
- import { t } from 'i18n-js';
9
+ import { useTranslations } from '../../hooks/Common/useTranslations';
10
10
 
11
11
  import { Colors, Theme } from '../../configs';
12
12
  import useTitleHeader from '../../hooks/Common/useTitleHeader';
@@ -23,7 +23,7 @@ import { useSCContextSelector } from '../../context';
23
23
  const AQIGuide = memo(() => {
24
24
  useTitleHeader(t('AQI Guide'));
25
25
  const language = useSCContextSelector((state) => state.language);
26
-
26
+ const t = useTranslations();
27
27
  const data = useMemo(
28
28
  () => ({
29
29
  titles: [
@@ -53,8 +53,8 @@ export default (sensor) => {
53
53
  } else {
54
54
  dataTemp = dataTemp.concat(results);
55
55
  setData(getDataForList(dataTemp));
56
- setIsCanLoadMore(page < Math.ceil(data.count / 20));
57
56
  }
57
+ setIsCanLoadMore(page < Math.ceil(data.count / 20));
58
58
  }
59
59
  page === 1 ? setIsRefreshing(false) : setIsLoading(false);
60
60
  };
@@ -2,7 +2,7 @@
2
2
  import React, { useEffect } from 'react';
3
3
  import { View, Text, SectionList, ActivityIndicator } from 'react-native';
4
4
  import moment from 'moment';
5
- import { t } from 'i18n-js';
5
+ import { useTranslations } from '../../hooks/Common/useTranslations';
6
6
  import { Colors } from '../../configs';
7
7
  import { HeaderCustom } from '../../commons/Header';
8
8
  import { getTitleFromTime } from '../../utils/Converter/time';
@@ -13,6 +13,7 @@ import styles from './Styles/indexStyles';
13
13
  const keyExtractor = (item) => item.id;
14
14
 
15
15
  const ActivityLogScreen = () => {
16
+ const t = useTranslations();
16
17
  const { params = {} } = useRoute();
17
18
  const { sensor } = params;
18
19
  const { data, isLoading, isRefreshing, onLoadMore, onRefresh } =
@@ -0,0 +1,143 @@
1
+ import { useIsFocused, useNavigation } from '@react-navigation/native';
2
+ import { useTranslations } from '../../hooks/Common/useTranslations';
3
+ import React, { useCallback, useEffect, useState } from 'react';
4
+ import { SafeAreaView, ScrollView, TouchableOpacity, View } from 'react-native';
5
+
6
+ import { API } from '../../configs';
7
+ import { Section, RadioCircle, ViewButtonBottom } from '../../commons';
8
+ import { axiosGet } from '../../utils/Apis/axios';
9
+ import Text from '../../commons/Text';
10
+ import Routes from '../../utils/Route';
11
+ import { TESTID } from '../../configs/Constants';
12
+ import styles from './SelectSubUnitStyles';
13
+ import Button from '../../commons/Button';
14
+
15
+ const AddCommonSelectSubUnit = ({ route }) => {
16
+ const t = useTranslations();
17
+ const navigation = useNavigation();
18
+ const isFocused = useIsFocused();
19
+ const { addType, unit_id } = route.params;
20
+ const [selectedIndex, setSelectedIndex] = useState(-1);
21
+ const [unit, setUnit] = useState([]);
22
+ const [title, setTitle] = useState('');
23
+ const [subTitle, setSubTitle] = useState('');
24
+
25
+ useEffect(() => {
26
+ switch (addType) {
27
+ case 'AddNewGateway':
28
+ setTitle(t('add_new_gateway'));
29
+ setSubTitle(t('select_a_sub_unit'));
30
+ break;
31
+ default:
32
+ setTitle(t('add_new_gateway'));
33
+ setSubTitle(t('select_a_sub_unit'));
34
+ break;
35
+ }
36
+ }, [title, subTitle, addType, t]);
37
+
38
+ const fetchDetails = useCallback(async () => {
39
+ const { success, data } = await axiosGet(
40
+ API.UNIT.UNIT_DETAIL(unit_id),
41
+ {},
42
+ true
43
+ );
44
+ if (success) {
45
+ setUnit(data);
46
+ }
47
+ }, [unit_id]);
48
+
49
+ useEffect(() => {
50
+ isFocused && fetchDetails();
51
+ }, [fetchDetails, isFocused]);
52
+
53
+ const subUnits = unit.stations || [];
54
+
55
+ const onPressNext = useCallback(() => {
56
+ switch (addType) {
57
+ case 'AddNewGateway':
58
+ navigation.navigate(Routes.ScanChipQR, {
59
+ station: subUnits[selectedIndex].id,
60
+ unit_name: unit.name,
61
+ ...route.params,
62
+ });
63
+ break;
64
+ default:
65
+ break;
66
+ }
67
+ }, [addType, navigation, subUnits, selectedIndex, unit.name, route.params]);
68
+
69
+ const handleSelectIndex = (index) => {
70
+ if (index !== selectedIndex) {
71
+ setSelectedIndex(index);
72
+ } else {
73
+ setSelectedIndex(-1);
74
+ }
75
+ };
76
+
77
+ const addSubUnit = useCallback(() => {
78
+ navigation.navigate(Routes.AddSubUnitStack, {
79
+ screen: Routes.AddSubUnit,
80
+ params: { unit, ...route.params },
81
+ });
82
+ }, [navigation, unit, route.params]);
83
+
84
+ return (
85
+ <SafeAreaView style={styles.container}>
86
+ <Text semibold style={styles.title}>
87
+ {title}
88
+ </Text>
89
+ <Text style={styles.subtitle}>{subTitle}</Text>
90
+ <View style={styles.contentContainer}>
91
+ <ScrollView
92
+ style={styles.scrollContainer}
93
+ showsVerticalScrollIndicator={false}
94
+ >
95
+ <Section type={'border'}>
96
+ {subUnits.map((item, index) => (
97
+ <TouchableOpacity
98
+ key={index}
99
+ style={styles.rowContainer}
100
+ onPress={() => handleSelectIndex(index)}
101
+ >
102
+ <RadioCircle
103
+ active={selectedIndex === index}
104
+ testID={TESTID.SELECT_UNIT_RADIO_BUTTON}
105
+ />
106
+ <TouchableOpacity
107
+ style={styles.row}
108
+ onPress={() => handleSelectIndex(index)}
109
+ testID={TESTID.SELECT_UNIT_SELECT}
110
+ >
111
+ <Text style={styles.text} testID={TESTID.SELECT_UNIT_NAME}>
112
+ {item.name}
113
+ </Text>
114
+ </TouchableOpacity>
115
+ </TouchableOpacity>
116
+ ))}
117
+ </Section>
118
+ <View style={styles.buttonAdd}>
119
+ <Button
120
+ type="primaryBorder"
121
+ title={`${t('add_new_sub_unit')} +`}
122
+ onPress={addSubUnit}
123
+ width="auto"
124
+ height={32}
125
+ textType="setupBorder"
126
+ textSemiBold={false}
127
+ />
128
+ </View>
129
+ </ScrollView>
130
+ <ViewButtonBottom
131
+ leftTitle={t('cancel')}
132
+ onLeftClick={() => navigation.goBack()}
133
+ rightTitle={t('next')}
134
+ rightDisabled={selectedIndex === -1}
135
+ onRightClick={onPressNext}
136
+ testIDPrefix={TESTID.PREFIX.SELECT_UNIT}
137
+ />
138
+ </View>
139
+ </SafeAreaView>
140
+ );
141
+ };
142
+
143
+ export default AddCommonSelectSubUnit;
@@ -0,0 +1,55 @@
1
+ import { Colors } from '../../configs';
2
+
3
+ import { StyleSheet, StatusBar, Platform } from 'react-native';
4
+
5
+ export default StyleSheet.create({
6
+ container: {
7
+ flex: 1,
8
+ backgroundColor: Colors.Gray2,
9
+ paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
10
+ },
11
+ contentContainer: {
12
+ flex: 1,
13
+ justifyContent: 'space-between',
14
+ },
15
+ scrollContainer: {
16
+ width: '100%',
17
+ flex: 1,
18
+ },
19
+ title: {
20
+ color: Colors.Gray9,
21
+ fontSize: 20,
22
+ lineHeight: 28,
23
+ marginTop: 8,
24
+ marginBottom: 4,
25
+ marginLeft: 16,
26
+ },
27
+ subtitle: {
28
+ color: Colors.Gray8,
29
+ fontSize: 14,
30
+ lineHeight: 22,
31
+ marginLeft: 16,
32
+ marginBottom: 16,
33
+ },
34
+ row: {
35
+ flex: 1,
36
+ paddingVertical: 16,
37
+ borderBottomColor: Colors.Gray4,
38
+ borderBottomWidth: 1,
39
+ marginRight: 24,
40
+ marginLeft: 16,
41
+ },
42
+ rowContainer: {
43
+ flexDirection: 'row',
44
+ alignItems: 'center',
45
+ paddingLeft: 16,
46
+ },
47
+ text: {
48
+ fontSize: 16,
49
+ lineHeight: 24,
50
+ color: Colors.Gray9,
51
+ },
52
+ buttonAdd: {
53
+ marginHorizontal: 16,
54
+ },
55
+ });
@@ -1,5 +1,5 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
- import { t } from 'i18n-js';
2
+ import { useTranslations } from '../../hooks/Common/useTranslations';
3
3
  import React, { useCallback, useEffect, useState } from 'react';
4
4
  import {
5
5
  SafeAreaView,
@@ -19,6 +19,7 @@ import Routes from '../../utils/Route';
19
19
  import { TESTID } from '../../configs/Constants';
20
20
 
21
21
  const AddCommonSelectUnit = ({ route }) => {
22
+ const t = useTranslations();
22
23
  const navigation = useNavigation();
23
24
  const { addType } = route.params;
24
25
  const [selectedIndex, setSelectedIndex] = useState(-1);
@@ -49,7 +50,7 @@ const AddCommonSelectUnit = ({ route }) => {
49
50
  setSubTitle(t('add_new_subunit_select_unit'));
50
51
  break;
51
52
  }
52
- }, [title, subTitle, addType]);
53
+ }, [title, subTitle, addType, t]);
53
54
 
54
55
  useEffect(() => {
55
56
  (async () => {
@@ -3,7 +3,7 @@ import { View, StyleSheet } from 'react-native';
3
3
  import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
4
4
  import { getStatusBarHeight } from 'react-native-iphone-x-helper';
5
5
  import { useNavigation } from '@react-navigation/native';
6
- import { t } from 'i18n-js';
6
+ import { useTranslations } from '../../hooks/Common/useTranslations';
7
7
 
8
8
  import { Colors } from '../../configs';
9
9
  import Text from '../../commons/Text';
@@ -17,6 +17,7 @@ const initialRegion = {
17
17
  };
18
18
 
19
19
  const AddLocationMaps = memo(() => {
20
+ const t = useTranslations();
20
21
  const { goBack } = useNavigation();
21
22
  const [color, setColor] = useState(Colors.Black);
22
23
  useEffect(() => {
@@ -0,0 +1,43 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors, Constants } from '../../../configs';
3
+
4
+ const marginItem = 12;
5
+ const marginHorizontal = 16;
6
+ const widthItem = (Constants.width - marginHorizontal * 2 - marginItem) / 2;
7
+ const heightItem = (widthItem / 166) * 96;
8
+
9
+ export default StyleSheet.create({
10
+ container: {
11
+ padding: 12,
12
+ borderRadius: 10,
13
+ shadowColor: Colors.Shadow,
14
+ shadowOffset: {
15
+ width: 0,
16
+ height: 2,
17
+ },
18
+ shadowOpacity: 0.1,
19
+ shadowRadius: 3,
20
+ elevation: 4,
21
+ width: widthItem,
22
+ height: heightItem,
23
+ backgroundColor: Colors.White,
24
+ justifyContent: 'space-between',
25
+ marginBottom: 16,
26
+ },
27
+ active: {
28
+ borderColor: Colors.Primary,
29
+ borderWidth: 2,
30
+ },
31
+ boxIcon: {
32
+ flexDirection: 'row',
33
+ justifyContent: 'space-between',
34
+ },
35
+ lineHeight22: {
36
+ lineHeight: 22,
37
+ },
38
+ iconSensor: {
39
+ width: 40,
40
+ height: 40,
41
+ resizeMode: 'contain',
42
+ },
43
+ });
@@ -0,0 +1,33 @@
1
+ import React, { memo } from 'react';
2
+ import { TouchableWithoutFeedback, View } from 'react-native';
3
+ import { Colors } from '../../../configs';
4
+ import Text from '../../../commons/Text';
5
+ import IconComponent from '../../../commons/IconComponent';
6
+ import styles from './DeviceStyles';
7
+
8
+ const Device = memo(({ svgMain, sensor, title, isSelectDevice, onPress }) => {
9
+ const isActive = isSelectDevice && styles.active;
10
+
11
+ const onPressDevice = () => {
12
+ onPress && onPress(sensor);
13
+ };
14
+
15
+ return (
16
+ <TouchableWithoutFeedback onPress={onPressDevice}>
17
+ <View style={[styles.container, isActive]}>
18
+ <View style={styles.boxIcon}>
19
+ <IconComponent
20
+ icon={svgMain}
21
+ iconKit={sensor.icon_kit}
22
+ style={styles.iconSensor}
23
+ />
24
+ </View>
25
+ <Text numberOfLines={1} semibold type="Body" color={Colors.Gray9}>
26
+ {title}
27
+ </Text>
28
+ </View>
29
+ </TouchableWithoutFeedback>
30
+ );
31
+ });
32
+
33
+ export default Device;