|
|
@@ -11,8 +11,9 @@ import momentT from 'moment';
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import { useSelector } from "react-redux";
|
|
|
import Calendar from "@/features/health/calendar";
|
|
|
+import { WindowType } from "@/utils/types";
|
|
|
|
|
|
-export default function MainDayNightCard(props: { count: number }) {
|
|
|
+export default function MainDayNightCard(props: { count: number, typeChanged: Function }) {
|
|
|
const [isDay, setIsDay] = useState(true)
|
|
|
const [isDayMode, setIsDayMode] = useState(true)
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
@@ -119,7 +120,9 @@ export default function MainDayNightCard(props: { count: number }) {
|
|
|
}
|
|
|
|
|
|
function switchMode() {
|
|
|
- setIsDayMode(!isDayMode)
|
|
|
+ const mode = !isDayMode
|
|
|
+ setIsDayMode(mode)
|
|
|
+ props.typeChanged(mode ? WindowType.day : WindowType.night)
|
|
|
}
|
|
|
|
|
|
function timeStatus() {
|
|
|
@@ -131,41 +134,48 @@ export default function MainDayNightCard(props: { count: number }) {
|
|
|
}
|
|
|
return 'Coming up'
|
|
|
}
|
|
|
- return <ScrollView className="scroll-view" scrollY>
|
|
|
- <View className="content">
|
|
|
- {/* 上方内容 */}
|
|
|
- <View style={{ height: 400, backgroundColor: '#f0f0f0' }}>
|
|
|
- <Calendar year={2024} month={8} />
|
|
|
- </View>
|
|
|
-
|
|
|
- {/* 粘性视图 */}
|
|
|
- <View className="sticky-view">
|
|
|
- <Text>2024年8月</Text>
|
|
|
- </View>
|
|
|
+ // return <ScrollView className="scroll-view" scrollY>
|
|
|
+ // <View className="content">
|
|
|
+ // <View style={{ height: 400, backgroundColor: '#f0f0f0' }}>
|
|
|
+ // <Calendar year={2024} month={8} />
|
|
|
+ // </View>
|
|
|
|
|
|
- {/* 下方内容 */}
|
|
|
- <View style={{ height: 1200, backgroundColor: '#e0e0e0' }}>
|
|
|
- <Text>更多内容...</Text>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </ScrollView>
|
|
|
-
|
|
|
- // return <View style={{ width: rpxToPx(750), display: 'flex', flexShrink: 0, flexDirection: 'column', alignItems: 'center',position:'relative' }}>
|
|
|
- // <Calendar year={2024} month={8}/>
|
|
|
- // <View>Page Day Night</View>
|
|
|
- // <View style={{ position: 'relative' }}>
|
|
|
- // {
|
|
|
- // ring()
|
|
|
- // }
|
|
|
- // <View className="ring_center">
|
|
|
- // <View>{isDayMode?'Daylight':'Night'}</View>
|
|
|
- // <View>{timeStatus()}</View>
|
|
|
- // <Text className="time1" style={{color:'#000'}}>{formatTime('HH:mm:ss')}</Text>
|
|
|
- // <Text className="date1">{global.language == 'en' ? formatTime('dddd, MMM D') : formatTime('MMMD日 dddd')}</Text>
|
|
|
+ // <View className="sticky-view">
|
|
|
+ // <Text>2024年8月</Text>
|
|
|
+ // </View>
|
|
|
+ // <View style={{ height: 1200, backgroundColor: '#e0e0e0' }}>
|
|
|
+ // <Text>更多内容...</Text>
|
|
|
+ // </View>
|
|
|
+ // <View className="sticky-view">
|
|
|
+ // <Text>2024年9月</Text>
|
|
|
+ // </View>
|
|
|
+ // <View style={{ height: 1200, backgroundColor: '#e0e0e0' }}>
|
|
|
+ // <Text>更多内容...</Text>
|
|
|
+ // </View>
|
|
|
+ // <View className="sticky-view">
|
|
|
+ // <Text>2024年10月</Text>
|
|
|
+ // </View>
|
|
|
+ // <View style={{ height: 1200, backgroundColor: '#e0e0e0' }}>
|
|
|
+ // <Text>更多内容...</Text>
|
|
|
// </View>
|
|
|
// </View>
|
|
|
- // <Text onClick={switchMode}>Switch</Text>
|
|
|
- // <View className="sticky"></View>
|
|
|
- // <View style={{height:200}}/>
|
|
|
- // </View>
|
|
|
+ // </ScrollView>
|
|
|
+
|
|
|
+ return <View style={{ width: rpxToPx(750), display: 'flex', flexShrink: 0, flexDirection: 'column', alignItems: 'center', position: 'relative' }}>
|
|
|
+ {/* <Calendar year={2024} month={8}/> */}
|
|
|
+ <View style={{ position: 'relative' }}>
|
|
|
+ {
|
|
|
+ ring()
|
|
|
+ }
|
|
|
+ <View className="ring_center">
|
|
|
+ <View>{isDayMode ? 'Daylight' : 'Night'}</View>
|
|
|
+ <View>{timeStatus()}</View>
|
|
|
+ <Text className="time1" style={{ color: '#000' }}>{formatTime('HH:mm:ss')}</Text>
|
|
|
+ <Text className="date1">{global.language == 'en' ? formatTime('dddd, MMM D') : formatTime('MMMD日 dddd')}</Text>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <Text onClick={switchMode}>Switch</Text>
|
|
|
+ <View className="sticky"></View>
|
|
|
+ <View style={{ height: 200 }} />
|
|
|
+ </View>
|
|
|
}
|