8a829964be
* Add ag-grid * Add lazy loaded ag-grid component * Add theme context, move VegaWallet to separate lib * Fix trading app cypress configuration * Lazy load ag-grid theme css files * Encapsulate theme switch hook
27 lines
607 B
TypeScript
27 lines
607 B
TypeScript
import { useVegaWallet } from '@vegaprotocol/wallet';
|
|
|
|
interface VegaWalletButtonProps {
|
|
setConnectDialog: (isOpen: boolean) => void;
|
|
}
|
|
|
|
export const VegaWalletButton = ({
|
|
setConnectDialog,
|
|
}: VegaWalletButtonProps) => {
|
|
const { disconnect, keypairs } = useVegaWallet();
|
|
const isConnected = keypairs !== null;
|
|
|
|
const handleClick = () => {
|
|
if (isConnected) {
|
|
disconnect();
|
|
} else {
|
|
setConnectDialog(true);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<button onClick={handleClick} className="ml-auto inline-block">
|
|
{isConnected ? 'Disconnect' : 'Connect Vega wallet'}
|
|
</button>
|
|
);
|
|
};
|