@eohjsc/react-native-smart-city 0.2.56 → 0.2.60

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 (126) hide show
  1. package/assets/images/Map/MarkerGeolocation.svg +4 -0
  2. package/assets/images/SonosSpeaker/buttonpause-active.svg +3 -0
  3. package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
  4. package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
  5. package/assets/images/SonosSpeaker/picture-main.svg +6 -0
  6. package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
  7. package/package.json +4 -22
  8. package/src/Images/Common/buttonLeftCurtain.png +0 -0
  9. package/src/Images/Common/buttonPause-center-curtain.png +0 -0
  10. package/src/Images/Common/buttonRightCurtain.png +0 -0
  11. package/src/commons/ActionGroup/CurtainButtonTemplate.js +139 -0
  12. package/src/commons/ActionGroup/CurtainButtonTemplateStyle.js +58 -0
  13. package/src/commons/ActionGroup/__test__/CurtainButtonTemplate.test.js +72 -0
  14. package/src/commons/ActionGroup/index.js +3 -0
  15. package/src/commons/Auth/__test__/AccountList.test.js +33 -0
  16. package/src/commons/CameraDevice/index.js +2 -0
  17. package/src/commons/CardShadow/index.js +1 -1
  18. package/src/commons/CardShadow/styles.js +1 -3
  19. package/src/commons/DateTimeRangeChange/DateTimeButton.js +1 -1
  20. package/src/commons/DateTimeRangeChange/index.js +2 -2
  21. package/src/commons/Device/HistoryChart.js +21 -55
  22. package/src/commons/Device/HorizontalBarChart.js +46 -30
  23. package/src/commons/Device/LinearChart.js +0 -34
  24. package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
  25. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
  26. package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
  27. package/src/commons/Device/SonosSpeaker/index.js +88 -0
  28. package/src/commons/Device/SonosSpeaker/styles.js +57 -0
  29. package/src/commons/Form/CurrencyInput.js +169 -0
  30. package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
  31. package/src/commons/FourButtonFilterHistory/__test__/FourButtonFilterHistory.test.js +48 -0
  32. package/src/commons/FourButtonFilterHistory/index.js +72 -0
  33. package/src/commons/FourButtonFilterHistory/styles.js +22 -0
  34. package/src/commons/MediaPlayerDetail/Styles/MediaPlayerDetailStyles.js +14 -0
  35. package/src/commons/MediaPlayerDetail/index.js +204 -161
  36. package/src/commons/SearchLocation/index.js +0 -1
  37. package/src/commons/Sharing/RowMember.js +7 -2
  38. package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
  39. package/src/commons/SubUnit/ShortDetail.js +12 -6
  40. package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
  41. package/src/commons/UnitSummary/ConfigHistoryChart.js +2 -1
  42. package/src/configs/API.js +13 -3
  43. package/src/configs/Constants.js +14 -4
  44. package/src/configs/Images.js +3 -0
  45. package/src/configs/SCConfig.js +8 -0
  46. package/src/context/actionType.ts +5 -0
  47. package/src/context/mockStore.ts +3 -0
  48. package/src/context/reducer.ts +14 -0
  49. package/src/iot/RemoteControl/Bluetooth.js +14 -0
  50. package/src/iot/RemoteControl/index.js +0 -1
  51. package/src/navigations/UnitStack.js +42 -4
  52. package/src/screens/ActivityLog/FilterPopup.js +1 -1
  53. package/src/screens/ActivityLog/ItemLog.js +11 -2
  54. package/src/screens/ActivityLog/__test__/ItemLog.test.js +46 -0
  55. package/src/screens/ActivityLog/hooks/index.js +1 -0
  56. package/src/screens/ActivityLog/index.js +0 -1
  57. package/src/screens/AddCommon/SelectSubUnit.js +24 -2
  58. package/src/screens/AddCommon/SelectUnit.js +12 -0
  59. package/src/screens/AddLocationMaps/index.js +139 -44
  60. package/src/screens/AddLocationMaps/indexStyle.js +14 -12
  61. package/src/screens/AddNewAction/SelectAction.js +1 -0
  62. package/src/screens/Automate/MultiUnits.js +8 -8
  63. package/src/screens/Automate/__test__/MultiUnits.test.js +2 -2
  64. package/src/screens/Automate/__test__/index.test.js +2 -0
  65. package/src/screens/Automate/index.js +4 -2
  66. package/src/screens/Device/__test__/detail.test.js +3 -7
  67. package/src/screens/Device/components/SensorDisplayItem.js +10 -10
  68. package/src/screens/Device/detail.js +65 -15
  69. package/src/screens/Device/hooks/useDisconnectedDevice.js +32 -26
  70. package/src/screens/Device/styles.js +3 -3
  71. package/src/screens/EmergencySetting/__test__/DropDownItem.test.js +59 -0
  72. package/src/screens/EmergencySetting/__test__/index.test.js +27 -0
  73. package/src/screens/EmergencySetting/components/DropDownItem.js +54 -0
  74. package/src/screens/EmergencySetting/index.js +90 -0
  75. package/src/screens/EmergencySetting/styles/DropDownItem.js +38 -0
  76. package/src/screens/EmergencySetting/styles.js +19 -0
  77. package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +126 -0
  78. package/src/screens/MoveToAnotherSubUnit/index.js +88 -0
  79. package/src/screens/MoveToAnotherSubUnit/styles/MoveToAnotherSubUnitStyles.js +50 -0
  80. package/src/screens/Notification/__test__/Notification.test.js +3 -3
  81. package/src/screens/Notification/components/NotificationItem.js +3 -6
  82. package/src/screens/Notification/index.js +2 -2
  83. package/src/screens/ScriptDetail/Styles/indexStyles.js +0 -1
  84. package/src/screens/ScriptDetail/__test__/index.test.js +13 -0
  85. package/src/screens/ScriptDetail/index.js +20 -17
  86. package/src/screens/SelectUnit/index.js +2 -0
  87. package/src/screens/Sharing/MemberList.js +2 -9
  88. package/src/screens/SubUnit/AddSubUnit.js +79 -59
  89. package/src/screens/SubUnit/AddSubUnitStyles.js +0 -2
  90. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +4 -3
  91. package/src/screens/TDSGuide/index.js +6 -4
  92. package/src/screens/Unit/ChooseLocation.js +96 -0
  93. package/src/screens/Unit/ChooseLocationStyles.js +26 -0
  94. package/src/screens/Unit/Detail.js +14 -2
  95. package/src/screens/Unit/ManageUnit.js +4 -5
  96. package/src/screens/Unit/SelectAddress.js +240 -0
  97. package/src/screens/Unit/SelectAddressStyles.js +48 -0
  98. package/src/screens/Unit/SmartAccountItem.js +1 -1
  99. package/src/screens/Unit/Summaries.js +5 -1
  100. package/src/screens/Unit/__test__/ChooseLocation.test.js +112 -0
  101. package/src/screens/Unit/__test__/SelectAddress.test.js +216 -0
  102. package/src/screens/Unit/components/MyUnitDevice/index.js +21 -5
  103. package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
  104. package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -2
  105. package/src/screens/UnitSummary/components/PowerConsumption/index.js +3 -2
  106. package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
  107. package/src/screens/UnitSummary/index.js +3 -2
  108. package/src/screens/WaterQualityGuide/index.js +1 -0
  109. package/src/utils/Apis/axios.js +17 -5
  110. package/src/utils/I18n/translations/en.json +19 -4
  111. package/src/utils/I18n/translations/vi.json +22 -7
  112. package/src/utils/Route/index.js +4 -1
  113. package/src/utils/Utils.js +22 -2
  114. package/assets/images/AddLocationMaps/PinLocation.svg +0 -3
  115. package/assets/images/AddLocationMaps/Point.svg +0 -3
  116. package/src/commons/ThreeButtonHistory/CalendarHeader.js +0 -35
  117. package/src/commons/ThreeButtonHistory/CalendarHeaderStyles.js +0 -17
  118. package/src/commons/ThreeButtonHistory/SelectMonth.js +0 -53
  119. package/src/commons/ThreeButtonHistory/SelectMonthStyles.js +0 -29
  120. package/src/commons/ThreeButtonHistory/__test__/SelectMonth.test.js +0 -37
  121. package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +0 -231
  122. package/src/commons/ThreeButtonHistory/index.js +0 -281
  123. package/src/commons/ThreeButtonHistory/styles.js +0 -65
  124. package/src/screens/Unit/ManageUnit/index.js +0 -286
  125. package/src/screens/Unit/SelectLocation.js +0 -161
  126. package/src/screens/Unit/SelectLocationStyles.js +0 -114
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="39" viewBox="0 0 24 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12 8.21875C11.0656 8.21875 10.1875 8.58125 9.525 9.24375C9.19945 9.56837 8.94129 9.95415 8.76538 10.3789C8.58947 10.8037 8.49928 11.259 8.5 11.7188C8.5 12.6531 8.86562 13.5312 9.525 14.1938C9.84962 14.5193 10.2354 14.7775 10.6602 14.9534C11.0849 15.1293 11.5403 15.2195 12 15.2188C12.9344 15.2188 13.8125 14.8531 14.475 14.1938C15.1375 13.5312 15.5 12.6531 15.5 11.7188C15.5 10.7844 15.1375 9.90625 14.475 9.24375C13.8125 8.58125 12.9344 8.21875 12 8.21875ZM22.7062 7.03438C22.1179 5.67775 21.2697 4.44944 20.2094 3.41875C19.1456 2.37875 17.8915 1.55331 16.5156 0.9875C15.0844 0.39375 13.5656 0.09375 12 0.09375C10.4344 0.09375 8.91562 0.39375 7.48438 0.984375C6.1 1.55625 4.85938 2.375 3.79063 3.41563C2.73101 4.44689 1.88286 5.67506 1.29375 7.03125C0.684375 8.4375 0.375 9.93125 0.375 11.4688C0.375 13.675 0.903125 15.8719 1.94063 17.9906C2.775 19.6938 3.94063 21.3531 5.40938 22.9312C7.91875 25.625 10.55 27.2719 11.2969 27.7125C11.5089 27.8377 11.7507 27.9036 11.9969 27.9031C12.2406 27.9031 12.4812 27.8406 12.6969 27.7125C13.4437 27.2719 16.075 25.625 18.5844 22.9312C20.0531 21.3562 21.2188 19.6938 22.0531 17.9906C23.0969 15.875 23.625 13.6812 23.625 11.4719C23.625 9.93437 23.3156 8.44063 22.7062 7.03438ZM12 17.2188C8.9625 17.2188 6.5 14.7563 6.5 11.7188C6.5 8.68125 8.9625 6.21875 12 6.21875C15.0375 6.21875 17.5 8.68125 17.5 11.7188C17.5 14.7563 15.0375 17.2188 12 17.2188Z" fill="#1890FF"/>
3
+ <path d="M16.6666 30.2735L15.7266 29.3335L12 33.0602L8.27331 29.3335L7.33331 30.2735L11.06 34.0002L7.33331 37.7268L8.27331 38.6668L12 34.9402L15.7266 38.6668L16.6666 37.7268L12.94 34.0002L16.6666 30.2735Z" fill="#262626"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="25" height="28" viewBox="0 0 25 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.5 28H8.5V0H0.5V28ZM16.5 0V28H24.5V0H16.5Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="23" height="28" viewBox="0 0 23 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.5 0V28L22.5 14L0.5 0Z" fill="#262626"/>
3
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="141" height="142" viewBox="0 0 141 142" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M80.0001 50.5387H60.0001C57.8001 50.5387 56.0001 52.3387 56.0001 54.5387V86.5387C56.0001 88.7387 57.8001 90.5187 60.0001 90.5187L80.0001 90.5387C82.2001 90.5387 84.0001 88.7387 84.0001 86.5387V54.5387C84.0001 52.3387 82.2001 50.5387 80.0001 50.5387ZM70.0001 54.5387C72.2001 54.5387 74.0001 56.3387 74.0001 58.5387C74.0001 60.7387 72.2001 62.5387 70.0001 62.5387C67.7801 62.5387 66.0001 60.7387 66.0001 58.5387C66.0001 56.3387 67.7801 54.5387 70.0001 54.5387ZM70.0001 86.5387C64.4801 86.5387 60.0001 82.0587 60.0001 76.5387C60.0001 71.0187 64.4801 66.5387 70.0001 66.5387C75.5201 66.5387 80.0001 71.0187 80.0001 76.5387C80.0001 82.0587 75.5201 86.5387 70.0001 86.5387ZM70.0001 70.5387C66.6801 70.5387 64.0001 73.2187 64.0001 76.5387C64.0001 79.8587 66.6801 82.5387 70.0001 82.5387C73.3201 82.5387 76.0001 79.8587 76.0001 76.5387C76.0001 73.2187 73.3201 70.5387 70.0001 70.5387Z" fill="white"/>
3
+ <circle cx="70.1245" cy="71" r="70.1245" fill="#E8E8E8"/>
4
+ <path d="M80 50.8755H60C57.8 50.8755 56 52.6755 56 54.8755V86.8755C56 89.0755 57.8 90.8555 60 90.8555L80 90.8755C82.2 90.8755 84 89.0755 84 86.8755V54.8755C84 52.6755 82.2 50.8755 80 50.8755ZM70 54.8755C72.2 54.8755 74 56.6755 74 58.8755C74 61.0755 72.2 62.8755 70 62.8755C67.78 62.8755 66 61.0755 66 58.8755C66 56.6755 67.78 54.8755 70 54.8755ZM70 86.8755C64.48 86.8755 60 82.3955 60 76.8755C60 71.3555 64.48 66.8755 70 66.8755C75.52 66.8755 80 71.3555 80 76.8755C80 82.3955 75.52 86.8755 70 86.8755ZM70 70.8755C66.68 70.8755 64 73.5555 64 76.8755C64 80.1955 66.68 82.8755 70 82.8755C73.32 82.8755 76 80.1955 76 76.8755C76 73.5555 73.32 70.8755 70 70.8755Z" fill="white"/>
5
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle opacity="0.1" cx="100" cy="100" r="100" fill="#00979D"/>
3
+ <circle opacity="0.5" cx="100.477" cy="100.477" r="85.4772" fill="#00979D"/>
4
+ <circle cx="100.124" cy="100.124" r="70.1245" fill="#00979D"/>
5
+ <path d="M110 79.9996H90.0001C87.8001 79.9996 86.0001 81.7996 86.0001 83.9996V116C86.0001 118.2 87.8001 119.98 90.0001 119.98L110 120C112.2 120 114 118.2 114 116V83.9996C114 81.7996 112.2 79.9996 110 79.9996ZM100 83.9996C102.2 83.9996 104 85.7996 104 87.9996C104 90.1996 102.2 91.9996 100 91.9996C97.7801 91.9996 96.0001 90.1996 96.0001 87.9996C96.0001 85.7996 97.7801 83.9996 100 83.9996ZM100 116C94.4801 116 90.0001 111.52 90.0001 106C90.0001 100.48 94.4801 95.9996 100 95.9996C105.52 95.9996 110 100.48 110 106C110 111.52 105.52 116 100 116ZM100 99.9996C96.6801 99.9996 94.0001 102.68 94.0001 106C94.0001 109.32 96.6801 112 100 112C103.32 112 106 109.32 106 106C106 102.68 103.32 99.9996 100 99.9996Z" fill="white"/>
6
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0.5 5.5V10.5H3.83333L8 14.6667V1.33333L3.83333 5.5H0.5ZM6.33333 5.35833V10.6417L4.525 8.83333H2.16667V7.16667H4.525L6.33333 5.35833ZM11.75 8C11.75 6.525 10.9 5.25833 9.66667 4.64167V11.35C10.9 10.7417 11.75 9.475 11.75 8ZM9.66667 0.691666V2.40833C12.075 3.125 13.8333 5.35833 13.8333 8C13.8333 10.6417 12.075 12.875 9.66667 13.5917V15.3083C13.0083 14.55 15.5 11.5667 15.5 8C15.5 4.43333 13.0083 1.45 9.66667 0.691666V0.691666Z" fill="#262626"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.2.56",
4
+ "version": "0.2.60",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -43,11 +43,7 @@
43
43
  "pods": "cd example && pod-install --quiet",
44
44
  "bootstrap": "yarn example && yarn && yarn pods",
45
45
  "build": "sync-files ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src",
46
- "watch": "sync-files --watch ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src",
47
- "test:code-formatter": "prettier src/**/**/*.js --write",
48
- "test:code-formatter-step-1": "prettier --check src/**/*.js",
49
- "test:code-formatter-step-2": "prettier --check src/**/**/*.js",
50
- "test:code-formatter-step-3": "prettier --check src/**/**/**/*.js"
46
+ "watch": "sync-files --watch ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src"
51
47
  },
52
48
  "repository": {
53
49
  "type": "git",
@@ -85,7 +81,6 @@
85
81
  "eslint-plugin-react": "^7.21.5",
86
82
  "eslint-plugin-react-native": "^3.10.0",
87
83
  "factory-girl": "^5.0.4",
88
- "husky": "^2.7.0",
89
84
  "jest": "^26.6.3",
90
85
  "jest-circus": "^26.6.3",
91
86
  "jetifier": "^1.6.6",
@@ -146,6 +141,7 @@
146
141
  "react-hooks-global-state": "^1.0.1",
147
142
  "react-i18next": "^11.8.12",
148
143
  "react-native-alert-async": "^1.0.5",
144
+ "react-native-android-wifi": "^0.0.41",
149
145
  "react-native-appearance": "^0.3.4",
150
146
  "react-native-base64": "^0.1.0",
151
147
  "react-native-ble-plx": "^2.0.1",
@@ -182,6 +178,7 @@
182
178
  "react-native-responsive-fontsize": "^0.5.1",
183
179
  "react-native-safe-area-context": "^3.1.1",
184
180
  "react-native-screens": "^2.9.0",
181
+ "react-native-slider": "^0.11.0",
185
182
  "react-native-snap-carousel": "4.0.0-beta.5",
186
183
  "react-native-super-grid": "^4.0.3",
187
184
  "react-native-svg": "^12.1.0",
@@ -205,21 +202,6 @@
205
202
  "validator": "^13.1.1",
206
203
  "victory-native": "^35.0.1"
207
204
  },
208
- "husky": {
209
- "hooks": {
210
- "pre-commit": "lint-staged",
211
- "pre-push": "yarn jest"
212
- }
213
- },
214
- "lint-staged": {
215
- "*.{js, ts}": [
216
- "yarn lint",
217
- "yarn test:code-formatter",
218
- "yarn test:code-formatter-step-1",
219
- "yarn test:code-formatter-step-2",
220
- "yarn test:code-formatter-step-3"
221
- ]
222
- },
223
205
  "bugs": {
224
206
  "url": "https://github.com/github_account/react-native-smart-city/issues"
225
207
  },
@@ -0,0 +1,139 @@
1
+ import React, { memo, useCallback, useState } from 'react';
2
+ import { TouchableOpacity, View, Switch, Image } from 'react-native';
3
+ import { Icon } from '@ant-design/react-native';
4
+ import { useTranslations } from '../../hooks/Common/useTranslations';
5
+ import styles from './CurtainButtonTemplateStyle';
6
+ import Text from '../Text';
7
+ import { TESTID } from '../../configs/Constants';
8
+ import { Colors, Images } from '../../configs';
9
+ import { Section } from '../../commons/Section';
10
+ import { IconOutline } from '@ant-design/icons-react-native';
11
+
12
+ const CurtainButtonTemplate = memo(({ actionGroup, doAction }) => {
13
+ const t = useTranslations();
14
+ const { configuration } = actionGroup;
15
+ const [lock, setLock] = useState(false);
16
+
17
+ const onButtonOpenPress = useCallback(
18
+ () => doAction(configuration.open_action_data),
19
+ [configuration.open_action_data, doAction]
20
+ );
21
+ const onButtonStopPress = useCallback(
22
+ () => doAction(configuration.stop_action_data),
23
+ [configuration.stop_action_data, doAction]
24
+ );
25
+ const onButtonClosePress = useCallback(
26
+ () => doAction(configuration.close_action_data),
27
+ [configuration.close_action_data, doAction]
28
+ );
29
+ const onChangeSwitch = useCallback(() => {
30
+ if (lock) {
31
+ setLock(false);
32
+ doAction(configuration.action_off_data);
33
+ return;
34
+ }
35
+ doAction(configuration.action_on_data);
36
+ setLock(true);
37
+ }, [
38
+ configuration.action_off_data,
39
+ configuration.action_on_data,
40
+ doAction,
41
+ lock,
42
+ ]);
43
+
44
+ const RenderThreeButtonActions = () => {
45
+ const buttons = [
46
+ {
47
+ style: styles.buttonActionCurtain,
48
+ icon: Images.buttonLeftCurtain,
49
+ text: configuration.text1,
50
+ onPress: onButtonOpenPress,
51
+ testID: TESTID.BUTTON_TEMPLATE_1,
52
+ },
53
+ {
54
+ style: styles.buttonActionCurtainCenter,
55
+ icon: Images.buttonPauseCurtain,
56
+ text: configuration.text2,
57
+ onPress: onButtonStopPress,
58
+ testID: TESTID.BUTTON_TEMPLATE_2,
59
+ },
60
+ {
61
+ style: styles.buttonActionCurtain,
62
+ icon: Images.buttonRightCurtain,
63
+ text: configuration.text3,
64
+ onPress: onButtonClosePress,
65
+ testID: TESTID.BUTTON_TEMPLATE_3,
66
+ },
67
+ ];
68
+
69
+ return (
70
+ <>
71
+ {buttons.map((item, index) => (
72
+ <TouchableOpacity
73
+ testID={item.testID}
74
+ style={item.style}
75
+ onPress={item.onPress}
76
+ underlayColor={Colors.Gray2}
77
+ >
78
+ <Image source={item.icon} />
79
+ </TouchableOpacity>
80
+ ))}
81
+ </>
82
+ );
83
+ };
84
+ const itemLock = (icon, color) => {
85
+ return (
86
+ <>
87
+ <View style={styles.lockDoor}>
88
+ <Icon name={icon} size={15} color={color} style={styles.iconLock} />
89
+ <Text
90
+ style={styles.textLockDoor}
91
+ testID={TESTID.TEXT_DOOR_LOOK_ON_OFF}
92
+ >
93
+ {configuration.text_door_lock}{' '}
94
+ </Text>
95
+ </View>
96
+ <Switch
97
+ trackColor={{ false: Colors.Gray4, true: Colors.Primary }}
98
+ thumbColor={Colors.White}
99
+ ios_backgroundColor={Colors.Gray4}
100
+ onValueChange={onChangeSwitch}
101
+ value={lock}
102
+ />
103
+ </>
104
+ );
105
+ };
106
+ return (
107
+ <>
108
+ <View style={styles.wrap}>
109
+ <RenderThreeButtonActions />
110
+ </View>
111
+ <View style={styles.lockSwitch}>
112
+ {configuration.is_display_lock &&
113
+ itemLock(
114
+ lock ? 'lock' : 'unlock',
115
+ lock ? Colors.Primary : Colors.Gray6
116
+ )}
117
+ </View>
118
+ <Section style={styles.section}>
119
+ <View style={styles.reminderOption}>
120
+ <Text type="H4" color={Colors.Gray8}>
121
+ {t('schedule')}
122
+ </Text>
123
+ <TouchableOpacity>
124
+ <IconOutline name="plus" size={20} />
125
+ </TouchableOpacity>
126
+ </View>
127
+ <View>
128
+ <TouchableOpacity style={styles.tapToAddSchedule}>
129
+ <Text type="Body" color={Colors.Gray6} center>
130
+ {t('tap_to_add_new_schedule')}
131
+ </Text>
132
+ </TouchableOpacity>
133
+ </View>
134
+ </Section>
135
+ </>
136
+ );
137
+ });
138
+
139
+ export default CurtainButtonTemplate;
@@ -0,0 +1,58 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ wrap: {
5
+ flexDirection: 'row',
6
+ justifyContent: 'space-around',
7
+ paddingVertical: 30,
8
+ },
9
+ text: {
10
+ fontSize: 14,
11
+ lineHeight: 22,
12
+ },
13
+ lockSwitch: {
14
+ flexDirection: 'row',
15
+ justifyContent: 'space-between',
16
+ marginBottom: 7,
17
+ },
18
+ iconLock: {
19
+ paddingBottom: 7,
20
+ },
21
+ textLockDoor: {
22
+ paddingLeft: 12,
23
+ height: 24,
24
+ fontSize: 16,
25
+ lineHeight: 24,
26
+ },
27
+ lockDoor: {
28
+ flexDirection: 'row',
29
+ alignItems: 'flex-end',
30
+ paddingLeft: 5,
31
+ },
32
+ section: {
33
+ marginHorizontal: 20,
34
+ borderRadius: 10,
35
+ },
36
+ reminderOption: {
37
+ flex: 1,
38
+ flexDirection: 'row',
39
+ justifyContent: 'space-between',
40
+ },
41
+ tapToAddSchedule: {
42
+ paddingVertical: 50,
43
+ },
44
+ buttonActionCurtain: {
45
+ flex: 1,
46
+ aspectRatio: 1,
47
+ marginHorizontal: 4,
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
50
+ },
51
+ buttonActionCurtainCenter: {
52
+ flex: 1,
53
+ aspectRatio: 1,
54
+ alignItems: 'center',
55
+ justifyContent: 'center',
56
+ marginTop: 15,
57
+ },
58
+ });
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import renderer, { act } from 'react-test-renderer';
3
+ import { TouchableOpacity } from 'react-native';
4
+
5
+ import CurtainButtonTemplate from '../CurtainButtonTemplate';
6
+ import { SCProvider } from '../../../context';
7
+ import { mockSCStore } from '../../../context/mockStore';
8
+
9
+ const wrapComponent = (actionGroup) => (
10
+ <SCProvider initState={mockSCStore({})}>
11
+ <CurtainButtonTemplate actionGroup={actionGroup} doAction={jest.fn()} />
12
+ </SCProvider>
13
+ );
14
+
15
+ describe('Test CurtainButtonTemplate', () => {
16
+ const actionGroup = {
17
+ configuration: {
18
+ action1: '2b949045-8e03-4c07-a855-7794ade2e69c',
19
+ action1_data: {
20
+ color: '#00979D',
21
+ command_prefer_over_bluetooth: true,
22
+ command_prefer_over_googlehome: false,
23
+ command_prefer_over_internet: false,
24
+ googlehome_actions: [],
25
+ icon: 'caret-up',
26
+ id: 9,
27
+ key: '2b949045-8e03-4c07-a855-7794ade2e69c',
28
+ },
29
+ action2: '38347d5e-4418-4ab0-978c-c82f4c034897',
30
+ action2_data: {
31
+ color: '#00979D',
32
+ command_prefer_over_bluetooth: true,
33
+ command_prefer_over_googlehome: false,
34
+ command_prefer_over_internet: false,
35
+ googlehome_actions: [],
36
+ icon: 'stop',
37
+ id: 11,
38
+ key: '38347d5e-4418-4ab0-978c-c82f4c034897',
39
+ },
40
+ action3: 'a492e08c-8cb1-44ee-8ea0-46aaca4e5141',
41
+ action3_data: {
42
+ color: '#00979D',
43
+ command_prefer_over_bluetooth: true,
44
+ command_prefer_over_googlehome: false,
45
+ command_prefer_over_internet: false,
46
+ googlehome_actions: [],
47
+ icon: 'caret-down',
48
+ id: 10,
49
+ key: 'a492e08c-8cb1-44ee-8ea0-46aaca4e5141',
50
+ },
51
+ icon1: 'caret-up',
52
+ icon2: 'stop',
53
+ icon3: 'caret-down',
54
+ text1: 'UP',
55
+ text2: 'STOP/UNLOCK',
56
+ text3: 'DOWN',
57
+ id: 1,
58
+ template: 'curtain_button_action_template',
59
+ },
60
+ };
61
+
62
+ let wrapper;
63
+
64
+ test('render CurtainButtonTemplate', async () => {
65
+ await act(() => {
66
+ wrapper = renderer.create(wrapComponent(actionGroup));
67
+ });
68
+ const instance = wrapper.root;
69
+ const touchableOpacities = instance.findAllByType(TouchableOpacity);
70
+ expect(touchableOpacities.length).toEqual(5);
71
+ });
72
+ });
@@ -8,6 +8,7 @@ import NumberUpDownActionTemplate from './NumberUpDownActionTemplate';
8
8
  import OptionsDropdownActionTemplate from './OptionsDropdownActionTemplate';
9
9
  import OnOffTemplate from './OnOffTemplate';
10
10
  import TimerActionTemplate from './TimerActionTemplate';
11
+ import CurtainButtonTemplate from './CurtainButtonTemplate';
11
12
 
12
13
  export const getActionComponent = (template) => {
13
14
  switch (template) {
@@ -29,6 +30,8 @@ export const getActionComponent = (template) => {
29
30
  return OptionsDropdownActionTemplate;
30
31
  case 'TimerActionTemplate':
31
32
  return TimerActionTemplate;
33
+ case 'curtain_action_template':
34
+ return CurtainButtonTemplate;
32
35
  default:
33
36
  return null;
34
37
  }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { ScrollView } from 'react-native';
3
+ import { act, create } from 'react-test-renderer';
4
+ import AccountList from '../AccountList';
5
+
6
+ describe('Test AccountList', () => {
7
+ let tree;
8
+ const accounts = [
9
+ {
10
+ id: 1,
11
+ name: 'test',
12
+ phone_number: 123456677,
13
+ },
14
+ ];
15
+
16
+ it('test render has data', async () => {
17
+ await act(() => {
18
+ tree = create(<AccountList accounts={accounts} />);
19
+ });
20
+ const instance = tree.root;
21
+ const scrollViews = instance.findAllByType(ScrollView);
22
+ expect(scrollViews).toHaveLength(1);
23
+ });
24
+
25
+ it('test render has no data', async () => {
26
+ await act(() => {
27
+ tree = create(<AccountList accounts={[]} />);
28
+ });
29
+ const instance = tree.root;
30
+ const scrollViews = instance.findAllByType(ScrollView);
31
+ expect(scrollViews).toHaveLength(1);
32
+ });
33
+ });
@@ -59,6 +59,8 @@ const CameraDevice = ({ station, handleFullScreen, goToPlayBack }) => {
59
59
  cameraName={device.configuration.name}
60
60
  handleFullScreen={handleFullScreen}
61
61
  goToPlayBack={goToPlayBack(device, { uri: station?.background })}
62
+ width={standardizeWidth}
63
+ height={standardizeHeight}
62
64
  />
63
65
  </View>
64
66
  ))}
@@ -7,7 +7,7 @@ const Card = memo(({ title, children, style }) => {
7
7
  return (
8
8
  <View style={[styles.card, style]}>
9
9
  {title && <Text style={styles.headerTitle}>{title}</Text>}
10
- <View>{children}</View>
10
+ {children}
11
11
  </View>
12
12
  );
13
13
  });
@@ -3,11 +3,9 @@ import { StyleSheet } from 'react-native';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  card: {
6
- marginTop: 14,
7
- marginBottom: 14,
6
+ marginVertical: 14,
8
7
  marginHorizontal: 16,
9
8
  padding: 16,
10
- flexDirection: 'column',
11
9
  backgroundColor: Colors.White,
12
10
  borderRadius: 10,
13
11
  shadowColor: Colors.Shadow,
@@ -7,7 +7,7 @@ import Text from '../Text';
7
7
  import { Colors } from '../../configs';
8
8
 
9
9
  const DateTimeButton = memo(({ onPress, time, date, formatType, style }) => {
10
- let format = 'DD.MM.YY hh:mm';
10
+ let format = 'DD.MM.YY HH:mm';
11
11
  if (formatType === 'date') {
12
12
  format = 'DD.MM.YY';
13
13
  }
@@ -23,7 +23,7 @@ const DateTimeRangeChange = memo(
23
23
  style={[styles.dateTimeView, !inline && styles.spaceBetween, style]}
24
24
  >
25
25
  <View style={[styles.wrap, !inline && styles.buttonWrap]}>
26
- <Text size={12} color={Colors.Gray7}>
26
+ <Text type="Label" color={Colors.Gray7}>
27
27
  {t('from')}
28
28
  </Text>
29
29
  <DateTimeButton
@@ -35,7 +35,7 @@ const DateTimeRangeChange = memo(
35
35
  />
36
36
  </View>
37
37
  <View style={[styles.wrap, !inline && styles.buttonWrap]}>
38
- <Text size={12} color={Colors.Gray7}>
38
+ <Text type="Label" color={Colors.Gray7}>
39
39
  {t('to')}
40
40
  </Text>
41
41
  <DateTimeButton
@@ -5,13 +5,13 @@ import { useTranslations } from '../../hooks/Common/useTranslations';
5
5
 
6
6
  import { Colors } from '../../configs';
7
7
  import Text from '../../commons/Text';
8
- import TextInput from '../../commons/Form/TextInput';
9
8
  import Button from '../../commons/Button';
9
+ import CurrencyInput from '../../commons/Form/CurrencyInput';
10
10
  import DateTimeRangeChange from '../DateTimeRangeChange';
11
11
  import HorizontalBarChart from './HorizontalBarChart';
12
12
  import DateTimePickerModal from 'react-native-modal-datetime-picker';
13
13
  import LinearChart from './LinearChart';
14
- import ThreeButtonHistory from '../ThreeButtonHistory';
14
+ import FourButtonFilterHistory from '../FourButtonFilterHistory';
15
15
  import { formatMoney } from '../../utils/Utils';
16
16
 
17
17
  export const dateTimeType = {
@@ -33,6 +33,7 @@ const HistoryChart = memo(
33
33
  endDate,
34
34
  setEndDate,
35
35
  setStartDate,
36
+ groupBy,
36
37
  setGroupBy,
37
38
  configuration,
38
39
  }) => {
@@ -49,8 +50,7 @@ const HistoryChart = memo(
49
50
  startTime: startDate ? startDate : moment().subtract(1, 'day').valueOf(),
50
51
  endTime: dateNow,
51
52
  });
52
- const [price, setPrice] = useState('');
53
- const [priceDisplay, setPriceDisplay] = useState('');
53
+ const [price, setPrice] = useState(null);
54
54
 
55
55
  const onStart = useCallback(() => {
56
56
  setEventPicker({
@@ -137,20 +137,6 @@ const HistoryChart = memo(
137
137
  [chartOptions]
138
138
  );
139
139
 
140
- const onChangePrice = useCallback(
141
- (input) => {
142
- const validInput = input.replace(/\D/g, '');
143
- setPrice(validInput);
144
- setPriceDisplay(validInput);
145
- },
146
- [setPrice, setPriceDisplay]
147
- );
148
- const onPriceFocus = useCallback(() => {
149
- setPriceDisplay(price);
150
- }, [price]);
151
- const onPriceBlur = useCallback(() => {
152
- setPriceDisplay(price !== '' ? formatMoney(price) : '');
153
- }, [price]);
154
140
  const onCalculateCost = useCallback(() => {
155
141
  setChartConfig((config) => ({
156
142
  ...config,
@@ -194,26 +180,20 @@ const HistoryChart = memo(
194
180
  {t('history')}
195
181
  </Text>
196
182
  {configuration.type === 'horizontal_bar_chart' && (
197
- <ThreeButtonHistory
198
- setStartDate={setStartDate}
199
- setEndDate={setEndDate}
183
+ <FourButtonFilterHistory
184
+ groupBy={groupBy}
200
185
  setGroupBy={setGroupBy}
201
- startDate={startDate}
202
- endDate={endDate}
203
186
  />
204
187
  )}
205
188
  </View>
206
- {configuration.type !== 'horizontal_bar_chart' && (
207
- <DateTimeRangeChange
208
- startTime={eventPicker.startTime}
209
- onStart={onStart}
210
- onEnd={onEnd}
211
- endTime={eventPicker.endTime}
212
- date={dateNow}
213
- formatType={formatType}
214
- inline={false}
215
- />
216
- )}
189
+ <DateTimeRangeChange
190
+ startTime={eventPicker.startTime}
191
+ onStart={onStart}
192
+ onEnd={onEnd}
193
+ endTime={eventPicker.endTime}
194
+ date={dateNow}
195
+ formatType={formatType}
196
+ />
217
197
  </View>
218
198
  {configuration.config === 'power_consumption' && (
219
199
  <View style={styles.wrapCalculateCost}>
@@ -221,17 +201,13 @@ const HistoryChart = memo(
221
201
  {t('input_price_to_calculate_electricity_cost')}
222
202
  </Text>
223
203
  <View style={styles.row}>
224
- <TextInput
225
- onFocus={onPriceFocus}
226
- onBlur={onPriceBlur}
227
- value={priceDisplay}
228
- onChange={onChangePrice}
204
+ <CurrencyInput
205
+ value={price}
206
+ onChange={setPrice}
207
+ minValue={0}
208
+ maxValue={100000000}
209
+ placeholder={'0'}
229
210
  onSubmitEditing={onCalculateCost}
230
- placeholder={'0đ'}
231
- keyboardType="numeric"
232
- textInputStyle={styles.textInput}
233
- wrapStyle={styles.wrapTextInput}
234
- borderBottomOnly
235
211
  />
236
212
  <Button
237
213
  type="primary"
@@ -298,17 +274,7 @@ const styles = StyleSheet.create({
298
274
  row: {
299
275
  flexDirection: 'row',
300
276
  alignItems: 'center',
301
- },
302
- wrapTextInput: {
303
- flex: 1,
304
- marginRight: 16,
305
- },
306
- textInput: {
307
- marginTop: 0,
308
- paddingTop: 0,
309
- paddingLeft: 0,
310
- fontSize: 18,
311
- lineHeight: 24,
277
+ marginTop: 8,
312
278
  },
313
279
  buttonCalculate: {
314
280
  width: null,