;
}
export const Web3Content = ({
children,
childrenOnly,
connectEagerly,
appChainId,
connectors,
}: Web3ContentProps) => {
const { isActive, error, connector, chainId } = useWeb3React();
const openDialog = useWeb3ConnectStore((state) => state.open);
useEffect(() => {
if (
connector?.connectEagerly &&
(!('Cypress' in window) || connectEagerly)
) {
connector.connectEagerly();
}
// wallet connect doesnt handle connectEagerly being called when connector is also in the
// deps array.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
if (childrenOnly) {
// eslint-disable-next-line react/jsx-no-useless-fragment
return <>{children}>;
}
if (error) {
return (
{t(`Something went wrong: ${error.message}`)}
);
}
if (!isActive) {
return (
{t('Connect your Ethereum wallet')}
);
}
if (chainId !== appChainId) {
return (
{t(`This app only works on ${getChainName(appChainId)}`)}
);
}
// eslint-disable-next-line react/jsx-no-useless-fragment
return <>{children}>;
};
interface SplashWrapperProps {
children: ReactNode;
}
const SplashWrapper = ({ children }: SplashWrapperProps) => {
return (
{children}
);
};