Skip to content

Commit

Permalink
use the ExpandRow funtionality
Browse files Browse the repository at this point in the history
  • Loading branch information
radumojic committed Feb 20, 2024
1 parent 57e2536 commit 3c4b2c2
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,52 @@ import { useGetSort } from 'hooks';
import { NodeType, SortOrderEnum, WithClassnameType } from 'types';

import { AuctionListBaseRow } from './AuctionListBaseRow';
import { AuctionListExpandRow } from './AuctionListExpandRow';
import { AuctionListTresholdRow } from './AuctionListTresholdRow';

export interface AuctionListRowUIType extends WithClassnameType {
nodeData: NodeType;
showTresholdRow?: boolean;
expandRowDetails?: ExpandRowDetailsType;
index?: number;
showPosition?: boolean;
}

export const AuctionListRow = ({
nodeData,
showTresholdRow,
index
index,
showPosition,
expandRowDetails
}: AuctionListRowUIType) => {
const { sort, order } = useGetSort();
const isSortDesc = sort === 'auctionPosition' && order === SortOrderEnum.desc;

const hasExpand = Boolean(
expandRowDetails?.qualifiedExpandPosition ||
expandRowDetails?.dangerZoneExpandPosition ||
expandRowDetails?.notQualifiedExpandPosition
);

return (
<>
{isSortDesc && showTresholdRow && (
<AuctionListTresholdRow key={nodeData.bls} isSortDesc />
)}
<AuctionListBaseRow nodeData={nodeData} index={index} />
{hasExpand && index && expandRowDetails ? (
<AuctionListExpandRow
nodeData={nodeData}
expandRowDetails={expandRowDetails}
showPosition={showPosition}
index={index}
/>
) : (
<AuctionListBaseRow
nodeData={nodeData}
index={index}
showPosition={showPosition}
/>
)}
{!isSortDesc && showTresholdRow && (
<AuctionListTresholdRow key={nodeData.bls} />
)}
Expand Down

0 comments on commit 3c4b2c2

Please sign in to comment.