import React from 'react' import { useTheme } from 'styled-components/native' import { useLanguage, useUtils } from 'ordering-components/native' import { Container, DateBlock, MessageBlock, DescriptionBlock, Dot } from './styles' import { OIcon, OText } from '../shared'; export const WalletTransactionItem = (props: any) => { const { item, idx, type, withFormatPrice } = props const theme = useTheme() const [{ parsePrice, parseDate }] = useUtils() const [, t] = useLanguage() const LANG_EVENT_KEY = `WALLET_${type.toUpperCase()}_${item?.event.toUpperCase()}_${item?.event_type.toUpperCase()}_${item?.amount >= 0 ? 'POSITIVE' : 'NEGATIVE'}` const lang_event_text = !!item?.event?.order_id ? `:author${item?.amount >= 0 ? 'Add' : 'Reduce'} money in Order No. :order_id` : `:author${item?.amount >= 0 ? 'Add' : 'Reduce'} money` return ( {parseDate(item?.created_at)} 0 && theme.colors.primary, fontWeight: 'bold' }} > {item?.amount > 0 && '+ '}{withFormatPrice ? parsePrice(item?.amount) : item?.amount} {t(LANG_EVENT_KEY, lang_event_text) .replace(':author', item?.event?.author?.name ? item?.event?.author?.name + ' ' : '') .replace(':order_id', item?.event?.order_id ? item?.event?.order_id + ' ' : '')} {!!item?.description && ( {item?.description} )} {/* {!!item?.code && ( {t('CODE', 'Code')} {': '}{item?.code} )} */} ) }