|
|
@@ -12,7 +12,12 @@ import { systemLocation } from '@/services/common'
|
|
|
import { updateMember } from '@/store/day_night'
|
|
|
import Modal from '@/components/layout/Modal.weapp'
|
|
|
import { rpxToPx } from '@/utils/tools'
|
|
|
+import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
|
|
|
|
|
|
+let useNavigation;
|
|
|
+if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useNavigation = require("@react-navigation/native").useNavigation
|
|
|
+}
|
|
|
export default function DayNightCard(props: { isNight: boolean, switchChanged: Function }) {
|
|
|
const [expand, setExpand] = useState(false)
|
|
|
const user = useSelector((state: any) => state.user);
|
|
|
@@ -24,6 +29,10 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
const [showDetailModal, setShowDetailModal] = useState(false)
|
|
|
const dispatch = useDispatch();
|
|
|
const { t } = useTranslation()
|
|
|
+ let navigation;
|
|
|
+ if (useNavigation) {
|
|
|
+ navigation = useNavigation()
|
|
|
+ }
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (user.isLogin) {
|
|
|
@@ -84,26 +93,32 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
|
|
|
function footer() {
|
|
|
return <View className='day_night_card_footer'>
|
|
|
- <Text style={{color:'#9E9E9E',fontSize:rpxToPx(20)}}>{
|
|
|
+ <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }}>{
|
|
|
// !isMember ? t('feature.track_time_duration.third_ring.member_desc') :
|
|
|
authInfo ? t('feature.track_time_duration.third_ring.base_location_desc') :
|
|
|
t('feature.track_time_duration.third_ring.enter_location_desc')
|
|
|
}</Text>
|
|
|
+ {
|
|
|
+ authInfo && <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }} onClick={auth}>Edit Location</Text>
|
|
|
+ }
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
function tapCard(e) {
|
|
|
if (!user.isLogin) {
|
|
|
+ jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!expand) {
|
|
|
return
|
|
|
}
|
|
|
+ var list = ['Current location Info',
|
|
|
+ 'Choose a new location']
|
|
|
+ if (user.test_user){
|
|
|
+ list.push('clear location data')
|
|
|
+ }
|
|
|
Taro.showActionSheet({
|
|
|
- itemList: [
|
|
|
- 'Current location Info',
|
|
|
- 'Choose a new location',
|
|
|
- 'clear location data'
|
|
|
- //t('feature.track_time_duration.action_sheet.switch_scenario'),
|
|
|
- //t('feature.track_time_duration.action_sheet.change_schedule')
|
|
|
- ]
|
|
|
+ itemList: list
|
|
|
}).then(res => {
|
|
|
switch (res.tapIndex) {
|
|
|
case 0:
|
|
|
@@ -336,7 +351,7 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
<View>
|
|
|
<View className='day_night_top'>
|
|
|
<Text className='day_night_title'>{props.isNight ? 'Overnight' : 'Day'}</Text>
|
|
|
- <View className='free'>限时免费</View>
|
|
|
+ <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>限时免费</View>
|
|
|
<View style={{ flex: 1 }} />
|
|
|
<Switch checked={expand}
|
|
|
color={props.isNight ? ColorType.night : ColorType.day}
|
|
|
@@ -368,15 +383,20 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}}
|
|
|
/>
|
|
|
</View>
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
- <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}` : `${sunriseTime} - ${sunsetTime}`}</Text>
|
|
|
- <Text>{props.isNight ? 'Sunset to Sunrise' : 'Sunrise to Sunset'}</Text>
|
|
|
- <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
|
|
|
- <Text>{timeDesc()}</Text>
|
|
|
- </View>
|
|
|
{
|
|
|
- footer()
|
|
|
+ expand && <View>
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
+ <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}` : `${sunriseTime} - ${sunsetTime}`}</Text>
|
|
|
+ <Text>{props.isNight ? 'Sunset to Sunrise' : 'Sunrise to Sunset'}</Text>
|
|
|
+ <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
|
|
|
+ <Text>{timeDesc()}</Text>
|
|
|
+ </View>
|
|
|
+ {
|
|
|
+ footer()
|
|
|
+ }
|
|
|
+ </View>
|
|
|
}
|
|
|
+
|
|
|
</View>
|
|
|
</Box>
|
|
|
{
|