25b67009a6
* feat: add a global zustand store for managing connect dialogs and landing dialog * feat: add tests * fix: remove condition for cypress for auto connecting * chore: fix assertion in tests for vega wallet text * fix: add mock for landing dialog markets query Co-authored-by: madalinaraicu <madalina@vegaprotocol.io>
35 lines
944 B
TypeScript
35 lines
944 B
TypeScript
import type { ReactNode } from 'react';
|
|
import { t } from '@vegaprotocol/react-helpers';
|
|
import { Button, Splash } from '@vegaprotocol/ui-toolkit';
|
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
|
import { useGlobalStore } from '../../stores';
|
|
|
|
interface VegaWalletContainerProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
export const VegaWalletContainer = ({ children }: VegaWalletContainerProps) => {
|
|
const store = useGlobalStore();
|
|
const { keypair } = useVegaWallet();
|
|
|
|
if (!keypair) {
|
|
return (
|
|
<Splash>
|
|
<div className="text-center">
|
|
<p className="mb-12" data-testid="connect-vega-wallet-text">
|
|
{t('Connect your Vega wallet')}
|
|
</p>
|
|
<Button
|
|
onClick={() => store.setVegaWalletConnectDialog(true)}
|
|
data-testid="vega-wallet-connect"
|
|
>
|
|
{t('Connect')}
|
|
</Button>
|
|
</div>
|
|
</Splash>
|
|
);
|
|
}
|
|
|
|
return <>{children}</>;
|
|
};
|