import moment from "moment"; import "moment/locale/fr"; import { asp as g } from "@asp/asp"; import type { FC } from "react"; import { Text, View } from "react-native"; import type { Transaction } from "../types"; import PaymentType from "./PaymentType"; moment.locale("fr"); export const TransactionItem: FC<{ transaction: Transaction }> = ({ transaction }) => { const { type_paiement_label, reference, date, montant, status } = transaction; const dateObject = Date.parse(date); const color = status === "SUCCESS" ? "green" : status === "INITIATED" ? "orange" : "red"; return ( {reference} {moment(dateObject).fromNow()} {montant} ); };