import {
useEnvironment,
useNodeHealth,
useNodeSwitcherStore,
} from '@vegaprotocol/environment';
import { Indicator, ExternalLink } from '@vegaprotocol/ui-toolkit';
import { Tooltip } from '../../components/tooltip';
import { useT } from '../../lib/use-t';
export const NodeHealthContainer = () => {
const t = useT();
const { VEGA_URL, VEGA_INCIDENT_URL } = useEnvironment();
const setNodeSwitcher = useNodeSwitcherStore((store) => store.setDialogOpen);
const { text, intent, datanodeBlockHeight } = useNodeHealth();
return (
{text}
{datanodeBlockHeight}
{VEGA_URL && (
)}
{VEGA_INCIDENT_URL && (
{t('Mainnet status & incidents')}
)}
}
align="end"
side="left"
sideOffset={18}
arrow={false}
>
);
};
interface NodeUrlProps {
url: string;
}
export const NodeUrl = ({ url }: NodeUrlProps) => {
const t = useT();
const urlObj = new URL(url);
const nodeUrl = urlObj.hostname;
return {nodeUrl};
};