@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 React from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import { Colors } from '../../configs';
5
5
  import Text from '../../commons/Text';
6
6
 
@@ -12,6 +12,8 @@ const MemberList = ({
12
12
  currentUserId, //user is using app
13
13
  onPressRemove,
14
14
  }) => {
15
+ const t = useTranslations();
16
+
15
17
  return (
16
18
  <View style={styles.box}>
17
19
  {!!dataMember.length &&
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useMemo } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import { IconOutline } from '@ant-design/icons-react-native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Colors } from '../../configs';
7
7
  import Text from '../../commons/Text';
@@ -19,6 +19,7 @@ const arrColor = [
19
19
  ];
20
20
  const RowMember = memo(
21
21
  ({ member, index, ownerId, currentUserId, onPressRemove }) => {
22
+ const t = useTranslations();
22
23
  const canRemoveMember = useMemo(
23
24
  () => ownerId === currentUserId && member.id !== ownerId,
24
25
  [currentUserId, member.id, ownerId]
@@ -30,7 +31,7 @@ const RowMember = memo(
30
31
  : member.id === currentUserId
31
32
  ? [t('me'), Colors.Gray6]
32
33
  : ['', ''],
33
- [currentUserId, member.id, ownerId]
34
+ [currentUserId, member.id, ownerId, t]
34
35
  );
35
36
  const paddingBottom = role ? 16 : 23;
36
37
 
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useState, useCallback } from 'react';
2
2
  import { View, StyleSheet, TouchableOpacity } from 'react-native';
3
3
  import { IconOutline } from '@ant-design/icons-react-native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
  import { Colors } from '../../configs';
6
6
  import Text from '../../commons/Text';
7
7
  import SensorIcon from '../../../assets/images/Device/sensor.svg';
@@ -14,6 +14,7 @@ import DoorInactive from '../../../assets/images/Device/door-inactive.svg';
14
14
  import DevicePermissionsCheckbox from './DevicePermissionsCheckbox';
15
15
 
16
16
  const StationDevicePermissions = memo(({ dataStation, onselectSensor }) => {
17
+ const t = useTranslations();
17
18
  const [listChosen, setListChosen] = useState({}); // { sensorId : indexConfigChoosen , ...}
18
19
  const [expandedIndex, setExpandedIndex] = useState(-1);
19
20
 
@@ -0,0 +1,86 @@
1
+ import React, { memo, useCallback } from 'react';
2
+ import { TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native';
3
+ import { IconOutline } from '@ant-design/icons-react-native';
4
+ import moment from 'moment';
5
+ import Text from '../../Text';
6
+ import { API, Colors } from '../../../configs';
7
+ import OneTap from '../../../../assets/images/OneTap.svg';
8
+ import CheckCircle from '../../../../assets/images/CheckCircle.svg';
9
+ import FImage from '../../FImage';
10
+ import { timeDifference } from '../../../utils/Converter/time';
11
+ import styles from './ItemOneTapStyles.js';
12
+ import { ToastBottomHelper } from '../../../utils/Utils';
13
+ import { axiosPost } from '../../../utils/Apis/axios';
14
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
15
+ import { useNavigation } from '@react-navigation/core';
16
+ import Routes from '../../../utils/Route';
17
+
18
+ const ItemOneTap = memo(({ automate }) => {
19
+ const { navigate } = useNavigation();
20
+ const { id, script, activate_at } = automate;
21
+
22
+ const t = useTranslations();
23
+ const goToDetail = useCallback(() => {
24
+ navigate(Routes.ScriptDetail, { id, name: script?.name });
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ }, []);
27
+
28
+ const handleScriptAction = useCallback(async () => {
29
+ const { success } = await axiosPost(API.AUTOMATE.ACTION_ONE_TAP(id));
30
+ if (success) {
31
+ ToastBottomHelper.success(t('Activated successfully.'));
32
+ } else {
33
+ ToastBottomHelper.error(t('Activation failed.'));
34
+ }
35
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
+ }, [id]);
37
+
38
+ const displayIcon = () => {
39
+ const iconKit = script?.icon_kit;
40
+ return iconKit ? (
41
+ <FImage source={{ uri: iconKit }} style={styles.iconSensor} />
42
+ ) : (
43
+ <OneTap />
44
+ );
45
+ };
46
+ const activateAt = activate_at
47
+ ? timeDifference(new Date(), moment(activate_at), true)
48
+ : null;
49
+ return (
50
+ <TouchableWithoutFeedback onPress={goToDetail}>
51
+ <View style={styles.container}>
52
+ <View style={styles.boxIcon}>
53
+ {displayIcon()}
54
+ <TouchableOpacity onPress={handleScriptAction}>
55
+ <CheckCircle />
56
+ </TouchableOpacity>
57
+ </View>
58
+ <TouchableOpacity onPress={goToDetail}>
59
+ <Text
60
+ numberOfLines={1}
61
+ semibold
62
+ size={14}
63
+ color={Colors.Gray9}
64
+ type="Body"
65
+ >
66
+ {script?.name}
67
+ </Text>
68
+ <View style={styles.descriptionContainer}>
69
+ <Text
70
+ numberOfLines={1}
71
+ semibold
72
+ size={12}
73
+ color={Colors.Gray8}
74
+ type="Label"
75
+ >
76
+ {activateAt && t('activated_time', { time: activateAt })}
77
+ </Text>
78
+ <IconOutline name="right" size={12} />
79
+ </View>
80
+ </TouchableOpacity>
81
+ </View>
82
+ </TouchableWithoutFeedback>
83
+ );
84
+ });
85
+
86
+ export default ItemOneTap;
@@ -0,0 +1,41 @@
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) * 106;
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: 8,
26
+ },
27
+ boxIcon: {
28
+ flexDirection: 'row',
29
+ justifyContent: 'space-between',
30
+ },
31
+ descriptionContainer: {
32
+ flexDirection: 'row',
33
+ justifyContent: 'space-between',
34
+ alignItems: 'center',
35
+ },
36
+ iconSensor: {
37
+ width: 40,
38
+ height: 40,
39
+ resizeMode: 'contain',
40
+ },
41
+ });
@@ -0,0 +1,36 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors, Device } from '../../../configs';
3
+
4
+ export default StyleSheet.create({
5
+ boxImage: {
6
+ flexDirection: 'row',
7
+ marginTop: 8,
8
+ marginBottom: 8,
9
+ overflow: 'hidden',
10
+ width: Device.screenWidth - 32,
11
+ alignSelf: 'center',
12
+ },
13
+ image: {
14
+ width: '100%',
15
+ height: 160,
16
+ },
17
+ boxDevices: {
18
+ flexWrap: 'wrap',
19
+ flexDirection: 'row',
20
+ marginTop: 16,
21
+ justifyContent: 'space-between',
22
+ },
23
+ noShadow: {
24
+ shadowOpacity: 0,
25
+ elevation: 0,
26
+ },
27
+ viewAll: {
28
+ color: Colors.Orange,
29
+ },
30
+ UnitsHeading: {
31
+ flexDirection: 'row',
32
+ justifyContent: 'space-between',
33
+ alignItems: 'center',
34
+ paddingBottom: 3,
35
+ },
36
+ });
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import styles from './OneTapStyles.js';
4
+ import { Section } from '../..';
5
+
6
+ import ItemAddNew from '../../Device/ItemAddNew';
7
+ import ItemOneTap from './ItemOneTap';
8
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
9
+ import { useNavigation } from '@react-navigation/native';
10
+ import Routes from '../../../utils/Route/index.js';
11
+
12
+ const SubUnitOneTap = ({ automates }) => {
13
+ const t = useTranslations();
14
+ const navigation = useNavigation();
15
+ const handleOnAddNew = () => {
16
+ navigation.navigate(Routes.AddNewOneTap);
17
+ };
18
+ return (
19
+ <Section style={styles.noShadow}>
20
+ <View style={styles.boxDevices}>
21
+ <ItemAddNew title={t('add_new')} onAddNew={handleOnAddNew} />
22
+ {!!automates.length &&
23
+ automates.map((item) => <ItemOneTap automate={item} />)}
24
+ </View>
25
+ </Section>
26
+ );
27
+ };
28
+
29
+ export default SubUnitOneTap;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, View } 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 { Images, Device } from '../../configs';
7
7
  import { TESTID } from '../../configs/Constants';
@@ -19,6 +19,7 @@ const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
19
19
  );
20
20
 
21
21
  const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
22
+ const t = useTranslations();
22
23
  const { navigate } = useNavigation();
23
24
  const renderCamera = () => {
24
25
  if (station?.camera) {
@@ -32,6 +33,7 @@ const ShortDetailSubUnit = ({ unit, station, isGGHomeConnected }) => {
32
33
  >
33
34
  <MediaPlayer
34
35
  uri={station.camera.uri}
36
+ previewUri={station.camera.preview_uri}
35
37
  thumbnail={{
36
38
  uri: station.background,
37
39
  }}
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import moment from 'moment';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
  import i18n from 'i18n-js';
6
6
 
7
7
  import { Colors } from '../../configs';
8
8
  import Text from '../../commons/Text';
9
9
 
10
10
  const TodayComponent = ({ style }) => {
11
+ const t = useTranslations();
11
12
  const getCurrentDate = () => {
12
13
  const currentLanguage = i18n.currentLocale();
13
14
  moment.locale(currentLanguage);
@@ -1,6 +1,6 @@
1
1
  import React, { Fragment, useCallback } from 'react';
2
2
  import { View, Image, TouchableOpacity } from 'react-native';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../hooks/Common/useTranslations';
4
4
  import { IconOutline, IconFill } from '@ant-design/icons-react-native';
5
5
 
6
6
  import { API, Colors, Images } from '../../configs';
@@ -18,6 +18,7 @@ const SharedUnit = ({
18
18
  index,
19
19
  isOptions = true,
20
20
  }) => {
21
+ const t = useTranslations();
21
22
  const { unit } = item;
22
23
  const goToDetail = useCallback(() => {
23
24
  navigation.navigate(Routes.UnitStack, {
@@ -2,7 +2,6 @@ import React, { useState, useEffect, useCallback } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
3
  import PropTypes from 'prop-types';
4
4
  import Svg, { G, Text, Path } from 'react-native-svg';
5
- import { t } from 'i18n-js';
6
5
 
7
6
  import { Colors } from '../../../../configs';
8
7
  import TextCustom from '../../../../commons/Text';
@@ -255,7 +254,7 @@ SegmentedRoundDisplay.defaultProps = {
255
254
  radius: 90,
256
255
  pos: [0, 100, 200, 300, 400, 500],
257
256
  boxTitle: false,
258
- textHeader: t('text_air_quality_index'),
257
+ textHeader: '',
259
258
  initIndex: 0,
260
259
  };
261
260
 
@@ -1,7 +1,7 @@
1
1
  import React, { memo, useCallback, useMemo, useState } from 'react';
2
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
2
+ import { TouchableOpacity, View } from 'react-native';
3
3
  import { IconOutline } from '@ant-design/icons-react-native';
4
- import { t } from 'i18n-js';
4
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Colors } from '../../../configs';
7
7
  import { Section } from '../../../commons/index';
@@ -10,8 +10,10 @@ import ConfigHistoryChart from '../ConfigHistoryChart';
10
10
 
11
11
  import SegmentedRoundDisplay from './SegmentedRoundDisplay';
12
12
  import { TESTID } from '../../../configs/Constants';
13
+ import styles from './styles';
13
14
 
14
15
  const AirQuality = memo(({ summaryDetail }) => {
16
+ const t = useTranslations();
15
17
  const {
16
18
  outdoor_pm10_id,
17
19
  outdoor_pm2_5_id,
@@ -121,15 +123,8 @@ const AirQuality = memo(({ summaryDetail }) => {
121
123
  totalValue={500}
122
124
  title={outdoorValues[indexOutdoor].title}
123
125
  style={styles.segment}
126
+ textHeader={t('text_air_quality_index')}
124
127
  />
125
-
126
- <TouchableOpacity
127
- style={[styles.touchStatus, { backgroundColor: outdoorColor }]}
128
- >
129
- <Text size={14} color={Colors.White}>
130
- {outdoorStatus}
131
- </Text>
132
- </TouchableOpacity>
133
128
  {!!advices && !!advices.length && (
134
129
  <View style={styles.boxHealth}>
135
130
  <IconOutline name="alert" size={20} style={styles.iconMargin} />
@@ -173,113 +168,3 @@ const AirQuality = memo(({ summaryDetail }) => {
173
168
  });
174
169
 
175
170
  export default AirQuality;
176
-
177
- const styles = StyleSheet.create({
178
- textIndoor: {
179
- color: Colors.Gray9,
180
- fontSize: 20,
181
- marginBottom: 4,
182
- },
183
- textDesIndoor: {
184
- color: Colors.Gray8,
185
- fontSize: 12,
186
- marginBottom: 16,
187
- },
188
- textNotAvailable: {
189
- textAlign: 'center',
190
- },
191
- boxStatus: {
192
- borderRadius: 10,
193
- height: 80,
194
- overflow: 'hidden',
195
- flexDirection: 'row',
196
- marginBottom: 16,
197
- },
198
- boxEmotion: {
199
- height: 80,
200
- width: 80,
201
- backgroundColor: Colors.Yellow6,
202
- justifyContent: 'center',
203
- alignItems: 'center',
204
- },
205
- textStatus: {
206
- fontSize: 16,
207
- color: Colors.Gray9,
208
- marginRight: 24,
209
- textAlign: 'right',
210
- maxWidth: 120,
211
- },
212
- boxTextStatus: {
213
- backgroundColor: Colors.Yellow4,
214
- flex: 1,
215
- alignItems: 'flex-end',
216
- justifyContent: 'center',
217
- },
218
- boxNumber: {
219
- flexDirection: 'row',
220
- justifyContent: 'space-between',
221
- marginBottom: 16,
222
- },
223
- boxHealth: {
224
- flexDirection: 'row',
225
- marginBottom: 12,
226
- alignItems: 'center',
227
- marginTop: 10,
228
- },
229
- boxContentHealth: {
230
- flexDirection: 'row',
231
- alignItems: 'center',
232
- marginBottom: 8,
233
- },
234
- boxDot: {
235
- width: 8,
236
- height: 8,
237
- borderRadius: 4,
238
- backgroundColor: Colors.Yellow6,
239
- marginRight: 8,
240
- },
241
- textOutdoor: {
242
- color: Colors.Gray9,
243
- fontSize: 20,
244
- marginBottom: 24,
245
- marginTop: 16,
246
- },
247
- touchOption: {
248
- borderWidth: 1,
249
- borderColor: Colors.Gray5,
250
- paddingHorizontal: 16,
251
- paddingVertical: 5,
252
- marginHorizontal: 4,
253
- borderRadius: 2,
254
- },
255
- textOption: {
256
- alignSelf: 'center',
257
- marginBottom: 8,
258
- },
259
- touchStatus: {
260
- borderRadius: 100,
261
- paddingHorizontal: 24,
262
- alignSelf: 'center',
263
- paddingVertical: 3,
264
- marginTop: 12,
265
- },
266
- segment: {
267
- marginTop: 36,
268
- alignSelf: 'center',
269
- },
270
- boxOutdoorValues: {
271
- flexDirection: 'row',
272
- justifyContent: 'center',
273
- },
274
- iconMargin: {
275
- marginRight: 8,
276
- },
277
- historyChart: {
278
- paddingHorizontal: 16,
279
- backgroundColor: Colors.White,
280
- borderRadius: 20,
281
- borderWidth: 1,
282
- borderColor: Colors.Gray4,
283
- marginTop: 16,
284
- },
285
- });
@@ -0,0 +1,112 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ import { Colors } from '../../../configs';
4
+
5
+ export default StyleSheet.create({
6
+ textIndoor: {
7
+ color: Colors.Gray9,
8
+ fontSize: 20,
9
+ marginBottom: 4,
10
+ },
11
+ textDesIndoor: {
12
+ color: Colors.Gray8,
13
+ fontSize: 12,
14
+ marginBottom: 16,
15
+ },
16
+ textNotAvailable: {
17
+ textAlign: 'center',
18
+ },
19
+ boxStatus: {
20
+ borderRadius: 10,
21
+ height: 80,
22
+ overflow: 'hidden',
23
+ flexDirection: 'row',
24
+ marginBottom: 16,
25
+ },
26
+ boxEmotion: {
27
+ height: 80,
28
+ width: 80,
29
+ backgroundColor: Colors.Yellow6,
30
+ justifyContent: 'center',
31
+ alignItems: 'center',
32
+ },
33
+ textStatus: {
34
+ fontSize: 16,
35
+ color: Colors.Gray9,
36
+ marginRight: 24,
37
+ textAlign: 'right',
38
+ maxWidth: 120,
39
+ },
40
+ boxTextStatus: {
41
+ backgroundColor: Colors.Yellow4,
42
+ flex: 1,
43
+ alignItems: 'flex-end',
44
+ justifyContent: 'center',
45
+ },
46
+ boxNumber: {
47
+ flexDirection: 'row',
48
+ justifyContent: 'space-between',
49
+ marginBottom: 16,
50
+ },
51
+ boxHealth: {
52
+ flexDirection: 'row',
53
+ marginBottom: 12,
54
+ alignItems: 'center',
55
+ marginTop: 36,
56
+ },
57
+ boxContentHealth: {
58
+ flexDirection: 'row',
59
+ alignItems: 'center',
60
+ marginBottom: 8,
61
+ },
62
+ boxDot: {
63
+ width: 8,
64
+ height: 8,
65
+ borderRadius: 4,
66
+ backgroundColor: Colors.Yellow6,
67
+ marginRight: 8,
68
+ },
69
+ textOutdoor: {
70
+ color: Colors.Gray9,
71
+ fontSize: 20,
72
+ marginBottom: 24,
73
+ marginTop: 16,
74
+ },
75
+ touchOption: {
76
+ borderWidth: 1,
77
+ borderColor: Colors.Gray5,
78
+ paddingHorizontal: 16,
79
+ paddingVertical: 5,
80
+ marginHorizontal: 4,
81
+ borderRadius: 2,
82
+ },
83
+ textOption: {
84
+ paddingTop: 4,
85
+ },
86
+ touchStatus: {
87
+ borderRadius: 100,
88
+ paddingHorizontal: 24,
89
+ alignSelf: 'center',
90
+ paddingVertical: 3,
91
+ marginTop: 12,
92
+ },
93
+ segment: {
94
+ marginTop: 36,
95
+ alignSelf: 'center',
96
+ },
97
+ boxOutdoorValues: {
98
+ flexDirection: 'row',
99
+ justifyContent: 'center',
100
+ },
101
+ iconMargin: {
102
+ marginRight: 8,
103
+ },
104
+ historyChart: {
105
+ paddingHorizontal: 16,
106
+ backgroundColor: Colors.White,
107
+ borderRadius: 20,
108
+ borderWidth: 1,
109
+ borderColor: Colors.Gray4,
110
+ marginTop: 16,
111
+ },
112
+ });
@@ -1,6 +1,6 @@
1
1
  import React, { memo } from 'react';
2
2
  import { View, StyleSheet } from 'react-native';
3
- import { t } from 'i18n-js';
3
+ import { useTranslations } from '../../../hooks/Common/useTranslations';
4
4
 
5
5
  import { Colors } from '../../../configs';
6
6
  import TotalPowerBox from '../TotalPowerBox';
@@ -8,6 +8,7 @@ import Text from '../../Text';
8
8
  import { TESTID } from '../../../configs/Constants';
9
9
 
10
10
  const TotalPowerConsumption = memo(({ time, total }) => {
11
+ const t = useTranslations();
11
12
  return (
12
13
  <View style={styles.container}>
13
14
  <Text color={Colors.Gray9} size={16} style={styles.txtCurrent}>
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+
4
+ import ScrollPicker from 'react-native-wheel-scrollview-picker';
5
+ import Text from '../Text';
6
+
7
+ import { Colors } from '../../configs';
8
+ import styles from './styles';
9
+
10
+ const PickerItem = ({ data, isSelected, align }) => {
11
+ return (
12
+ <View style={styles.wrapText}>
13
+ <Text
14
+ type={isSelected ? 'H2' : 'H3'}
15
+ color={isSelected ? Colors.Gray9 : Colors.Gray6}
16
+ bold={isSelected}
17
+ style={{ textAlign: align }}
18
+ >
19
+ {data.text}
20
+ </Text>
21
+ </View>
22
+ );
23
+ };
24
+
25
+ const Picker = ({
26
+ dataSource,
27
+ selectedIndex,
28
+ onValueChange,
29
+ keyPrefix,
30
+ style,
31
+ align = 'center',
32
+ }) => {
33
+ return (
34
+ <View style={style}>
35
+ <ScrollPicker
36
+ dataSource={dataSource}
37
+ selectedIndex={selectedIndex}
38
+ renderItem={(data, index, isSelected) => (
39
+ <PickerItem
40
+ key={`${keyPrefix}-${index}`}
41
+ data={data}
42
+ isSelected={isSelected}
43
+ align={align}
44
+ />
45
+ )}
46
+ onValueChange={onValueChange}
47
+ wrapperHeight={180}
48
+ wrapperColor={Colors.Transparent}
49
+ itemHeight={60}
50
+ highlightColor={Colors.Transparent}
51
+ highlightBorderWidth={0}
52
+ />
53
+ </View>
54
+ );
55
+ };
56
+
57
+ export default Picker;