@eohjsc/react-native-smart-city 0.2.54 → 0.2.58
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/SonosSpeaker/buttonpause-active.svg +3 -0
- package/assets/images/SonosSpeaker/buttonpause-notactive.svg +3 -0
- package/assets/images/SonosSpeaker/picture-main-notactive.svg +5 -0
- package/assets/images/SonosSpeaker/picture-main.svg +6 -0
- package/assets/images/SonosSpeaker/picture-volume.svg +3 -0
- package/package.json +4 -23
- package/src/commons/AlertAction/index.js +3 -3
- package/src/commons/Auth/__test__/AccountList.test.js +33 -0
- package/src/commons/CameraDevice/index.js +2 -0
- package/src/commons/CardShadow/index.js +1 -1
- package/src/commons/CardShadow/styles.js +1 -3
- package/src/commons/DateTimeRangeChange/index.js +2 -2
- package/src/commons/Device/HistoryChart.js +9 -39
- package/src/commons/Device/HorizontalBarChart.js +1 -1
- package/src/commons/Device/LinearChart.js +0 -34
- package/src/commons/Device/PMSensor/PMSensorIndicatior.js +1 -1
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +2 -1
- package/src/commons/Device/SonosSpeaker/__test__/SonosSpeaker.test.js +57 -0
- package/src/commons/Device/SonosSpeaker/index.js +88 -0
- package/src/commons/Device/SonosSpeaker/styles.js +57 -0
- package/src/commons/Form/CurrencyInput.js +163 -0
- package/src/commons/Form/__test__/CurrencyInput.test.js +65 -0
- package/src/commons/MediaPlayerDetail/index.js +160 -160
- package/src/commons/Sharing/RowMember.js +7 -2
- package/src/commons/Sharing/__test__/RowMember.test.js +42 -0
- package/src/commons/SubUnit/ShortDetail.js +11 -5
- package/src/commons/ThreeButtonHistory/__test__/ThreeButtonHistory.test.js +17 -8
- package/src/commons/ThreeButtonHistory/index.js +52 -23
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -1
- package/src/configs/API.js +5 -0
- package/src/configs/Constants.js +3 -3
- package/src/configs/SCConfig.js +8 -0
- package/src/iot/RemoteControl/Bluetooth.js +14 -0
- package/src/iot/RemoteControl/index.js +0 -1
- package/src/screens/ActivityLog/ItemLog.js +9 -0
- package/src/screens/ActivityLog/__test__/ItemLog.test.js +43 -0
- package/src/screens/AddCommon/SelectSubUnit.js +24 -2
- package/src/screens/AddCommon/SelectUnit.js +12 -0
- package/src/screens/Device/__test__/detail.test.js +0 -5
- package/src/screens/Device/components/SensorDisplayItem.js +10 -10
- package/src/screens/Device/detail.js +15 -1
- package/src/screens/Device/hooks/useDisconnectedDevice.js +31 -26
- package/src/screens/Sharing/MemberList.js +2 -9
- package/src/screens/SubUnit/AddSubUnit.js +78 -59
- package/src/screens/TDSGuide/index.js +6 -4
- package/src/screens/Unit/Detail.js +7 -1
- package/src/screens/Unit/ManageUnit/index.test.js +34 -0
- package/src/screens/Unit/ManageUnit.js +3 -4
- package/src/screens/Unit/SmartAccount.js +2 -3
- package/src/screens/Unit/SmartAccountItem.js +1 -1
- package/src/screens/Unit/Summaries.js +5 -1
- package/src/screens/Unit/hook/useStateAlertRemove.js +3 -1
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +1 -1
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +1 -1
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +1 -3
- package/src/screens/UnitSummary/index.js +3 -2
- package/src/utils/Apis/axios.js +17 -5
- package/src/utils/I18n/translations/en.json +8 -3
- package/src/utils/I18n/translations/vi.json +9 -4
- package/src/utils/Utils.js +22 -2
|
@@ -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.
|
|
4
|
+
"version": "0.2.58",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -39,16 +39,11 @@
|
|
|
39
39
|
"reset-cache": "react-native start --reset-cache",
|
|
40
40
|
"merge_conflict": "yarn jest && yarn update_coverage_result && yarn check_coverage_config",
|
|
41
41
|
"jest": "jest --detectOpenHandles",
|
|
42
|
-
"postinstall": "npx husky install",
|
|
43
42
|
"example": "yarn --cwd example",
|
|
44
43
|
"pods": "cd example && pod-install --quiet",
|
|
45
44
|
"bootstrap": "yarn example && yarn && yarn pods",
|
|
46
45
|
"build": "sync-files ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src",
|
|
47
|
-
"watch": "sync-files --watch ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src"
|
|
48
|
-
"test:code-formatter": "prettier src/**/**/*.js --write",
|
|
49
|
-
"test:code-formatter-step-1": "prettier --check src/**/*.js",
|
|
50
|
-
"test:code-formatter-step-2": "prettier --check src/**/**/*.js",
|
|
51
|
-
"test:code-formatter-step-3": "prettier --check src/**/**/**/*.js"
|
|
46
|
+
"watch": "sync-files --watch ./src ../EohMobile/node_modules/@eohjsc/react-native-smart-city/src"
|
|
52
47
|
},
|
|
53
48
|
"repository": {
|
|
54
49
|
"type": "git",
|
|
@@ -86,7 +81,6 @@
|
|
|
86
81
|
"eslint-plugin-react": "^7.21.5",
|
|
87
82
|
"eslint-plugin-react-native": "^3.10.0",
|
|
88
83
|
"factory-girl": "^5.0.4",
|
|
89
|
-
"husky": "^2.7.0",
|
|
90
84
|
"jest": "^26.6.3",
|
|
91
85
|
"jest-circus": "^26.6.3",
|
|
92
86
|
"jetifier": "^1.6.6",
|
|
@@ -147,6 +141,7 @@
|
|
|
147
141
|
"react-hooks-global-state": "^1.0.1",
|
|
148
142
|
"react-i18next": "^11.8.12",
|
|
149
143
|
"react-native-alert-async": "^1.0.5",
|
|
144
|
+
"react-native-android-wifi": "^0.0.41",
|
|
150
145
|
"react-native-appearance": "^0.3.4",
|
|
151
146
|
"react-native-base64": "^0.1.0",
|
|
152
147
|
"react-native-ble-plx": "^2.0.1",
|
|
@@ -183,6 +178,7 @@
|
|
|
183
178
|
"react-native-responsive-fontsize": "^0.5.1",
|
|
184
179
|
"react-native-safe-area-context": "^3.1.1",
|
|
185
180
|
"react-native-screens": "^2.9.0",
|
|
181
|
+
"react-native-slider": "^0.11.0",
|
|
186
182
|
"react-native-snap-carousel": "4.0.0-beta.5",
|
|
187
183
|
"react-native-super-grid": "^4.0.3",
|
|
188
184
|
"react-native-svg": "^12.1.0",
|
|
@@ -206,21 +202,6 @@
|
|
|
206
202
|
"validator": "^13.1.1",
|
|
207
203
|
"victory-native": "^35.0.1"
|
|
208
204
|
},
|
|
209
|
-
"husky": {
|
|
210
|
-
"hooks": {
|
|
211
|
-
"pre-commit": "lint-staged",
|
|
212
|
-
"pre-push": "yarn jest"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
"lint-staged": {
|
|
216
|
-
"*.{js, ts}": [
|
|
217
|
-
"yarn lint",
|
|
218
|
-
"yarn test:code-formatter",
|
|
219
|
-
"yarn test:code-formatter-step-1",
|
|
220
|
-
"yarn test:code-formatter-step-2",
|
|
221
|
-
"yarn test:code-formatter-step-3"
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
205
|
"bugs": {
|
|
225
206
|
"url": "https://github.com/github_account/react-native-smart-city/issues"
|
|
226
207
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import Modal from 'react-native-modal';
|
|
4
3
|
|
|
4
|
+
import ModalCustom from '../../commons/Modal/ModalCustom';
|
|
5
5
|
import Text from '../../commons/Text';
|
|
6
6
|
import ViewButtonBottom from '../ViewButtonBottom';
|
|
7
7
|
import { Colors, Device } from '../../configs';
|
|
@@ -24,7 +24,7 @@ const AlertAction = ({
|
|
|
24
24
|
animatedStyle,
|
|
25
25
|
}) => {
|
|
26
26
|
return (
|
|
27
|
-
<
|
|
27
|
+
<ModalCustom
|
|
28
28
|
isVisible={visible}
|
|
29
29
|
onBackButtonPress={hideModal}
|
|
30
30
|
onBackdropPress={hideModal}
|
|
@@ -58,7 +58,7 @@ const AlertAction = ({
|
|
|
58
58
|
/>
|
|
59
59
|
</View>
|
|
60
60
|
</Animated.View>
|
|
61
|
-
</
|
|
61
|
+
</ModalCustom>
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
64
|
|
|
@@ -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
|
))}
|
|
@@ -3,11 +3,9 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
card: {
|
|
6
|
-
|
|
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,
|
|
@@ -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
|
|
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
|
|
38
|
+
<Text type="Label" color={Colors.Gray7}>
|
|
39
39
|
{t('to')}
|
|
40
40
|
</Text>
|
|
41
41
|
<DateTimeButton
|
|
@@ -5,8 +5,8 @@ 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';
|
|
@@ -49,8 +49,7 @@ const HistoryChart = memo(
|
|
|
49
49
|
startTime: startDate ? startDate : moment().subtract(1, 'day').valueOf(),
|
|
50
50
|
endTime: dateNow,
|
|
51
51
|
});
|
|
52
|
-
const [price, setPrice] = useState(
|
|
53
|
-
const [priceDisplay, setPriceDisplay] = useState('');
|
|
52
|
+
const [price, setPrice] = useState(null);
|
|
54
53
|
|
|
55
54
|
const onStart = useCallback(() => {
|
|
56
55
|
setEventPicker({
|
|
@@ -137,20 +136,6 @@ const HistoryChart = memo(
|
|
|
137
136
|
[chartOptions]
|
|
138
137
|
);
|
|
139
138
|
|
|
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
139
|
const onCalculateCost = useCallback(() => {
|
|
155
140
|
setChartConfig((config) => ({
|
|
156
141
|
...config,
|
|
@@ -211,7 +196,6 @@ const HistoryChart = memo(
|
|
|
211
196
|
endTime={eventPicker.endTime}
|
|
212
197
|
date={dateNow}
|
|
213
198
|
formatType={formatType}
|
|
214
|
-
inline={false}
|
|
215
199
|
/>
|
|
216
200
|
)}
|
|
217
201
|
</View>
|
|
@@ -221,17 +205,13 @@ const HistoryChart = memo(
|
|
|
221
205
|
{t('input_price_to_calculate_electricity_cost')}
|
|
222
206
|
</Text>
|
|
223
207
|
<View style={styles.row}>
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
208
|
+
<CurrencyInput
|
|
209
|
+
value={price}
|
|
210
|
+
onChange={setPrice}
|
|
211
|
+
minValue={0}
|
|
212
|
+
maxValue={100000000}
|
|
213
|
+
placeholder={'0'}
|
|
229
214
|
onSubmitEditing={onCalculateCost}
|
|
230
|
-
placeholder={'0đ'}
|
|
231
|
-
keyboardType="numeric"
|
|
232
|
-
textInputStyle={styles.textInput}
|
|
233
|
-
wrapStyle={styles.wrapTextInput}
|
|
234
|
-
borderBottomOnly
|
|
235
215
|
/>
|
|
236
216
|
<Button
|
|
237
217
|
type="primary"
|
|
@@ -298,17 +278,7 @@ const styles = StyleSheet.create({
|
|
|
298
278
|
row: {
|
|
299
279
|
flexDirection: 'row',
|
|
300
280
|
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,
|
|
281
|
+
marginTop: 8,
|
|
312
282
|
},
|
|
313
283
|
buttonCalculate: {
|
|
314
284
|
width: null,
|
|
@@ -85,7 +85,7 @@ const HorizontalBarChart = memo(({ datas, config }) => {
|
|
|
85
85
|
const costStyle = valueStyle + 'font-weight:bold;';
|
|
86
86
|
|
|
87
87
|
let label = `<span style="${valueStyle}">` + `${this.y}${unit}`;
|
|
88
|
-
if (price ===
|
|
88
|
+
if (price === null || isNaN(price)) {
|
|
89
89
|
return label + '</span>';
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -56,40 +56,6 @@ const chartOptions = {
|
|
|
56
56
|
},
|
|
57
57
|
minRange: 3600 * 24 * 1000,
|
|
58
58
|
},
|
|
59
|
-
plotOptions: {
|
|
60
|
-
series: {
|
|
61
|
-
point: {
|
|
62
|
-
events: {
|
|
63
|
-
click: () => {
|
|
64
|
-
let series = this.series.chart.series;
|
|
65
|
-
const seriesIndex = this.series.index;
|
|
66
|
-
for (let i = 0; i < series.length; i++) {
|
|
67
|
-
if (series[i].index !== seriesIndex) {
|
|
68
|
-
series[i].visible ? series[i].hide() : series[i].show();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return false;
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
events: {
|
|
76
|
-
legendItemClick: (event) => {
|
|
77
|
-
if (!this.visible) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
let seriesIndex = this.index;
|
|
81
|
-
let series = this.chart.series;
|
|
82
|
-
for (let i = 0; i < series.length; i++) {
|
|
83
|
-
if (series[i].index !== seriesIndex) {
|
|
84
|
-
series[i].visible ? series[i].hide() : series[i].show();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
showInNavigator: true,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
59
|
};
|
|
94
60
|
|
|
95
61
|
function LinearChart({ datas }) {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
+
import Text from '../../../Text';
|
|
7
|
+
import SonosSpeaker from '..';
|
|
8
|
+
import { TouchableOpacity } from 'react-native';
|
|
9
|
+
import Slider from 'react-native-slider';
|
|
10
|
+
|
|
11
|
+
const wrapComponent = () => (
|
|
12
|
+
<SCProvider initState={mockSCStore({})}>
|
|
13
|
+
<SonosSpeaker />
|
|
14
|
+
</SCProvider>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe('Test SonosSpeaker', () => {
|
|
18
|
+
let tree;
|
|
19
|
+
test('create SonosSpeaker', () => {
|
|
20
|
+
act(() => {
|
|
21
|
+
tree = renderer.create(wrapComponent());
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const instance = tree.root;
|
|
25
|
+
const textElement = instance.findAllByType(Text);
|
|
26
|
+
expect(textElement[0]).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Test handleClickButton', () => {
|
|
30
|
+
act(() => {
|
|
31
|
+
tree = renderer.create(wrapComponent());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const instance = tree.root;
|
|
35
|
+
const touchableOpacity = instance.findAllByType(TouchableOpacity);
|
|
36
|
+
const textElement = instance.findAllByType(Text);
|
|
37
|
+
|
|
38
|
+
act(() => {
|
|
39
|
+
touchableOpacity[0].props.onPress();
|
|
40
|
+
});
|
|
41
|
+
expect(textElement[1].props.children).toEqual('Pause');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Test onValueChange', () => {
|
|
45
|
+
act(() => {
|
|
46
|
+
tree = renderer.create(wrapComponent());
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const instance = tree.root;
|
|
50
|
+
const slider = instance.findByType(Slider);
|
|
51
|
+
|
|
52
|
+
act(() => {
|
|
53
|
+
slider.props.onValueChange(40);
|
|
54
|
+
});
|
|
55
|
+
expect(slider.props.value).toEqual(40);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { useTranslations } from '../../../hooks/Common/useTranslations';
|
|
4
|
+
import { Icon } from '@ant-design/react-native';
|
|
5
|
+
import Slider from 'react-native-slider';
|
|
6
|
+
|
|
7
|
+
import Text from '../../Text';
|
|
8
|
+
import { Colors } from '../../../configs';
|
|
9
|
+
import SvgSonosSpeaker from '../../../../assets/images/SonosSpeaker/picture-main.svg';
|
|
10
|
+
import SvgSoundSonosSpeaker from '../../../../assets/images/SonosSpeaker/picture-volume.svg';
|
|
11
|
+
import SvgButtonPauseActive from '../../../../assets/images/SonosSpeaker/buttonpause-active.svg';
|
|
12
|
+
import SvgButtonPauseNotActive from '../../../../assets/images/SonosSpeaker/buttonpause-notactive.svg';
|
|
13
|
+
import SvgSonosSpeakerNotActive from '../../../../assets/images/SonosSpeaker/picture-main-notactive.svg';
|
|
14
|
+
import styles from './styles';
|
|
15
|
+
|
|
16
|
+
const SonosSpeaker = memo(() => {
|
|
17
|
+
const t = useTranslations();
|
|
18
|
+
const [value, setValue] = useState(30);
|
|
19
|
+
const [active, setActive] = useState(true);
|
|
20
|
+
|
|
21
|
+
const handleClickButton = () => {
|
|
22
|
+
setActive(!active);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View>
|
|
27
|
+
<View style={styles.container}>
|
|
28
|
+
<Text type="H4">MIC DROP (Steve aoki)</Text>
|
|
29
|
+
<Text color={Colors.Gray7}>
|
|
30
|
+
{active ? t('now_playing') : t('pause')}
|
|
31
|
+
</Text>
|
|
32
|
+
<TouchableOpacity
|
|
33
|
+
delayLongPress={3000}
|
|
34
|
+
style={styles.imageMain}
|
|
35
|
+
onPress={handleClickButton}
|
|
36
|
+
>
|
|
37
|
+
{active ? (
|
|
38
|
+
<SvgSonosSpeaker />
|
|
39
|
+
) : (
|
|
40
|
+
<View style={styles.sonosSpeakerNotActive}>
|
|
41
|
+
<SvgSonosSpeakerNotActive />
|
|
42
|
+
</View>
|
|
43
|
+
)}
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
<View style={styles.threeButton}>
|
|
46
|
+
<TouchableOpacity style={styles.buttonLeft}>
|
|
47
|
+
<Icon name={'backward'} size={35} color={Colors.Black} />
|
|
48
|
+
</TouchableOpacity>
|
|
49
|
+
<TouchableOpacity
|
|
50
|
+
style={styles.buttonCenter}
|
|
51
|
+
onPress={handleClickButton}
|
|
52
|
+
>
|
|
53
|
+
{active ? <SvgButtonPauseActive /> : <SvgButtonPauseNotActive />}
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
<TouchableOpacity style={styles.buttonRight}>
|
|
56
|
+
<Icon name={'forward'} size={35} color={Colors.Black} />
|
|
57
|
+
</TouchableOpacity>
|
|
58
|
+
</View>
|
|
59
|
+
</View>
|
|
60
|
+
<View style={styles.volumeButton}>
|
|
61
|
+
<View style={styles.imageVolumeButton}>
|
|
62
|
+
<View style={styles.imageSoundSonos}>
|
|
63
|
+
<SvgSoundSonosSpeaker />
|
|
64
|
+
</View>
|
|
65
|
+
<Text type="H4" style={styles.textVolumeLeft}>
|
|
66
|
+
{t('volume')}
|
|
67
|
+
</Text>
|
|
68
|
+
</View>
|
|
69
|
+
<View style={styles.containerSlider}>
|
|
70
|
+
<Slider
|
|
71
|
+
value={value}
|
|
72
|
+
onValueChange={(value) => setValue(value)}
|
|
73
|
+
step={1}
|
|
74
|
+
minimumValue={0}
|
|
75
|
+
maximumValue={100}
|
|
76
|
+
thumbTintColor={Colors.Gray3}
|
|
77
|
+
minimumTrackTintColor={Colors.Primary}
|
|
78
|
+
maximumTrackTintColor={Colors.Gray3}
|
|
79
|
+
trackStyle={styles.slider}
|
|
80
|
+
/>
|
|
81
|
+
</View>
|
|
82
|
+
<Text style={styles.textVolumeRight}>{value}%</Text>
|
|
83
|
+
</View>
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export default SonosSpeaker;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors } from '../../../configs';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
justifyContent: 'center',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
},
|
|
9
|
+
imageMain: {
|
|
10
|
+
marginTop: 25,
|
|
11
|
+
height: 200,
|
|
12
|
+
},
|
|
13
|
+
sonosSpeakerNotActive: {
|
|
14
|
+
marginTop: 30,
|
|
15
|
+
},
|
|
16
|
+
imageSoundSonos: {
|
|
17
|
+
marginBottom: 3,
|
|
18
|
+
},
|
|
19
|
+
containerSlider: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
},
|
|
22
|
+
emergencyDescription: {
|
|
23
|
+
color: Colors.Gray8,
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
},
|
|
26
|
+
threeButton: {
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
marginTop: 30,
|
|
29
|
+
},
|
|
30
|
+
buttonCenter: {
|
|
31
|
+
marginHorizontal: 50,
|
|
32
|
+
marginTop: 3,
|
|
33
|
+
},
|
|
34
|
+
volumeButton: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
marginTop: 35,
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
},
|
|
39
|
+
textVolumeRight: {
|
|
40
|
+
margin: 5,
|
|
41
|
+
marginLeft: 20,
|
|
42
|
+
marginRight: 20,
|
|
43
|
+
},
|
|
44
|
+
textVolumeLeft: {
|
|
45
|
+
marginLeft: 10,
|
|
46
|
+
marginRight: 70,
|
|
47
|
+
},
|
|
48
|
+
imageVolumeButton: {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
marginLeft: 20,
|
|
52
|
+
},
|
|
53
|
+
slider: {
|
|
54
|
+
height: 10,
|
|
55
|
+
borderRadius: 10,
|
|
56
|
+
},
|
|
57
|
+
});
|