@ledvance/group-ui-biz-bundle 1.0.46 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +5 -13
  3. package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
  4. package/src/modules/biorhythm/BiorhythmPage.tsx +14 -38
  5. package/src/modules/biorhythm/Router.ts +34 -0
  6. package/src/modules/fixedTimeForPlug/Router.ts +25 -0
  7. package/src/modules/fixedTimingForLight/Router.ts +25 -0
  8. package/src/modules/flags/Router.ts +25 -0
  9. package/src/modules/mood/AddMoodPage.tsx +2 -2
  10. package/src/modules/mood_new/AddMoodPage.tsx +197 -0
  11. package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
  12. package/src/modules/mood_new/Interface.ts +219 -0
  13. package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
  14. package/src/modules/mood_new/MoodActions.ts +227 -0
  15. package/src/modules/mood_new/MoodInfo.ts +2151 -0
  16. package/src/modules/mood_new/MoodItem.tsx +148 -0
  17. package/src/modules/mood_new/MoodPage.tsx +374 -0
  18. package/src/modules/mood_new/MoodParse.ts +442 -0
  19. package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
  20. package/src/modules/mood_new/Router.ts +43 -0
  21. package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
  22. package/src/modules/music/Router.ts +16 -0
  23. package/src/modules/randomTimeForPlug/Router.ts +25 -0
  24. package/src/modules/randomTimingForLight/Router.ts +25 -0
  25. package/src/modules/remoteSwitch/Router.ts +16 -0
  26. package/src/modules/select/Router.ts +16 -0
  27. package/src/modules/switchGradient/Router.ts +16 -0
  28. package/src/modules/timeSchedule/Interface.ts +150 -0
  29. package/src/modules/timeSchedule/Router.ts +25 -0
  30. package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
  31. package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
  32. package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
  33. package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
  34. package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
  35. package/src/modules/timeSchedule/components/Summary.tsx +124 -0
  36. package/src/modules/timer/Router.ts +16 -0
  37. package/src/navigation/Routers.ts +1 -0
@@ -0,0 +1,625 @@
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
+ import {
3
+ FlatList,
4
+ Image,
5
+ ScrollView,
6
+ StyleSheet,
7
+ Text,
8
+ TouchableOpacity,
9
+ View,
10
+ } from 'react-native';
11
+ import { useNavigation } from '@react-navigation/core';
12
+ import Page from '@ledvance/base/src/components/Page';
13
+ import I18n from '@ledvance/base/src/i18n';
14
+ import TextField from '@ledvance/base/src/components/TextField';
15
+ import { cloneDeep, isEqual } from 'lodash';
16
+ import { useReactive } from 'ahooks';
17
+ import { SwitchButton, TimerPicker, Utils } from 'tuya-panel-kit';
18
+ import Spacer from '@ledvance/base/src/components/Spacer';
19
+ import LdvWeekView from '@ledvance/base/src/components/weekSelect';
20
+ import { convertTo12HourFormat, loopText, showDialog } from '@ledvance/base/src/utils/common';
21
+ import {
22
+ ApplyForItem,
23
+ ComponentConfig,
24
+ DeviceType,
25
+ TimeScheduleDetailState,
26
+ Timer,
27
+ } from './Interface';
28
+ import res from '@ledvance/base/src/res';
29
+ import {
30
+ useMoods,
31
+ useSystemTimeFormate,
32
+ useUAGroupInfo,
33
+ } from '@ledvance/base/src/models/modules/NativePropsSlice';
34
+ import { TimeSchedulePageParams } from './TimeSchedulePage';
35
+ import { Result } from '@ledvance/base/src/models/modules/Result';
36
+ import DeleteButton from '@ledvance/base/src/components/DeleteButton';
37
+ import SegmentControl from '@ledvance/base/src/components/segmentControl';
38
+ import { useParams } from '@ledvance/base/src/hooks/Hooks';
39
+ import ManualSettings from './components/ManuaSettings';
40
+ import { defCeilingLihtDeviceData, defDeviceData, defMixDeviceData, defStripDeviceData } from './TimeScheduleActions';
41
+ import MoodItem from '../mood_new/MoodItem';
42
+ import Summary from './components/Summary'
43
+ import { getRemoteMoodList } from '../mood_new/MoodActions'
44
+ import { MoodUIInfo } from '../mood_new/Interface';
45
+
46
+ const { convertX: cx } = Utils.RatioUtils;
47
+ const { toFixedString } = Utils.NumberUtils;
48
+ interface TimeScheduleDetailPageParams extends TimeSchedulePageParams {
49
+ mode: 'add' | 'edit';
50
+ timeSchedule: Timer;
51
+ modDeleteTimeSchedule: (mode: 'add' | 'edit' | 'del', timeSchedule: Timer, ids: string) => Promise<Result<any>>
52
+ refreshFn: () => void;
53
+ }
54
+
55
+ const TimeScheduleDetailPage = () => {
56
+ const props = useParams<TimeScheduleDetailPageParams>();
57
+ const navigation = useNavigation();
58
+ const uaGroupInfo = useUAGroupInfo()
59
+ const is24HourClock = useSystemTimeFormate();
60
+ const [moods, setMoods] = useMoods();
61
+ const state = useReactive<TimeScheduleDetailState>({
62
+ timeSchedule: props.mode === 'add' ? newTimeSchedule() : cloneDeep(props.timeSchedule),
63
+ dps: props.mode === 'add' ? {} : props.timeSchedule.dps,
64
+ isManual: true, // manual ,mood
65
+ selectedSkill: [] as ApplyForItem[],
66
+ unSelectedSkill: [] as ApplyForItem[],
67
+ loading: false,
68
+ moodLoading: false,
69
+ manualData:
70
+ props.mode === 'add'
71
+ ? getDefaultManual(props)
72
+ : props.manualDataDp2Obj(props.timeSchedule.dps)?.deviceData,
73
+ mood: props.mode === 'add' ? undefined : props.manualDataDp2Obj(props.timeSchedule.dps)?.mood,
74
+ moods: cloneDeep(moods),
75
+ timerId: undefined,
76
+ moodName: '',
77
+ });
78
+
79
+ useEffect(() => {
80
+ const { applyForDisabled, timeSchedule, applyForList, mode } = props;
81
+ const cannotChoose = applyForDisabled || applyForList.length === 1;
82
+ const cloneApplyList =
83
+ mode === 'add'
84
+ ? cloneDeep(applyForList)
85
+ : cloneDeep(applyForList).map(item => {
86
+ if (props.isMixLight && state.manualData.type === DeviceType.MixLight) {
87
+ return {
88
+ ...item,
89
+ enable:
90
+ item.type === 'mainLight'
91
+ ? state.manualData.deviceData.whiteLightSwitch
92
+ : state.manualData.deviceData.colorLightSwitch,
93
+ };
94
+ }
95
+ if (timeSchedule?.dps?.hasOwnProperty(item.dp)) {
96
+ return {
97
+ ...item,
98
+ enable: timeSchedule?.dps[item.dp],
99
+ };
100
+ }
101
+ return item;
102
+ });
103
+
104
+ if (cannotChoose) {
105
+ state.selectedSkill = cloneApplyList;
106
+ state.unSelectedSkill = [];
107
+ } else {
108
+ const selectedList = cloneApplyList.filter(item =>
109
+ Object.keys(timeSchedule.dps).includes(item.dp)
110
+ );
111
+ const unSelectedList = cloneApplyList.filter(
112
+ item => !Object.keys(timeSchedule.dps).includes(item.dp)
113
+ );
114
+ state.selectedSkill = mode === 'add' ? [] : selectedList;
115
+ state.unSelectedSkill = mode === 'add' ? cloneApplyList : unSelectedList;
116
+ }
117
+ if (props.mode === 'edit' && props.manualDataDp2Obj) {
118
+ const { isManual, mood } = props.manualDataDp2Obj(props.timeSchedule.dps);
119
+ state.isManual = isManual;
120
+ state.mood = mood;
121
+ }
122
+
123
+ if (!(Array.isArray(moods) && moods.length)) {
124
+ state.timerId = setTimeout(() => {
125
+ getRemoteMoodList(uaGroupInfo.tyGroupId.toString(), props).then(res => {
126
+ if (res.success && Array.isArray(res.data)) {
127
+ state.moods = cloneDeep(res.data);
128
+ console.log(state.moods, '< --- moods')
129
+ setMoods(cloneDeep(res.data));
130
+ if (!state.mood) state.mood = cloneDeep(res.data[0]);
131
+ }
132
+ });
133
+ }, 300);
134
+ return () => {
135
+ if (state.timerId) clearTimeout(state.timerId);
136
+ };
137
+ } else {
138
+ if (!state.mood) state.mood = cloneDeep(state.moods[0]);
139
+ }
140
+ }, []);
141
+
142
+ useEffect(() => {
143
+ if (state.moods?.length) {
144
+ state.moodName =
145
+ state.moods.find(m =>
146
+ props.isCeilingLight
147
+ ? m.mainLamp.id === state.mood?.mainLamp.id &&
148
+ m.secondaryLamp.id === state.mood?.secondaryLamp.id
149
+ : m.id === state.mood?.id
150
+ )?.name || '';
151
+ }
152
+ }, [state.mood, state.moods]);
153
+
154
+ const getFormateTime = useCallback((time: number | string) => {
155
+ if (typeof time === 'number') {
156
+ return `${toFixedString(Math.trunc(time / 60), 2)}:${toFixedString(time % 60, 2)}`;
157
+ }
158
+ if (typeof time === 'string') {
159
+ const t = time.split(':');
160
+ return Number(t[0]) * 60 + Number(t[1]);
161
+ }
162
+ return time;
163
+ }, []);
164
+
165
+ const isModify = useMemo(() => {
166
+ const schedule = props.mode === 'add' ? newTimeSchedule() : props.timeSchedule;
167
+ const manual =
168
+ props.mode === 'add'
169
+ ? getDefaultManual(props)
170
+ : props.manualDataDp2Obj(props.timeSchedule.dps).deviceData;
171
+ const before = {
172
+ ...schedule,
173
+ dps: manual,
174
+ isManual:
175
+ props.mode === 'add' ? true : props.manualDataDp2Obj(props.timeSchedule.dps).isManual,
176
+ mood: props.mode === 'add' ? undefined : props.manualDataDp2Obj(props.timeSchedule.dps)?.mood,
177
+ id: 1,
178
+ };
179
+ before.mood = (before.isManual || props.mode === 'add') ? undefined : props.manualDataDp2Obj(props.timeSchedule.dps)?.mood
180
+ const now = {
181
+ ...state.timeSchedule,
182
+ dps: state.manualData,
183
+ isManual: state.isManual,
184
+ mood: state.isManual ? undefined : state.mood,
185
+ id: 1,
186
+ };
187
+ return isEqual(before, now);
188
+ }, [JSON.stringify(state.timeSchedule), state.manualData, state.isManual, state.mood]);
189
+
190
+ const allowSubmit = useMemo(() => {
191
+ return (
192
+ (state.timeSchedule.aliasName.length && state.timeSchedule.aliasName.length < 33) &&
193
+ state.selectedSkill.length &&
194
+ (state.isManual ? state.isManual : !!state.mood) &&
195
+ !isModify
196
+ );
197
+ }, [state.timeSchedule.aliasName, state.selectedSkill, isModify, state.isManual, state.mood]);
198
+
199
+ const showSelectedIcon = useMemo(() => {
200
+ return state.selectedSkill.length !== 1 && !props.applyForDisabled;
201
+ }, [state.selectedSkill.length, props.applyForDisabled]);
202
+
203
+ const getMoodItemEnable = useCallback((item: MoodUIInfo ) =>{
204
+ return props.isCeilingLight ? ((item.mainLamp.id === state.mood?.mainLamp?.id) && (item.secondaryLamp.id === state.mood?.secondaryLamp?.id)) : item.id === state.mood?.id
205
+ }, [state.mood, props.isCeilingLight])
206
+
207
+ return (
208
+ <Page
209
+ backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
210
+ headlineText={I18n.getLang(
211
+ props.mode === 'add'
212
+ ? 'motion_detection_add_time_schedule_headline_text'
213
+ : 'edit_timeschedule_headline_text'
214
+ )}
215
+ rightButtonIcon={allowSubmit ? res.ic_check : res.ic_uncheck}
216
+ rightButtonIconClick={async () => {
217
+ if (!allowSubmit || state.loading) return;
218
+ state.loading = true;
219
+ const res = await props.modDeleteTimeSchedule(props.mode, {
220
+ ...state.timeSchedule,
221
+ status: 1,
222
+ dps: props.manualDataObj2Dp(
223
+ {
224
+ deviceData: state.manualData,
225
+ isManual: state.isManual,
226
+ mood: state.mood,
227
+ },
228
+ state.selectedSkill
229
+ ),
230
+ }, '');
231
+ state.loading = false;
232
+ if (res.success) {
233
+ props.refreshFn()
234
+ navigation.goBack();
235
+ }
236
+ }}
237
+ backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
238
+ backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_timeschedule_note')}
239
+ showBackDialog={!isModify}
240
+ loading={state.loading}
241
+ >
242
+ <ScrollView nestedScrollEnabled={true}>
243
+ <TextField
244
+ style={styles.cardContainer}
245
+ value={state.timeSchedule.aliasName}
246
+ showError={state.timeSchedule.aliasName?.length > 32}
247
+ maxLength={33}
248
+ errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}
249
+ placeholder={I18n.getLang('add_new_trigger_time_inputfield_value_text')}
250
+ onChangeText={(t: string) => {
251
+ state.timeSchedule.aliasName = t;
252
+ }}
253
+ />
254
+
255
+ {/* pick */}
256
+ <TimerPicker
257
+ itemTextColor="#aeadb5"
258
+ style={{ paddingVertical: cx(0), marginVertical: cx(0) }}
259
+ is12Hours={!is24HourClock}
260
+ singlePicker={true}
261
+ amText={I18n.getLang('manage_user_calendar_label_am')}
262
+ pmText={I18n.getLang('manage_user_calendar_label_pm')}
263
+ startTime={getFormateTime(state.timeSchedule.time) as number}
264
+ symbol={''}
265
+ onTimerChange={startTime => {
266
+ state.timeSchedule.time = getFormateTime(startTime) as string;
267
+ }}
268
+ />
269
+
270
+ <LdvWeekView
271
+ value={state.timeSchedule.loops.split('').map(Number)}
272
+ style={styles.cardContainer}
273
+ onSelect={(index: number) => {
274
+ const rawIndex = index - 1;
275
+ const weeks = state.timeSchedule.loops.split('');
276
+ weeks[rawIndex] = weeks[rawIndex] === '1' ? '0' : '1';
277
+ state.timeSchedule.loops = weeks.join('');
278
+ }}
279
+ />
280
+ <Spacer />
281
+ <Text style={styles.cardContainer}>{loopText(state.timeSchedule.loops.split(''))}</Text>
282
+ <Spacer height={cx(30)} />
283
+
284
+ {/* Apply for */}
285
+ <View style={styles.cardContainer}>
286
+ <Text style={styles.itemTitle}>
287
+ {I18n.getLang('timeschedule_add_schedule_subheadline_text')}
288
+ </Text>
289
+ <Spacer height={cx(10)} />
290
+ <View style={styles.applyContent}>
291
+ {props.applyForList.length === 0 ? (
292
+ <Text>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
293
+ ) : (
294
+ state.selectedSkill.map(skill => (
295
+ <View
296
+ style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}
297
+ key={skill.dp}
298
+ >
299
+ <Text style={{ color: '#000' }}>{skill.key}</Text>
300
+ {showSelectedIcon && (
301
+ <TouchableOpacity
302
+ onPress={() => {
303
+ state.selectedSkill = state.selectedSkill.filter(s => skill.dp !== s.dp);
304
+ state.unSelectedSkill = [...state.unSelectedSkill, skill];
305
+ }}
306
+ style={{ paddingHorizontal: cx(5) }}
307
+ >
308
+ <Image
309
+ style={{ width: cx(16), height: cx(16) }}
310
+ source={res.ic_arrows_nav_clear}
311
+ />
312
+ </TouchableOpacity>
313
+ )}
314
+ </View>
315
+ ))
316
+ )}
317
+ </View>
318
+ {state.unSelectedSkill.map((item: ApplyForItem) => {
319
+ return (
320
+ <TouchableOpacity
321
+ style={styles.applyItem}
322
+ key={item.dp}
323
+ onPress={() => {
324
+ state.selectedSkill = [...state.selectedSkill, item];
325
+ state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
326
+ }}
327
+ >
328
+ <Text style={{ color: '#000' }}>{item.key}</Text>
329
+ <Image
330
+ style={{ width: cx(16), height: cx(16) }}
331
+ source={res.device_panel_timer_add}
332
+ />
333
+ </TouchableOpacity>
334
+ );
335
+ })}
336
+ <Spacer />
337
+ </View>
338
+
339
+ {/* device state */}
340
+ <Text style={[styles.itemTitle, styles.cardContainer]}>
341
+ {I18n.getLang('timeschedule_add_schedule_subheadline2_text')}
342
+ </Text>
343
+ <Spacer height={cx(10)} />
344
+ {props.isSupportMood && (
345
+ <>
346
+ <SegmentControl
347
+ title1={I18n.getLang('timeschedule_add_schedule_switch_tab_manual_text')}
348
+ title2={I18n.getLang('timeschedule_add_schedule_switch_tab_mood_text')}
349
+ isFirst={state.isManual}
350
+ setIsFirst={(v: boolean) => (state.isManual = v)}
351
+ />
352
+ <Spacer height={cx(16)} />
353
+ </>
354
+ )}
355
+ <Spacer height={cx(10)} />
356
+ {state.isManual ? (
357
+ <ManualSettings
358
+ dps={state.dps}
359
+ applyForList={state.selectedSkill}
360
+ isSupportColor={props.isSupportColor}
361
+ isSupportBrightness={props.isSupportBrightness}
362
+ isSupportTemperature={props.isSupportTemperature}
363
+ isCeilingLight={props.isCeilingLight}
364
+ manualData={state.manualData}
365
+ onManualChange={manual => {
366
+ // @ts-ignore
367
+ state.manualData = {
368
+ ...state.manualData,
369
+ deviceData: cloneDeep(manual),
370
+ };
371
+ }}
372
+ onApplyChange={apply => {
373
+ state.selectedSkill = cloneDeep(apply);
374
+ }}
375
+ />
376
+ ) : (
377
+ <FlatList
378
+ data={state.moods}
379
+ renderItem={({ item }) => {
380
+ return (
381
+ <MoodItem
382
+ enable={getMoodItemEnable(item)}
383
+ mood={item}
384
+ isMix={!!(props.isMixLight || props.isCeilingLight)}
385
+ onSwitch={_ => {
386
+ state.mood = cloneDeep(item);
387
+ }}
388
+ />
389
+ );
390
+ }}
391
+ ListHeaderComponent={() => <Spacer height={cx(10)} />}
392
+ ItemSeparatorComponent={() => <Spacer />}
393
+ ListFooterComponent={() => <Spacer />}
394
+ keyExtractor={item => `${item.name}`}
395
+ />
396
+ )}
397
+ <Spacer />
398
+
399
+ {/* settings */}
400
+ <Text style={[styles.itemTitle, styles.cardContainer]}>
401
+ {I18n.getLang('timeschedule_add_schedule_subheadline4_text')}
402
+ </Text>
403
+ <View style={[styles.switchButton, styles.cardContainer]}>
404
+ <Text style={styles.text}>{I18n.getLang('timeschedule_add_schedule_text2')}</Text>
405
+ <SwitchButton
406
+ value={state.timeSchedule.isAppPush}
407
+ onValueChange={value => {
408
+ state.timeSchedule.isAppPush = value;
409
+ }}
410
+ />
411
+ </View>
412
+ <Spacer />
413
+
414
+ {/* summary */}
415
+ <Summary
416
+ frequency={loopText(state.timeSchedule.loops.split(''), state.timeSchedule.time)}
417
+ time={is24HourClock
418
+ ? state.timeSchedule.time
419
+ : convertTo12HourFormat(state.timeSchedule.time)}
420
+ actions={<View style={{ flex: 1 }}>
421
+ {state.isManual
422
+ ? !!state.selectedSkill.length && (
423
+ <>
424
+ {!!state.selectedSkill.filter(skill => skill.enable).length && (
425
+ <>
426
+ <Text style={{ fontSize: cx(14), color: '#000' }}>
427
+ {I18n.getLang('feature_summary_action_txt_1')}
428
+ </Text>
429
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
430
+ {state.selectedSkill
431
+ .filter(skill => skill.enable)
432
+ .map(item => (
433
+ <View
434
+ style={[
435
+ styles.summaryRight,
436
+ { marginRight: cx(5), marginBottom: cx(5) },
437
+ ]}
438
+ key={item.dp}
439
+ >
440
+ <Text style={[styles.rightItem]}>{item.key}</Text>
441
+ </View>
442
+ ))}
443
+ </View>
444
+ </>
445
+ )}
446
+
447
+ {!!state.selectedSkill.filter(skill => !skill.enable).length && (
448
+ <>
449
+ <Text style={{ fontSize: cx(14) }}>
450
+ {I18n.getLang('feature_summary_action_txt_2')}
451
+ </Text>
452
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
453
+ {state.selectedSkill
454
+ .filter(skill => !skill.enable)
455
+ .map((item) => (
456
+ <View
457
+ style={[
458
+ styles.summaryRight,
459
+ { marginRight: cx(5), marginBottom: cx(5) },
460
+ ]}
461
+ key={item.dp}
462
+ >
463
+ <Text style={[styles.rightItem]}>{item.key}</Text>
464
+ </View>
465
+ ))}
466
+ </View>
467
+ </>
468
+ )}
469
+ </>
470
+ )
471
+ : !!state.moodName && (
472
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
473
+ <View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
474
+ <Text style={styles.rightItem}>{state.moodName}</Text>
475
+ </View>
476
+ </View>
477
+ )}
478
+ </View>}
479
+ />
480
+ <Spacer height={cx(30)} />
481
+
482
+ {/* delete */}
483
+ {props.mode === 'edit' && (
484
+ <View style={{ marginHorizontal: cx(24) }}>
485
+ <DeleteButton
486
+ text={I18n.getLang('edit_timeschedule_bttn_text')}
487
+ onPress={() => {
488
+ showDialog({
489
+ method: 'confirm',
490
+ title: I18n.getLang('cancel_dialog_delete_item_timeschedule_titel'),
491
+ subTitle: I18n.getLang('cancel_dialog_delete_item_timeschedule_description'),
492
+ onConfirm: async (_, { close }) => {
493
+ state.loading = true;
494
+ close();
495
+ const res = await props.modDeleteTimeSchedule('del', state.timeSchedule, state.timeSchedule.id.toString());
496
+ state.loading = false;
497
+ if (res.success) {
498
+ navigation.goBack();
499
+ }
500
+ },
501
+ });
502
+ }}
503
+ />
504
+ <Spacer />
505
+ </View>
506
+ )}
507
+ </ScrollView>
508
+ </Page>
509
+ );
510
+ };
511
+
512
+ const newTimeSchedule = () => {
513
+ return {
514
+ status: 1,
515
+ loops: '0000000',
516
+ isAppPush: false,
517
+ aliasName: '',
518
+ time: `${toFixedString(new Date().getHours(), 2)}:${toFixedString(new Date().getMinutes(), 2)}`,
519
+ dps: {},
520
+ id: -1,
521
+ };
522
+ };
523
+
524
+ const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig => {
525
+ const deviceType =
526
+ props.isStripLight
527
+ ? DeviceType.StripLight
528
+ : props.isMixLight
529
+ ? DeviceType.MixLight
530
+ : props.isCeilingLight
531
+ ? DeviceType.CeilingLight
532
+ : DeviceType.LightSource;
533
+ const deviceData =
534
+ deviceType === DeviceType.StripLight
535
+ ? defStripDeviceData
536
+ : deviceType === DeviceType.MixLight
537
+ ? defMixDeviceData
538
+ : deviceType === DeviceType.CeilingLight
539
+ ? defCeilingLihtDeviceData
540
+ : defDeviceData;
541
+ // @ts-ignore
542
+ return {
543
+ type: deviceType,
544
+ deviceData: {
545
+ ...deviceData,
546
+ isColorMode: props.isSupportColor ? true : false,
547
+ },
548
+ };
549
+ };
550
+
551
+ const styles = StyleSheet.create({
552
+ cardContainer: {
553
+ marginHorizontal: cx(24),
554
+ },
555
+ itemTitle: {
556
+ color: '#000',
557
+ fontSize: cx(16),
558
+ fontWeight: 'bold',
559
+ fontFamily: 'helvetica_neue_lt_std_bd',
560
+ },
561
+ applyContent: {
562
+ backgroundColor: '#f6f6f6',
563
+ borderRadius: 4,
564
+ minHeight: cx(55),
565
+ flex: 1,
566
+ justifyContent: 'center',
567
+ paddingHorizontal: cx(10),
568
+ paddingTop: cx(10),
569
+ },
570
+ applyItem: {
571
+ paddingLeft: cx(5),
572
+ flexDirection: 'row',
573
+ justifyContent: 'space-between',
574
+ alignItems: 'center',
575
+ backgroundColor: '#fff',
576
+ height: cx(35),
577
+ },
578
+ moodScrollView: {
579
+ maxHeight: cx(500),
580
+ },
581
+ summaryContainer: {
582
+ flexDirection: 'row',
583
+ justifyContent: 'flex-start',
584
+ marginBottom: cx(10),
585
+ marginHorizontal: cx(24),
586
+ },
587
+ summaryImg: {
588
+ height: cx(12),
589
+ width: cx(12),
590
+ tintColor: '#000',
591
+ },
592
+ summaryLeft: {
593
+ flexDirection: 'row',
594
+ alignItems: 'center',
595
+ minWidth: cx(90),
596
+ },
597
+ leftTitle: {
598
+ fontSize: cx(14),
599
+ color: '#000',
600
+ marginTop: 0,
601
+ },
602
+ summaryRight: {
603
+ flexDirection: 'column',
604
+ backgroundColor: '#cbcbcb',
605
+ borderRadius: cx(16),
606
+ alignItems: 'center'
607
+ },
608
+ rightItem: {
609
+ paddingHorizontal: cx(12),
610
+ color: '#000',
611
+ fontSize: cx(14)
612
+ },
613
+ switchButton: {
614
+ flexDirection: 'row',
615
+ alignItems: 'center',
616
+ justifyContent: 'space-between',
617
+ marginBottom: cx(10),
618
+ },
619
+ text: {
620
+ color: '#000',
621
+ fontSize: cx(14)
622
+ },
623
+ });
624
+
625
+ export default TimeScheduleDetailPage;