Skip to content

Commit d0005f6

Browse files
minor fixes
1 parent 2b7addc commit d0005f6

File tree

3 files changed

+61
-72
lines changed

3 files changed

+61
-72
lines changed

packages/ui/src/components/Modal.tsx

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -155,61 +155,63 @@ export default function Modal(props: ModalProps) {
155155

156156
const modalClassName = `w3a-modal ${isDark ? "" : " w3a-modal--light"}`;
157157
return (
158-
<div id="w3a-modal" className={modalClassName} style={{ display: !modalState.modalVisibilityDelayed ? "none" : "flex" }}>
159-
<div className={modalTransitionClasses.join(" ")}>
160-
<Header onClose={closeModal} appLogo={appLogo} />
161-
{modalState.status !== MODAL_STATUS.INITIALIZED ? (
162-
<div className="w3a-modal__content w3ajs-content">
163-
{modalState.detailedLoaderAdapter ? (
164-
<AdapterLoader
165-
onClose={onCloseLoader}
166-
appLogo={appLogo}
167-
modalStatus={modalState.status}
168-
message={modalState.postLoadingMessage}
169-
adapter={modalState.detailedLoaderAdapter}
170-
/>
171-
) : (
172-
<Loader onClose={onCloseLoader} modalStatus={modalState.status} message={modalState.postLoadingMessage} />
173-
)}
174-
</div>
175-
) : (
176-
<div className="w3a-modal__content w3ajs-content">
177-
{areSocialLoginsVisible && !modalState.externalWalletsVisibility ? (
178-
<>
179-
<SocialLogins
180-
handleSocialLoginClick={(params: SocialLoginEventType) => preHandleSocialWalletClick(params)}
181-
socialLoginsConfig={modalState.socialLoginsConfig}
158+
modalState.modalVisibilityDelayed && (
159+
<div id="w3a-modal" className={modalClassName} style={{ display: "flex" }}>
160+
<div className={modalTransitionClasses.join(" ")}>
161+
<Header onClose={closeModal} appLogo={appLogo} />
162+
{modalState.status !== MODAL_STATUS.INITIALIZED ? (
163+
<div className="w3a-modal__content w3ajs-content">
164+
{modalState.detailedLoaderAdapter ? (
165+
<AdapterLoader
166+
onClose={onCloseLoader}
167+
appLogo={appLogo}
168+
modalStatus={modalState.status}
169+
message={modalState.postLoadingMessage}
170+
adapter={modalState.detailedLoaderAdapter}
182171
/>
183-
184-
{modalState.socialLoginsConfig.loginMethods[LOGIN_PROVIDER.EMAIL_PASSWORDLESS].showOnModal && (
185-
<SocialLoginEmail
186-
adapter={modalState.socialLoginsConfig?.adapter}
172+
) : (
173+
<Loader onClose={onCloseLoader} modalStatus={modalState.status} message={modalState.postLoadingMessage} />
174+
)}
175+
</div>
176+
) : (
177+
<div className="w3a-modal__content w3ajs-content">
178+
{areSocialLoginsVisible && !modalState.externalWalletsVisibility ? (
179+
<>
180+
<SocialLogins
187181
handleSocialLoginClick={(params: SocialLoginEventType) => preHandleSocialWalletClick(params)}
182+
socialLoginsConfig={modalState.socialLoginsConfig}
188183
/>
189-
)}
190-
191-
{/* button to show external wallets */}
192-
{modalState.hasExternalWallets && externalWalletButton}
193-
</>
194-
) : (
195-
<ExternalWallets
196-
modalStatus={modalState.status}
197-
showBackButton={areSocialLoginsVisible}
198-
handleExternalWalletClick={(params: ExternalWalletEventType) => preHandleExternalWalletClick(params)}
199-
walletConnectUri={modalState.walletConnectUri}
200-
config={modalState.externalWalletsConfig}
201-
hideExternalWallets={() =>
202-
setModalState((prevState) => {
203-
return { ...prevState, externalWalletsVisibility: false };
204-
})
205-
}
206-
/>
207-
)}
208-
</div>
209-
)}
210-
211-
<Footer version={version} />
184+
185+
{modalState.socialLoginsConfig.loginMethods[LOGIN_PROVIDER.EMAIL_PASSWORDLESS].showOnModal && (
186+
<SocialLoginEmail
187+
adapter={modalState.socialLoginsConfig?.adapter}
188+
handleSocialLoginClick={(params: SocialLoginEventType) => preHandleSocialWalletClick(params)}
189+
/>
190+
)}
191+
192+
{/* button to show external wallets */}
193+
{modalState.hasExternalWallets && externalWalletButton}
194+
</>
195+
) : (
196+
<ExternalWallets
197+
modalStatus={modalState.status}
198+
showBackButton={areSocialLoginsVisible}
199+
handleExternalWalletClick={(params: ExternalWalletEventType) => preHandleExternalWalletClick(params)}
200+
walletConnectUri={modalState.walletConnectUri}
201+
config={modalState.externalWalletsConfig}
202+
hideExternalWallets={() =>
203+
setModalState((prevState) => {
204+
return { ...prevState, externalWalletsVisibility: false };
205+
})
206+
}
207+
/>
208+
)}
209+
</div>
210+
)}
211+
212+
<Footer version={version} />
213+
</div>
212214
</div>
213-
</div>
215+
)
214216
);
215217
}

packages/ui/src/components/SocialLogins.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ export default function SocialLogins(props: SocialLoginProps) {
7474
);
7575
})}
7676
</ul>
77-
<button type="button" className={adapterButtonClass} style={{ display: canShowMore ? "flex" : "none" }} onClick={expandClickHandler}>
78-
<Icon iconName={`expand${isDark ? "-light" : ""}`} />
79-
<span className="w3ajs-button-expand-text">{adapterExpandText}</span>
80-
</button>
77+
{canShowMore && (
78+
<button type="button" className={adapterButtonClass} style={{ display: "flex" }} onClick={expandClickHandler}>
79+
<Icon iconName={`expand${isDark ? "-light" : ""}`} />
80+
<span className="w3ajs-button-expand-text">{adapterExpandText}</span>
81+
</button>
82+
)}
8183
</div>
8284
);
8385
}

packages/ui/src/config.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
import { LOGIN_PROVIDER } from "@toruslabs/openlogin";
22

3-
export const OPENLOGIN_PROVIDERS = [
4-
LOGIN_PROVIDER.GOOGLE,
5-
LOGIN_PROVIDER.FACEBOOK,
6-
LOGIN_PROVIDER.TWITTER,
7-
LOGIN_PROVIDER.REDDIT,
8-
LOGIN_PROVIDER.DISCORD,
9-
LOGIN_PROVIDER.TWITCH,
10-
LOGIN_PROVIDER.APPLE,
11-
LOGIN_PROVIDER.LINE,
12-
LOGIN_PROVIDER.GITHUB,
13-
LOGIN_PROVIDER.KAKAO,
14-
LOGIN_PROVIDER.LINKEDIN,
15-
LOGIN_PROVIDER.WEIBO,
16-
LOGIN_PROVIDER.WECHAT,
17-
LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
18-
];
3+
export const OPENLOGIN_PROVIDERS = Object.values(LOGIN_PROVIDER).filter((x) => x !== LOGIN_PROVIDER.WEBAUTHN && x !== LOGIN_PROVIDER.JWT);

0 commit comments

Comments
 (0)