From 4347aeb57e54d4efb9498425fad28b48d9db7681 Mon Sep 17 00:00:00 2001 From: denis6421 Date: Thu, 22 Jun 2023 10:26:10 +0300 Subject: [PATCH 1/2] connect button --- src/App.tsx | 2 +- src/components/AddSourcesBlock.tsx | 4 ++-- src/components/ConnectButton.tsx | 22 ++++++++++++++++++++++ src/components/MobileMenu.tsx | 15 ++------------- src/components/TopBar.tsx | 15 ++------------- src/components/admin/Admin.tsx | 4 ++-- src/components/admin/ContractInteract.tsx | 4 ++-- src/components/tactDeployer/TopBar.tsx | 2 +- src/styles.ts | 14 ++++++++++++++ 9 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 src/components/ConnectButton.tsx create mode 100644 src/styles.ts diff --git a/src/App.tsx b/src/App.tsx index cb06286..dc0e27b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -158,7 +158,7 @@ function App() { )} {!isLoading && proofData?.hasOnchainProof && } - {proofData && (!proofData.hasOnchainProof || canOverride) && ( + {true && ( <> {hasFiles() && } diff --git a/src/components/AddSourcesBlock.tsx b/src/components/AddSourcesBlock.tsx index ee2910c..8b224f2 100644 --- a/src/components/AddSourcesBlock.tsx +++ b/src/components/AddSourcesBlock.tsx @@ -11,7 +11,7 @@ import { AppButton } from "./AppButton"; import { SECTIONS, STEPS, usePublishStore } from "../lib/usePublishSteps"; import { CircularProgress, Fade } from "@mui/material"; import { useTonAddress } from "@tonconnect/ui-react"; -import { StyledTonConnectButton } from "./TopBar"; +import ConnectButton from "./ConnectButton"; const ContentBox = styled(Box)({ padding: "15px 24px", @@ -48,7 +48,7 @@ export function AddSourcesBlock() { {hasFiles() && ( {!walletAddress ? ( - + ) : !data?.result?.msgCell ? ( tonConnect.connectWallet()}> + Connect wallet + + ); +} + +export default ConnectButton; diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index 1dcfa14..acc102b 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -7,7 +7,8 @@ import github from "../assets/github-dark.svg"; import { AppLogo, GitLogo, LinkWrapper } from "./TopBar.styled"; import icon from "../assets/icon.svg"; import { useNavigatePreserveQuery } from "../lib/useNavigatePreserveQuery"; -import { TonConnectButton, useTonAddress } from "@tonconnect/ui-react"; +import { useTonAddress } from "@tonconnect/ui-react"; +import { StyledTonConnectButton } from "../styles"; interface MobileMenuProps { closeMenu?: () => void; @@ -51,15 +52,3 @@ export function MobileMenu({ closeMenu, showMenu }: MobileMenuProps) { ); } - -const StyledTonConnectButton = styled(TonConnectButton)(({ theme }) => ({ - button: { - background: theme.palette.primary.main, - "*": { color: "white" }, - svg: { - "*": { - stroke: "white", - }, - }, - }, -})); diff --git a/src/components/TopBar.tsx b/src/components/TopBar.tsx index 32bc923..766614d 100644 --- a/src/components/TopBar.tsx +++ b/src/components/TopBar.tsx @@ -19,10 +19,11 @@ import { IconButton, styled, useMediaQuery, useTheme } from "@mui/material"; import MenuRoundedIcon from "@mui/icons-material/MenuRounded"; import { MobileMenu } from "./MobileMenu"; import { useNavigatePreserveQuery } from "../lib/useNavigatePreserveQuery"; -import { TonConnectButton } from "@tonconnect/ui-react"; +import { StyledTonConnectButton } from "../styles"; export function TopBar() { const { pathname } = useLocation(); + const theme = useTheme(); const navigate = useNavigatePreserveQuery(); const headerSpacings = useMediaQuery(theme.breakpoints.down("lg")); @@ -73,15 +74,3 @@ export function TopBar() { ); } - -export const StyledTonConnectButton = styled(TonConnectButton)(({ theme }) => ({ - button: { - background: theme.palette.primary.main, - "*": { color: "white" }, - svg: { - "*": { - stroke: "white", - }, - }, - }, -})); diff --git a/src/components/admin/Admin.tsx b/src/components/admin/Admin.tsx index 1ef7be6..077dbab 100644 --- a/src/components/admin/Admin.tsx +++ b/src/components/admin/Admin.tsx @@ -4,7 +4,7 @@ import SourcesRegistry from "./SourcesRegistry"; import { VerifierRegistry } from "./VerifierRegistry"; import { FlexBoxRow } from "../Getters.styled"; import { Footer } from "../Footer"; -import { StyledTonConnectButton } from "../TopBar"; +import ConnectButton from "../ConnectButton"; export function Admin() { return ( @@ -16,7 +16,7 @@ export function Admin() { px: 4, }}>

Admin

- + diff --git a/src/components/admin/ContractInteract.tsx b/src/components/admin/ContractInteract.tsx index 2208cd7..26299ae 100644 --- a/src/components/admin/ContractInteract.tsx +++ b/src/components/admin/ContractInteract.tsx @@ -1,8 +1,8 @@ import { Button, TextField } from "@mui/material"; import { useState } from "react"; import { Address, beginCell, Builder } from "ton"; +import ConnectButton from "../ConnectButton"; import Spacer from "../Spacer"; -import { StyledTonConnectButton } from "../TopBar"; function CellBuilder() { const [state, setState] = useState<{ @@ -86,7 +86,7 @@ function ContractInteract() { maxWidth: 1100, padding: 40, }}> - + diff --git a/src/components/tactDeployer/TopBar.tsx b/src/components/tactDeployer/TopBar.tsx index 12f5225..4941a45 100644 --- a/src/components/tactDeployer/TopBar.tsx +++ b/src/components/tactDeployer/TopBar.tsx @@ -5,7 +5,7 @@ import { CenteringBox } from "../Common.styled"; import { githubLink } from "../../const"; import { TopBarContent, LinkWrapper, AppLogo, ContentColumn, GitLogo } from "../TopBar.styled"; import { styled } from "@mui/material/styles"; -import { StyledTonConnectButton } from "../TopBar"; +import { StyledTonConnectButton } from "../../styles"; interface TopBarWrapperProps { isMobile: boolean; diff --git a/src/styles.ts b/src/styles.ts new file mode 100644 index 0000000..0fbc41f --- /dev/null +++ b/src/styles.ts @@ -0,0 +1,14 @@ +import { styled } from "@mui/material"; +import { TonConnectButton } from "@tonconnect/ui-react"; + +export const StyledTonConnectButton = styled(TonConnectButton)(({ theme }) => ({ + button: { + background: theme.palette.primary.main, + "*": { color: "white" }, + svg: { + "*": { + stroke: "white", + }, + }, + }, +})); From 3c8d8113ca0fb8d8a5f4eef0111756acffeff8ea Mon Sep 17 00:00:00 2001 From: denis6421 Date: Thu, 22 Jun 2023 10:28:12 +0300 Subject: [PATCH 2/2] mend --- src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index dc0e27b..cb06286 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -158,7 +158,7 @@ function App() { )} {!isLoading && proofData?.hasOnchainProof && } - {true && ( + {proofData && (!proofData.hasOnchainProof || canOverride) && ( <> {hasFiles() && }