This reverts commit 0dc22f8b90.
This commit is contained in:
committed by
GitHub Enterprise
parent
0dc22f8b90
commit
daac19fb21
@@ -3,6 +3,7 @@ import { StyleSheet, View } from 'react-native';
|
||||
import { GenericStyles } from '../../../../RN-UI-LIB/src/styles';
|
||||
import Text from '../../../../RN-UI-LIB/src/components/Text';
|
||||
import { COLORS } from '../../../../RN-UI-LIB/src/styles/colors';
|
||||
import RepaymentsUnpaidIcon from '../../../assets/icons/RepaymentsUnpaidIcon';
|
||||
import RepaymentsPaidIcon from '../../../assets/icons/RepaymentsPaidIcon';
|
||||
import Tag from '../../../../RN-UI-LIB/src/components/Tag';
|
||||
import {
|
||||
@@ -10,23 +11,34 @@ import {
|
||||
REPAYMENT_STATUS,
|
||||
RepaymentStatusTagging,
|
||||
} from '../../../types/repayments.types';
|
||||
import { BUSINESS_DATE_FORMAT, dateFormat } from '../../../../RN-UI-LIB/src/utlis/dates';
|
||||
import InfoIcon from '../../../../RN-UI-LIB/src/Icons/InfoIcon';
|
||||
import { row } from '../constants';
|
||||
import {
|
||||
BUSINESS_DATE_FORMAT,
|
||||
BUSINESS_TIME_FORMAT,
|
||||
dateFormat,
|
||||
} from '../../../../RN-UI-LIB/src/utlis/dates';
|
||||
|
||||
interface RepaymentsItemProps {
|
||||
repaymentRecord: IRepaymentsRecord;
|
||||
}
|
||||
|
||||
const StatusIcon: React.FC<{ status: REPAYMENT_STATUS }> = ({ status }) => {
|
||||
switch (status) {
|
||||
case REPAYMENT_STATUS.FAILURE:
|
||||
return <RepaymentsUnpaidIcon />;
|
||||
case REPAYMENT_STATUS.SUCCESS:
|
||||
return <RepaymentsPaidIcon />;
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
};
|
||||
|
||||
const RepaymentsItem: React.FC<RepaymentsItemProps> = ({ repaymentRecord }) => {
|
||||
const repaymentTag = RepaymentStatusTagging[repaymentRecord.status];
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.leftContainer}>
|
||||
{repaymentRecord.status === REPAYMENT_STATUS.SUCCESS ? (
|
||||
<RepaymentsPaidIcon />
|
||||
) : repaymentTag ? (
|
||||
<InfoIcon color={repaymentTag.iconColor} />
|
||||
) : null}
|
||||
<StatusIcon status={repaymentRecord.status} />
|
||||
</View>
|
||||
<View style={[GenericStyles.fill]}>
|
||||
<View style={[GenericStyles.row, GenericStyles.fill]}>
|
||||
|
||||
@@ -5,7 +5,6 @@ export enum REPAYMENT_STATUS {
|
||||
FAILURE = 'FAILURE',
|
||||
SCHEDULED = 'SCHEDULED',
|
||||
UNKNOWN = 'UNKNOWN',
|
||||
FAILED = 'FAILED',
|
||||
}
|
||||
|
||||
interface IRepaymentStatusTagging {
|
||||
@@ -19,17 +18,12 @@ interface IRepaymentStatusTagging {
|
||||
export const RepaymentStatusTagging: IRepaymentStatusTagging = {
|
||||
[REPAYMENT_STATUS.FAILURE]: {
|
||||
label: 'Failed',
|
||||
iconColor: COLORS.TEXT.RED,
|
||||
variant: 'error',
|
||||
},
|
||||
[REPAYMENT_STATUS.FAILED]: {
|
||||
label: 'Failed',
|
||||
iconColor: COLORS.TEXT.RED,
|
||||
iconColor: COLORS.BACKGROUND.LIGHT,
|
||||
variant: 'error',
|
||||
},
|
||||
[REPAYMENT_STATUS.UNKNOWN]: {
|
||||
label: 'Unknown',
|
||||
iconColor: COLORS.TEXT.LIGHT,
|
||||
iconColor: COLORS.BACKGROUND.LIGHT,
|
||||
variant: 'gray',
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user