@ledvance/ui-biz-bundle 1.1.80 → 1.1.82
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 +1 -1
- package/src/modules/timer/TimerPage.tsx +3 -11
- package/src/modules/timer/TimerPageAction.ts +7 -0
- package/src/newModules/mood/StaticMoodEditorPage.tsx +2 -2
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +2 -1
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +2 -2
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import Page from "@ledvance/base/src/components/Page";
|
|
|
11
11
|
import LdvPickerView from '@ledvance/base/src/components/ldvPickerView'
|
|
12
12
|
import { Utils, Progress } from 'tuya-panel-kit'
|
|
13
13
|
import { useDeviceInfo } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
14
|
-
import { useProgress
|
|
14
|
+
import {timeFormatToRealTime, useProgress} from "./TimerPageAction";
|
|
15
15
|
import { cloneDeep } from "lodash";
|
|
16
16
|
import dayjs from "dayjs";
|
|
17
17
|
import DeleteButton from "@ledvance/base/src/components/DeleteButton";
|
|
@@ -123,14 +123,6 @@ const TimerPage = (props: {theme?: any}) => {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
const getSingleLightEndTimeString = (mCountdown: number) => {
|
|
127
|
-
const date = new Date()
|
|
128
|
-
const now = date.getTime()
|
|
129
|
-
const after = new Date(now + mCountdown * 1000)
|
|
130
|
-
const timeString = `${after.getHours()}:${after.getMinutes().toString().padStart(2, '0')}`
|
|
131
|
-
return timeString
|
|
132
|
-
}
|
|
133
|
-
|
|
134
126
|
const showActiveView = () => {
|
|
135
127
|
return progress.length > 1
|
|
136
128
|
}
|
|
@@ -317,7 +309,7 @@ const TimerPage = (props: {theme?: any}) => {
|
|
|
317
309
|
/>
|
|
318
310
|
<Text style={{ marginLeft: cx(20), fontSize: cx(22) }}>{getActiveTimeString(timer.progressHook.countdown)}</Text>
|
|
319
311
|
</View>
|
|
320
|
-
<Text>{I18n.formatValue(timer.enable ? timer.stringOff : timer.stringOn,
|
|
312
|
+
<Text>{I18n.formatValue(timer.enable ? timer.stringOff : timer.stringOn, timeFormatToRealTime(timer.progressHook.countdown))}</Text>
|
|
321
313
|
</Card>
|
|
322
314
|
<Spacer height={cx(40)} />
|
|
323
315
|
</View>
|
|
@@ -363,7 +355,7 @@ const TimerPage = (props: {theme?: any}) => {
|
|
|
363
355
|
{I18n.formatValue(
|
|
364
356
|
runningTimer()[0].enable ?
|
|
365
357
|
runningTimer()[0].stringOff :
|
|
366
|
-
runningTimer()[0].stringOn,
|
|
358
|
+
runningTimer()[0].stringOn, timeFormatToRealTime(runningTimer()[0].progressHook.countdown)
|
|
367
359
|
)}
|
|
368
360
|
</Text>
|
|
369
361
|
</View>
|
|
@@ -130,6 +130,13 @@ export const useProgress = (dps: dpItem[]) => {
|
|
|
130
130
|
}))
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
export function timeFormatToRealTime(mCountdown: number) {
|
|
134
|
+
const date = new Date()
|
|
135
|
+
const now = date.getTime()
|
|
136
|
+
const after = new Date(now + mCountdown * 1000)
|
|
137
|
+
return `${after.getHours()}:${after.getMinutes().toString().padStart(2, '0')}`
|
|
138
|
+
}
|
|
139
|
+
|
|
133
140
|
export function timeFormat(time: number): string {
|
|
134
141
|
let hour = Math.trunc(time / 3600)
|
|
135
142
|
const beforeMin = (time % 3600) / 60
|
|
@@ -78,7 +78,7 @@ const StaticMoodEditorPage = () => {
|
|
|
78
78
|
...state.mood,
|
|
79
79
|
mainLamp: {
|
|
80
80
|
...state.mood.mainLamp,
|
|
81
|
-
nodes: [cloneDeep(state.mainNode)],
|
|
81
|
+
nodes: state.mainNode ? [cloneDeep(state.mainNode)] : [],
|
|
82
82
|
},
|
|
83
83
|
secondaryLamp: {
|
|
84
84
|
...state.mood.secondaryLamp,
|
|
@@ -88,7 +88,7 @@ const StaticMoodEditorPage = () => {
|
|
|
88
88
|
if (isMix && moduleParams.isMixLight) {
|
|
89
89
|
newMood.secondaryLamp = {
|
|
90
90
|
...newMood.secondaryLamp,
|
|
91
|
-
nodes: [cloneDeep(state.secondaryNode)],
|
|
91
|
+
nodes: state.secondaryNode ? [cloneDeep(state.secondaryNode)] : [],
|
|
92
92
|
};
|
|
93
93
|
newMood.mainLamp.type = 2
|
|
94
94
|
if (moduleParams.isSupportBrightness && !moduleParams.isSupportTemperature) {
|
|
@@ -505,7 +505,8 @@ const SleepWakeUpDetailPage = () => {
|
|
|
505
505
|
time={`${convertMinutesTo12HourFormat(
|
|
506
506
|
state.sleepWakeUp.startTime,
|
|
507
507
|
is24HourClock
|
|
508
|
-
)} - ${convertMinutesTo12HourFormat(state.sleepWakeUp.endTime,
|
|
508
|
+
)} - ${convertMinutesTo12HourFormat(state.sleepWakeUp.endTime + (state.sleepWakeUp.isSleep ? 0 : state.sleepWakeUp.last * 5),
|
|
509
|
+
is24HourClock)}`}
|
|
509
510
|
actions={(
|
|
510
511
|
<View>
|
|
511
512
|
<Text style={{ fontSize: cx(12), color: '#000000' }}>
|
|
@@ -317,7 +317,7 @@ const SleepWakeUpCard = (props: {
|
|
|
317
317
|
<Spacer height={cx(16)} />
|
|
318
318
|
<View style={styles.switchLine}>
|
|
319
319
|
<Text style={styles.time}>
|
|
320
|
-
{`${convertMinutesTo12HourFormat(sleepWakeUp.startTime, is24HourClock)} - ${convertMinutesTo12HourFormat(sleepWakeUp.endTime, is24HourClock)}`}</Text>
|
|
320
|
+
{`${convertMinutesTo12HourFormat(sleepWakeUp.startTime, is24HourClock)} - ${convertMinutesTo12HourFormat(sleepWakeUp.endTime + (sleepWakeUp.isSleep ? 0 : sleepWakeUp.last * 5), is24HourClock)}`}</Text>
|
|
321
321
|
<SwitchButton
|
|
322
322
|
value={sleepWakeUp.enable}
|
|
323
323
|
thumbStyle={{ elevation: 0 }}
|
|
@@ -453,4 +453,4 @@ const styles = StyleSheet.create({
|
|
|
453
453
|
},
|
|
454
454
|
})
|
|
455
455
|
|
|
456
|
-
export default SleepWakeUpPage
|
|
456
|
+
export default SleepWakeUpPage
|