| 1 | import { View, StyleSheet } from "react-native";
|
| 2 | import { Text } from "@/components/ui/Text";
|
| 3 | import { MaterialIcons } from "@expo/vector-icons";
|
| 4 | import { Card } from "@/components/ui/Cards";
|
| 5 | import type { HistoryCard } from "@/lib/history/types";
|
| 6 | import type { CareAction } from "@/lib/api";
|
| 7 | import { Spacing } from "@/constants/theme";
|
| 8 | import { router } from "expo-router";
|
| 9 |
|
| 10 | type Props = { card: HistoryCard & { raw: CareAction } };
|
| 11 |
|
| 12 | export function MedicineHistoryCard({ card }: Props) {
|
| 13 | const time = new Date(card.timestamp).toLocaleTimeString("pt-BR", {
|
| 14 | hour: "2-digit",
|
| 15 | minute: "2-digit",
|
| 16 | });
|
| 17 |
|
| 18 | return (
|
| 19 | <Card
|
| 20 | style={styles.card}
|
| 21 | onPress={() => router.push(`/care-actions/${card.raw.id}`)}
|
| 22 | >
|
| 23 | <View style={styles.row}>
|
| 24 | <View style={[styles.iconWrap, styles.iconBg]}>
|
| 25 | <MaterialIcons name="medication" size={22} color="#7C3AED" />
|
| 26 | </View>
|
| 27 | <View style={styles.body}>
|
| 28 | <View style={styles.titleRow}>
|
| 29 | <Text style={styles.title}>{card.title}</Text>
|
| 30 | <Text style={styles.time}>{time}</Text>
|
| 31 | </View>
|
| 32 | <Text style={styles.summary} numberOfLines={2}>
|
| 33 | {card.summary}
|
| 34 | </Text>
|
| 35 | </View>
|
| 36 | </View>
|
| 37 | </Card>
|
| 38 | );
|
| 39 | }
|
| 40 |
|
| 41 | const styles = StyleSheet.create({
|
| 42 | card: { padding: Spacing.cardGap },
|
| 43 | row: { flexDirection: "row", alignItems: "flex-start", gap: 12 },
|
| 44 | iconWrap: {
|
| 45 | width: 40,
|
| 46 | height: 40,
|
| 47 | borderRadius: 20,
|
| 48 | alignItems: "center",
|
| 49 | justifyContent: "center",
|
| 50 | marginTop: 1,
|
| 51 | },
|
| 52 | iconBg: { backgroundColor: "#EDE9FE" },
|
| 53 | body: { flex: 1 },
|
| 54 | titleRow: {
|
| 55 | flexDirection: "row",
|
| 56 | justifyContent: "space-between",
|
| 57 | alignItems: "center",
|
| 58 | marginBottom: 2,
|
| 59 | },
|
| 60 | title: { fontSize: 15, fontWeight: "600" },
|
| 61 | time: { fontSize: 13, opacity: 0.45 },
|
| 62 | summary: { fontSize: 13, opacity: 0.6, lineHeight: 18 },
|
| 63 | });
|