import { Vec } from '@polkadot/types'; import { EventRecord } from '@polkadot/types/interfaces'; import { IdeaEvent } from '@/features/explorer'; import { Placeholder } from '@/entities/placeholder'; import EventPlaceholderSVG from '@/shared/assets/images/placeholders/eventPlaceholder.svg?react'; import { Event } from '../event'; import styles from './system.module.scss'; type Props = { eventRecords: Vec | undefined; isError: boolean; }; const System = ({ eventRecords, isError }: Props) => { const systemEvents = eventRecords ?.filter(({ phase }) => !phase.isApplyExtrinsic) .map(({ event }) => new IdeaEvent(event)); // eslint-disable-next-line react/no-array-index-key const getEvents = () => systemEvents?.map((event, index) => ); const isAnyEvent = systemEvents && systemEvents.length > 0; const isListEmpty = systemEvents?.length === 0; return (
System events
{isAnyEvent ? ( getEvents() ) : ( } title={isError ? '' : 'No system events'} isEmpty={isListEmpty || isError} blocksCount={2} /> )}
); }; export { System };