@ledvance/group-ui-biz-bundle 1.0.37 → 1.0.39

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 (124) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +216 -0
  3. package/src/modules/biorhythm/BiorhythmBean.ts +230 -0
  4. package/src/modules/biorhythm/BiorhythmDetailPage.tsx +261 -0
  5. package/src/modules/biorhythm/BiorhythmPage.tsx +706 -0
  6. package/src/modules/biorhythm/IconSelect.tsx +84 -0
  7. package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -0
  8. package/src/modules/biorhythm/circular/ItemIcon.tsx +173 -0
  9. package/src/modules/biorhythm/circular/Progress.d.ts +24 -0
  10. package/src/modules/biorhythm/circular/Progress.tsx +412 -0
  11. package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -0
  12. package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -0
  13. package/src/modules/biorhythm/circular/biorhythm_plantimer.png +0 -0
  14. package/src/modules/biorhythm/circular/rhythm_icon.png +0 -0
  15. package/src/modules/biorhythm/iconListData.ts +30 -0
  16. package/src/modules/biorhythm/pIdList.ts +36 -0
  17. package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -0
  18. package/src/modules/biorhythm/res/BiologicalRes.ts +42 -0
  19. package/src/modules/biorhythm/res/Biological_Rhythm.png +0 -0
  20. package/src/modules/biorhythm/res/Biological_Rhythm_12.png +0 -0
  21. package/src/modules/biorhythm/res/Biological_Rhythm_new.png +0 -0
  22. package/src/modules/biorhythm/res/Biological_Rhythm_new_12.png +0 -0
  23. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups.png +0 -0
  24. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups@2x.png +0 -0
  25. package/src/modules/biorhythm/res/iconsMaterialOutlinedAccountGroups@3x.png +0 -0
  26. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd.png +0 -0
  27. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@2x.png +0 -0
  28. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavAdd@3x.png +0 -0
  29. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
  30. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
  31. package/src/modules/biorhythm/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
  32. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome.png +0 -0
  33. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@2x.png +0 -0
  34. package/src/modules/biorhythm/res/iconsMaterialOutlinedBuildingsHome@3x.png +0 -0
  35. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder.png +0 -0
  36. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@2x.png +0 -0
  37. package/src/modules/biorhythm/res/iconsMaterialOutlinedEditorFavoriteBorder@3x.png +0 -0
  38. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed.png +0 -0
  39. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed@2x.png +0 -0
  40. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBed@3x.png +0 -0
  41. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter.png +0 -0
  42. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@2x.png +0 -0
  43. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherBusinessCenter@3x.png +0 -0
  44. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair.png +0 -0
  45. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair@2x.png +0 -0
  46. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherChair@3x.png +0 -0
  47. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee.png +0 -0
  48. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@2x.png +0 -0
  49. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherCoffee@3x.png +0 -0
  50. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar.png +0 -0
  51. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@2x.png +0 -0
  52. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherDirectionsCar@3x.png +0 -0
  53. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter.png +0 -0
  54. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@2x.png +0 -0
  55. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherFitnessCenter@3x.png +0 -0
  56. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones.png +0 -0
  57. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@2x.png +0 -0
  58. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherHeadphones@3x.png +0 -0
  59. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook.png +0 -0
  60. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@2x.png +0 -0
  61. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMenuBook@3x.png +0 -0
  62. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote.png +0 -0
  63. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@2x.png +0 -0
  64. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherMusicNote@3x.png +0 -0
  65. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone.png +0 -0
  66. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@2x.png +0 -0
  67. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherNotificationsNone@3x.png +0 -0
  68. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant.png +0 -0
  69. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@2x.png +0 -0
  70. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherPottedPlant@3x.png +0 -0
  71. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant.png +0 -0
  72. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@2x.png +0 -0
  73. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherRestaurant@3x.png +0 -0
  74. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied.png +0 -0
  75. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@2x.png +0 -0
  76. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSentimentSatisfied@3x.png +0 -0
  77. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports.png +0 -0
  78. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@2x.png +0 -0
  79. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherSportsEsports@3x.png +0 -0
  80. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv.png +0 -0
  81. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv@2x.png +0 -0
  82. package/src/modules/biorhythm/res/iconsMaterialOutlinedOtherTv@3x.png +0 -0
  83. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm.png +0 -0
  84. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@2x.png +0 -0
  85. package/src/modules/biorhythm/res/iconsMaterialOutlinedTimeAccessAlarm@3x.png +0 -0
  86. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime.png +0 -0
  87. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@2x.png +0 -0
  88. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherBedtime@3x.png +0 -0
  89. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay.png +0 -0
  90. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@2x.png +0 -0
  91. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherPartlyCloudyDay@3x.png +0 -0
  92. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline.png +0 -0
  93. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@2x.png +0 -0
  94. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherStarOutline@3x.png +0 -0
  95. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny.png +0 -0
  96. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@2x.png +0 -0
  97. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbSunny@3x.png +0 -0
  98. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight.png +0 -0
  99. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@2x.png +0 -0
  100. package/src/modules/biorhythm/res/iconsMaterialOutlinedWheatherWbTwilight@3x.png +0 -0
  101. package/src/modules/music/MusicActions.ts +61 -0
  102. package/src/modules/music/MusicDataBean.ts +292 -0
  103. package/src/modules/music/MusicManager.ts +206 -0
  104. package/src/modules/music/MusicPage.tsx +206 -0
  105. package/src/modules/music/res/app_music_ball@2x.png +0 -0
  106. package/src/modules/music/res/app_music_ball@3x.png +0 -0
  107. package/src/modules/music/res/app_music_game@2x.png +0 -0
  108. package/src/modules/music/res/app_music_game@3x.png +0 -0
  109. package/src/modules/music/res/app_music_music@2x.png +0 -0
  110. package/src/modules/music/res/app_music_music@3x.png +0 -0
  111. package/src/modules/music/res/app_music_romantic@2x.png +0 -0
  112. package/src/modules/music/res/app_music_romantic@3x.png +0 -0
  113. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck.png +0 -0
  114. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck@2x.png +0 -0
  115. package/src/modules/music/res/iconsMaterialOutlinedArrowsNavCheck@3x.png +0 -0
  116. package/src/modules/music/res/illustrationsFeaturesMusic.png +0 -0
  117. package/src/modules/music/res/illustrationsFeaturesMusic@2x.png +0 -0
  118. package/src/modules/music/res/illustrationsFeaturesMusic@3x.png +0 -0
  119. package/src/modules/music/res/illustrationsFeaturesMusicDisabled.png +0 -0
  120. package/src/modules/music/res/illustrationsFeaturesMusicDisabled@2x.png +0 -0
  121. package/src/modules/music/res/illustrationsFeaturesMusicDisabled@3x.png +0 -0
  122. package/src/modules/music/res/index.d.ts +10 -0
  123. package/src/modules/music/res/index.ts +9 -0
  124. package/src/navigation/Routers.ts +46 -0
@@ -0,0 +1,261 @@
1
+ import React, { useCallback } from 'react'
2
+ import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
3
+ import { useNavigation } from '@react-navigation/native'
4
+ import { TimerPicker, Utils } from 'tuya-panel-kit'
5
+ import { useReactive } from 'ahooks'
6
+ import { colorTemperatureValue, Plan } from './BiorhythmBean'
7
+ import iconList from './iconListData'
8
+ import I18n from '@ledvance/base/src/i18n'
9
+ import TextField from '@ledvance/base/src/components/TextField'
10
+ import BiologicalRes from './res/BiologicalRes'
11
+ import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
12
+ import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView'
13
+ import DeleteButton from '@ledvance/base/src/components/DeleteButton'
14
+ import res from '@ledvance/base/src/res'
15
+ import { ui_biz_routerKey } from '../../navigation/Routers'
16
+ import { cloneDeep, delay, isEqual } from 'lodash'
17
+ import { showDialog } from '@ledvance/base/src/utils/common'
18
+ import Page from '@ledvance/base/src/components/Page'
19
+ import { useParams } from '@ledvance/base/src/hooks/Hooks'
20
+ import Card from '@ledvance/base/src/components/Card'
21
+ import { useSystemTimeFormate } from '@ledvance/base/src/models/modules/NativePropsSlice'
22
+ import Spacer from '@ledvance/base/src/components/Spacer'
23
+
24
+ const cx = Utils.RatioUtils.convertX
25
+
26
+ export interface BiorhythmEditPageParams {
27
+ planData: Plan
28
+ isAdd: boolean
29
+ onPlanEdited: (isAdd: boolean, plan: Plan) => void
30
+ onPlanDelete: (id: number) => void
31
+ minimumEnable: (plan: Plan) => boolean
32
+ iconIdList?: any
33
+ isMixLight: boolean
34
+ isSupportTemperature: boolean
35
+ isSupportBrightness: boolean
36
+ showDeleteBtn?: boolean
37
+ }
38
+
39
+ const BiorhythmEditPage = () => {
40
+ const navigation = useNavigation()
41
+ const is24Hour = useSystemTimeFormate()
42
+ const params = useParams<BiorhythmEditPageParams>()
43
+ const {
44
+ planData,
45
+ isAdd,
46
+ onPlanEdited,
47
+ onPlanDelete,
48
+ minimumEnable,
49
+ iconIdList,
50
+ isMixLight,
51
+ isSupportTemperature,
52
+ isSupportBrightness,
53
+ showDeleteBtn
54
+ } = params
55
+ const [hour, minute] = planData.startTime.split(':')
56
+ const state = useReactive({
57
+ hour: Number(hour),
58
+ minute: Number(minute),
59
+ iconIdList,
60
+ planData: cloneDeep(planData),
61
+ backStatus: false,
62
+ })
63
+
64
+ const onTopBarRightBtnClick = useCallback(() => {
65
+ if (!saveEnable() || minimumTipEnable()) return
66
+ state.backStatus = true
67
+ onPlanEdited(isAdd, {
68
+ ...state.planData,
69
+ icon: iconList?.find(val => val?.id === state.planData.iconId)?.icon || '',
70
+ })
71
+ navigation.goBack()
72
+ }, [])
73
+
74
+ const onDeleteBtnClick = useCallback(() => {
75
+ onPlanDelete(state.planData.id)
76
+ delay(() => {
77
+ navigation.goBack()
78
+ }, 300)
79
+ }, [])
80
+
81
+ const saveEnable = () => {
82
+ return state.planData.name.length > 0 && state.planData.name.length < 33 && !isEqual(state.planData, planData)
83
+ }
84
+
85
+ const minimumTipEnable = () => {
86
+ const enable = minimumEnable(state.planData)
87
+ return enable
88
+ }
89
+
90
+ const setImg = () => {
91
+ const imgIcon = iconList?.find(val => val?.id === state.planData.iconId)?.icon || ''
92
+ return imgIcon
93
+ }
94
+
95
+ return (
96
+ <Page
97
+ backText={I18n.getLang('add_new_trigger_time_system_back_text')}
98
+ headlineText={I18n.getLang(isAdd ? 'add_new_trigger_time_headline_text' : 'edit_trigger_time_headline_text')}
99
+ backDialogTitle={I18n.getLang('manage_user_unsaved_changes_dialog_headline')}
100
+ backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_bio_rhythm_note')}
101
+ showBackDialog={saveEnable() && !minimumTipEnable()}
102
+ rightButtonIcon={(saveEnable() && !minimumTipEnable()) ? res.ic_check : res.ic_uncheck}
103
+ rightButtonIconClick={onTopBarRightBtnClick}
104
+ >
105
+ <ScrollView>
106
+ <View
107
+ style={{
108
+ marginHorizontal: cx(24),
109
+ backgroundColor: '#fff',
110
+ }}>
111
+ <View style={{ height: cx(20) }} />
112
+ <TextField
113
+ value={state.planData.name}
114
+ showError={state.planData.name?.length > 32}
115
+ maxLength={33}
116
+ errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}
117
+ placeholder={I18n.getLang('add_new_trigger_time_inputfield_value_text')}
118
+ onChangeText={text => {
119
+ state.planData.name = text
120
+ }} />
121
+
122
+ <Spacer />
123
+ <TimerPicker
124
+ itemTextColor='#aeadb5'
125
+ style={{paddingVertical: cx(0), marginVertical: cx(0)}}
126
+ is12Hours={!is24Hour}
127
+ singlePicker={true}
128
+ startTime={state.hour * 60 + state.minute}
129
+ amText={I18n.getLang('manage_user_calendar_label_am')}
130
+ pmText={I18n.getLang('manage_user_calendar_label_pm')}
131
+ symbol=''
132
+ onTimerChange={(startTime) => {
133
+ state.hour = Math.trunc(startTime / 60)
134
+ state.minute = startTime % 60
135
+ state.planData.startTime = `${state.hour.toString().padStart(2, '0')}:${state.minute.toString().padStart(2, '0')}`
136
+ }}/>
137
+ {minimumTipEnable() && <View style={{ flexDirection: 'row', marginVertical: cx(5) }}>
138
+ <Image style={{ width: cx(16), height: cx(16), tintColor: '#000' }} source={res.ic_info} />
139
+ <Text
140
+ style={{ color: '#000', fontSize: cx(12) }}>{I18n.getLang('add_new_trigger_time_information_text')}</Text>
141
+ </View>}
142
+ <Spacer />
143
+ <View style={{ flexDirection: 'row' }}>
144
+ <View style={{ flex: 1 }}>
145
+ <Text style={{ fontSize: cx(14) }}>{I18n.getLang(isAdd ? 'add_new_trigger_time_text' : 'edit_trigger_time_headline_text')}</Text>
146
+ </View>
147
+ <TouchableOpacity
148
+ activeOpacity={1}
149
+ onPress={() => {
150
+ navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_icon_select, {
151
+ id: state.planData.iconId,
152
+ setIcon: (id) => {
153
+ state.planData.iconId = id
154
+ },
155
+ iconIdList: state.iconIdList,
156
+ })
157
+ }}
158
+ >
159
+ <View
160
+ style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end', alignContent: 'center', alignItems: 'center' }}>
161
+ <Image
162
+ style={{ width: cx(24), height: cx(24), tintColor: '#000' }}
163
+ source={setImg()}
164
+ />
165
+ <Image style={{ width: cx(16), height: cx(16) }} source={BiologicalRes.biorhythom_select_rightIcon} />
166
+ </View>
167
+ </TouchableOpacity>
168
+ </View>
169
+ <Text
170
+ style={{ fontSize: cx(16), fontFamily: 'helvetica_neue_lt_std_bd', marginTop: cx(33), marginBottom: cx(16) }}>
171
+ {I18n.getLang('add_new_trigger_time_subheadline_text')}
172
+ </Text>
173
+ <Card>
174
+ <View style={styles.titleBGView}>
175
+ <Text
176
+ style={styles.title}>{isMixLight ? I18n.getLang('light_sources_tile_main_lighting_headline') : I18n.getLang('light_sources_tile_tw_lighting_headline')}</Text>
177
+ {isSupportTemperature && <View style={[
178
+ styles.colorBlock,
179
+ {
180
+ backgroundColor: cctToColor(state.planData.colorTemperature.toFixed()) ?
181
+ cctToColor(state.planData.colorTemperature.toFixed()) : '#fff', opacity: 1,
182
+ }]}
183
+ />}
184
+ </View>
185
+ <View style={{ paddingBottom: cx(16) }}>
186
+ <ColorTempAdjustView
187
+ colorTemp={state.planData.colorTemperature}
188
+ brightness={Number(state.planData.brightness.toFixed())}
189
+ minBrightness={0}
190
+ onCCTChange={newValue => {
191
+ state.planData.colorTemperature = newValue
192
+ state.planData.action[0].startValue = `${colorTemperatureValue(newValue)}`
193
+ }}
194
+ onCCTChangeComplete={newValue => {
195
+ state.planData.colorTemperature = newValue
196
+ state.planData.action[0].startValue = `${colorTemperatureValue(newValue)}`
197
+ }}
198
+ onBrightnessChange={newValue => {
199
+ state.planData.brightness = newValue
200
+ state.planData.action[1].startValue = `${newValue}`
201
+ }}
202
+ onBrightnessChangeComplete={newValue => {
203
+ state.planData.brightness = newValue
204
+ state.planData.action[1].startValue = `${newValue}`
205
+ }}
206
+ isSupportBrightness={isSupportBrightness}
207
+ isSupportTemperature={isSupportTemperature} />
208
+ </View>
209
+ </Card>
210
+ <Spacer />
211
+ </View>
212
+ {!isAdd && showDeleteBtn &&
213
+ <View
214
+ style={{
215
+ marginHorizontal: cx(24),
216
+ marginVertical: cx(20)
217
+ }}>
218
+ <DeleteButton
219
+ text={I18n.getLang('edit_trigger_time_button_delete_text')}
220
+ onPress={() => {
221
+ showDialog({
222
+ method: 'confirm',
223
+ title: I18n.getLang('cancel_dialog_delete_item_bio_rhythm_titel'),
224
+ subTitle: I18n.getLang('cancel_dialog_delete_item_wakeupschedule_description'),
225
+ onConfirm: async (_, { close }) => {
226
+ close()
227
+ onDeleteBtnClick()
228
+ },
229
+ })
230
+ }}
231
+ />
232
+ </View>}
233
+ </ScrollView>
234
+ </Page>
235
+
236
+ )
237
+ }
238
+
239
+
240
+ const styles = StyleSheet.create({
241
+ titleBGView: {
242
+ flexDirection: 'row',
243
+ alignItems: 'center',
244
+ paddingHorizontal: cx(16),
245
+ },
246
+ colorBlock: {
247
+ width: cx(20),
248
+ height: cx(20),
249
+ marginStart: cx(12),
250
+ borderRadius: cx(4),
251
+ },
252
+ title: {
253
+ color: '#000',
254
+ fontSize: cx(16),
255
+ fontFamily: 'helvetica_neue_lt_std_bd',
256
+ paddingVertical: cx(16),
257
+ },
258
+ })
259
+
260
+
261
+ export default BiorhythmEditPage