Files
nice-app-web/src/entities/transaction/ui/escrow-list.tsx
focp212@naver.com d2b477e7bd 상세 수정
2025-11-03 20:57:55 +09:00

62 lines
1.5 KiB
TypeScript

import { EscrowListProps } from '../model/types';
import { ListDateGroup } from './list-date-group';
export const EscrowList = ({
transactionCategory,
listItems,
setDetailData
}: EscrowListProps) => {
const getListDateGroup = () => {
let rs = [];
let date = '';
let list = [];
for(let i=0;i<listItems.length;i++){
let item = listItems[i];
if(!!item){
let transactionDate = item.transactionDate;
if(!!transactionDate){
if(i === 0){
date = transactionDate;
}
if(date !== transactionDate){
if(list.length > 0){
rs.push(
<ListDateGroup
transactionCategory={ transactionCategory }
key={ date + '-' + i }
date={ date }
items={ list }
setDetailData={ setDetailData }
></ListDateGroup>
);
}
date = transactionDate;
list = [];
}
list.push(item);
}
}
}
if(list.length > 0){
rs.push(
<ListDateGroup
transactionCategory={ transactionCategory }
key={ date + '-last' }
date={ date }
items={ list }
setDetailData={ setDetailData }
></ListDateGroup>
);
}
return rs;
};
return (
<>
<div className="transaction-list">
{ getListDateGroup() }
</div>
</>
);
};