import { Flex, Grid } from '@chakra-ui/react'; import React from 'react'; import type { DecodedInput } from 'types/api/decodedInput'; import type { ArrayElement } from 'types/utils'; import { Skeleton } from 'toolkit/chakra/skeleton'; import { TruncatedText } from 'toolkit/components/truncation/TruncatedText'; import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity'; interface Props { data: DecodedInput['parameters']; isLoading?: boolean; } const HeaderItem = ({ children, isLoading }: { children: React.ReactNode; isLoading?: boolean }) => { return ( { children } ); }; const Row = ({ name, type, indexed, value, isLoading }: ArrayElement & { isLoading?: boolean }) => { const content = (() => { if (type === 'address' && typeof value === 'string') { return ( ); } if (typeof value === 'object') { const text = JSON.stringify(value, undefined, 4); return ( ); } return ( ); })(); return ( <> { indexed !== undefined && ( { indexed ? 'true' : 'false' } ) } { content } ); }; const LogDecodedInputDataTable = ({ data, isLoading }: Props) => { const hasIndexed = data.some(({ indexed }) => indexed !== undefined); const gridTemplateColumnsBase = hasIndexed ? '50px 60px 40px minmax(0, 1fr)' : '50px 60px minmax(0, 1fr)'; const gridTemplateColumnsLg = hasIndexed ? '80px 80px 80px minmax(0, 1fr)' : '80px 80px minmax(0, 1fr)'; return ( Name Type { hasIndexed && Indexed? } Data { data.map((item) => { return ; }) } ); }; export default LogDecodedInputDataTable;