import React, { memo, useState, FC, useEffect } from 'react' import { IssueFeedCell } from '../general/cells' import { issueExtractor } from '@app/utils' import { FeedHeading } from './heading' import type { FeedComponentProps } from './interface' import { FixedSizeList as List } from 'react-window' import { getListHeight } from './utils' import { FilterManager } from '@app/managers/filters' import { Header3 } from '../general/header' interface RowProps { index: number style?: React.CSSProperties } // List of issues rendered. const FeedListComponent: FC = ({ onScanEvent, issue, isHidden, fullScreen, highlightErrors, }) => { const [sectionHidden, onToggleSection] = useState(!!isHidden) const pageIssues = issueExtractor(issue) // array of issues extract duplex types useEffect(() => { for (const item of pageIssues) { FilterManager.addFilter(item?.code) } }, [pageIssues]) const Row = ({ index, style }: RowProps) => ( ) const issueCount = pageIssues.length const { size, height } = getListHeight({ fullScreen, issueCount }) if (fullScreen) { if (!issueCount) { return (
No Issues found!
) } return (
    {Row}
) } const highLight = highlightErrors && issue?.issues?.length && issue.issues[0]?.type === 'error' return (
  • {sectionHidden ? null : (
      {Row}
    )}
  • ) } export const FeedList = memo(FeedListComponent)