import { View, Text } from '@tarojs/components' import Rings, { RingCommon, BgRing, TargetRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings"; import './target_progress.scss' import { MainColorType } from '@/context/themes/color'; import { durationArc, startArc } from '@/utils/ring_utils'; import { rpxToPx } from '@/utils/tools'; export default function TargetProgress(props: { showLine?: boolean, color?: string, startTimestamp?: number, endTimerstamp?: number, canvasId?: string, showRing: boolean, icon?: any, desc?: string, //双环 doubleRing?: boolean, first?: any, second?: any, onClick?: any }) { function ring() { const common: RingCommon = { useCase: 'ChooseScenario', radius: 12, lineWidth: 6, isFast: true, status: 'WAIT_FOR_START' } const bgRing: BgRing = { color: MainColorType.ringBg } const realRing = { hideBg: true, color: props.color ?? MainColorType.fast, startArc: startArc(props.startTimestamp ?? 0), durationArc: durationArc(props.startTimestamp ?? 0, props.endTimerstamp ?? 0) } return } function ring1() { const common: RingCommon = { useCase: 'ChooseScenario', radius: 12.5, lineWidth: 5, isFast: true, status: 'WAIT_FOR_START' } const bgRing: BgRing = { color: MainColorType.ringBg } const realRing = { hideBg: true, color: MainColorType.fast, startArc: startArc(props.first.window_range.start_timestamp ?? 0), durationArc: durationArc(props.first.window_range.start_timestamp ?? 0, props.first.window_range.end_timestamp ?? 0) } return } function ring2() { const common: RingCommon = { useCase: 'ChooseScenario', radius: 6.5, lineWidth: 5, isFast: true, status: 'WAIT_FOR_START' } const bgRing: BgRing = { color: MainColorType.ringBg } const realRing = { hideBg: true, color: MainColorType.sleep, startArc: startArc(props.second.window_range.start_timestamp ?? 0), durationArc: durationArc(props.second.window_range.start_timestamp ?? 0, props.second.window_range.end_timestamp ?? 0) } return } function twoRing() { return { ring1() } { ring2() } } return { if (props.onClick) { if (process.env.TARO_ENV == 'weapp') { e.stopPropagation() } props.onClick() } }} style={{ position: 'relative', marginTop: 0, marginBottom: props.showLine ? rpxToPx(7) : 0 }}> { props.showRing ? { props.doubleRing ? twoRing() : ring() } : { props.icon } } { props.desc && {props.desc} } { props.doubleRing && {props.first.description}{props.second.description} } {/* { props.showLine && } */} }