import TargetProgress from "@/_health/components/target_progress"; import TimeTitleDesc from "@/_health/components/time_title_desc"; import TimelineDate from "@/_health/components/timeline_date"; import { IconActive } from "@/components/basic/Icons"; import { MainColorType } from "@/context/themes/color"; import { getThemeColor } from "@/features/health/hooks/health_hooks"; import JournalCover from "@/features/journal/components/journal_cover"; import { jumpPage } from "@/features/trackTimeDuration/hooks/Common"; import { rpxToPx } from "@/utils/tools"; import { View, Text, Image, ScrollView } from "@tarojs/components"; import dayjs from "dayjs"; import './recent_item.scss' export default function RecentItem(props: { data: any, index: number }) { const { time, moment, link } = props.data function historyMonth(index) { var showDate = time.is_start_year ? true : false; var dateStr = global.language == 'en' ? dayjs(time.timestamp).format('YYYY') : dayjs(time.timestamp).format('YYYY年') if (index == 0) { var now = global.language == 'en' ? dayjs().format('YYYY') : dayjs().format('YYYY年') if (dateStr == now) { showDate = false } } if (showDate) { return {dateStr} } return } function medias() { var pics = moment.media.map(obj => obj.url); return } function goDetail() { if (link.scenario == 'MOVE') { jumpPage('/_health/pages/move_detail?id=' + link.move.id) return; } jumpPage(`/_health/pages/timeline_detail?source=home&window_id=${link.window_id}&event_id=${link.event_id}`) } const hasImg = moment && moment.media.length > 0 var hasText = moment && (moment.title || moment.description) if (hasText == undefined) { hasText = false } const spaceY = rpxToPx(12) return { historyMonth(props.index) } { hasImg && medias() } { hasText && 0 ? 'transparent' : '#fafafa', paddingLeft: moment.media.length > 0 ? 0 : rpxToPx(20), paddingRight: rpxToPx(20), paddingTop: hasImg ? rpxToPx(12) : rpxToPx(12), paddingBottom: rpxToPx(12) }}> } { link && link.ring && } { link && link.move && } /> } }