Page MenuHomePhabricator

D6221.id20765.diff
No OneTemporary

D6221.id20765.diff

diff --git a/web/account/log-in-form.css b/web/account/log-in-form.css
--- a/web/account/log-in-form.css
+++ b/web/account/log-in-form.css
@@ -65,3 +65,10 @@
content: 'or';
background-color: #1f1f1fff;
}
+
+div.connectButtonContainer {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-content: center;
+}
diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -3,15 +3,23 @@
import '@rainbow-me/rainbowkit/dist/index.css';
import {
+ ConnectButton,
darkTheme,
getDefaultWallets,
RainbowKitProvider,
+ useConnectModal,
} from '@rainbow-me/rainbowkit';
import invariant from 'invariant';
import _merge from 'lodash/fp/merge';
import * as React from 'react';
import { FaEthereum } from 'react-icons/fa';
-import { chain, configureChains, createClient, WagmiConfig } from 'wagmi';
+import {
+ chain,
+ configureChains,
+ createClient,
+ WagmiConfig,
+ useSigner,
+} from 'wagmi';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { publicProvider } from 'wagmi/providers/public';
@@ -63,6 +71,8 @@
const loadingStatusSelector = createLoadingStatusSelector(logInActionTypes);
function LoginForm(): React.Node {
+ const { openConnectModal } = useConnectModal();
+ const { data: signer } = useSigner();
const inputDisabled = useSelector(loadingStatusSelector) === 'loading';
const loginExtraInfo = useSelector(webLogInExtraInfoSelector);
const callLogIn = useServerCall(logIn);
@@ -158,13 +168,30 @@
[],
);
- let siweButton;
+ let siweSeparator;
if (isDev) {
+ siweSeparator = <hr />;
+ }
+
+ let siweConnectButton;
+ if (isDev && signer) {
+ siweConnectButton = (
+ <div className={css.connectButtonContainer}>
+ <ConnectButton />
+ </div>
+ );
+ }
+
+ const onSIWEButtonClick = React.useCallback(() => {
+ openConnectModal();
+ }, [openConnectModal]);
+
+ let siweButton;
+ if (isDev && openConnectModal) {
siweButton = (
<>
- <hr />
<Button
- onClick={undefined}
+ onClick={onSIWEButtonClick}
variant="filled"
buttonColor={siweButtonColor}
>
@@ -213,6 +240,8 @@
>
{loginButtonContent}
</Button>
+ {siweSeparator}
+ {siweConnectButton}
{siweButton}
<div className={css.modal_form_error}>{errorMessage}</div>
</div>

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 7:35 PM (21 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2501641
Default Alt Text
D6221.id20765.diff (2 KB)

Event Timeline