-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui-ux): hide /faucet navigation and page if not in Testnet env
- Loading branch information
Showing
4 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NetworkConnection } from "@contexts/Environment"; | ||
import { useNetwork } from "@contexts/NetworkContext"; | ||
|
||
export interface MenuItem { | ||
label: string; | ||
pathname: string; | ||
testId: string; | ||
childPaths: string[]; | ||
imagePath: string; | ||
} | ||
|
||
// To hide /faucet navigation menu item if not in testnet | ||
export default function useMenuNavigationHelper({ | ||
menu, | ||
}: { | ||
menu: MenuItem[]; | ||
}) { | ||
const { connection } = useNetwork(); | ||
|
||
return connection !== NetworkConnection.TestNet | ||
? menu.filter((item) => item.label !== "Faucet") | ||
: menu; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters