@ledvance/group-ui-biz-bundle 1.0.105 → 1.0.107
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/package.json +6 -36
- package/src/modules/music/MusicActions.ts +4 -4
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +1 -1
- package/src/modules/time_schedule/Interface.ts +0 -90
- package/src/modules/time_schedule/ScheduleCard.tsx +0 -128
- package/src/modules/time_schedule/TimeScheduleActions.ts +0 -102
- package/src/modules/time_schedule/TimeScheduleDetailPage.tsx +0 -910
- package/src/modules/time_schedule/TimeSchedulePage.tsx +0 -256
|
@@ -1,910 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo } from "react";
|
|
2
|
-
import { FlatList, ScrollView, StyleSheet, Text, View } from 'react-native'
|
|
3
|
-
import { useNavigation, useRoute } from '@react-navigation/native'
|
|
4
|
-
import Page from "@ledvance/base/src/components/Page";
|
|
5
|
-
import I18n from "@ledvance/base/src/i18n";
|
|
6
|
-
import TextField from "@ledvance/base/src/components/TextField";
|
|
7
|
-
import { cloneDeep, isEqual } from "lodash";
|
|
8
|
-
import { useCreation, useReactive } from "ahooks";
|
|
9
|
-
import { SwitchButton, TimerPicker, Utils } from "tuya-panel-kit";
|
|
10
|
-
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
11
|
-
import LdvWeekView from '@ledvance/base/src/components/weekSelect'
|
|
12
|
-
import { convertTo12HourFormat, loopText, showDialog } from "@ledvance/base/src/utils/common";
|
|
13
|
-
import Card from "@ledvance/base/src/components/Card";
|
|
14
|
-
import LdvSwitch from "@ledvance/base/src/components/ldvSwitch";
|
|
15
|
-
import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList'
|
|
16
|
-
import LampAdjustView from "@ledvance/base/src/components/LampAdjustView";
|
|
17
|
-
import { Timer, UVCFanMode } from './Interface'
|
|
18
|
-
import res from "@ledvance/base/src/res";
|
|
19
|
-
import { useGroupDevices, useMoods, useSystemTimeFormate, useUAGroupInfo } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
20
|
-
import { TimeSchedulePageParams } from "./TimeSchedulePage";
|
|
21
|
-
import { Result } from "@ledvance/base/src/models/modules/Result";
|
|
22
|
-
import DeleteButton from "@ledvance/base/src/components/DeleteButton";
|
|
23
|
-
import InfoText from "@ledvance/base/src/components/InfoText";
|
|
24
|
-
import SegmentControl from "@ledvance/base/src/components/segmentControl";
|
|
25
|
-
import { getHSVByHex, getHexByHSV } from "@ledvance/base/src/utils";
|
|
26
|
-
import MoodItem from "../mood/MoodItem";
|
|
27
|
-
import { dp2Obj, getRemoteSceneList, obj2Dp, stripDp2Obj, stripObj2Dp } from "../mood/SceneAction";
|
|
28
|
-
import FanAdjustView from "@ledvance/base/src/components/FanAdjustView";
|
|
29
|
-
import { SceneMode } from "../mood/SceneInfo";
|
|
30
|
-
import StripAdjustView, { ColorList } from "@ledvance/base/src/components/StripAdjustView"
|
|
31
|
-
import SocketItem from '@ledvance/base/src/components/SocketItem'
|
|
32
|
-
import { WorkMode } from "@ledvance/base/src/utils/interface";
|
|
33
|
-
import { Buffer } from 'buffer'
|
|
34
|
-
import { fanModeOption, actionOption } from "./TimeScheduleActions";
|
|
35
|
-
import LoadingView from "@ledvance/base/src/components/LoadingView";
|
|
36
|
-
|
|
37
|
-
const { convertX: cx } = Utils.RatioUtils;
|
|
38
|
-
const { toFixedString } = Utils.NumberUtils;
|
|
39
|
-
interface TimeScheduleDetailPageParams extends TimeSchedulePageParams {
|
|
40
|
-
mode: 'add' | 'edit'
|
|
41
|
-
timeSchedule: Timer,
|
|
42
|
-
modDeleteTimeSchedule: (mode: 'add' | 'edit' | 'del', timeSchedule: Timer, ids: string) => Promise<Result<any>>
|
|
43
|
-
refreshFn: () => void
|
|
44
|
-
}
|
|
45
|
-
const TimeScheduleDetailPage = () => {
|
|
46
|
-
const navigation = useNavigation()
|
|
47
|
-
const uaGroupInfo = useUAGroupInfo()
|
|
48
|
-
const is24HourClock = useSystemTimeFormate()
|
|
49
|
-
const [groupDevices] = useGroupDevices()
|
|
50
|
-
const [moods, setMoods] = useMoods()
|
|
51
|
-
const props = cloneDeep(useRoute().params) as TimeScheduleDetailPageParams
|
|
52
|
-
const state = useReactive({
|
|
53
|
-
timeSchedule: props.mode === 'add' ? newTimeSchedule() : cloneDeep(props.timeSchedule),
|
|
54
|
-
isManual: true, // manual ,mood
|
|
55
|
-
isColorMode: !!props.colorDataCode,
|
|
56
|
-
switchLed: true, // light
|
|
57
|
-
switchSocket1: true,
|
|
58
|
-
switchSocket2: true,
|
|
59
|
-
switchSocket3: true,
|
|
60
|
-
switchSocketUSB: true,
|
|
61
|
-
switchFan: true,
|
|
62
|
-
fanMode: UVCFanMode.Normal,
|
|
63
|
-
fanSpeed: 1,
|
|
64
|
-
brightness: 100,
|
|
65
|
-
temperature: 0,
|
|
66
|
-
hsv: defaultHsv(),
|
|
67
|
-
stripState: defaultStripState(),
|
|
68
|
-
scene: '',
|
|
69
|
-
loading: false,
|
|
70
|
-
moodLoading: false
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
const tabList = useCreation(() => {
|
|
74
|
-
const isSupportWhite = props.isSupportBrightness || props.isSupportTemperature
|
|
75
|
-
const tabs = [
|
|
76
|
-
{ key: 1, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_color_text') },
|
|
77
|
-
{ key: 0, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_white_text') },
|
|
78
|
-
{ key: 3, title: I18n.getLang('add_new_dynamic_mood_strip_lights_schedule_switch_tab_combination_text') },
|
|
79
|
-
]
|
|
80
|
-
if (!isSupportWhite) {
|
|
81
|
-
return tabs.filter(tab => tab.key !== 0)
|
|
82
|
-
}
|
|
83
|
-
if (!props.isSupportColor) {
|
|
84
|
-
return tabs.filter(tab => tab.key === 0)
|
|
85
|
-
}
|
|
86
|
-
return tabs
|
|
87
|
-
}, [])
|
|
88
|
-
|
|
89
|
-
const isPowerStrip = useMemo(() => {
|
|
90
|
-
return !!(props.switchSocket3 || props.switchSocketUSB)
|
|
91
|
-
}, [])
|
|
92
|
-
|
|
93
|
-
const getSceneByDp = (sceneDp: string) => {
|
|
94
|
-
if (props.sceneDataDp2Obj) {
|
|
95
|
-
return props.sceneDataDp2Obj(sceneDp)
|
|
96
|
-
}
|
|
97
|
-
const isFantasy = props.isStringLight || props.isStripLight
|
|
98
|
-
return isFantasy ? stripDp2Obj(Buffer.from(sceneDp, 'base64').toString('hex'), props.isStringLight) : dp2Obj(sceneDp, props.isSupportFan, props.isSupportUVC)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const getDpByScene = (scene: any) => {
|
|
102
|
-
if (props.sceneDataObj2Dp) {
|
|
103
|
-
return props.sceneDataObj2Dp(scene)
|
|
104
|
-
}
|
|
105
|
-
const isFantasy = props.isStringLight || props.isStripLight
|
|
106
|
-
return isFantasy ? Buffer.from(stripObj2Dp(scene, props.isStringLight), 'hex').toString('base64') : obj2Dp(scene, props.isSupportFan, props.isSupportUVC)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const modeId = useMemo(() => {
|
|
110
|
-
if (state.scene) {
|
|
111
|
-
return getSceneByDp(state.scene).id
|
|
112
|
-
}
|
|
113
|
-
return -1
|
|
114
|
-
}, [state.scene])
|
|
115
|
-
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (!(moods && moods.length) && props.sceneDataCode) {
|
|
118
|
-
state.moodLoading = true
|
|
119
|
-
getRemoteSceneList(uaGroupInfo.tyGroupId.toString(), {
|
|
120
|
-
isSupportColor: props.isSupportColor,
|
|
121
|
-
isSupportTemperature: props.isSupportTemperature,
|
|
122
|
-
isSupportBrightness: props.isSupportBrightness,
|
|
123
|
-
isStringLight: props.isStringLight,
|
|
124
|
-
isStripLight: props.isStripLight
|
|
125
|
-
}).then(res => {
|
|
126
|
-
if (res.success && res.data) {
|
|
127
|
-
setMoods(res.data)
|
|
128
|
-
if (props.mode === 'add') state.scene = getDpByScene(res.data[0])
|
|
129
|
-
}
|
|
130
|
-
state.moodLoading = false
|
|
131
|
-
}).catch(() => {
|
|
132
|
-
state.moodLoading = false
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
}, [])
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (props.mode === 'edit' && props.timeSchedule) {
|
|
139
|
-
const dps = JSON.parse(props.timeSchedule.dps)
|
|
140
|
-
if (props.switchLedCode && dps.hasOwnProperty(props.switchLedCode)) {
|
|
141
|
-
state.switchLed = dps[props.switchLedCode]
|
|
142
|
-
}
|
|
143
|
-
if (props.switchSocket1 && dps.hasOwnProperty(props.switchSocket1)) {
|
|
144
|
-
state.switchSocket1 = dps[props.switchSocket1]
|
|
145
|
-
}
|
|
146
|
-
if (props.switchSocket2 && dps.hasOwnProperty(props.switchSocket2)) {
|
|
147
|
-
state.switchSocket2 = dps[props.switchSocket2]
|
|
148
|
-
}
|
|
149
|
-
if (props.switchSocket3 && dps.hasOwnProperty(props.switchSocket3)) {
|
|
150
|
-
state.switchSocket3 = dps[props.switchSocket3]
|
|
151
|
-
}
|
|
152
|
-
if (props.switchSocketUSB && dps.hasOwnProperty(props.switchSocketUSB)) {
|
|
153
|
-
state.switchSocketUSB = dps[props.switchSocketUSB]
|
|
154
|
-
}
|
|
155
|
-
if (props.switchFan && dps.hasOwnProperty(props.switchFan)) {
|
|
156
|
-
state.switchFan = dps[props.switchFan]
|
|
157
|
-
}
|
|
158
|
-
if (props.fanModeCode && dps.hasOwnProperty(props.fanModeCode)) {
|
|
159
|
-
state.fanMode = dps[props.fanModeCode]
|
|
160
|
-
}
|
|
161
|
-
if (props.fanSpeedCode && dps.hasOwnProperty(props.fanSpeedCode)) {
|
|
162
|
-
state.fanSpeed = dps[props.fanSpeedCode]
|
|
163
|
-
}
|
|
164
|
-
if (props.tempValueCode && dps.hasOwnProperty(props.tempValueCode)) {
|
|
165
|
-
if (props.tempValueParser) {
|
|
166
|
-
state.temperature = props.tempValueParser(dps[props.tempValueCode])
|
|
167
|
-
} else {
|
|
168
|
-
state.temperature = Math.round(dps[props.tempValueCode] / 10)
|
|
169
|
-
}
|
|
170
|
-
state.isColorMode = false
|
|
171
|
-
}
|
|
172
|
-
if (props.brightValueCode && dps.hasOwnProperty(props.brightValueCode)) {
|
|
173
|
-
if (props.brightValueParser) {
|
|
174
|
-
state.brightness = props.brightValueParser(dps[props.brightValueCode])
|
|
175
|
-
} else {
|
|
176
|
-
state.brightness = Math.round(dps[props.brightValueCode] / 10)
|
|
177
|
-
}
|
|
178
|
-
state.isColorMode = false
|
|
179
|
-
}
|
|
180
|
-
if (props.colorDataCode && dps.hasOwnProperty(props.colorDataCode)) {
|
|
181
|
-
if (props.colorDataDp2Obj) {
|
|
182
|
-
const color = props.colorDataDp2Obj(dps[props.colorDataCode])
|
|
183
|
-
state.hsv = cloneDeep(color)
|
|
184
|
-
if (props.isMatterLight && props.brightValueCode && dps.hasOwnProperty(props.brightValueCode) && props.brightValueParser) {
|
|
185
|
-
state.hsv.v = props.brightValueParser(dps[props.brightValueCode])
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
const hsv = getHSVByHex(dps[props.colorDataCode])
|
|
189
|
-
state.hsv = {
|
|
190
|
-
h: hsv.h,
|
|
191
|
-
s: Math.round(hsv.s / 10),
|
|
192
|
-
v: Math.round(hsv.v / 10),
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
state.isColorMode = true
|
|
196
|
-
}
|
|
197
|
-
if (props.sceneDataCode && dps.hasOwnProperty(props.sceneDataCode)) {
|
|
198
|
-
if (dps[props.sceneDataCode]) {
|
|
199
|
-
state.scene = dps[props.sceneDataCode]
|
|
200
|
-
} else {
|
|
201
|
-
state.scene = getDpByScene(moods[0])
|
|
202
|
-
}
|
|
203
|
-
state.isManual = false
|
|
204
|
-
}
|
|
205
|
-
if (props.drawToolDataCode && dps.hasOwnProperty(props.drawToolDataCode)) {
|
|
206
|
-
if (props.drawToolDataDp2Obj && dps[props.drawToolDataCode]) {
|
|
207
|
-
const { hsv, brightness, temperature, stripState, isColor } = props.drawToolDataDp2Obj(dps[props.drawToolDataCode])
|
|
208
|
-
state.brightness = brightness
|
|
209
|
-
state.temperature = temperature
|
|
210
|
-
state.hsv = cloneDeep(hsv)
|
|
211
|
-
if (stripState) {
|
|
212
|
-
state.stripState = cloneDeep(stripState)
|
|
213
|
-
}
|
|
214
|
-
state.isColorMode = !!isColor
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
if (moods && moods.length) {
|
|
219
|
-
state.scene = getDpByScene(moods[0])
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}, [props.mode, JSON.stringify(props.timeSchedule), JSON.stringify(moods)])
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const getFormateTime = useCallback((time: number | string) => {
|
|
226
|
-
if (typeof time === 'number') {
|
|
227
|
-
return `${toFixedString(Math.trunc(time / 60), 2)}:${toFixedString(time % 60, 2)}`
|
|
228
|
-
}
|
|
229
|
-
if (typeof time === 'string') {
|
|
230
|
-
const t = time.split(':')
|
|
231
|
-
return Number(t[0]) * 60 + Number(t[1])
|
|
232
|
-
}
|
|
233
|
-
return time
|
|
234
|
-
}, [])
|
|
235
|
-
|
|
236
|
-
const getActionOnOff = useMemo(() => {
|
|
237
|
-
const off: string[] = []
|
|
238
|
-
const on: string[] = []
|
|
239
|
-
if (props.switchLedCode) {
|
|
240
|
-
const s = actionOption['switchLed']
|
|
241
|
-
if (state.switchLed) {
|
|
242
|
-
on.push(s)
|
|
243
|
-
} else {
|
|
244
|
-
off.push(s)
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (props.switchSocket1) {
|
|
248
|
-
const s = isPowerStrip ? actionOption['switchSocket1'] : actionOption['switchSocket']
|
|
249
|
-
if (state.switchSocket1) {
|
|
250
|
-
on.push(s)
|
|
251
|
-
} else {
|
|
252
|
-
off.push(s)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (props.switchSocket2) {
|
|
256
|
-
const s = actionOption['switchSocket2']
|
|
257
|
-
if (state.switchSocket2) {
|
|
258
|
-
on.push(s)
|
|
259
|
-
} else {
|
|
260
|
-
off.push(s)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (props.switchSocket3) {
|
|
264
|
-
const s = actionOption['switchSocket3']
|
|
265
|
-
if (state.switchSocket3) {
|
|
266
|
-
on.push(s)
|
|
267
|
-
} else {
|
|
268
|
-
off.push(s)
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (props.switchSocketUSB) {
|
|
272
|
-
const s = actionOption['switchSocket4']
|
|
273
|
-
if (state.switchSocketUSB) {
|
|
274
|
-
on.push(s)
|
|
275
|
-
} else {
|
|
276
|
-
off.push(s)
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (props.switchFan) {
|
|
280
|
-
const s = actionOption['switchFan']
|
|
281
|
-
if (state.switchFan) {
|
|
282
|
-
on.push(s)
|
|
283
|
-
} else {
|
|
284
|
-
off.push(s)
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return {
|
|
288
|
-
on, off
|
|
289
|
-
}
|
|
290
|
-
}, [state.switchLed, state.switchSocket1, state.switchSocket2, state.switchSocket3, state.switchSocketUSB, state.switchFan])
|
|
291
|
-
|
|
292
|
-
const getActions = useCallback(() => {
|
|
293
|
-
const actions = {
|
|
294
|
-
time: state.timeSchedule.time,
|
|
295
|
-
dps: {}
|
|
296
|
-
}
|
|
297
|
-
if (state.isManual) {
|
|
298
|
-
if (state.switchLed) {
|
|
299
|
-
if (props.drawToolDataObj2Dp && props.drawToolDataCode) {
|
|
300
|
-
actions.dps[props.drawToolDataCode] = props.drawToolDataObj2Dp({
|
|
301
|
-
hsv: state.hsv,
|
|
302
|
-
stripState: state.stripState,
|
|
303
|
-
brightness: state.brightness,
|
|
304
|
-
temperature: state.temperature,
|
|
305
|
-
isColor: state.isColorMode
|
|
306
|
-
})
|
|
307
|
-
const whiteMode = props.isStringLight ? !state.isColorMode : state.stripState.activeKey === 0
|
|
308
|
-
if (props.workModeCode) actions.dps[props.workModeCode] = whiteMode ? WorkMode.White : WorkMode.Colour
|
|
309
|
-
|
|
310
|
-
} else if (state.isColorMode) {
|
|
311
|
-
if (props.colorDataCode) {
|
|
312
|
-
const hsv = {
|
|
313
|
-
...state.hsv,
|
|
314
|
-
s: state.hsv.s * 10,
|
|
315
|
-
v: state.hsv.v * 10,
|
|
316
|
-
}
|
|
317
|
-
if (props.colorDataObj2Dp) {
|
|
318
|
-
actions.dps[props.colorDataCode] = props.colorDataObj2Dp(hsv)
|
|
319
|
-
if (props.isMatterLight && props.brightValueCode && props.brightValueFormatter) {
|
|
320
|
-
actions.dps[props.brightValueCode] = props.brightValueFormatter(state.hsv.v)
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
const hex = getHexByHSV(hsv)
|
|
324
|
-
actions.dps[props.colorDataCode] = hex
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (props.workModeCode) actions.dps[props.workModeCode] = WorkMode.Colour
|
|
328
|
-
} else {
|
|
329
|
-
if (props.brightValueCode) {
|
|
330
|
-
if (props.brightValueFormatter) {
|
|
331
|
-
actions.dps[props.brightValueCode] = props.brightValueFormatter(state.brightness)
|
|
332
|
-
} else {
|
|
333
|
-
actions.dps[props.brightValueCode] = state.brightness * 10
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
if (props.tempValueCode) {
|
|
337
|
-
if (props.tempValueFormatter) {
|
|
338
|
-
actions.dps[props.tempValueCode] = props.tempValueFormatter(state.temperature)
|
|
339
|
-
} else {
|
|
340
|
-
actions.dps[props.tempValueCode] = state.temperature * 10
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (props.workModeCode) actions.dps[props.workModeCode] = WorkMode.White
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (props.switchLedCode) {
|
|
347
|
-
actions.dps[props.switchLedCode] = state.switchLed
|
|
348
|
-
}
|
|
349
|
-
if (props.switchSocket1) {
|
|
350
|
-
actions.dps[props.switchSocket1] = state.switchSocket1
|
|
351
|
-
}
|
|
352
|
-
if (props.switchSocket2) {
|
|
353
|
-
actions.dps[props.switchSocket2] = state.switchSocket2
|
|
354
|
-
}
|
|
355
|
-
if (props.switchSocket3) {
|
|
356
|
-
actions.dps[props.switchSocket3] = state.switchSocket3
|
|
357
|
-
}
|
|
358
|
-
if (props.switchSocketUSB) {
|
|
359
|
-
actions.dps[props.switchSocketUSB] = state.switchSocketUSB
|
|
360
|
-
}
|
|
361
|
-
if (props.switchFan) {
|
|
362
|
-
actions.dps[props.switchFan] = state.switchFan
|
|
363
|
-
if (props.fanModeCode && state.switchFan) {
|
|
364
|
-
actions.dps[props.fanModeCode] = state.fanMode
|
|
365
|
-
}
|
|
366
|
-
if (props.fanSpeedCode && state.switchFan) {
|
|
367
|
-
actions.dps[props.fanSpeedCode] = state.fanSpeed
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
} else {
|
|
371
|
-
if (props.sceneDataCode) {
|
|
372
|
-
actions.dps[props.sceneDataCode] = state.scene
|
|
373
|
-
}
|
|
374
|
-
actions.dps[props.workModeCode] = WorkMode.Scene
|
|
375
|
-
if (props.switchLedCode) {
|
|
376
|
-
actions.dps[props.switchLedCode] = true
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
console.log(state, '< --- state')
|
|
380
|
-
console.log(actions, '< --- actions')
|
|
381
|
-
return JSON.stringify(actions)
|
|
382
|
-
}, [JSON.stringify(state)])
|
|
383
|
-
|
|
384
|
-
const isModify = useMemo(() => {
|
|
385
|
-
const schedule = props.mode === 'add' ? newTimeSchedule() : props.timeSchedule
|
|
386
|
-
const before = {
|
|
387
|
-
aliasName: schedule.aliasName,
|
|
388
|
-
time: schedule.time,
|
|
389
|
-
isAppPush: schedule.isAppPush,
|
|
390
|
-
loops: schedule.loops
|
|
391
|
-
}
|
|
392
|
-
const now = {
|
|
393
|
-
aliasName: state.timeSchedule.aliasName,
|
|
394
|
-
time: state.timeSchedule.time,
|
|
395
|
-
isAppPush: state.timeSchedule.isAppPush,
|
|
396
|
-
loops: state.timeSchedule.loops
|
|
397
|
-
}
|
|
398
|
-
if (props.mode === 'add') {
|
|
399
|
-
return isEqual(before, now)
|
|
400
|
-
} else {
|
|
401
|
-
return isEqual({
|
|
402
|
-
...before,
|
|
403
|
-
dps: JSON.stringify({
|
|
404
|
-
time: before.time,
|
|
405
|
-
dps: JSON.parse(schedule.dps)
|
|
406
|
-
})
|
|
407
|
-
}, {
|
|
408
|
-
...now,
|
|
409
|
-
dps: getActions()
|
|
410
|
-
})
|
|
411
|
-
}
|
|
412
|
-
}, [JSON.stringify(state)])
|
|
413
|
-
|
|
414
|
-
const allowSubmit = useMemo(() => {
|
|
415
|
-
return !!(state.timeSchedule.aliasName.length && state.timeSchedule.aliasName.length < 33) && !isModify
|
|
416
|
-
}, [state.timeSchedule.aliasName, isModify])
|
|
417
|
-
|
|
418
|
-
const gradientMode = useMemo(() => (
|
|
419
|
-
props.isStringLight ? SceneMode.StringGradient : props.isStripLight ? SceneMode.StripGradient : SceneMode.SourceGradient
|
|
420
|
-
), [props.isStringLight, props.isStripLight, SceneMode])
|
|
421
|
-
|
|
422
|
-
return (
|
|
423
|
-
<Page
|
|
424
|
-
backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
|
|
425
|
-
headlineText={I18n.getLang(props.mode === 'add' ? 'motion_detection_add_time_schedule_headline_text' : 'edit_timeschedule_headline_text')}
|
|
426
|
-
rightButtonIcon={allowSubmit ? res.ic_check : res.ic_uncheck}
|
|
427
|
-
rightButtonIconClick={async () => {
|
|
428
|
-
if (!allowSubmit || state.loading) return
|
|
429
|
-
showDialog({
|
|
430
|
-
method: 'confirm',
|
|
431
|
-
title: I18n.getLang('conflict_dialog_active_item_timeschedule_titel'),
|
|
432
|
-
subTitle: I18n.getLang('group_conflict_feature'),
|
|
433
|
-
confirmText: I18n.getLang('registration_dialog_button_yes'),
|
|
434
|
-
cancelText: I18n.getLang('registration_dialog_button_no'),
|
|
435
|
-
onConfirm: async (_, { close }) => {
|
|
436
|
-
state.loading = true
|
|
437
|
-
const res = await props.modDeleteTimeSchedule(props.mode, {
|
|
438
|
-
...state.timeSchedule,
|
|
439
|
-
status: 1,
|
|
440
|
-
dps: getActions()
|
|
441
|
-
}, '')
|
|
442
|
-
console.log(res, '< ---- resss')
|
|
443
|
-
state.loading = false
|
|
444
|
-
if (res.success) {
|
|
445
|
-
close()
|
|
446
|
-
props.refreshFn()
|
|
447
|
-
navigation.goBack()
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
})
|
|
451
|
-
}}
|
|
452
|
-
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
453
|
-
backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_timeschedule_note')}
|
|
454
|
-
showBackDialog={!isModify}
|
|
455
|
-
loading={state.loading}
|
|
456
|
-
>
|
|
457
|
-
<ScrollView nestedScrollEnabled={true}>
|
|
458
|
-
<TextField
|
|
459
|
-
style={styles.cardContainer}
|
|
460
|
-
value={state.timeSchedule.aliasName}
|
|
461
|
-
showError={state.timeSchedule.aliasName?.length > 32}
|
|
462
|
-
maxLength={33}
|
|
463
|
-
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}
|
|
464
|
-
placeholder={I18n.getLang('add_new_trigger_time_inputfield_value_text')}
|
|
465
|
-
onChangeText={(t: string) => {
|
|
466
|
-
state.timeSchedule.aliasName = t;
|
|
467
|
-
}}
|
|
468
|
-
/>
|
|
469
|
-
|
|
470
|
-
{/* pick */}
|
|
471
|
-
<TimerPicker
|
|
472
|
-
itemTextColor='#aeadb5'
|
|
473
|
-
style={{ paddingVertical: cx(0), marginVertical: cx(0) }}
|
|
474
|
-
is12Hours={!is24HourClock}
|
|
475
|
-
singlePicker={true}
|
|
476
|
-
amText={I18n.getLang('manage_user_calendar_label_am')}
|
|
477
|
-
pmText={I18n.getLang('manage_user_calendar_label_pm')}
|
|
478
|
-
startTime={getFormateTime(state.timeSchedule.time) as number}
|
|
479
|
-
symbol={''}
|
|
480
|
-
onTimerChange={(startTime) => {
|
|
481
|
-
state.timeSchedule.time = getFormateTime(startTime) as string
|
|
482
|
-
}} />
|
|
483
|
-
<LdvWeekView
|
|
484
|
-
value={state.timeSchedule.loops.split('').map(Number)}
|
|
485
|
-
style={styles.cardContainer}
|
|
486
|
-
onSelect={(index: number) => {
|
|
487
|
-
const rawIndex = index - 1
|
|
488
|
-
const weeks = state.timeSchedule.loops.split('')
|
|
489
|
-
weeks[rawIndex] = weeks[rawIndex] === '1' ? '0' : '1'
|
|
490
|
-
state.timeSchedule.loops = weeks.join('')
|
|
491
|
-
}} />
|
|
492
|
-
<Spacer />
|
|
493
|
-
<Text style={styles.cardContainer}>{loopText(state.timeSchedule.loops.split(''))}</Text>
|
|
494
|
-
<Spacer height={cx(30)} />
|
|
495
|
-
|
|
496
|
-
{/* device state */}
|
|
497
|
-
<Text style={[styles.itemTitle, styles.cardContainer]}>{I18n.getLang('timeschedule_add_schedule_subheadline2_text')}</Text>
|
|
498
|
-
<Spacer height={cx(10)} />
|
|
499
|
-
{props.isSupportMood && <SegmentControl
|
|
500
|
-
title1={I18n.getLang('timeschedule_add_schedule_switch_tab_manual_text')}
|
|
501
|
-
title2={I18n.getLang('timeschedule_add_schedule_switch_tab_mood_text')}
|
|
502
|
-
isFirst={state.isManual}
|
|
503
|
-
setIsFirst={(v: boolean) => state.isManual = v}
|
|
504
|
-
/>}
|
|
505
|
-
<Spacer height={cx(10)} />
|
|
506
|
-
{state.isManual ?
|
|
507
|
-
<>
|
|
508
|
-
{!!props.switchLedCode && <>
|
|
509
|
-
<Card
|
|
510
|
-
style={styles.cardContainer}
|
|
511
|
-
>
|
|
512
|
-
<LdvSwitch
|
|
513
|
-
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
514
|
-
color={'#fff'}
|
|
515
|
-
colorAlpha={1}
|
|
516
|
-
enable={state.switchLed}
|
|
517
|
-
setEnable={(enable: boolean) => {
|
|
518
|
-
state.switchLed = enable
|
|
519
|
-
}}
|
|
520
|
-
/>
|
|
521
|
-
{state.switchLed && (props.isStripLight ?
|
|
522
|
-
<StripAdjustView
|
|
523
|
-
lampTabs={tabList}
|
|
524
|
-
onColorDiskChange={(color, idx: K) => {
|
|
525
|
-
state.stripState = {
|
|
526
|
-
...state.stripState,
|
|
527
|
-
colors: color,
|
|
528
|
-
colorDiskActiveKey: idx
|
|
529
|
-
}
|
|
530
|
-
}}
|
|
531
|
-
colorDiskActiveKey={state.stripState.colorDiskActiveKey}
|
|
532
|
-
activeKey={state.stripState.activeKey}
|
|
533
|
-
onActiveKeyChange={(v) => {
|
|
534
|
-
state.stripState = {
|
|
535
|
-
...state.stripState,
|
|
536
|
-
activeKey: Number(v) as K
|
|
537
|
-
}
|
|
538
|
-
}}
|
|
539
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
540
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
541
|
-
h={state.hsv.h} s={state.hsv.s} v={state.hsv.v}
|
|
542
|
-
onHSVChange={(h, s, v) => { state.hsv = { h, s, v } }}
|
|
543
|
-
onHSVChangeComplete={(h, s, v) => { state.hsv = { h, s, v } }}
|
|
544
|
-
colorTemp={state.temperature}
|
|
545
|
-
brightness={state.brightness}
|
|
546
|
-
onCCTChange={() => { }}
|
|
547
|
-
onCCTChangeComplete={(cct) => { state.temperature = cct }}
|
|
548
|
-
onBrightnessChange={() => { }}
|
|
549
|
-
onBrightnessChangeComplete={(bright) => { state.brightness = bright }}
|
|
550
|
-
/> :
|
|
551
|
-
<LampAdjustView
|
|
552
|
-
reserveSV={true}
|
|
553
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
554
|
-
isSupportColor={props.isSupportColor}
|
|
555
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
556
|
-
isColorMode={state.isColorMode}
|
|
557
|
-
setIsColorMode={(v) => { state.isColorMode = v }}
|
|
558
|
-
h={state.hsv.h} s={state.hsv.s} v={state.hsv.v}
|
|
559
|
-
colorTemp={state.temperature}
|
|
560
|
-
brightness={state.brightness}
|
|
561
|
-
onHSVChangeComplete={(h, s, v) => { state.hsv = { h, s, v } }}
|
|
562
|
-
onHSVChange={(h, s, v) => { state.hsv = { h, s, v } }}
|
|
563
|
-
onCCTChangeComplete={(cct) => { state.temperature = cct }}
|
|
564
|
-
onCCTChange={(cct) => { state.temperature = cct }}
|
|
565
|
-
onBrightnessChangeComplete={(bright) => { state.brightness = bright }}
|
|
566
|
-
onBrightnessChange={(bright) => { state.brightness = bright }}
|
|
567
|
-
/>)}
|
|
568
|
-
<ApplyForDeviceList
|
|
569
|
-
devices={cloneDeep(groupDevices)}
|
|
570
|
-
/>
|
|
571
|
-
<Spacer height={cx(16)} />
|
|
572
|
-
</Card>
|
|
573
|
-
<Spacer />
|
|
574
|
-
</>}
|
|
575
|
-
|
|
576
|
-
{/* socket */}
|
|
577
|
-
{!!props.switchSocket1 && <>
|
|
578
|
-
{isPowerStrip ?
|
|
579
|
-
<SocketItem
|
|
580
|
-
title={I18n.getLang('feature_summary_action_component_6')}
|
|
581
|
-
name=""
|
|
582
|
-
icon={{ uri: res.switch_1 }}
|
|
583
|
-
onNameChange={() => { }}
|
|
584
|
-
enabled={state.switchSocket1}
|
|
585
|
-
disabledEdit={true}
|
|
586
|
-
onSwitchChange={enable => {
|
|
587
|
-
state.switchSocket1 = enable
|
|
588
|
-
}}
|
|
589
|
-
>
|
|
590
|
-
<ApplyForDeviceList
|
|
591
|
-
devices={cloneDeep(groupDevices)}
|
|
592
|
-
/>
|
|
593
|
-
<Spacer height={cx(16)} />
|
|
594
|
-
</SocketItem> :
|
|
595
|
-
<Card
|
|
596
|
-
style={styles.cardContainer}
|
|
597
|
-
>
|
|
598
|
-
<LdvSwitch
|
|
599
|
-
title={I18n.getLang('feature_summary_action_component_5')}
|
|
600
|
-
color={'#fff'}
|
|
601
|
-
colorAlpha={1}
|
|
602
|
-
enable={state.switchSocket1}
|
|
603
|
-
setEnable={(enable: boolean) => {
|
|
604
|
-
state.switchSocket1 = enable
|
|
605
|
-
}}
|
|
606
|
-
/>
|
|
607
|
-
<ApplyForDeviceList
|
|
608
|
-
devices={cloneDeep(groupDevices)}
|
|
609
|
-
/>
|
|
610
|
-
<Spacer height={cx(16)} />
|
|
611
|
-
</Card>
|
|
612
|
-
}
|
|
613
|
-
<Spacer />
|
|
614
|
-
</>}
|
|
615
|
-
{!!props.switchSocket2 && <>
|
|
616
|
-
<SocketItem
|
|
617
|
-
title={I18n.getLang('feature_summary_action_component_7')}
|
|
618
|
-
name=""
|
|
619
|
-
icon={{ uri: res.switch_2 }}
|
|
620
|
-
onNameChange={() => { }}
|
|
621
|
-
enabled={state.switchSocket2}
|
|
622
|
-
disabledEdit={true}
|
|
623
|
-
onSwitchChange={enable => {
|
|
624
|
-
state.switchSocket2 = enable
|
|
625
|
-
}}
|
|
626
|
-
>
|
|
627
|
-
<ApplyForDeviceList
|
|
628
|
-
devices={cloneDeep(groupDevices)}
|
|
629
|
-
/>
|
|
630
|
-
<Spacer height={cx(16)} />
|
|
631
|
-
</SocketItem>
|
|
632
|
-
<Spacer />
|
|
633
|
-
</>}
|
|
634
|
-
{!!props.switchSocket3 && <>
|
|
635
|
-
<SocketItem
|
|
636
|
-
title={I18n.getLang('feature_summary_action_component_8')}
|
|
637
|
-
name=""
|
|
638
|
-
icon={{ uri: res.switch_3 }}
|
|
639
|
-
onNameChange={() => { }}
|
|
640
|
-
enabled={state.switchSocket3}
|
|
641
|
-
disabledEdit={true}
|
|
642
|
-
onSwitchChange={enable => {
|
|
643
|
-
state.switchSocket3 = enable
|
|
644
|
-
}}
|
|
645
|
-
>
|
|
646
|
-
<ApplyForDeviceList
|
|
647
|
-
devices={cloneDeep(groupDevices)}
|
|
648
|
-
/>
|
|
649
|
-
<Spacer height={cx(16)} />
|
|
650
|
-
</SocketItem>
|
|
651
|
-
<Spacer />
|
|
652
|
-
</>}
|
|
653
|
-
{!!props.switchSocketUSB && <>
|
|
654
|
-
<SocketItem
|
|
655
|
-
title={I18n.getLang('feature_summary_action_component_9')}
|
|
656
|
-
name=""
|
|
657
|
-
icon={{ uri: res.switch_4 }}
|
|
658
|
-
onNameChange={() => { }}
|
|
659
|
-
enabled={state.switchSocketUSB}
|
|
660
|
-
disabledEdit={true}
|
|
661
|
-
onSwitchChange={enable => {
|
|
662
|
-
state.switchSocketUSB = enable
|
|
663
|
-
}}
|
|
664
|
-
>
|
|
665
|
-
<ApplyForDeviceList
|
|
666
|
-
devices={cloneDeep(groupDevices)}
|
|
667
|
-
/>
|
|
668
|
-
<Spacer height={cx(16)} />
|
|
669
|
-
</SocketItem>
|
|
670
|
-
<Spacer />
|
|
671
|
-
</>}
|
|
672
|
-
|
|
673
|
-
{/* Fan */}
|
|
674
|
-
{props.isSupportFan && <FanAdjustView
|
|
675
|
-
style={styles.cardContainer}
|
|
676
|
-
fanEnable={state.switchFan}
|
|
677
|
-
fanSpeed={state.fanSpeed}
|
|
678
|
-
modeValue={state.fanMode}
|
|
679
|
-
modeOptions={fanModeOption}
|
|
680
|
-
modeChange={(v: any) => state.fanMode = v}
|
|
681
|
-
maxFanSpeed={props.isSupportUVC ? 20 : 3}
|
|
682
|
-
onFanSpeedChangeComplete={(v) => state.fanSpeed = v}
|
|
683
|
-
onFanSwitch={(enable) => {
|
|
684
|
-
state.switchFan = enable
|
|
685
|
-
}}
|
|
686
|
-
isSupportMode={props.isSupportUVC}
|
|
687
|
-
/>}
|
|
688
|
-
</> :
|
|
689
|
-
( state.moodLoading ?
|
|
690
|
-
<LoadingView />
|
|
691
|
-
:
|
|
692
|
-
<FlatList
|
|
693
|
-
data={cloneDeep(moods)}
|
|
694
|
-
renderItem={({ item }) => {
|
|
695
|
-
return (
|
|
696
|
-
<MoodItem
|
|
697
|
-
enable={modeId === item.id}
|
|
698
|
-
mood={item}
|
|
699
|
-
type={gradientMode === item.mode ? 'gradient' : 'separate'}
|
|
700
|
-
onSwitch={async _ => {
|
|
701
|
-
state.scene = getDpByScene(item)
|
|
702
|
-
}} />
|
|
703
|
-
)
|
|
704
|
-
}}
|
|
705
|
-
ListHeaderComponent={() => (<Spacer height={cx(10)} />)}
|
|
706
|
-
ItemSeparatorComponent={() => (<Spacer />)}
|
|
707
|
-
ListFooterComponent={() => (<View style={{ marginHorizontal: cx(8) }}>
|
|
708
|
-
<Spacer height={cx(16)} />
|
|
709
|
-
<ApplyForDeviceList
|
|
710
|
-
devices={cloneDeep(groupDevices)}
|
|
711
|
-
/>
|
|
712
|
-
</View>)}
|
|
713
|
-
keyExtractor={item => `${item.id}`} />
|
|
714
|
-
)
|
|
715
|
-
}
|
|
716
|
-
<Spacer height={cx(20)} />
|
|
717
|
-
<Text style={[styles.itemTitle, styles.cardContainer]}>{I18n.getLang('timeschedule_add_schedule_subheadline4_text')}</Text>
|
|
718
|
-
<View style={[styles.switchButton, styles.cardContainer]}>
|
|
719
|
-
<Text style={styles.text}>{I18n.getLang('timeschedule_add_schedule_text2')}</Text>
|
|
720
|
-
<SwitchButton
|
|
721
|
-
value={state.timeSchedule.isAppPush}
|
|
722
|
-
onValueChange={value => {
|
|
723
|
-
state.timeSchedule.isAppPush = value
|
|
724
|
-
}} />
|
|
725
|
-
</View>
|
|
726
|
-
<Spacer />
|
|
727
|
-
|
|
728
|
-
{/* summary */}
|
|
729
|
-
<Text style={[styles.itemTitle, styles.cardContainer]}>{I18n.getLang('add_sleepschedule_one_source_subheadline4_text')}</Text>
|
|
730
|
-
<Spacer height={cx(10)} />
|
|
731
|
-
<View style={styles.summaryContainer}>
|
|
732
|
-
<InfoText
|
|
733
|
-
icon={res.summary_icon1}
|
|
734
|
-
text={I18n.getLang('feature_summary_frequency_headline')}
|
|
735
|
-
iconStyle={styles.summaryImg}
|
|
736
|
-
textStyle={styles.leftTitle}
|
|
737
|
-
style={styles.summaryLeft}
|
|
738
|
-
/>
|
|
739
|
-
<View style={styles.summaryRight}>
|
|
740
|
-
<Text style={styles.rightItem}>{loopText(state.timeSchedule.loops.split(''), state.timeSchedule.time)}</Text>
|
|
741
|
-
</View>
|
|
742
|
-
</View>
|
|
743
|
-
<View style={styles.summaryContainer}>
|
|
744
|
-
<InfoText
|
|
745
|
-
icon={res.summary_icon2}
|
|
746
|
-
text={I18n.getLang('feature_summary_time_headline')}
|
|
747
|
-
iconStyle={styles.summaryImg}
|
|
748
|
-
textStyle={styles.leftTitle}
|
|
749
|
-
style={styles.summaryLeft}
|
|
750
|
-
/>
|
|
751
|
-
<View style={styles.summaryRight}>
|
|
752
|
-
<Text style={styles.rightItem}>{is24HourClock ? state.timeSchedule.time : convertTo12HourFormat(state.timeSchedule.time)}</Text>
|
|
753
|
-
</View>
|
|
754
|
-
</View>
|
|
755
|
-
<View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
756
|
-
<InfoText
|
|
757
|
-
icon={res.summary_icon3}
|
|
758
|
-
text={I18n.getLang('motion_detection_add_time_schedule_actions_text1')}
|
|
759
|
-
iconStyle={styles.summaryImg}
|
|
760
|
-
textStyle={styles.leftTitle}
|
|
761
|
-
style={styles.summaryLeft}
|
|
762
|
-
/>
|
|
763
|
-
<View style={{ marginLeft: cx(16), flex: 1 }}>
|
|
764
|
-
{!!getActionOnOff.on.length && <View>
|
|
765
|
-
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_1')}</Text>
|
|
766
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>{
|
|
767
|
-
getActionOnOff.on.map(item => (
|
|
768
|
-
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
769
|
-
key={item}>
|
|
770
|
-
<Text style={[styles.rightItem]}
|
|
771
|
-
>{item}</Text>
|
|
772
|
-
</View>
|
|
773
|
-
))
|
|
774
|
-
}</View>
|
|
775
|
-
</View>}
|
|
776
|
-
{!!getActionOnOff.off.length && <View>
|
|
777
|
-
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_2')}</Text>
|
|
778
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>{
|
|
779
|
-
getActionOnOff.off.map(item => (
|
|
780
|
-
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
781
|
-
key={item}>
|
|
782
|
-
<Text style={[styles.rightItem]}
|
|
783
|
-
>{item}</Text>
|
|
784
|
-
</View>
|
|
785
|
-
))}
|
|
786
|
-
</View>
|
|
787
|
-
</View>}
|
|
788
|
-
</View>
|
|
789
|
-
</View>
|
|
790
|
-
<Spacer height={cx(30)} />
|
|
791
|
-
|
|
792
|
-
{/* delete */}
|
|
793
|
-
{props.mode === 'edit' && <View style={{ marginHorizontal: cx(24) }}>
|
|
794
|
-
<DeleteButton
|
|
795
|
-
text={I18n.getLang('edit_timeschedule_bttn_text')}
|
|
796
|
-
onPress={() => {
|
|
797
|
-
showDialog({
|
|
798
|
-
method: 'confirm',
|
|
799
|
-
title: I18n.getLang('cancel_dialog_delete_item_timeschedule_titel'),
|
|
800
|
-
subTitle: I18n.getLang('cancel_dialog_delete_item_timeschedule_description'),
|
|
801
|
-
onConfirm: async (_, { close }) => {
|
|
802
|
-
state.loading = true
|
|
803
|
-
close()
|
|
804
|
-
const res = await props.modDeleteTimeSchedule('del', {
|
|
805
|
-
...state.timeSchedule,
|
|
806
|
-
status: 2
|
|
807
|
-
}, state.timeSchedule.id.toString())
|
|
808
|
-
state.loading = false
|
|
809
|
-
if (res.success) {
|
|
810
|
-
props.refreshFn()
|
|
811
|
-
navigation.goBack()
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
})
|
|
815
|
-
}}
|
|
816
|
-
/>
|
|
817
|
-
<Spacer />
|
|
818
|
-
</View>}
|
|
819
|
-
</ScrollView>
|
|
820
|
-
</Page>
|
|
821
|
-
)
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
const newTimeSchedule = () => {
|
|
825
|
-
return {
|
|
826
|
-
status: 1,
|
|
827
|
-
loops: '0000000',
|
|
828
|
-
isAppPush: false,
|
|
829
|
-
aliasName: '',
|
|
830
|
-
time: `${toFixedString(new Date().getHours(), 2)}:${toFixedString(new Date().getMinutes(), 2)}`,
|
|
831
|
-
dps: '',
|
|
832
|
-
id: -1
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
const defaultHsv = () => {
|
|
837
|
-
return {
|
|
838
|
-
h: 0,
|
|
839
|
-
s: 50,
|
|
840
|
-
v: 80
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
type K = 0 | 1 | 3
|
|
844
|
-
export interface StripState {
|
|
845
|
-
colorDiskActiveKey: number
|
|
846
|
-
colors: string[]
|
|
847
|
-
activeKey: K
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
const defaultStripState = (): StripState => {
|
|
851
|
-
return {
|
|
852
|
-
colorDiskActiveKey: 0,
|
|
853
|
-
colors: ColorList[0],
|
|
854
|
-
activeKey: 1,
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
const styles = StyleSheet.create({
|
|
859
|
-
cardContainer: {
|
|
860
|
-
marginHorizontal: cx(24)
|
|
861
|
-
},
|
|
862
|
-
itemTitle: {
|
|
863
|
-
color: '#000',
|
|
864
|
-
fontSize: cx(16),
|
|
865
|
-
fontWeight: 'bold',
|
|
866
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
867
|
-
},
|
|
868
|
-
summaryContainer: {
|
|
869
|
-
flexDirection: 'row',
|
|
870
|
-
justifyContent: 'flex-start',
|
|
871
|
-
marginBottom: cx(10),
|
|
872
|
-
marginHorizontal: cx(24)
|
|
873
|
-
},
|
|
874
|
-
summaryImg: {
|
|
875
|
-
height: cx(12),
|
|
876
|
-
width: cx(12),
|
|
877
|
-
tintColor: '#000'
|
|
878
|
-
},
|
|
879
|
-
summaryLeft: {
|
|
880
|
-
flexDirection: 'row',
|
|
881
|
-
alignItems: 'center',
|
|
882
|
-
minWidth: cx(90),
|
|
883
|
-
},
|
|
884
|
-
leftTitle: {
|
|
885
|
-
fontSize: cx(14),
|
|
886
|
-
color: '#000',
|
|
887
|
-
marginTop: 0
|
|
888
|
-
},
|
|
889
|
-
summaryRight: {
|
|
890
|
-
flexDirection: 'column',
|
|
891
|
-
marginLeft: cx(21),
|
|
892
|
-
backgroundColor: '#cbcbcb',
|
|
893
|
-
borderRadius: cx(16),
|
|
894
|
-
},
|
|
895
|
-
rightItem: {
|
|
896
|
-
paddingHorizontal: cx(12),
|
|
897
|
-
color: '#000',
|
|
898
|
-
},
|
|
899
|
-
switchButton: {
|
|
900
|
-
flexDirection: 'row',
|
|
901
|
-
alignItems: 'center',
|
|
902
|
-
justifyContent: 'space-between',
|
|
903
|
-
marginBottom: cx(10),
|
|
904
|
-
},
|
|
905
|
-
text: {
|
|
906
|
-
color: '#000',
|
|
907
|
-
},
|
|
908
|
-
})
|
|
909
|
-
|
|
910
|
-
export default TimeScheduleDetailPage
|