import { useCallback } from 'react';
import {
useEnvironment,
useNodeHealth,
useNodeSwitcherStore,
} from '@vegaprotocol/environment';
import { t } from '@vegaprotocol/i18n';
import type { Intent } from '@vegaprotocol/ui-toolkit';
import { Indicator, ExternalLink } from '@vegaprotocol/ui-toolkit';
import classNames from 'classnames';
import type { ButtonHTMLAttributes, ReactNode } from 'react';
export const Footer = () => {
return (
);
};
export const NodeHealth = () => {
const { VEGA_URL, VEGA_INCIDENT_URL } = useEnvironment();
const setNodeSwitcher = useNodeSwitcherStore((store) => store.setDialogOpen);
const { datanodeBlockHeight, text, intent } = useNodeHealth();
const onClick = useCallback(() => {
setNodeSwitcher(true);
}, [setNodeSwitcher]);
const incidentsLink = VEGA_INCIDENT_URL && (
{t('Mainnet status & incidents')}
);
return (
<>
{VEGA_URL && (
{/* create a monospace effect - avoiding jumps of width */}
{datanodeBlockHeight}
)}
{incidentsLink}
>
);
};
interface NodeUrlProps {
url: string;
}
export const NodeUrl = ({ url }: NodeUrlProps) => {
const urlObj = new URL(url);
const nodeUrl = urlObj.hostname;
return {nodeUrl};
};
interface HealthIndicatorProps {
text: string;
intent: Intent;
}
export const HealthIndicator = ({ text, intent }: HealthIndicatorProps) => {
return (
{text}
);
};
type FooterButtonProps = ButtonHTMLAttributes;
const FooterButton = (props: FooterButtonProps) => {
const buttonClasses = classNames(
'px-2 py-0.5 rounded-md',
'enabled:hover:bg-vega-light-150',
'dark:enabled:hover:bg-vega-dark-150'
);
return ;
};
const FooterButtonPart = ({
width = 'auto',
children,
}: {
children: ReactNode;
width?: string;
}) => {
return (
{children}
);
};