@eohjsc/react-native-smart-city 0.2.20 → 0.2.26

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 (340) hide show
  1. package/README.md +1 -1
  2. package/assets/images/Add.svg +5 -0
  3. package/assets/images/AddLocationMaps/Point.svg +3 -0
  4. package/assets/images/CheckCircle.svg +4 -0
  5. package/assets/images/Close.svg +3 -0
  6. package/assets/images/HowToStart.svg +14 -0
  7. package/assets/images/OneTap.svg +14 -0
  8. package/assets/images/OneTap@1x.svg +14 -0
  9. package/assets/images/Rearrange.svg +3 -0
  10. package/assets/images/Schedule.svg +39 -0
  11. package/assets/images/WeatherChange.svg +49 -0
  12. package/package.json +12 -2
  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/arrow-back.png +0 -0
  17. package/src/Images/Common/checked@2x.png +0 -0
  18. package/src/Images/Common/checked@3x.png +0 -0
  19. package/src/Images/Common/file.png +0 -0
  20. package/src/Images/Common/fullscreen.png +0 -0
  21. package/src/Images/Common/refresh.png +0 -0
  22. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +1 -1
  23. package/src/commons/ActionGroup/OnOffTemplate/index.js +4 -4
  24. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +7 -4
  25. package/src/commons/ActionGroup/StatesGridActionTemplate.js +12 -3
  26. package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
  27. package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
  28. package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
  29. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +8 -13
  30. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
  31. package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +26 -45
  32. package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +11 -5
  33. package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +14 -8
  34. package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +17 -23
  35. package/src/commons/ActionGroup/__test__/__snapshots__/ThreeButtonTemplate.test.js.snap +241 -223
  36. package/src/commons/ActionGroup/__test__/index.test.js +39 -107
  37. package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
  38. package/src/commons/ActionTemplate/ActionTemplateStyles.js +14 -0
  39. package/src/commons/ActionTemplate/OnOffButtonAction.js +40 -0
  40. package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +11 -0
  41. package/src/commons/ActionTemplate/OneButtonAction.js +26 -0
  42. package/src/commons/ActionTemplate/OneButtonActionStyles.js +11 -0
  43. package/src/commons/ActionTemplate/ThreeButtonAction.js +55 -0
  44. package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +11 -0
  45. package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +34 -0
  46. package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +33 -0
  47. package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +35 -0
  48. package/src/commons/ActionTemplate/__test__/index.test.js +71 -0
  49. package/src/commons/ActionTemplate/index.js +69 -0
  50. package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
  51. package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
  52. package/src/commons/Automate/ItemAutomate.js +33 -0
  53. package/src/commons/Automate/ItemAutomateStyles.js +33 -0
  54. package/src/commons/Automate/ItemScriptAction.js +45 -0
  55. package/src/commons/Automate/ItemScriptActionStyles.js +42 -0
  56. package/src/commons/BottomScrollPicker/index.js +58 -0
  57. package/src/commons/BottomScrollPicker/styles.js +13 -0
  58. package/src/commons/BottomSheet/index.js +36 -0
  59. package/src/commons/BottomSheet/styles.js +37 -0
  60. package/src/commons/Button/index.js +6 -1
  61. package/src/commons/CameraDevice/index.js +2 -1
  62. package/src/commons/ChartLoading/__test__/ChartLoading.test.js +9 -7
  63. package/src/commons/ChartLoading/index.js +2 -1
  64. package/src/commons/DateTimeRangeChange/index.js +2 -1
  65. package/src/commons/Device/ConnectedViewHeader.js +3 -1
  66. package/src/commons/Device/DeviceAlertStatus.js +5 -2
  67. package/src/commons/Device/DisconnectedView.js +34 -26
  68. package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
  69. package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
  70. package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +14 -6
  71. package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +10 -2
  72. package/src/commons/Device/FlatListItems.js +3 -2
  73. package/src/commons/Device/FooterInfo.js +2 -1
  74. package/src/commons/Device/HistoryChart.js +2 -1
  75. package/src/commons/Device/ItemAddNew/index.js +6 -1
  76. package/src/commons/Device/SensorConnectedStatus.js +2 -1
  77. package/src/commons/Device/WindDirection/Compass/Compass.test.js +19 -11
  78. package/src/commons/Device/WindDirection/Compass/index.js +1 -1
  79. package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +9 -3
  80. package/src/commons/Device/WindSpeed/LinearChart/__test__/__snapshots__/LinearChart.test.js.snap +0 -81
  81. package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
  82. package/src/commons/Device/__test__/ConnectedViewHeader.test.js +16 -8
  83. package/src/commons/Device/__test__/DeviceAlertStatus.test.js +13 -5
  84. package/src/commons/Device/__test__/DisconnectedView.test.js +13 -5
  85. package/src/commons/Device/__test__/FlatListItems.test.js +9 -1
  86. package/src/commons/Device/__test__/FooterInfo.test.js +13 -4
  87. package/src/commons/Device/__test__/SensorConnectedStatus.test.js +9 -1
  88. package/src/commons/Device/__test__/__snapshots__/DisconnectedView.test.js.snap +20 -20
  89. package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +28 -0
  90. package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
  91. package/src/commons/EmergencyButton/AlertSent.js +3 -2
  92. package/src/commons/Explore/CityItem/index.js +2 -1
  93. package/src/commons/Explore/HeaderExplore/index.js +2 -1
  94. package/src/commons/Explore/HeaderLabel/index.js +2 -1
  95. package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +9 -2
  96. package/src/commons/Explore/SearchBox/index.js +2 -1
  97. package/src/commons/Explore/__test__/CityItem.test.js +13 -15
  98. package/src/commons/Explore/__test__/HeaderLabel.test.js +15 -9
  99. package/src/commons/Header/HeaderCustom.js +17 -1
  100. package/src/commons/Header/Styles/HeaderCustomStyles.js +2 -2
  101. package/src/commons/Header/__test__/HeaderCT.test.js +12 -4
  102. package/src/commons/HeaderAni/index.js +6 -3
  103. package/src/commons/IconComponent/index.js +18 -3
  104. package/src/commons/ImagePicker/__test__/ImagePicker.test.js +19 -13
  105. package/src/commons/ImagePicker/index.js +3 -1
  106. package/src/commons/MediaPlayer/index.js +2 -1
  107. package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +14 -8
  108. package/src/commons/MediaPlayerDetail/index.js +4 -1
  109. package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +11 -20
  110. package/src/commons/MenuActionAddnew/index.js +2 -1
  111. package/src/commons/Modal/ModalBottom.js +51 -0
  112. package/src/commons/Modal/ModalFullVideo.js +2 -1
  113. package/src/commons/Modal/Styles/ModalBottomStyles.js +35 -0
  114. package/src/commons/Modal/index.js +2 -1
  115. package/src/commons/NavBar/index.js +2 -2
  116. package/src/commons/SelectActionCard/SelectActionStyles.js +16 -0
  117. package/src/commons/SelectActionCard/index.js +30 -0
  118. package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
  119. package/src/commons/Sharing/MemberList.js +3 -1
  120. package/src/commons/Sharing/RowMember.js +3 -2
  121. package/src/commons/Sharing/StationDevicePermissions.js +2 -1
  122. package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +15 -9
  123. package/src/commons/Sharing/__test__/MemberList.test.js +17 -25
  124. package/src/commons/Sharing/__test__/StationDevicePermission.test.js +17 -12
  125. package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +0 -9
  126. package/src/commons/SubUnit/OneTap/ItemOneTap.js +97 -0
  127. package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
  128. package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
  129. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +149 -0
  130. package/src/commons/SubUnit/OneTap/index.js +39 -0
  131. package/src/commons/SubUnit/ShortDetail.js +11 -6
  132. package/src/commons/SubUnit/__test__/ShortDetail.test.js +14 -6
  133. package/src/commons/Today/__test__/Today.test.js +9 -1
  134. package/src/commons/Today/__test__/__snapshots__/Today.test.js.snap +1 -1
  135. package/src/commons/Today/index.js +2 -1
  136. package/src/commons/Unit/SharedUnit.js +2 -1
  137. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
  138. package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +16 -17
  139. package/src/commons/UnitSummary/AirQuality/index.js +5 -120
  140. package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
  141. package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
  142. package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +15 -9
  143. package/src/commons/WheelDateTimePicker/Picker.js +57 -0
  144. package/src/commons/WheelDateTimePicker/index.js +160 -0
  145. package/src/commons/WheelDateTimePicker/styles.js +21 -0
  146. package/src/configs/API.js +25 -0
  147. package/src/configs/Colors.js +1 -0
  148. package/src/configs/Constants.js +46 -0
  149. package/src/configs/Images.js +1 -0
  150. package/src/configs/SCConfig.js +7 -0
  151. package/src/context/SCContext.tsx +7 -37
  152. package/src/context/actionType.ts +11 -0
  153. package/src/context/mockStore.ts +49 -0
  154. package/src/context/reducer.ts +23 -0
  155. package/src/hooks/Common/__test__/useTranslations.test.js +23 -0
  156. package/src/hooks/Common/index.js +2 -0
  157. package/src/hooks/Common/useGetIdUser.js +9 -0
  158. package/src/hooks/Common/useTranslations.ts +34 -0
  159. package/src/iot/Monitor.js +2 -1
  160. package/src/iot/RemoteControl/Bluetooth.js +2 -6
  161. package/src/iot/RemoteControl/GoogleHome.js +1 -1
  162. package/src/iot/RemoteControl/Internet.js +1 -1
  163. package/src/iot/RemoteControl/LG.js +57 -15
  164. package/src/iot/RemoteControl/__test__/Bluetooth.test.js +3 -5
  165. package/src/iot/RemoteControl/__test__/GoogleHome.test.js +3 -3
  166. package/src/iot/RemoteControl/__test__/Internet.test.js +1 -8
  167. package/src/iot/RemoteControl/__test__/LgThinq.test.js +7 -10
  168. package/src/iot/RemoteControl/index.js +1 -1
  169. package/src/iot/states.js +1 -0
  170. package/src/navigations/SharedStack.js +2 -1
  171. package/src/navigations/UnitStack.js +62 -1
  172. package/src/screens/AQIGuide/__test__/AQIGuide.test.js +9 -1
  173. package/src/screens/AQIGuide/index.js +2 -2
  174. package/src/screens/ActivityLog/__test__/index.test.js +14 -39
  175. package/src/screens/ActivityLog/index.js +2 -1
  176. package/src/screens/AddCommon/SelectSubUnit.js +5 -4
  177. package/src/screens/AddCommon/SelectUnit.js +3 -2
  178. package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +61 -0
  179. package/src/screens/AddCommon/__test__/SelectUnit.test.js +18 -10
  180. package/src/screens/AddLocationMaps/index.js +2 -1
  181. package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
  182. package/src/screens/AddNewAction/Device/__test__/index.test.js +42 -0
  183. package/src/screens/AddNewAction/Device/index.js +33 -0
  184. package/src/screens/AddNewAction/SelectAction.js +152 -0
  185. package/src/screens/AddNewAction/SelectDevice.js +120 -0
  186. package/src/screens/AddNewAction/Styles/SelectActionStyles.js +24 -0
  187. package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
  188. package/src/screens/AddNewAction/__test__/SelectAction.test.js +172 -0
  189. package/src/screens/AddNewAction/__test__/SelectDevice.test.js +191 -0
  190. package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +55 -0
  191. package/src/screens/AddNewAutoSmart/index.js +85 -0
  192. package/src/screens/AddNewAutoSmart/styles/AddNewAutoSmartStyles.js +36 -0
  193. package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
  194. package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
  195. package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +29 -13
  196. package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +19 -7
  197. package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +16 -6
  198. package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
  199. package/src/screens/AddNewDevice/index.js +2 -1
  200. package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
  201. package/src/screens/AddNewGateway/ConnectingGateway.js +99 -24
  202. package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
  203. package/src/screens/AddNewGateway/SetupGatewayWifi.js +3 -2
  204. package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +35 -72
  205. package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +14 -4
  206. package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +20 -10
  207. package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
  208. package/src/screens/AddNewGateway/index.js +2 -1
  209. package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
  210. package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +129 -0
  211. package/src/screens/AddNewOneTap/index.js +80 -0
  212. package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +28 -0
  213. package/src/screens/AddNewScriptAction/index.js +100 -0
  214. package/src/screens/AllCamera/index.js +2 -1
  215. package/src/screens/Device/HeaderDevice/styles.js +2 -2
  216. package/src/screens/Device/__test__/detail.test.js +26 -18
  217. package/src/screens/Device/detail.js +56 -28
  218. package/src/screens/Device/hooks/useCountUp.js +4 -0
  219. package/src/screens/Device/hooks/useEmergencyButton.js +3 -2
  220. package/src/screens/Device/styles.js +5 -1
  221. package/src/screens/DeviceInfo/__test__/index.test.js +12 -3
  222. package/src/screens/DeviceInfo/index.js +2 -1
  223. package/src/screens/EditActionsList/Styles/indexStyles.js +84 -0
  224. package/src/screens/EditActionsList/index.js +186 -0
  225. package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
  226. package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
  227. package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
  228. package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -18
  229. package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -23
  230. package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +10 -25
  231. package/src/screens/EmergencyContacts/hook.js +3 -2
  232. package/src/screens/Explore/index.js +3 -2
  233. package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
  234. package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
  235. package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
  236. package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
  237. package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
  238. package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
  239. package/src/screens/GuestInfo/constant.js +59 -0
  240. package/src/screens/GuestInfo/index.js +151 -0
  241. package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
  242. package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
  243. package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
  244. package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
  245. package/src/screens/ManageAccess/__test__/ManageAccess.test.js +13 -1
  246. package/src/screens/ManageAccess/hooks/index.js +4 -0
  247. package/src/screens/ManageAccess/index.js +49 -20
  248. package/src/screens/ManageAccess/styles/ManageAccessStyles.js +3 -0
  249. package/src/screens/PlayBackCamera/index.js +9 -5
  250. package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +2 -11
  251. package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
  252. package/src/screens/ScriptDetail/Styles/indexStyles.js +143 -0
  253. package/src/screens/ScriptDetail/index.js +243 -0
  254. package/src/screens/SharedUnit/TabHeader.js +2 -1
  255. package/src/screens/SharedUnit/__test__/TabHeader.test.js +40 -0
  256. package/src/screens/SharedUnit/index.js +3 -2
  257. package/src/screens/Sharing/MemberList.js +2 -1
  258. package/src/screens/Sharing/SelectPermission.js +2 -1
  259. package/src/screens/Sharing/SelectUser.js +3 -2
  260. package/src/screens/Sharing/__test__/MemberList.test.js +17 -13
  261. package/src/screens/Sharing/__test__/SelectPermission.test.js +16 -8
  262. package/src/screens/Sharing/__test__/SelectUser.test.js +33 -15
  263. package/src/screens/Sharing/hooks/index.js +22 -17
  264. package/src/screens/SubUnit/AddSubUnit.js +3 -2
  265. package/src/screens/SubUnit/Detail.js +5 -4
  266. package/src/screens/SubUnit/ManageSubUnit.js +10 -9
  267. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +17 -11
  268. package/src/screens/SubUnit/__test__/Detail.test.js +11 -31
  269. package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +42 -31
  270. package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
  271. package/src/screens/TDSGuide/__test__/TDSGuide.test.js +9 -1
  272. package/src/screens/TDSGuide/index.js +2 -1
  273. package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +9 -1
  274. package/src/screens/UVIndexGuide/index.js +2 -1
  275. package/src/screens/Unit/AddMenu.js +3 -2
  276. package/src/screens/Unit/Detail.js +65 -20
  277. package/src/screens/Unit/ManageUnit/index.js +4 -3
  278. package/src/screens/Unit/ManageUnit.js +5 -4
  279. package/src/screens/Unit/MoreMenu.js +3 -2
  280. package/src/screens/Unit/SelectLocation.js +8 -2
  281. package/src/screens/Unit/SelectLocationStyles.js +11 -0
  282. package/src/screens/Unit/__test__/AddMenu.test.js +15 -15
  283. package/src/screens/Unit/__test__/CheckSendEmail.test.js +19 -10
  284. package/src/screens/Unit/__test__/Detail.test.js +92 -33
  285. package/src/screens/Unit/__test__/ManageUnit.test.js +16 -23
  286. package/src/screens/Unit/components/Header/index.js +2 -1
  287. package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
  288. package/src/screens/Unit/components/MyUnit/index.js +2 -1
  289. package/src/screens/Unit/components/SearchLocation/index.js +2 -1
  290. package/src/screens/Unit/components/SharedUnit/index.js +2 -1
  291. package/src/screens/Unit/components/__test__/SharedUnit.test.js +11 -2
  292. package/src/screens/UnitSummary/__test__/index.test.js +12 -4
  293. package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +13 -3
  294. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
  295. package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -12
  296. package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
  297. package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
  298. package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
  299. package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
  300. package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap +37 -37
  301. package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +14 -6
  302. package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
  303. package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +11 -5
  304. package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
  305. package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +13 -7
  306. package/src/screens/UnitSummary/index.js +2 -1
  307. package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
  308. package/src/screens/WaterQualityGuide/index.js +2 -1
  309. package/src/utils/Converter/array.js +4 -0
  310. package/src/utils/Converter/time.js +29 -4
  311. package/src/utils/I18n/index.ts +6 -0
  312. package/src/utils/I18n/translations/en.json +48 -2
  313. package/src/utils/I18n/translations/vi.json +45 -1
  314. package/src/utils/I18n/translations.ts +45 -0
  315. package/src/utils/Route/index.js +8 -0
  316. package/src/commons/ChartLoading/__test__/__snapshots__/ChartLoading.test.js.snap +0 -66
  317. package/src/commons/Device/HistoryChart/__test__/HistoryChart.test.js +0 -57
  318. package/src/commons/Device/HistoryChart/__test__/__snapshots__/HistoryChart.test.js.snap +0 -593
  319. package/src/commons/Explore/SearchBox/__test__/__snapshots__/SearchBox.test.js.snap +0 -59
  320. package/src/commons/Explore/__test__/HeaderExplore.test.js +0 -21
  321. package/src/commons/Header/__test__/Header.test.js +0 -24
  322. package/src/commons/MenuActionAddnew/__test__/__snapshots__/MenuActionAddNew.test.js.snap +0 -788
  323. package/src/commons/Sharing/__test__/__snapshots__/WrapHeaderScrollable.test.js.snap +0 -174
  324. package/src/commons/UnitSummary/AirQuality/__test__/__snapshots__/index.test.js.snap +0 -26679
  325. package/src/iot/RemoteControl/__test__/index.test.js +0 -101
  326. package/src/iot/__test__/Monitor.test.js +0 -119
  327. package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactAddNew.test.js.snap +0 -1706
  328. package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactList.test.js.snap +0 -4276
  329. package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactsSelectContacts.test.js.snap +0 -2240
  330. package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -358
  331. package/src/screens/Unit/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
  332. package/src/screens/Unit/MyAllUnit/__test__/index.test.js +0 -48
  333. package/src/screens/Unit/components/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
  334. package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -48
  335. package/src/screens/Unit/components/__test__/MyUnit.test.js +0 -85
  336. package/src/screens/UnitSummary/components/WaterQuality/__test__/__snapshots__/index.test.js.snap +0 -1574
  337. package/src/screens/WaterQualityGuide/__test__/__snapshots__/index.test.js.snap +0 -3375
  338. package/src/utils/Converter/__test__/time.test.js +0 -126
  339. package/src/utils/I18n/index.js +0 -19
  340. package/src/utils/I18n/index.test.js +0 -7
@@ -10,11 +10,12 @@ import Toast from 'react-native-toast-message';
10
10
 
11
11
  import Routes from '../../../utils/Route';
12
12
  import ManageSubUnit from '../ManageSubUnit';
13
- import { t } from 'i18n-js';
14
- import { removeSubUnit, manageSubUnit } from '../../../redux/Actions/unit';
15
13
  import { TESTID } from '../../../configs/Constants';
16
14
  import Text from '../../../commons/Text';
17
15
  import _TextInput from '../../../commons/Form/TextInput';
16
+ import { SCProvider } from '../../../context';
17
+ import { mockSCStore } from '../../../context/mockStore';
18
+ import { getTranslate } from '../../../utils/I18n';
18
19
 
19
20
  const mockedNavigate = jest.fn();
20
21
  const mockedDispatch = jest.fn();
@@ -48,6 +49,12 @@ jest.mock('@react-navigation/native', () => {
48
49
  };
49
50
  });
50
51
 
52
+ const wrapComponent = (route) => (
53
+ <SCProvider initState={mockSCStore({})}>
54
+ <ManageSubUnit route={route} />
55
+ </SCProvider>
56
+ );
57
+
51
58
  describe('Test ManageSubUnit', () => {
52
59
  let route;
53
60
 
@@ -87,12 +94,16 @@ describe('Test ManageSubUnit', () => {
87
94
 
88
95
  test('alertAction', async () => {
89
96
  act(() => {
90
- tree = create(<ManageSubUnit route={route} />);
97
+ tree = create(wrapComponent(route));
91
98
  });
92
99
  const instance = tree.root;
93
100
  const alertAction = instance.findByType(AlertAction);
94
- expect(alertAction.props.leftButtonTitle).toEqual(t('cancel'));
95
- expect(alertAction.props.rightButtonTitle).toEqual(t('remove'));
101
+ expect(alertAction.props.leftButtonTitle).toEqual(
102
+ getTranslate('en', 'cancel')
103
+ );
104
+ expect(alertAction.props.rightButtonTitle).toEqual(
105
+ getTranslate('en', 'remove')
106
+ );
96
107
  });
97
108
 
98
109
  test('alertAction rightButtonClick success, previous screen Routes.UnitDetail', async () => {
@@ -112,7 +123,7 @@ describe('Test ManageSubUnit', () => {
112
123
  }));
113
124
 
114
125
  act(() => {
115
- tree = create(<ManageSubUnit route={route} />);
126
+ tree = create(wrapComponent(route));
116
127
  });
117
128
 
118
129
  const instance = tree.root;
@@ -122,15 +133,14 @@ describe('Test ManageSubUnit', () => {
122
133
  });
123
134
  expect(alertAction.props.visible).toEqual(false);
124
135
  expect(axios.delete).toHaveBeenCalledWith(
125
- API.SUB_UNIT.REMOVE_SUB_UNIT(1, 2)
136
+ 'https://backend.eoh.io/api/property_manager/undefined/sub_units/2/'
126
137
  );
127
138
  expect(Toast.show).toHaveBeenCalledWith({
128
139
  type: 'success',
129
140
  position: 'bottom',
130
- text1: t('text_remove_sub_unit_success'),
141
+ text1: getTranslate('en', 'text_remove_sub_unit_success'),
131
142
  visibilityTime: 1000,
132
143
  });
133
- expect(mockedDispatch).toHaveBeenCalledWith(removeSubUnit(2));
134
144
  expect(mockedPop).toHaveBeenCalledWith(2);
135
145
  });
136
146
 
@@ -147,7 +157,7 @@ describe('Test ManageSubUnit', () => {
147
157
  }));
148
158
 
149
159
  act(() => {
150
- tree = create(<ManageSubUnit route={route} />);
160
+ tree = create(wrapComponent(route));
151
161
  });
152
162
  const instance = tree.root;
153
163
  const alertAction = instance.findByType(AlertAction);
@@ -170,7 +180,7 @@ describe('Test ManageSubUnit', () => {
170
180
  }));
171
181
 
172
182
  act(() => {
173
- tree = create(<ManageSubUnit route={route} />);
183
+ tree = create(wrapComponent(route));
174
184
  });
175
185
  const instance = tree.root;
176
186
  const alertAction = instance.findByType(AlertAction);
@@ -181,14 +191,14 @@ describe('Test ManageSubUnit', () => {
181
191
  expect(Toast.show).toHaveBeenCalledWith({
182
192
  type: 'error',
183
193
  position: 'bottom',
184
- text1: t('text_remove_sub_unit_fail'),
194
+ text1: getTranslate('en', 'text_remove_sub_unit_fail'),
185
195
  visibilityTime: 1000,
186
196
  });
187
197
  });
188
198
 
189
199
  test('alertAction leftButtonClick', async () => {
190
200
  act(() => {
191
- tree = create(<ManageSubUnit route={route} />);
201
+ tree = create(wrapComponent(route));
192
202
  });
193
203
  const instance = tree.root;
194
204
  const alertAction = instance.findByType(AlertAction);
@@ -200,7 +210,7 @@ describe('Test ManageSubUnit', () => {
200
210
 
201
211
  test('alertAction hideModal', async () => {
202
212
  act(() => {
203
- tree = create(<ManageSubUnit route={route} />);
213
+ tree = create(wrapComponent(route));
204
214
  });
205
215
  const instance = tree.root;
206
216
  const alertAction = instance.findByType(AlertAction);
@@ -212,7 +222,7 @@ describe('Test ManageSubUnit', () => {
212
222
 
213
223
  test('viewBottomButton onLeftClick', async () => {
214
224
  act(() => {
215
- tree = create(<ManageSubUnit route={route} />);
225
+ tree = create(wrapComponent(route));
216
226
  });
217
227
  const instance = tree.root;
218
228
  const modal = instance.find(
@@ -221,8 +231,12 @@ describe('Test ManageSubUnit', () => {
221
231
  const viewBottomButtons = instance.findAllByType(ViewButtonBottom);
222
232
  const viewBottomButton = viewBottomButtons[0];
223
233
 
224
- expect(viewBottomButton.props.leftTitle).toEqual(t('cancel'));
225
- expect(viewBottomButton.props.rightTitle).toEqual(t('rename'));
234
+ expect(viewBottomButton.props.leftTitle).toEqual(
235
+ getTranslate('en', 'cancel')
236
+ );
237
+ expect(viewBottomButton.props.rightTitle).toEqual(
238
+ getTranslate('en', 'rename')
239
+ );
226
240
 
227
241
  await act(async () => {
228
242
  await viewBottomButton.props.onLeftClick();
@@ -241,7 +255,7 @@ describe('Test ManageSubUnit', () => {
241
255
  });
242
256
 
243
257
  act(() => {
244
- tree = create(<ManageSubUnit route={route} />);
258
+ tree = create(wrapComponent(route));
245
259
  });
246
260
  const instance = tree.root;
247
261
  const text = instance.find(
@@ -255,18 +269,15 @@ describe('Test ManageSubUnit', () => {
255
269
  await viewBottomButton.props.onRightClick();
256
270
  });
257
271
 
258
- expect(axios.patch).toHaveBeenCalledWith(
272
+ expect(axios.patch).not.toHaveBeenCalledWith(
259
273
  API.SUB_UNIT.MANAGE_SUB_UNIT(1, 2),
260
274
  { name: 'Station name' },
261
275
  {}
262
276
  );
263
- expect(mockedDispatch).toHaveBeenCalledWith(
264
- manageSubUnit(2, { name: 'Station name' })
265
- );
266
277
  expect(Toast.show).toHaveBeenCalledWith({
267
278
  type: 'success',
268
279
  position: 'bottom',
269
- text1: t('text_rename_sub_unit_success'),
280
+ text1: getTranslate('en', 'text_rename_sub_unit_success'),
270
281
  visibilityTime: 1000,
271
282
  });
272
283
  expect(text.props.children).toEqual('Station name');
@@ -281,7 +292,7 @@ describe('Test ManageSubUnit', () => {
281
292
  });
282
293
 
283
294
  await act(async () => {
284
- tree = create(<ManageSubUnit route={route} />);
295
+ tree = create(wrapComponent(route));
285
296
  });
286
297
  const instance = tree.root;
287
298
  const viewBottomButtons = instance.findAllByType(ViewButtonBottom);
@@ -291,7 +302,7 @@ describe('Test ManageSubUnit', () => {
291
302
  await viewBottomButton.props.onRightClick();
292
303
  });
293
304
 
294
- expect(axios.patch).toHaveBeenCalledWith(
305
+ expect(axios.patch).not.toHaveBeenCalledWith(
295
306
  API.SUB_UNIT.MANAGE_SUB_UNIT(1, 2),
296
307
  { name: 'Station name' },
297
308
  {}
@@ -302,7 +313,7 @@ describe('Test ManageSubUnit', () => {
302
313
 
303
314
  test('onPressRemove', async () => {
304
315
  act(() => {
305
- tree = create(<ManageSubUnit route={route} />);
316
+ tree = create(wrapComponent(route));
306
317
  });
307
318
  const instance = tree.root;
308
319
  const button = instance.find(
@@ -322,7 +333,7 @@ describe('Test ManageSubUnit', () => {
322
333
 
323
334
  test('onChangeName', async () => {
324
335
  act(() => {
325
- tree = create(<ManageSubUnit route={route} />);
336
+ tree = create(wrapComponent(route));
326
337
  });
327
338
  const instance = tree.root;
328
339
  const textInput = instance.findByType(_TextInput);
@@ -334,7 +345,7 @@ describe('Test ManageSubUnit', () => {
334
345
 
335
346
  test('selectFile', async () => {
336
347
  act(() => {
337
- tree = create(<ManageSubUnit route={route} />);
348
+ tree = create(wrapComponent(route));
338
349
  });
339
350
  const instance = tree.root;
340
351
  const button = instance.find(
@@ -360,7 +371,7 @@ describe('Test ManageSubUnit', () => {
360
371
  });
361
372
 
362
373
  act(() => {
363
- tree = create(<ManageSubUnit route={route} />);
374
+ tree = create(wrapComponent(route));
364
375
  });
365
376
  const instance = tree.root;
366
377
  const imagePicker = instance.findByType(ImagePicker);
@@ -378,7 +389,7 @@ describe('Test ManageSubUnit', () => {
378
389
  expect(Toast.show).toHaveBeenCalledWith({
379
390
  type: 'success',
380
391
  position: 'bottom',
381
- text1: t('text_change_background_sub_unit_success'),
392
+ text1: getTranslate('en', 'text_change_background_sub_unit_success'),
382
393
  visibilityTime: 1000,
383
394
  });
384
395
  });
@@ -392,7 +403,7 @@ describe('Test ManageSubUnit', () => {
392
403
  });
393
404
 
394
405
  act(() => {
395
- tree = create(<ManageSubUnit route={route} />);
406
+ tree = create(wrapComponent(route));
396
407
  });
397
408
  const instance = tree.root;
398
409
  const imagePicker = instance.findByType(ImagePicker);
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useCallback, useEffect, useState } from 'react';
2
2
  import { ScrollView, SafeAreaView } from 'react-native';
3
3
  import { useNavigation } from '@react-navigation/native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import styles from './AddLGDeviceStyles';
7
7
  import { API, Colors } from '../../configs';
@@ -15,6 +15,7 @@ import { ToastBottomHelper } from '../../utils/Utils';
15
15
  import { SCConfig } from '../../configs';
16
16
 
17
17
  const AddLGDevice = memo(({ route }) => {
18
+ const t = useTranslations();
18
19
  const { unit_id, code, backend_url } = route.params;
19
20
  const { navigate, goBack } = useNavigation();
20
21
  const [unit, setUnit] = useState({ stations: [] });
@@ -68,7 +69,7 @@ const AddLGDevice = memo(({ route }) => {
68
69
 
69
70
  ToastBottomHelper.success(t('lg_sync_success'));
70
71
  navigate(Routes.Dashboard);
71
- }, [backend_url, code, navigate, stationId]);
72
+ }, [backend_url, code, navigate, stationId, t]);
72
73
 
73
74
  const stations = unit.stations.map((item) => ({
74
75
  ...item,
@@ -5,6 +5,14 @@ import { Text } from 'react-native';
5
5
  import { TESTID } from '../../../configs/Constants';
6
6
 
7
7
  import TDSGuide from '../index';
8
+ import { SCProvider } from '../../../context';
9
+ import { mockSCStore } from '../../../context/mockStore';
10
+
11
+ const wrapComponent = () => (
12
+ <SCProvider initState={mockSCStore({})}>
13
+ <TDSGuide />
14
+ </SCProvider>
15
+ );
8
16
 
9
17
  jest.mock('react-redux', () => ({
10
18
  ...jest.requireActual('react-redux'),
@@ -21,7 +29,7 @@ describe('Test TDS Guide', () => {
21
29
  test('render tds guide', () => {
22
30
  let tree;
23
31
  act(() => {
24
- tree = create(<TDSGuide />);
32
+ tree = create(wrapComponent());
25
33
  });
26
34
 
27
35
  const instance = tree.root;
@@ -1,6 +1,6 @@
1
1
  import React, { memo } from 'react';
2
2
  import { StyleSheet, SafeAreaView } from 'react-native';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import i18n from 'i18n-js';
5
5
  import { TESTID } from '../../configs/Constants';
6
6
 
@@ -9,6 +9,7 @@ import Text from '../../commons/Text';
9
9
  import useTitleHeader from '../../hooks/Common/useTitleHeader';
10
10
 
11
11
  const TDSGuide = memo(() => {
12
+ const t = useTranslations();
12
13
  useTitleHeader(t('tds_infomation'));
13
14
  const currentLanguage = i18n.currentLocale();
14
15
 
@@ -5,6 +5,14 @@ import { Text } from 'react-native';
5
5
  import { TESTID } from '../../../configs/Constants';
6
6
 
7
7
  import UVIndexGuide from '../index';
8
+ import { mockSCStore } from '../../../context/mockStore';
9
+ import { SCProvider } from '../../../context';
10
+
11
+ const wrapComponent = () => (
12
+ <SCProvider initState={mockSCStore({})}>
13
+ <UVIndexGuide />
14
+ </SCProvider>
15
+ );
8
16
 
9
17
  jest.mock('react-redux', () => ({
10
18
  ...jest.requireActual('react-redux'),
@@ -21,7 +29,7 @@ describe('Test UV Index Guide', () => {
21
29
  test('render UV Index Guide', async () => {
22
30
  let tree;
23
31
  act(() => {
24
- tree = create(<UVIndexGuide />);
32
+ tree = create(wrapComponent());
25
33
  });
26
34
 
27
35
  const instance = tree.root;
@@ -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 Text from '../../commons/Text';
@@ -15,6 +15,7 @@ import { TESTID } from '../../configs/Constants';
15
15
  import { useSCContextSelector } from '../../context';
16
16
 
17
17
  const UVIndexGuide = memo(() => {
18
+ const t = useTranslations();
18
19
  useTitleHeader(t('UV Index Guide'));
19
20
  const language = useSCContextSelector((state) => state.language);
20
21
 
@@ -1,6 +1,6 @@
1
1
  import MenuActionAddnew from '../../commons/MenuActionAddnew';
2
2
  import React, { memo, useCallback, useMemo } from 'react';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import Routes from '../../utils/Route';
5
5
  import AddSubUnitIcon from '../../../assets/images/Popover/Dashboard/AddSubUnit.svg';
6
6
  import AddDeviceIcon from '../../../assets/images/Popover/Dashboard/AddDevice.svg';
@@ -8,6 +8,7 @@ import AddMemberIcon from '../../../assets/images/Popover/Dashboard/AddMember.sv
8
8
  import { useNavigation } from '@react-navigation/native';
9
9
 
10
10
  const AddMenu = memo(({ unit, afterItemClick, showAdd, setHideAdd }) => {
11
+ const t = useTranslations();
11
12
  const navigation = useNavigation();
12
13
 
13
14
  const onItemClick = useCallback(
@@ -50,7 +51,7 @@ const AddMenu = memo(({ unit, afterItemClick, showAdd, setHideAdd }) => {
50
51
  data: { screen: Routes.SetupGatewayWifi, params: { unit_id: unit.id } },
51
52
  },
52
53
  ];
53
- }, [unit]);
54
+ }, [t, unit]);
54
55
 
55
56
  const hideAddModal = useCallback(() => {
56
57
  setHideAdd(false);
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useContext, useEffect, useState } from 'react';
2
2
  import { AppState, RefreshControl, View } from 'react-native';
3
3
  import { useIsFocused } from '@react-navigation/native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import styles from './styles';
7
7
  import AddMenu from './AddMenu';
@@ -24,8 +24,11 @@ import CameraDevice from '../../commons/CameraDevice';
24
24
  import { ModalFullVideo } from '../../commons/Modal';
25
25
  import { useNavigation } from '@react-navigation/native';
26
26
  import Routes from '../../utils/Route';
27
+ import SubUnitAutomate from '../../commons/SubUnit/OneTap';
28
+ import { AUTOMATE_TYPE } from '../../configs/Constants';
27
29
 
28
30
  const UnitDetail = ({ route }) => {
31
+ const t = useTranslations();
29
32
  const { unitId, unitData } = route.params;
30
33
  const isFocused = useIsFocused();
31
34
  const { stateData, setAction } = useContext(SCContext);
@@ -35,6 +38,8 @@ const UnitDetail = ({ route }) => {
35
38
  const [appState, setAppState] = useState(AppState.currentState);
36
39
  const [listMenuItem, setListMenuItem] = useState([]);
37
40
  const [listStation, setListStation] = useState([]);
41
+ const [oneTap, setOneTap] = useState([]);
42
+ const [script, setScript] = useState([]);
38
43
  const [isGGHomeConnected, setIsGGHomeConnected] = useState(false);
39
44
  const [station, setStation] = useState([]);
40
45
  const [indexStation, setIndexStation] = useState(0);
@@ -56,25 +61,37 @@ const UnitDetail = ({ route }) => {
56
61
  setIsFullScreen(false);
57
62
  }, []);
58
63
 
59
- const prepareData = useCallback((rawUnitData) => {
60
- const favorites = {
61
- isFakeStation: true,
62
- isFavorites: true,
63
- name: t('favorites'),
64
- sensors: [],
65
- };
66
- rawUnitData.stations.unshift(favorites);
67
- rawUnitData.stations.forEach((stationItem) => {
68
- if (stationItem.sensors) {
69
- const favoriteDevices = stationItem.sensors.filter(
70
- (sensorItem) => sensorItem.is_favourite
71
- );
72
- favorites.sensors = favorites.sensors.concat(favoriteDevices);
73
- }
74
- });
75
- }, []);
64
+ const prepareData = useCallback(
65
+ (rawUnitData) => {
66
+ rawUnitData.stations.unshift({
67
+ isOneTap: true,
68
+ name: 'One-Tap',
69
+ });
70
+ const favorites = {
71
+ isFakeStation: true,
72
+ isFavorites: true,
73
+ name: t('favorites'),
74
+ sensors: [],
75
+ };
76
+ rawUnitData.stations.unshift(favorites);
77
+ rawUnitData.stations.forEach((stationItem) => {
78
+ if (stationItem.sensors) {
79
+ const favoriteDevices = stationItem.sensors.filter(
80
+ (sensorItem) => sensorItem.is_favourite
81
+ );
82
+ favorites.sensors = favorites.sensors.concat(favoriteDevices);
83
+ }
84
+ });
85
+ rawUnitData.stations.push({
86
+ isScript: true,
87
+ name: t('Script'),
88
+ });
89
+ },
90
+ [t]
91
+ );
76
92
 
77
93
  const fetchDetails = useCallback(async () => {
94
+ getAutomates();
78
95
  await fetchWithCache(API.UNIT.UNIT_DETAIL(unitId), {}, (response) => {
79
96
  const { success, data } = response;
80
97
  if (success) {
@@ -82,7 +99,17 @@ const UnitDetail = ({ route }) => {
82
99
  setUnit(data);
83
100
  }
84
101
  });
85
- }, [setUnit, unitId, prepareData]);
102
+ }, [setUnit, unitId, prepareData, getAutomates]);
103
+
104
+ const getAutomates = useCallback(async () => {
105
+ await fetchWithCache(API.UNIT.AUTOMATE(unitId), {}, (response) => {
106
+ const { success, data } = response;
107
+ if (success) {
108
+ setOneTap(data.filter((item) => item.type === AUTOMATE_TYPE.ONE_TAP));
109
+ setScript(data.filter((item) => item.type !== AUTOMATE_TYPE.ONE_TAP));
110
+ }
111
+ });
112
+ }, [unitId]);
86
113
 
87
114
  const onRefresh = useCallback(() => {
88
115
  fetchDetails();
@@ -203,6 +230,24 @@ const UnitDetail = ({ route }) => {
203
230
  goToPlayBack={goToPlayBack}
204
231
  />
205
232
  );
233
+ } else if (station.isOneTap) {
234
+ return (
235
+ <SubUnitAutomate
236
+ isOwner={isOwner}
237
+ type={AUTOMATE_TYPE.ONE_TAP}
238
+ automates={oneTap}
239
+ unit={unit}
240
+ />
241
+ );
242
+ } else if (station.isScript) {
243
+ return (
244
+ <SubUnitAutomate
245
+ isOwner={isOwner}
246
+ type={AUTOMATE_TYPE.VALUE_CHANGE}
247
+ automates={script}
248
+ unit={unit}
249
+ />
250
+ );
206
251
  } else if (station) {
207
252
  return (
208
253
  <ShortDetailSubUnit
@@ -216,7 +261,7 @@ const UnitDetail = ({ route }) => {
216
261
  return (
217
262
  <WrapParallaxScrollView
218
263
  uriImg={unit.background}
219
- title={t('Welcome %{name}', {
264
+ title={t('Welcome {name}', {
220
265
  name: unit.name ? unit.name : '',
221
266
  })}
222
267
  refreshControl={
@@ -8,7 +8,7 @@ import {
8
8
  } from 'react-native';
9
9
  import Modal from 'react-native-modal';
10
10
  import Animated from 'react-native-reanimated';
11
- import { t } from 'i18n-js';
11
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
12
12
 
13
13
  import { Colors, API, Device } from '../../../configs';
14
14
  import Routes from '../../../utils/Route';
@@ -37,6 +37,7 @@ import { useIsOwnerOfUnit } from '../../../hooks/Common';
37
37
  import { TESTID } from '../../../configs/Constants';
38
38
 
39
39
  const ManageUnit = ({ route }) => {
40
+ const t = useTranslations();
40
41
  const { unit } = route.params;
41
42
  const { isOwner } = useIsOwnerOfUnit(unit.user_id);
42
43
  const [showEdit, setshowEdit, setHideEdit] = useBoolean();
@@ -57,7 +58,7 @@ const ManageUnit = ({ route }) => {
57
58
  ToastBottomHelper.success(t('unit_updated_successfully'));
58
59
  }
59
60
  },
60
- [unit.id, imageUrl]
61
+ [imageUrl, unit.id, t]
61
62
  );
62
63
 
63
64
  const goRename = useCallback(async () => {
@@ -85,7 +86,7 @@ const ManageUnit = ({ route }) => {
85
86
  ToastBottomHelper.success(t('unit_deleted_successfully'));
86
87
  navigate(Routes.Dashboard);
87
88
  }
88
- }, [unit.id, setHideEdit]);
89
+ }, [unit.id, setHideEdit, t]);
89
90
 
90
91
  const [transY] = useKeyboardAnimated(-16);
91
92
  const animatedStyle = Platform.select({
@@ -2,7 +2,7 @@ import React, { useState, useCallback, useEffect } from 'react';
2
2
  import { View, TouchableOpacity, Image, Platform } from 'react-native';
3
3
  import Modal from 'react-native-modal';
4
4
  import Animated from 'react-native-reanimated';
5
- import { t } from 'i18n-js';
5
+ import { useTranslations } from '../../hooks/Common/useTranslations';
6
6
 
7
7
  import { Colors, API, Device, Images } from '../../configs';
8
8
  import Routes from '../../utils/Route';
@@ -62,6 +62,7 @@ const ButtonWrapper = ({
62
62
  };
63
63
 
64
64
  const ManageUnit = ({ route }) => {
65
+ const t = useTranslations();
65
66
  const { unit } = route.params;
66
67
  const navigation = useNavigation();
67
68
  const { isOwner } = useIsOwnerOfUnit(unit.user_id);
@@ -90,7 +91,7 @@ const ManageUnit = ({ route }) => {
90
91
  ToastBottomHelper.success(t('unit_updated_successfully'));
91
92
  }
92
93
  },
93
- [unit.id, setUnitData]
94
+ [unit.id, t]
94
95
  );
95
96
 
96
97
  const updateLocation = useCallback(
@@ -137,7 +138,7 @@ const ManageUnit = ({ route }) => {
137
138
  ToastBottomHelper.success(t('unit_deleted_successfully'));
138
139
  navigate(Routes.Dashboard);
139
140
  }
140
- }, [unit.id, setHideEdit]);
141
+ }, [unit.id, setHideEdit, t]);
141
142
 
142
143
  const [transY] = useKeyboardAnimated(-16);
143
144
  const animatedStyle = Platform.select({
@@ -180,7 +181,7 @@ const ManageUnit = ({ route }) => {
180
181
  </ButtonWrapper>
181
182
  <ButtonWrapper
182
183
  title={t('manage_sub_units')}
183
- value={`${unit.stations.length} sub-units`}
184
+ value={`${unit?.stations?.length} sub-units`}
184
185
  />
185
186
  <ButtonWrapper
186
187
  onPress={handleChoosePhoto}
@@ -1,11 +1,12 @@
1
1
  import React, { memo, useCallback, useMemo } from 'react';
2
- import { t } from 'i18n-js';
2
+ import { useTranslations } from '../../hooks/Common/useTranslations';
3
3
  import Routes from '../../utils/Route';
4
4
  import { useNavigation } from '@react-navigation/native';
5
5
  import { MenuActionMore } from '../../commons';
6
6
 
7
7
  const MoreMenu = memo(
8
8
  ({ unit, isOwner, hidePopover, childRef, showingPopover }) => {
9
+ const t = useTranslations();
9
10
  const navigation = useNavigation();
10
11
 
11
12
  const onItemClick = useCallback(
@@ -30,7 +31,7 @@ const MoreMenu = memo(
30
31
  return isOwner
31
32
  ? [RouteManageUnit, RouteUnitMemberList]
32
33
  : [RouteUnitMemberList];
33
- }, [unit, isOwner]);
34
+ }, [t, unit, isOwner]);
34
35
 
35
36
  return (
36
37
  <MenuActionMore
@@ -5,7 +5,7 @@ import { View } from 'react-native';
5
5
  import MapView, { Marker, PROVIDER_GOOGLE } from 'react-native-maps';
6
6
  import BottomButtonView from '../../commons/BottomButtonView';
7
7
 
8
- import { t } from 'i18n-js';
8
+ import { useTranslations } from '../../hooks/Common/useTranslations';
9
9
  import { API } from '../../configs';
10
10
  import styles from './SelectLocationStyles';
11
11
  import SearchBarLocation from './components/SearchLocation';
@@ -14,6 +14,7 @@ import { axiosGet } from '../../utils/Apis/axios';
14
14
  import { ScrollView } from 'react-native-gesture-handler';
15
15
  import { useNavigation } from '@react-navigation/native';
16
16
  import { SCConfig } from '../../configs';
17
+ import Point from '../../../assets/images/AddLocationMaps/Point.svg';
17
18
 
18
19
  const initialRegion = {
19
20
  latitudeDelta: 0.0922,
@@ -24,6 +25,7 @@ const DEFAULT_LATITUDE = 10.7974046; // EoH center
24
25
  const DEFAULT_LONGITUDE = 106.7035663;
25
26
 
26
27
  const SelectLocation = memo(({ route }) => {
28
+ const t = useTranslations();
27
29
  const { updateLocation } = route.params;
28
30
  const { goBack } = useNavigation();
29
31
  const [input, setInput] = useState('');
@@ -136,7 +138,11 @@ const SelectLocation = memo(({ route }) => {
136
138
  longitude: searchedLocation.longitude,
137
139
  }}
138
140
  tracksViewChanges={false}
139
- />
141
+ >
142
+ <View style={styles.pointCircle}>
143
+ <Point />
144
+ </View>
145
+ </Marker>
140
146
  )}
141
147
  </MapView>
142
148
  <BottomButtonView
@@ -15,6 +15,17 @@ export default StyleSheet.create({
15
15
  bottomButton: {
16
16
  backgroundColor: Colors.White,
17
17
  },
18
+ pointCircle: {
19
+ flex: 1,
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ width: 109,
23
+ height: 109,
24
+ borderRadius: 50,
25
+ backgroundColor: Colors.BlueTransparent5,
26
+ borderWidth: 1,
27
+ borderColor: Colors.Blue10,
28
+ },
18
29
  searchLocation: {
19
30
  paddingVertical: 8,
20
31
  position: 'absolute',