import { AlertTriangleIcon, ListChecksIcon, MapPinIcon, SearchCheckIcon, UsersIcon, } from 'lucide-react'; import { useMemo } from 'react'; import { cells } from '@/lib/blocks/create-blocks-typed/create-blocks-typed'; import { BlocksComponent } from '@ballerine/blocks'; import { BlockCardWrapper } from '../components/BlockCardWrapper'; import { ChecksSectionContent } from '../components/ChecksSectionContent'; import { StreetViewComponent } from '../components/StreetViewComponent'; import { AssessmentPageSection, SectionDataProps } from '../types'; export const useSectionData = ({ assessment, assessmentChecks, companySanctionsBlock, companyStructureBlock, registryInfoBlock, }: SectionDataProps): AssessmentPageSection[] => { return useMemo(() => { const registryData = assessment?.companyRegistryInformation?.output?.data; const getRegisteredAddress = () => { if (!registryData?.addresses?.length) return null; const registeredAddressObj = registryData.addresses.find((addr: any) => { if (addr.type) { return addr.type.toLowerCase().includes('registered') && addr.fullAddress; } return !!addr.fullAddress; }); return registeredAddressObj?.fullAddress || null; }; const registeredAddress = getRegisteredAddress(); return [ { id: 'checks', title: 'Checks', Icon: ListChecksIcon, hasViolations: assessmentChecks.some(check => check.status === 'negative'), Component: , }, { id: 'company-sanctions', title: 'Company Sanctions', Icon: AlertTriangleIcon, hasViolations: Boolean(assessment?.companySanctions?.output?.data?.length), Component: ( {(Cell: any, cell: any) => } ), }, { id: 'registry-information', title: 'Registry Information', Icon: SearchCheckIcon, hasViolations: assessment?.companyRegistryInformation?.status === 'failed', Component: ( {(Cell: any, cell: any) => } ), }, { id: 'company-structure', title: 'Company Structure', Icon: UsersIcon, hasViolations: assessment?.companyStructure?.status === 'failed', Component: ( {(Cell: any, cell: any) => } ), }, { id: 'registered-address', title: 'Registered Address', Icon: MapPinIcon, Component: ( ), }, ]; }, [ assessment, assessmentChecks, companySanctionsBlock, companyStructureBlock, registryInfoBlock, ]); };