Skip to content

Commit

Permalink
feat(docs): act-1481 - improvements to reference pages
Browse files Browse the repository at this point in the history
  • Loading branch information
TrofimovAnton85 committed Jul 23, 2024
1 parent f2cf103 commit 58664a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/ParserOpenRPC/AuthBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export const AuthBox = ({ handleConnect }: AuthBoxProps) => {
return (
<div className={styles.msgWrapper}>
<p className={styles.msgText}>Connect MetaMask to test requests using your wallet</p>
<button className={global.primaryBtn} onClick={() => handleConnect()}>
<button
className={global.primaryBtn}
onClick={() => handleConnect()}
data-test-id="connect-metamask"
>
Connect MetaMask
</button>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/ParserOpenRPC/RequestBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function RequestBox({
className={clsx(global.linkBtn, "margin-right--md")}
disabled={!isMetamaskInstalled}
onClick={openModal}
data-test-id="customize-request"
>
Customize request
</button>
Expand All @@ -59,6 +60,7 @@ export default function RequestBox({
className={global.primaryBtn}
disabled={!isMetamaskInstalled}
onClick={submitRequest}
data-test-id="run-request"
>
Run request
</button>
Expand Down
3 changes: 2 additions & 1 deletion src/theme/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default function FooterWrapper(props) {
}, []);

const isBrowser = useIsBrowser();
if (isBrowser) {
const isProd = process.env.NODE_ENV === "production"
if (isBrowser && isProd) {
Intercom({
app_id: 'txttgas6'
});
Expand Down
9 changes: 8 additions & 1 deletion src/theme/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, createContext, ReactChild } from "react";
import React, { useState, createContext, ReactChild, useEffect } from "react";
import { MetaMaskSDK } from "@metamask/sdk";

export const MetamaskProviderContext = createContext(null);
Expand All @@ -12,6 +12,7 @@ export default function Root({ children }: { children: ReactChild}) {
url: "https://docs.metamask.io/",
},
preferDesktop: true,
extensionOnly: true,
logging: {
sdk: false,
}
Expand All @@ -31,6 +32,12 @@ export default function Root({ children }: { children: ReactChild}) {
}
}

useEffect(() => {
if (sdk && !metaMaskProvider) {
metaMaskConnectHandler();
}
}, [metaMaskProvider]);

return (
<MetamaskProviderContext.Provider value={{
metaMaskProvider,
Expand Down

0 comments on commit 58664a7

Please sign in to comment.