import clsx from 'clsx' import { Fragment } from 'react' import { useTranslation } from 'react-i18next' import { ButtonLink, InfoLineCard, InputLabel, RawJsonDisplay, } from '@dao-dao/stateless' import { ProposalExecutionMetadata } from '@dao-dao/types' export type ProposalExecutionMetadataRendererProps = { /** * The metadata. If undefined or not enabled, will not render. */ metadata?: ProposalExecutionMetadata /** * Optional container class name. */ className?: string } /** * Renders proposal execution metadata. */ export const ProposalExecutionMetadataRenderer = ({ metadata, className, }: ProposalExecutionMetadataRendererProps) => { const { t } = useTranslation() if (!metadata) { return null } const hasExtensionData = !!metadata?.gaiaMetaprotocolsExtensionData?.length return (
{metadata.memo && ( )} {hasExtensionData && (
See the{' '} Cosmos Network docs {' '} for more information. } />
{metadata.gaiaMetaprotocolsExtensionData!.map( ({ protocolId, protocolVersion, data }, index) => { let stringifiedData = data try { stringifiedData = JSON.stringify(JSON.parse(data), null, 2) } catch { // Leave as string if JSON parsing fails. } return (
} />
) } )}
)}
) }