import { TWorkflowById } from '@/domains/workflows/fetchers'; import { TCollectionFlowStep } from '@ballerine/common'; import { useMemo } from 'react'; import { CollectionFlowStepItem } from '../../components/CollectionFlowStepItem'; import { getCollectionFlowStatus } from '../../helpers/get-collection-flow-status'; import { Skeleton } from '@ballerine/ui'; interface IUseCollectionFlowTrackerItemsParams { steps: TCollectionFlowStep[]; isLoadingSteps: boolean; workflow: TWorkflowById; } export const useCollectionFlowTrackerItems = ({ steps, workflow, isLoadingSteps, }: IUseCollectionFlowTrackerItemsParams) => { const items = useMemo(() => { if (!isLoadingSteps && steps.length) { return steps.map(step => { return { text: ( ), leftIcon: undefined, }; }); } if (isLoadingSteps) { return Array.from({ length: 3 }).map((_, index) => { return { text: , leftIcon: undefined, }; }); } return [ { text: (
No collection flow steps available
), }, ]; }, [steps, workflow, isLoadingSteps]); return items; };