import { Fragment } from 'react'; import { t } from '@vegaprotocol/react-helpers'; import { Link, Lozenge } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; const getFeedbackLinks = (gitOriginUrl?: string) => [ { name: 'Github', url: gitOriginUrl, }, ].filter((link) => !!link.url); export const NetworkInfo = () => { const { VEGA_URL, GIT_COMMIT_HASH, GIT_ORIGIN_URL, GITHUB_FEEDBACK_URL, ETHEREUM_PROVIDER_URL, setNodeSwitcherOpen, } = useEnvironment(); const feedbackLinks = getFeedbackLinks(GITHUB_FEEDBACK_URL); return (

{t('Reading network data from')}{' '} {VEGA_URL} . setNodeSwitcherOpen()}>{t('Edit')}

{t('Reading Ethereum data from')}{' '} {ETHEREUM_PROVIDER_URL} .{' '}

{GIT_COMMIT_HASH && (

{t('Version/commit hash')}:{' '} {GIT_COMMIT_HASH}

)} {feedbackLinks.length > 0 && (

{t('Known issues and feedback on')}{' '} {feedbackLinks.map(({ name, url }, index) => ( {name} {feedbackLinks.length > 1 && index < feedbackLinks.length - 2 && ','} {feedbackLinks.length > 1 && index === feedbackLinks.length - 1 && `, ${t('and')} `} ))}

)}
); };