@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.
- package/assets/images/Add.svg +5 -0
- package/assets/images/AddLocationMaps/Point.svg +3 -0
- package/assets/images/CheckCircle.svg +4 -0
- package/assets/images/Close.svg +3 -0
- package/assets/images/Event.svg +9 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/WeatherChange.svg +49 -0
- package/index.js +2 -0
- package/package.json +7 -4
- package/src/Images/Common/ActiveButton.png +0 -0
- package/src/Images/Common/ActiveButton@2x.png +0 -0
- package/src/Images/Common/ActiveButton@3x.png +0 -0
- package/src/Images/Common/file@2x.png +0 -0
- package/src/Images/Common/file@3x.png +0 -0
- package/src/Images/Common/fullscreen@2x.png +0 -0
- package/src/Images/Common/fullscreen@3x.png +0 -0
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +6 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +10 -1
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
- package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
- package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +2 -1
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/Automate/ItemAddNewScriptAction.js +30 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +63 -0
- package/src/commons/Automate/ItemAutomateStyles.js +30 -0
- package/src/commons/Automate/ItemScriptAction.js +41 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +38 -0
- package/src/commons/BottomScrollPicker/index.js +58 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +36 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/CameraDevice/index.js +22 -10
- package/src/commons/ChartLoading/index.js +2 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -1
- package/src/commons/Device/ConnectedViewHeader.js +3 -1
- package/src/commons/Device/DeviceAlertStatus.js +2 -1
- package/src/commons/Device/DisconnectedView.js +34 -26
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
- package/src/commons/Device/FlatListItems.js +2 -1
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/HorizontalBarChart.js +3 -3
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +7 -2
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -1
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +3 -1
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +2 -1
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
- package/src/commons/EmergencyButton/AlertSent.js +3 -2
- package/src/commons/Explore/CityItem/index.js +2 -1
- package/src/commons/Explore/HeaderExplore/index.js +2 -1
- package/src/commons/Explore/HeaderLabel/index.js +2 -1
- package/src/commons/Explore/SearchBox/index.js +2 -1
- package/src/commons/Header/HeaderCustom.js +36 -10
- package/src/commons/Header/Styles/HeaderCustomStyles.js +8 -3
- package/src/commons/HeaderAni/index.js +6 -3
- package/src/commons/IconComponent/index.js +18 -3
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +118 -62
- package/src/commons/MediaPlayer/styles.js +56 -0
- package/src/commons/MediaPlayerDetail/MediaPlayerDetailStyles.js +15 -0
- package/src/commons/MediaPlayerDetail/index.js +149 -64
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalCustom.js +22 -0
- package/src/commons/Modal/ModalFullVideo.js +48 -0
- package/src/commons/Modal/Styles/ModalFullVideoStyles.js +26 -0
- package/src/commons/Modal/index.js +4 -0
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
- package/src/commons/Sharing/MemberList.js +3 -1
- package/src/commons/Sharing/RowMember.js +3 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -1
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +86 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/index.js +29 -0
- package/src/commons/SubUnit/ShortDetail.js +3 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- package/src/commons/UnitSummary/AirQuality/index.js +5 -120
- package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
- package/src/commons/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +160 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/configs/API.js +25 -3
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +4 -0
- package/src/configs/Images.js +4 -0
- package/src/configs/SCConfig.js +94 -0
- package/src/context/SCContext.tsx +5 -11
- package/src/context/reducer.ts +2 -0
- package/src/hooks/Common/useStatusBar.js +3 -0
- package/src/hooks/Common/useTranslations.ts +34 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +2 -6
- package/src/iot/RemoteControl/GoogleHome.js +1 -1
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/LG.js +57 -15
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +2 -1
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +2 -1
- package/src/iot/RemoteControl/__test__/Internet.test.js +2 -1
- package/src/iot/RemoteControl/__test__/index.test.js +2 -1
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/AddGatewayStack.js +5 -0
- package/src/navigations/AddNewActionStack.js +23 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +72 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/hooks/index.js +1 -1
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +143 -0
- package/src/screens/AddCommon/SelectSubUnitStyles.js +55 -0
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectDevice.js +106 -0
- package/src/screens/AddNewAction/Styles/SelectDeviceStyles.js +36 -0
- package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
- package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +2 -1
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +2 -1
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +23 -4
- package/src/screens/AddNewGateway/AddNewGatewayStyles.js +29 -0
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +100 -25
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +25 -3
- package/src/screens/AddNewGateway/SetupGatewayWifiStyles.js +6 -1
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +2 -1
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +2 -1
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +28 -110
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +43 -0
- package/src/screens/AddNewOneTap/index.js +67 -0
- package/src/screens/AddNewScriptAction/AddNewScriptActionStyles.js +27 -0
- package/src/screens/AddNewScriptAction/index.js +92 -0
- package/src/screens/AllCamera/Styles/index.js +101 -0
- package/src/screens/AllCamera/index.js +208 -0
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +2 -1
- package/src/screens/Device/detail.js +66 -23
- package/src/screens/Device/hooks/useEmergencyButton.js +7 -6
- package/src/screens/Device/styles.js +3 -0
- package/src/screens/DeviceInfo/index.js +3 -2
- package/src/screens/EditActionsList/Styles/indexStyles.js +73 -0
- package/src/screens/EditActionsList/index.js +122 -0
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +2 -1
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +27 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +193 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +99 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +46 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +151 -0
- package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
- package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
- package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +82 -0
- package/src/screens/ManageAccess/hooks/index.js +32 -0
- package/src/screens/ManageAccess/index.js +126 -0
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +72 -0
- package/src/screens/PlayBackCamera/Styles/TimerStyles.js +22 -0
- package/src/screens/PlayBackCamera/Styles/index.js +81 -0
- package/src/screens/PlayBackCamera/Timer.js +127 -0
- package/src/screens/PlayBackCamera/index.js +233 -0
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScanChipQR/hooks/index.js +4 -11
- package/src/screens/ScriptDetail/Styles/indexStyles.js +140 -0
- package/src/screens/ScriptDetail/index.js +241 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- package/src/screens/SharedUnit/index.js +3 -2
- package/src/screens/Sharing/MemberList.js +2 -1
- package/src/screens/Sharing/SelectPermission.js +2 -1
- package/src/screens/Sharing/SelectUser.js +3 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +2 -1
- package/src/screens/Sharing/__test__/SelectUser.test.js +2 -1
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +14 -72
- package/src/screens/SubUnit/AddSubUnitStyles.js +66 -0
- package/src/screens/SubUnit/Detail.js +5 -63
- package/src/screens/SubUnit/DetailStyles.js +46 -0
- package/src/screens/SubUnit/ManageSubUnit.js +5 -4
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +2 -1
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +2 -1
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +2 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +75 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +4 -3
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +10 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- package/src/screens/Unit/components/Header/index.js +2 -1
- package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
- package/src/screens/Unit/components/MyUnit/index.js +2 -1
- package/src/screens/Unit/components/SearchLocation/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/styles.js +4 -0
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Converter/__test__/time.test.js +3 -1
- package/src/utils/Converter/array.js +4 -0
- package/src/utils/Converter/time.js +29 -4
- package/src/utils/I18n/index.ts +6 -0
- package/src/utils/I18n/translations/en.json +51 -2
- package/src/utils/I18n/translations/vi.json +48 -1
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +11 -0
- package/src/utils/I18n/index.js +0 -19
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { get } from 'lodash';
|
|
5
|
-
import {
|
|
5
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
6
|
|
|
7
|
-
import { Device, Colors, Theme } from '../../configs';
|
|
8
|
-
import { standardizeCameraScreenSize } from '../../utils/Utils';
|
|
9
7
|
import Routes from '../../utils/Route';
|
|
10
|
-
import {
|
|
8
|
+
import { usePopover } from '../../hooks/Common';
|
|
11
9
|
import Text from '../../commons/Text';
|
|
12
10
|
import ItemDevice from '../../commons/Device/ItemDevice';
|
|
13
11
|
import WrapParallaxScrollView from '../../commons/WrapParallaxScrollView';
|
|
14
12
|
import MediaPlayer from '../../commons/MediaPlayer';
|
|
15
13
|
import { MenuActionMore } from '../../commons';
|
|
16
14
|
import { useSCContextSelector } from '../../context';
|
|
17
|
-
|
|
18
|
-
const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
19
|
-
Device.screenWidth - 32
|
|
20
|
-
);
|
|
15
|
+
import styles from './DetailStyles';
|
|
21
16
|
|
|
22
17
|
const SubUnitDetail = ({ route }) => {
|
|
18
|
+
const t = useTranslations();
|
|
23
19
|
const { unit, station, isGGHomeConnected } = route.params;
|
|
24
20
|
const language = useSCContextSelector((state) => state.language);
|
|
25
21
|
const navigation = useNavigation();
|
|
@@ -33,21 +29,6 @@ const SubUnitDetail = ({ route }) => {
|
|
|
33
29
|
const canManageSubUnit = useCallback(() => {
|
|
34
30
|
return currentUserId === unit.user_id;
|
|
35
31
|
}, [currentUserId, unit]);
|
|
36
|
-
|
|
37
|
-
useAndroidTranslucentStatusBar();
|
|
38
|
-
|
|
39
|
-
// TODO remove redux
|
|
40
|
-
// const arrStation = useSelector((state) => state.unit.unitDetail.stations);
|
|
41
|
-
|
|
42
|
-
// const checkID = useCallback(() => {
|
|
43
|
-
// const result = arrStation.find((x) => x.id === station.id)
|
|
44
|
-
// ? 'true'
|
|
45
|
-
// : 'false';
|
|
46
|
-
// return result;
|
|
47
|
-
// }, [arrStation, station]);
|
|
48
|
-
// const idExists = checkID();
|
|
49
|
-
// const stationState =
|
|
50
|
-
// idExists === 'true' ? arrStation.find((x) => x.id === station.id) : station;
|
|
51
32
|
const stationState = station;
|
|
52
33
|
|
|
53
34
|
const devices = stationState.sensors;
|
|
@@ -168,43 +149,4 @@ const SubUnitDetail = ({ route }) => {
|
|
|
168
149
|
);
|
|
169
150
|
};
|
|
170
151
|
|
|
171
|
-
const styles = StyleSheet.create({
|
|
172
|
-
wrap: {
|
|
173
|
-
flex: 1,
|
|
174
|
-
},
|
|
175
|
-
boxCamera: {
|
|
176
|
-
height: standardizeHeight,
|
|
177
|
-
width: standardizeWidth,
|
|
178
|
-
alignSelf: 'center',
|
|
179
|
-
borderRadius: 10,
|
|
180
|
-
...Theme.shadow,
|
|
181
|
-
},
|
|
182
|
-
subUnitTitle: {
|
|
183
|
-
fontSize: 20,
|
|
184
|
-
lineHeight: 28,
|
|
185
|
-
color: Colors.Gray8,
|
|
186
|
-
marginLeft: 16,
|
|
187
|
-
marginTop: 24,
|
|
188
|
-
marginBottom: 8,
|
|
189
|
-
},
|
|
190
|
-
emptyDevice: {
|
|
191
|
-
fontStyle: 'normal',
|
|
192
|
-
fontWeight: 'normal',
|
|
193
|
-
fontSize: 18,
|
|
194
|
-
lineHeight: 28,
|
|
195
|
-
color: Colors.Border,
|
|
196
|
-
},
|
|
197
|
-
boxDevices: {
|
|
198
|
-
flexWrap: 'wrap',
|
|
199
|
-
flexDirection: 'row',
|
|
200
|
-
paddingHorizontal: 16,
|
|
201
|
-
justifyContent: 'space-between',
|
|
202
|
-
},
|
|
203
|
-
boxEmptyDevices: {
|
|
204
|
-
flexDirection: 'row',
|
|
205
|
-
justifyContent: 'center',
|
|
206
|
-
paddingTop: 16,
|
|
207
|
-
},
|
|
208
|
-
});
|
|
209
|
-
|
|
210
152
|
export default SubUnitDetail;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Device, Colors, Theme } from '../../configs';
|
|
3
|
+
import { standardizeCameraScreenSize } from '../../utils/Utils';
|
|
4
|
+
|
|
5
|
+
const { standardizeWidth, standardizeHeight } = standardizeCameraScreenSize(
|
|
6
|
+
Device.screenWidth - 32
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export default StyleSheet.create({
|
|
10
|
+
wrap: {
|
|
11
|
+
flex: 1,
|
|
12
|
+
},
|
|
13
|
+
boxCamera: {
|
|
14
|
+
height: standardizeHeight,
|
|
15
|
+
width: standardizeWidth,
|
|
16
|
+
alignSelf: 'center',
|
|
17
|
+
borderRadius: 10,
|
|
18
|
+
...Theme.shadow,
|
|
19
|
+
},
|
|
20
|
+
subUnitTitle: {
|
|
21
|
+
fontSize: 20,
|
|
22
|
+
lineHeight: 28,
|
|
23
|
+
color: Colors.Gray8,
|
|
24
|
+
marginLeft: 16,
|
|
25
|
+
marginTop: 24,
|
|
26
|
+
marginBottom: 8,
|
|
27
|
+
},
|
|
28
|
+
emptyDevice: {
|
|
29
|
+
fontStyle: 'normal',
|
|
30
|
+
fontWeight: 'normal',
|
|
31
|
+
fontSize: 18,
|
|
32
|
+
lineHeight: 28,
|
|
33
|
+
color: Colors.Border,
|
|
34
|
+
},
|
|
35
|
+
boxDevices: {
|
|
36
|
+
flexWrap: 'wrap',
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
paddingHorizontal: 16,
|
|
39
|
+
justifyContent: 'space-between',
|
|
40
|
+
},
|
|
41
|
+
boxEmptyDevices: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
paddingTop: 16,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -4,7 +4,7 @@ import Modal from 'react-native-modal';
|
|
|
4
4
|
import { connect } from 'react-redux';
|
|
5
5
|
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
6
6
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
7
|
-
import {
|
|
7
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
8
8
|
|
|
9
9
|
import { Colors, API, Device } from '../../configs';
|
|
10
10
|
import { ToastBottomHelper } from '../../utils/Utils';
|
|
@@ -26,6 +26,7 @@ import { IconOutline } from '@ant-design/icons-react-native';
|
|
|
26
26
|
import { useEmeragencyContacts } from './hooks/useEmergencyContacts';
|
|
27
27
|
|
|
28
28
|
const ManageSubUnit = (props) => {
|
|
29
|
+
const t = useTranslations();
|
|
29
30
|
const { station } = props.route.params;
|
|
30
31
|
//TODO remove redux
|
|
31
32
|
// const unit = useSelector((state) => state.unit.unitDetail);
|
|
@@ -82,7 +83,7 @@ const ManageSubUnit = (props) => {
|
|
|
82
83
|
ToastBottomHelper.success(t('text_rename_sub_unit_success'));
|
|
83
84
|
}
|
|
84
85
|
},
|
|
85
|
-
[unit, station]
|
|
86
|
+
[unit.id, station.id, t]
|
|
86
87
|
);
|
|
87
88
|
const updateBackground = useCallback(
|
|
88
89
|
async (headers) => {
|
|
@@ -97,7 +98,7 @@ const ManageSubUnit = (props) => {
|
|
|
97
98
|
ToastBottomHelper.success(t('text_change_background_sub_unit_success'));
|
|
98
99
|
}
|
|
99
100
|
},
|
|
100
|
-
[unit, station,
|
|
101
|
+
[imageUrl, unit.id, station.id, t]
|
|
101
102
|
);
|
|
102
103
|
|
|
103
104
|
const onPressRemove = useCallback(() => {
|
|
@@ -120,7 +121,7 @@ const ManageSubUnit = (props) => {
|
|
|
120
121
|
} else {
|
|
121
122
|
ToastBottomHelper.error(t('text_remove_sub_unit_fail'));
|
|
122
123
|
}
|
|
123
|
-
}, [unit, station,
|
|
124
|
+
}, [setHideModalRemoveSubUnit, unit.id, station.id, t, onBack]);
|
|
124
125
|
|
|
125
126
|
const goRename = useCallback(() => {
|
|
126
127
|
updateSubUnit({ name: inputName }, {});
|
|
@@ -5,7 +5,7 @@ import { ImagePicker, ViewButtonBottom } from '../../../commons';
|
|
|
5
5
|
import { act, create } from 'react-test-renderer';
|
|
6
6
|
import Toast from 'react-native-toast-message';
|
|
7
7
|
import Routes from '../../../utils/Route';
|
|
8
|
-
import {
|
|
8
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
9
9
|
import { createSubUnit } from '../../../redux/Actions/unit';
|
|
10
10
|
import { TESTID } from '../../../configs/Constants';
|
|
11
11
|
import _TextInput from '../../../commons/Form/TextInput';
|
|
@@ -36,6 +36,7 @@ jest.mock('@react-navigation/native', () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
describe('Test AddSubUnit', () => {
|
|
39
|
+
const t = useTranslations();
|
|
39
40
|
let route;
|
|
40
41
|
|
|
41
42
|
beforeEach(() => {
|
|
@@ -10,7 +10,7 @@ import Toast from 'react-native-toast-message';
|
|
|
10
10
|
|
|
11
11
|
import Routes from '../../../utils/Route';
|
|
12
12
|
import ManageSubUnit from '../ManageSubUnit';
|
|
13
|
-
import {
|
|
13
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
14
14
|
import { removeSubUnit, manageSubUnit } from '../../../redux/Actions/unit';
|
|
15
15
|
import { TESTID } from '../../../configs/Constants';
|
|
16
16
|
import Text from '../../../commons/Text';
|
|
@@ -49,6 +49,7 @@ jest.mock('@react-navigation/native', () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
describe('Test ManageSubUnit', () => {
|
|
52
|
+
const t = useTranslations();
|
|
52
53
|
let route;
|
|
53
54
|
|
|
54
55
|
beforeEach(() => {
|
|
@@ -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 {
|
|
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,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
4
|
import axios from 'axios';
|
|
5
5
|
|
|
6
6
|
import AddLGDevice from '../AddLGDevice';
|
|
@@ -27,6 +27,7 @@ jest.mock('@react-navigation/native', () => {
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
describe('Test Add LG Device', () => {
|
|
30
|
+
const t = useTranslations();
|
|
30
31
|
let tree;
|
|
31
32
|
let route;
|
|
32
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { StyleSheet, SafeAreaView } from 'react-native';
|
|
3
|
-
import {
|
|
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
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
SafeAreaView,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {
|
|
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 {
|
|
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 {
|
|
4
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
6
|
import styles from './styles';
|
|
7
7
|
import AddMenu from './AddMenu';
|
|
@@ -21,44 +21,70 @@ import WrapParallaxScrollView from '../../commons/WrapParallaxScrollView';
|
|
|
21
21
|
import { SCContext } from '../../context';
|
|
22
22
|
import { Action } from '../../context/actionType';
|
|
23
23
|
import CameraDevice from '../../commons/CameraDevice';
|
|
24
|
+
import { ModalFullVideo } from '../../commons/Modal';
|
|
25
|
+
import { useNavigation } from '@react-navigation/native';
|
|
26
|
+
import Routes from '../../utils/Route';
|
|
27
|
+
import SubUnitOneTap from '../../commons/SubUnit/OneTap';
|
|
24
28
|
|
|
25
29
|
const UnitDetail = ({ route }) => {
|
|
30
|
+
const t = useTranslations();
|
|
26
31
|
const { unitId, unitData } = route.params;
|
|
27
32
|
const isFocused = useIsFocused();
|
|
28
33
|
const { stateData, setAction } = useContext(SCContext);
|
|
34
|
+
const { navigate } = useNavigation();
|
|
29
35
|
|
|
30
36
|
const [unit, setUnit] = useState(unitData || { id: unitId });
|
|
31
37
|
const [appState, setAppState] = useState(AppState.currentState);
|
|
32
38
|
const [listMenuItem, setListMenuItem] = useState([]);
|
|
33
39
|
const [listStation, setListStation] = useState([]);
|
|
40
|
+
const [automates, setAutomates] = useState([]);
|
|
34
41
|
const [isGGHomeConnected, setIsGGHomeConnected] = useState(false);
|
|
35
42
|
const [station, setStation] = useState([]);
|
|
36
43
|
const [indexStation, setIndexStation] = useState(0);
|
|
37
44
|
const [showAdd, setShowAdd, setHideAdd] = useBoolean();
|
|
45
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
46
|
+
const [dataFullScreen, setDataFullScreen] = useState();
|
|
38
47
|
|
|
39
48
|
const { childRef, showingPopover, showPopoverWithRef, hidePopover } =
|
|
40
49
|
usePopover();
|
|
41
50
|
|
|
42
51
|
const { isOwner } = useIsOwnerOfUnit(unit.user_id);
|
|
43
52
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
rawUnitData.stations.unshift(favorites);
|
|
52
|
-
rawUnitData.stations.forEach((stationItem) => {
|
|
53
|
-
if (stationItem.sensors) {
|
|
54
|
-
const favoriteDevices = stationItem.sensors.filter(
|
|
55
|
-
(sensorItem) => sensorItem.is_favourite
|
|
56
|
-
);
|
|
57
|
-
favorites.sensors = favorites.sensors.concat(favoriteDevices);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
53
|
+
const handleFullScreen = (data) => {
|
|
54
|
+
setIsFullScreen(!isFullScreen);
|
|
55
|
+
setDataFullScreen(data);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onClose = useCallback(() => {
|
|
59
|
+
setIsFullScreen(false);
|
|
60
60
|
}, []);
|
|
61
61
|
|
|
62
|
+
const prepareData = useCallback(
|
|
63
|
+
(rawUnitData) => {
|
|
64
|
+
const oneTap = {
|
|
65
|
+
isOneTap: true,
|
|
66
|
+
name: 'One-Tap',
|
|
67
|
+
};
|
|
68
|
+
rawUnitData.stations.unshift(oneTap);
|
|
69
|
+
const favorites = {
|
|
70
|
+
isFakeStation: true,
|
|
71
|
+
isFavorites: true,
|
|
72
|
+
name: t('favorites'),
|
|
73
|
+
sensors: [],
|
|
74
|
+
};
|
|
75
|
+
rawUnitData.stations.unshift(favorites);
|
|
76
|
+
rawUnitData.stations.forEach((stationItem) => {
|
|
77
|
+
if (stationItem.sensors) {
|
|
78
|
+
const favoriteDevices = stationItem.sensors.filter(
|
|
79
|
+
(sensorItem) => sensorItem.is_favourite
|
|
80
|
+
);
|
|
81
|
+
favorites.sensors = favorites.sensors.concat(favoriteDevices);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
[t]
|
|
86
|
+
);
|
|
87
|
+
|
|
62
88
|
const fetchDetails = useCallback(async () => {
|
|
63
89
|
await fetchWithCache(API.UNIT.UNIT_DETAIL(unitId), {}, (response) => {
|
|
64
90
|
const { success, data } = response;
|
|
@@ -69,6 +95,15 @@ const UnitDetail = ({ route }) => {
|
|
|
69
95
|
});
|
|
70
96
|
}, [setUnit, unitId, prepareData]);
|
|
71
97
|
|
|
98
|
+
const getScriptOneTap = useCallback(async () => {
|
|
99
|
+
await fetchWithCache(API.UNIT.AUTOMATE(unitId), {}, (response) => {
|
|
100
|
+
const { success, data } = response;
|
|
101
|
+
if (success) {
|
|
102
|
+
setAutomates(data);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}, [unitId]);
|
|
106
|
+
|
|
72
107
|
const onRefresh = useCallback(() => {
|
|
73
108
|
fetchDetails();
|
|
74
109
|
}, [fetchDetails]);
|
|
@@ -150,8 +185,9 @@ const UnitDetail = ({ route }) => {
|
|
|
150
185
|
useEffect(() => {
|
|
151
186
|
if (isFocused) {
|
|
152
187
|
fetchDetails();
|
|
188
|
+
getScriptOneTap();
|
|
153
189
|
}
|
|
154
|
-
}, [fetchDetails, isFocused]);
|
|
190
|
+
}, [fetchDetails, getScriptOneTap, isFocused]);
|
|
155
191
|
|
|
156
192
|
useEffect(() => {
|
|
157
193
|
if (unit.stations) {
|
|
@@ -174,9 +210,22 @@ const UnitDetail = ({ route }) => {
|
|
|
174
210
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
175
211
|
[unit, indexStation]
|
|
176
212
|
);
|
|
213
|
+
|
|
214
|
+
const goToPlayBack = (item, thumbnail) => () => {
|
|
215
|
+
navigate(Routes.PlaybackCamera, { item, thumbnail });
|
|
216
|
+
};
|
|
217
|
+
|
|
177
218
|
const renderDetailSubUnit = () => {
|
|
178
219
|
if (station.camera_devices) {
|
|
179
|
-
return
|
|
220
|
+
return (
|
|
221
|
+
<CameraDevice
|
|
222
|
+
station={station}
|
|
223
|
+
handleFullScreen={handleFullScreen}
|
|
224
|
+
goToPlayBack={goToPlayBack}
|
|
225
|
+
/>
|
|
226
|
+
);
|
|
227
|
+
} else if (station.isOneTap) {
|
|
228
|
+
return <SubUnitOneTap automates={automates} />;
|
|
180
229
|
} else if (station) {
|
|
181
230
|
return (
|
|
182
231
|
<ShortDetailSubUnit
|
|
@@ -190,7 +239,7 @@ const UnitDetail = ({ route }) => {
|
|
|
190
239
|
return (
|
|
191
240
|
<WrapParallaxScrollView
|
|
192
241
|
uriImg={unit.background}
|
|
193
|
-
title={t('Welcome
|
|
242
|
+
title={t('Welcome {name}', {
|
|
194
243
|
name: unit.name ? unit.name : '',
|
|
195
244
|
})}
|
|
196
245
|
refreshControl={
|
|
@@ -229,6 +278,12 @@ const UnitDetail = ({ route }) => {
|
|
|
229
278
|
childRef={childRef}
|
|
230
279
|
showingPopover={showingPopover}
|
|
231
280
|
/>
|
|
281
|
+
<ModalFullVideo
|
|
282
|
+
isVisible={isFullScreen}
|
|
283
|
+
data={dataFullScreen}
|
|
284
|
+
modalStyles={styles.modal}
|
|
285
|
+
onClose={onClose}
|
|
286
|
+
/>
|
|
232
287
|
</WrapParallaxScrollView>
|
|
233
288
|
);
|
|
234
289
|
};
|
|
@@ -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 {
|
|
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,
|
|
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 {
|
|
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,
|
|
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({
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { memo, useCallback, useMemo } from 'react';
|
|
2
|
-
import {
|
|
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 {
|
|
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('');
|
|
@@ -75,6 +77,8 @@ const SelectLocation = memo(({ route }) => {
|
|
|
75
77
|
}, []);
|
|
76
78
|
|
|
77
79
|
const onPressRowLocation = useCallback(async (item) => {
|
|
80
|
+
setInput(item.description);
|
|
81
|
+
setSearchData([]);
|
|
78
82
|
const body = {
|
|
79
83
|
params: {
|
|
80
84
|
place_id: item.place_id,
|
|
@@ -134,7 +138,11 @@ const SelectLocation = memo(({ route }) => {
|
|
|
134
138
|
longitude: searchedLocation.longitude,
|
|
135
139
|
}}
|
|
136
140
|
tracksViewChanges={false}
|
|
137
|
-
|
|
141
|
+
>
|
|
142
|
+
<View style={styles.pointCircle}>
|
|
143
|
+
<Point />
|
|
144
|
+
</View>
|
|
145
|
+
</Marker>
|
|
138
146
|
)}
|
|
139
147
|
</MapView>
|
|
140
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',
|
|
@@ -3,7 +3,7 @@ import { Dimensions, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
|
3
3
|
import Popover from 'react-native-popover-view';
|
|
4
4
|
import Modal from 'react-native-modal';
|
|
5
5
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
7
7
|
|
|
8
8
|
import { Colors } from '../../../../configs';
|
|
9
9
|
import Text from '../../../../commons/Text';
|
|
@@ -30,6 +30,7 @@ const HeaderComponent = ({
|
|
|
30
30
|
fixedHeight, // when height of header is fixed
|
|
31
31
|
style,
|
|
32
32
|
}) => {
|
|
33
|
+
const t = useTranslations();
|
|
33
34
|
const popoverRef = useRef();
|
|
34
35
|
const [menu, setMenu] = useState(false);
|
|
35
36
|
const [showModal, setShowModal] = useState(false);
|