Skip to content

Commit

Permalink
Add diconnect wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
peterochieng committed Nov 4, 2024
1 parent 749913e commit 1dc7e46
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Binary file added public/disconnect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions src/app/components/navbar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const NavBar = () => {

console.log(path);

const { handleConnetWalletBtnClick, address, connection } = useAppContext();
const { handleConnetWalletBtnClick, address, connection, disconnectWallet } = useAppContext();

console.log("Connection Log")
console.log(connection)
Expand Down Expand Up @@ -107,7 +107,19 @@ const NavBar = () => {
height={24}
alt="StarkNetLogo"
></Image>
<span>{address ? address?.substring(0, 6) : "Connect Wallet"}</span>
<span>{address ? address?.substring(0, 6) : walletConnect}</span>
</li>
<li
className={styles.active_navbar_menuItems_diconnect}
onClick={disconnectWallet}
>
<Image
src={"/disconnect.png"}
width={24}
height={24}
alt="StarkNetLogo"
></Image>
<span>{address ? address?.substring(0, 6) : "Disconnect Wallet"}</span>
</li>
</ul>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/navbar/navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@
padding: 10px;
}

.active_navbar_menuItems {
.active_navbar_menuItems, .active_navbar_menuItems_diconnect {
background-color: var(--activeLinkIndicator);
cursor: pointer;
}

.active_navbar_menuItems_diconnect{
color: black;
background-color: white;
}

.display {
display: none;
}
Expand Down
4 changes: 3 additions & 1 deletion src/app/providers/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const initialData = {
address: null as any,
connection: null as any,
handleConnetWalletBtnClick: null as any,
disconnectWallet: null as any,
};

export const AppContext = createContext(initialData);
Expand Down Expand Up @@ -120,8 +121,9 @@ const connectWallet = async () => {
address,
connection,
handleConnetWalletBtnClick,
disconnectWallet
}),
[account, contract, address, connection]
[account, contract, address, connection, ]
);

useEffect(() => {
Expand Down

0 comments on commit 1dc7e46

Please sign in to comment.