|
|
@@ -18,6 +18,8 @@ import TimeTitleDesc from "@/_health/components/time_title_desc";
|
|
|
import CoverList from "@/_health/components/cover_list";
|
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
|
import { jumpPage } from "../trackTimeDuration/hooks/Common";
|
|
|
+import TargetProgress from "@/_health/components/target_progress";
|
|
|
+import Cell from "@/_health/base/cell";
|
|
|
|
|
|
export default function HistoryItem(props: {
|
|
|
data: any,
|
|
|
@@ -71,8 +73,8 @@ export default function HistoryItem(props: {
|
|
|
function ring() {
|
|
|
const common: RingCommon = {
|
|
|
useCase: 'ChooseScenario',
|
|
|
- radius: 7,
|
|
|
- lineWidth: 3,
|
|
|
+ radius: 12,
|
|
|
+ lineWidth: 6,
|
|
|
isFast: true,
|
|
|
status: 'WAIT_FOR_START'
|
|
|
}
|
|
|
@@ -94,8 +96,8 @@ export default function HistoryItem(props: {
|
|
|
function ring2() {
|
|
|
const common: RingCommon = {
|
|
|
useCase: 'ChooseScenario',
|
|
|
- radius: 7,
|
|
|
- lineWidth: 3,
|
|
|
+ radius: 12,
|
|
|
+ lineWidth: 6,
|
|
|
isFast: true,
|
|
|
status: 'WAIT_FOR_START'
|
|
|
}
|
|
|
@@ -222,31 +224,72 @@ export default function HistoryItem(props: {
|
|
|
var begin = props.data.events[0].time.timestamp
|
|
|
var end = props.data.events[index].time.timestamp
|
|
|
|
|
|
- const date1 = dayjs(begin);
|
|
|
- const date2 = dayjs(end);
|
|
|
-
|
|
|
- // 获取日期部分(去掉时间)
|
|
|
- const startDate = date1.startOf('day');
|
|
|
- const endDate = date2.startOf('day');
|
|
|
- const days = endDate.diff(startDate, 'day')
|
|
|
- if (days > 0)
|
|
|
- return '+' + days;
|
|
|
+ return TimeFormatter.dayTagText(begin, end)
|
|
|
}
|
|
|
- return ''
|
|
|
}
|
|
|
|
|
|
- function goDetail(){
|
|
|
- jumpPage(`/_health/pages/timeline_detail?window_id=${props.data.window_id}&fast_type=${props.fast_type}&type=recent&isFastsleep=${props.mode=='FAST,SLEEP'}`)
|
|
|
+ function goDetail() {
|
|
|
+ jumpPage(`/_health/pages/timeline_detail?window_id=${props.data.window_id}&fast_type=${props.fast_type}&type=recent&isfastsleep=${props.mode == 'FAST,SLEEP' ? 1 : 0}`)
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (props.mode == 'FAST,SLEEP'){
|
|
|
+ // debugger
|
|
|
+ // }
|
|
|
+
|
|
|
+ function momentItem(moment) {
|
|
|
+ var hasImage = false
|
|
|
+ if (moment.media && moment.media.length > 0) hasImage = true
|
|
|
+ if (moment.title || moment.description) {
|
|
|
+ return <View style={{
|
|
|
+ display: 'flex',
|
|
|
+ flex: 1,
|
|
|
+ flexShrink: 0,
|
|
|
+ flexDirection: 'column',
|
|
|
+ backgroundColor: hasImage ? 'transparent' : '#fafafa',
|
|
|
+ paddingLeft: !hasImage ? rpxToPx(20) : rpxToPx(17),
|
|
|
+ paddingRight: !hasImage ? rpxToPx(20) : 0,
|
|
|
+ paddingTop: !hasImage ? rpxToPx(12) : 0,
|
|
|
+ paddingBottom: !hasImage ? rpxToPx(12) : 0
|
|
|
+ }}>
|
|
|
+ <TimeTitleDesc
|
|
|
+ className={hasImage?'line3':'line2'}
|
|
|
+ timeObj={moment.time}
|
|
|
+ time=''
|
|
|
+ // time={moment.time && dayjs(moment.time.timestamp).format('HH:mm')}
|
|
|
+ // dayTag={dayTag(index)}
|
|
|
+ title={moment.title}
|
|
|
+ desc={moment.description}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return <View className="history_item2" onClick={goDetail}>
|
|
|
<View className="cell_date" >
|
|
|
<View className="h42 bold" style={{ lineHeight: rpxToPx(60) + 'px' }}>{historyDate()}</View>
|
|
|
- <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(11), lineHeight: rpxToPx(49) + 'px' }}>{historyMonth()}</View>
|
|
|
+ <View className="h24 bold" style={{ marginLeft: rpxToPx(6), marginTop: rpxToPx(13), lineHeight: rpxToPx(47) + 'px' }}>{historyMonth()}</View>
|
|
|
</View>
|
|
|
- <View className="history_content" >
|
|
|
+ <View className="history_content" style={{ paddingTop: rpxToPx(4) }}>
|
|
|
+ {
|
|
|
+ props.data.events.map((event, i) => {
|
|
|
+ return event.moments && event.moments.map((moment, j) => {
|
|
|
+ return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i * 100 + j}>
|
|
|
+ {
|
|
|
+ moment.media && moment.media.length > 0 && <Image
|
|
|
+ style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
|
|
|
+ src={moment.media[0].url}
|
|
|
+ mode="aspectFill" />
|
|
|
+ }
|
|
|
+ {
|
|
|
+ momentItem(moment)
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12), flex: 1, paddingTop: rpxToPx(4) }}>
|
|
|
+ {/* <View style={{ display: 'flex', flexDirection: 'column', marginBottom: rpxToPx(12), flex: 1, paddingTop: rpxToPx(4) }}>
|
|
|
{
|
|
|
props.data.events.map((item, index) => {
|
|
|
return <TimeTitleDesc
|
|
|
@@ -256,44 +299,53 @@ export default function HistoryItem(props: {
|
|
|
title={getTitle(item)}
|
|
|
desc={item.moments && item.moments.length > 0 ? item.moments[0].description : ''}
|
|
|
/>
|
|
|
- // return <Text key={index}>
|
|
|
- // <Text className="history_item_title">{item.time && dayjs(item.time.timestamp).format('HH:mm')}
|
|
|
- // <Text style={{ fontSize: 9, lineHeight: '20px', fontWeight: 'bold', verticalAlign: 'text-top' }}>{dayTag(index)} </Text>
|
|
|
- // {getTitle(item)} </Text>
|
|
|
- // {
|
|
|
- // item.moments && item.moments.map((moment, i) => {
|
|
|
- // return <Text className="history_item_desc" key={i * 1000}>{moment.description}</Text>
|
|
|
- // })
|
|
|
- // }
|
|
|
- // </Text>
|
|
|
})
|
|
|
}
|
|
|
- </View>
|
|
|
- {
|
|
|
+ </View> */}
|
|
|
+ {/* {
|
|
|
mediaCount() > 0 && <CoverList count={mediaCount()} imgs={imgList()} />
|
|
|
- }
|
|
|
+ } */}
|
|
|
|
|
|
- <View className="history_duration_bg" style={{ marginTop: 0 }}>
|
|
|
- {
|
|
|
- props.fast_type != 'LF' && ring()
|
|
|
- }
|
|
|
- {
|
|
|
- props.fast_type == 'LF' && <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} />
|
|
|
- }
|
|
|
- {
|
|
|
- props.data.window_range.end_timestamp && <Text className="history_item_duration">{formatMilliseconds(props.data.window_range.end_timestamp - props.data.window_range.start_timestamp)}</Text>
|
|
|
+ {
|
|
|
+ props.data.windows.map((item, index) => {
|
|
|
+ return <TargetProgress key={index} showLine={index < props.data.windows.length - 1}
|
|
|
+ color={getThemeColor(item.window)}
|
|
|
+ showRing={props.fast_type != 'LF'}
|
|
|
+ desc={item.description}
|
|
|
+ icon={
|
|
|
+ props.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
|
|
|
+ }
|
|
|
+ canvasId={`${item.window}${item.window_range.start_timestamp}${index}`}
|
|
|
+ startTimestamp={item.window_range.start_timestamp}
|
|
|
+ endTimerstamp={item.window_range.end_timestamp}
|
|
|
+ />
|
|
|
+ })
|
|
|
+ }
|
|
|
+ {/* <TargetProgress showLine={props.mode == 'FAST,SLEEP' && props.data.events.length > 2}
|
|
|
+ color={props.mode == 'FAST,SLEEP' ? getThemeColor('FAST') : getThemeColor(health.mode)}
|
|
|
+ showRing={props.fast_type != 'LF'}
|
|
|
+ desc={props.data.window_range.end_timestamp ? formatMilliseconds(props.data.window_range.end_timestamp - props.data.window_range.start_timestamp) : ''}
|
|
|
+ icon={
|
|
|
+ props.fast_type == 'LF' ? <IconLongFast color={MainColorType.fast} width={rpxToPx(32)} /> : null
|
|
|
}
|
|
|
- </View>
|
|
|
+ canvasId={(props.mode == 'FAST,SLEEP' ? 'history_fast_sleep' + props.index : 'history_' + props.index) + props.type}
|
|
|
+ startTimestamp={props.data.window_range.start_timestamp}
|
|
|
+ endTimerstamp={props.data.window_range.end_timestamp}
|
|
|
+ />
|
|
|
{
|
|
|
props.mode == 'FAST,SLEEP' && props.data.events.length > 2 && <View className="history_duration_bg" style={{ marginTop: 0 }}>
|
|
|
{
|
|
|
- props.fast_type != 'LF' && ring2()
|
|
|
+ props.fast_type != 'LF' && <View className="recent_ring_bg">
|
|
|
+ {
|
|
|
+ ring2()
|
|
|
+ }
|
|
|
+ </View>
|
|
|
}
|
|
|
{
|
|
|
- props.data.window_range.end_timestamp && <Text className="history_item_duration">{formatMilliseconds(props.data.events[2].time.timestamp - props.data.events[1].time.timestamp)}</Text>
|
|
|
+ props.data.window_range.end_timestamp && <Text className="history_item_duration h26">{formatMilliseconds(props.data.events[2].time.timestamp - props.data.events[1].time.timestamp)}</Text>
|
|
|
}
|
|
|
</View>
|
|
|
- }
|
|
|
+ } */}
|
|
|
{/* {
|
|
|
props.isArchived && <View className="history_archived_row">
|
|
|
<View className="history_archived" onClick={(e) => {
|
|
|
@@ -325,17 +377,18 @@ export default function HistoryItem(props: {
|
|
|
</View>
|
|
|
</View>
|
|
|
} */}
|
|
|
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(60), marginTop: rpxToPx(20) }}>
|
|
|
+ <View style={{ height: rpxToPx(0), flexShrink: 0 }} />
|
|
|
+ {/* <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(60), marginTop: rpxToPx(20) }}>
|
|
|
<View style={{ flex: 1 }} />
|
|
|
<NewButton type={NewButtonType.more}
|
|
|
onClick={tapDel}
|
|
|
/>
|
|
|
- </View>
|
|
|
+ </View> */}
|
|
|
</View>
|
|
|
-
|
|
|
+ {/*
|
|
|
{
|
|
|
!props.hideLine && <View className="border_footer_line" />
|
|
|
- }
|
|
|
+ } */}
|
|
|
|
|
|
</View>
|
|
|
}
|