Skip to content

Commit 19466e6

Browse files
committed
🐛 Indicate signing-in-progress to user
1 parent e708a3d commit 19466e6

File tree

2 files changed

+36
-43
lines changed

2 files changed

+36
-43
lines changed

public/js/connect.jsx

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,25 @@ export const WPRainbowConnect = () => {
101101
}
102102
}, [accountData, state.address, loading, hasLoadedSecondTime]);
103103

104+
const siteLoginText = (
105+
<p
106+
className="wp-rainbow help-text"
107+
style={{
108+
fontSize: "12px",
109+
fontStyle: "italic",
110+
marginBottom: "4px",
111+
marginTop: "4px",
112+
textAlign: "center",
113+
}}
114+
>
115+
{__("- OR USE SITE LOGIN -", "wp-rainbow")}
116+
</p>
117+
);
118+
104119
return (
105120
<>
106121
<ConnectButton.Custom>
107-
{({
108-
account,
109-
chain,
110-
openAccountModal,
111-
openChainModal,
112-
openConnectModal,
113-
}) => {
122+
{({ account, openAccountModal, openConnectModal }) => {
114123
if (state.error) {
115124
return (
116125
<React.Fragment>
@@ -122,33 +131,28 @@ export const WPRainbowConnect = () => {
122131
>
123132
{__("Log In Error, Click to Refresh", "wp-rainbow")}
124133
</button>
125-
<p
126-
className="wp-rainbow help-text"
127-
style={{
128-
fontSize: "12px",
129-
fontStyle: "italic",
130-
marginBottom: "4px",
131-
marginTop: "4px",
132-
textAlign: "center",
133-
}}
134-
>
135-
{__("- OR USE SITE LOGIN -", "wp-rainbow")}
136-
</p>
134+
{siteLoginText}
137135
</React.Fragment>
138136
);
139137
}
140138
if (account) {
141139
return (
142-
<button
143-
className="button button-secondary button-hero"
144-
onClick={state.address ? openAccountModal : signIn}
145-
type="button"
146-
style={{ width: "100%" }}
147-
>
148-
{state.address
149-
? `${__("Logged In as ")} ${account.displayName}`
150-
: __("Continue Log In with Ethereum")}
151-
</button>
140+
<React.Fragment>
141+
<button
142+
className="button button-secondary button-hero"
143+
onClick={state.address ? openAccountModal : signIn}
144+
type="button"
145+
disabled={state.loading}
146+
style={{ width: "100%" }}
147+
>
148+
{state.address
149+
? `${__("Logged In as ")} ${account.displayName}`
150+
: state.loading
151+
? __("Check Wallet to Sign Message")
152+
: __("Continue Log In with Ethereum")}
153+
</button>
154+
{siteLoginText}
155+
</React.Fragment>
152156
);
153157
}
154158
return (
@@ -161,18 +165,7 @@ export const WPRainbowConnect = () => {
161165
>
162166
{__("Log In with Ethereum", "wp-rainbow")}
163167
</button>
164-
<p
165-
className="wp-rainbow help-text"
166-
style={{
167-
fontSize: "12px",
168-
fontStyle: "italic",
169-
marginBottom: "4px",
170-
marginTop: "4px",
171-
textAlign: "center",
172-
}}
173-
>
174-
{__("- OR USE SITE LOGIN -", "wp-rainbow")}
175-
</p>
168+
{siteLoginText}
176169
</React.Fragment>
177170
);
178171
}}

wp-rainbow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Plugin Name: WP Rainbow
4-
* Version: 0.0.1
4+
* Version: 0.0.2
55
*
66
* @package WP_Rainbow
77
*/
@@ -13,7 +13,7 @@
1313
*
1414
* @var string
1515
*/
16-
define( 'WP_RAINBOW_ASSETS_VERSION', '0.0.1' );
16+
define( 'WP_RAINBOW_ASSETS_VERSION', '0.0.2' );
1717

1818
// Include the autoloader.
1919
add_action(

0 commit comments

Comments
 (0)