|
|
@@ -9,10 +9,10 @@ import Rings, { RingCommon, BgRing, TargetRing, CurrentDot } from "@/features/tr
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import { durationArc, startArc } from "./util";
|
|
|
|
|
|
-export default function HistoryItem(props: { data: any, index: number }) {
|
|
|
+export default function HistoryItem(props: { data: any, index: number, onClick: Function }) {
|
|
|
const health = useSelector((state: any) => state.health);
|
|
|
function preview(obj) {
|
|
|
- var list:any = []
|
|
|
+ var list: any = []
|
|
|
props.data.events.map((item) => {
|
|
|
item.moment.media.map((media) => {
|
|
|
list.push(media.url)
|
|
|
@@ -25,6 +25,8 @@ export default function HistoryItem(props: { data: any, index: number }) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ //npm install react-native-text-size
|
|
|
+
|
|
|
function getTitle(item) {
|
|
|
if (item.moment) {
|
|
|
return item.moment.title
|
|
|
@@ -41,7 +43,7 @@ export default function HistoryItem(props: { data: any, index: number }) {
|
|
|
function ring() {
|
|
|
const common: RingCommon = {
|
|
|
useCase: 'ChooseScenario',
|
|
|
- radius: 17,
|
|
|
+ radius: 10,
|
|
|
lineWidth: 3,
|
|
|
isFast: true,
|
|
|
status: 'WAIT_FOR_START'
|
|
|
@@ -52,41 +54,34 @@ export default function HistoryItem(props: { data: any, index: number }) {
|
|
|
}
|
|
|
|
|
|
const realRing = {
|
|
|
- hideBg:true,
|
|
|
- color:getThemeColor(health.mode),
|
|
|
- startArc:startArc(props.data.window_range.start_timestamp),
|
|
|
- durationArc:durationArc(props.data.window_range.start_timestamp,props.data.window_range.end_timestamp)
|
|
|
+ hideBg: true,
|
|
|
+ color: getThemeColor(health.mode),
|
|
|
+ startArc: startArc(props.data.window_range.start_timestamp),
|
|
|
+ durationArc: durationArc(props.data.window_range.start_timestamp, props.data.window_range.end_timestamp)
|
|
|
}
|
|
|
|
|
|
|
|
|
return <Rings common={common} bgRing={bgRing} realRing={realRing} canvasId={'history_' + props.index} />
|
|
|
}
|
|
|
|
|
|
- function mediaCount(){
|
|
|
+ function mediaCount() {
|
|
|
let count = 0;
|
|
|
props.data.events.map((item) => {
|
|
|
- if (item.moment){
|
|
|
+ if (item.moment) {
|
|
|
item.moment.media.map((obj, j) => {
|
|
|
count++;
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
- return <View className="history_item">
|
|
|
- <View className="history_ring">
|
|
|
- {
|
|
|
- ring()
|
|
|
- }
|
|
|
- <View className="history_date">{dayjs(props.data.window_range.start_timestamp).format('D')}</View>
|
|
|
- </View>
|
|
|
+ return <View className="history_item" onClick={() => props.onClick()}>
|
|
|
+ <View className="history_date">{dayjs(props.data.window_range.start_timestamp).format('D')}</View>
|
|
|
<View className="history_content">
|
|
|
- {
|
|
|
- props.data.window_range.end_timestamp && <Text className="history_item_duration" style={{ color: getThemeColor(health.mode) }}>{formatMilliseconds(props.data.window_range.end_timestamp - props.data.window_range.start_timestamp)}</Text>
|
|
|
- }
|
|
|
- <Text>
|
|
|
+
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
{
|
|
|
props.data.events.map((item, index) => {
|
|
|
return <Text key={index}>
|
|
|
@@ -97,19 +92,27 @@ export default function HistoryItem(props: { data: any, index: number }) {
|
|
|
</Text>
|
|
|
})
|
|
|
}
|
|
|
- </Text>
|
|
|
- <View className="media" style={{ marginTop: mediaCount()>0?9:-10 }}>
|
|
|
+ </View>
|
|
|
+ <View className="media" style={{ marginTop: mediaCount() > 0 ? 9 : -10, marginRight: mediaCount() == 4 ? 80 : 0 }}>
|
|
|
{
|
|
|
props.data.events.map((item) => {
|
|
|
- if (item.moment){
|
|
|
+ if (item.moment) {
|
|
|
return item.moment.media.map((obj, j) => {
|
|
|
return <Image className="media_item" mode="aspectFill" onClick={() => preview(obj)} src={obj.url} key={j * 10} />
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
</View>
|
|
|
+ <View className="history_duration_bg">
|
|
|
+ {
|
|
|
+ ring()
|
|
|
+ }
|
|
|
+ {
|
|
|
+ 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>
|
|
|
+ }
|
|
|
+ </View>
|
|
|
</View>
|
|
|
<View className="border_footer_line" />
|
|
|
</View>
|