Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added big connect wallet buttons if the user's wallet is not connected #269

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
3 changes: 1 addition & 2 deletions packages/react-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ function App(props) {
address={address}
mainnetProvider={mainnetProvider}
tx={tx}
isWalletConnected={isWalletConnected}
nativeCurrency={targetNetwork.nativeCurrency}
/>
</Route>
Expand All @@ -622,7 +621,7 @@ function App(props) {
nativeCurrency={targetNetwork.nativeCurrency}
networkTokenList={targetNetwork.networkTokenList}
isHost={isHost}
isWalletConnected={isWalletConnected}
loadWeb3Modal={loadWeb3Modal}
/>
</Route>
{/* This is used when testing out smart contracts:
Expand Down
4 changes: 2 additions & 2 deletions packages/react-app/src/components/Account/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export default function Account({
modalButtons.push(
<Button
key="loginbutton"
style={{ verticalAlign: "top", marginLeft: 8, marginTop: 4, width: width }}
size="medium"
style={{ verticalAlign: "top", position: "fixed", top: 20, right: 10, width: width }}
size="large"
onClick={loadWeb3Modal}
key="second"
type="primary"
Expand Down
14 changes: 14 additions & 0 deletions packages/react-app/src/views/GuestRoom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default function GuestRoom({
selectedChainId,
tx,
nativeCurrency,
isWalletConnected,
loadWeb3Modal,
}) {
const { room } = useParams();

Expand Down Expand Up @@ -168,6 +170,18 @@ export default function GuestRoom({

return (
<div className="bg-purple-darkpurple">
{(!web3Modal || !web3Modal.cachedProvider ) && (
<Button
style={{ height: "50px", fontSize: "20px", marginBottom: "40px" }}
key="loginbutton"
size="large"
onClick={loadWeb3Modal}
type="primary"
shape="round"
>
Connect Wallet to Use Tip Party!
</Button>
)}
<h2 id="title">Welcome to the Tip Party!</h2>
<h3>
{" "}
Expand Down
30 changes: 30 additions & 0 deletions packages/react-app/src/views/HostRoom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function HostRoom({
selectedChainId,
tx,
nativeCurrency,
loadWeb3Modal,
networkTokenList,
}) {
const { room } = useParams();
Expand Down Expand Up @@ -206,6 +207,13 @@ export default function HostRoom({
};

const ethPayHandler = async () => {
if (web3Modal.cachedProvider === "") {
return notification.error({
message: "Failed to Distribute!",
description: "Please connect to a wallet before distributing tokens",
placement: "bottomRight",
});
}
const result = tx(
writeContracts.TokenDistributor.splitEth(allAddresses, room, {
value: ethers.utils.parseEther(numericalAmount),
Expand Down Expand Up @@ -251,6 +259,14 @@ export default function HostRoom({
};

const tokenPayHandler = async opts => {

if (web3Modal.cachedProvider === "") {
return notification.error({
message: "Failed to Distribute!",
description: "Please connect to a wallet before distributing tokens",
placement: "bottomRight",
});
}
const result = tx(
writeContracts.TokenDistributor.splitTokenFromUser(
allAddresses,
Expand Down Expand Up @@ -354,6 +370,19 @@ export default function HostRoom({

return (
<div className="bg-purple-darkpurple">
{(!web3Modal || !web3Modal.cachedProvider )&&(
<Button
style={{ height: "50px", fontSize: "20px", marginBottom: "40px" }}
key="loginbutton"
size="large"
onClick={loadWeb3Modal}
type="primary"
shape="round"
>
Connect Wallet to Use Tip Party!
</Button>
)}

<h2 id="title">Tip Your Party!</h2>
<h3>
{" "}
Expand Down Expand Up @@ -382,6 +411,7 @@ export default function HostRoom({
<LinkOutlined style={{ color: "#C9B8FF" }} />
</button>
</h3>

<div
className="Room"
style={{
Expand Down
3 changes: 3 additions & 0 deletions packages/react-app/src/views/Rooms.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function Rooms({
tx,
nativeCurrency,
isHost,
loadWeb3Modal,
networkTokenList,
}) {
return (
Expand All @@ -36,6 +37,7 @@ export default function Rooms({
selectedChainId={selectedChainId}
tx={tx}
nativeCurrency={nativeCurrency}
loadWeb3Modal={loadWeb3Modal}
networkTokenList={networkTokenList}
/>
)}
Expand All @@ -56,6 +58,7 @@ export default function Rooms({
selectedChainId={selectedChainId}
tx={tx}
nativeCurrency={nativeCurrency}
loadWeb3Modal={loadWeb3Modal}
/>
</div>
)}
Expand Down