Skip to content

Commit

Permalink
remove filtered nav from account page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Apr 10, 2024
1 parent 6183740 commit 23223ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 36 deletions.
53 changes: 18 additions & 35 deletions src/app/(sidebar)/account/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,33 @@ import React from "react";

import { LayoutSidebarContent } from "@/components/layout/LayoutSidebarContent";
import { Routes } from "@/constants/routes";
import { useIsTestingNetwork } from "@/hooks/useIsTestingNetwork";

// Includes navigation items that should ONLY display
// in TESTNET or FUTURENET
const DEFAULT_ACCOUNT_NAV_ITEMS = [
{
route: Routes.ACCOUNT_CREATE,
label: "Create Account",
},
{
route: Routes.ACCOUNT_FUND,
label: "Fund Account",
isTestnetOnly: true,
},
{
route: Routes.ACCOUNT_CREATE_MUXED,
label: "Create Muxed Account",
},
{
route: Routes.ACCOUNT_PARSE_MUXED,
label: "Parse Muxed Account",
},
];

export default function AccountTemplate({
children,
}: {
children: React.ReactNode;
}) {
const IS_TESTING_NETWORK = useIsTestingNetwork();

// Filtered navigation items for MAINNET
const filteredNavItems = DEFAULT_ACCOUNT_NAV_ITEMS.filter(
({ isTestnetOnly }) => !isTestnetOnly,
);

const navItems = IS_TESTING_NETWORK
? DEFAULT_ACCOUNT_NAV_ITEMS
: filteredNavItems;

return (
<LayoutSidebarContent
sidebar={{
navItems,
navItems: [
{
route: Routes.ACCOUNT_CREATE,
label: "Create Account",
},
{
route: Routes.ACCOUNT_FUND,
label: "Fund Account",
},
{
route: Routes.ACCOUNT_CREATE_MUXED,
label: "Create Muxed Account",
},
{
route: Routes.ACCOUNT_PARSE_MUXED,
label: "Parse Muxed Account",
},
],
}}
>
{children}
Expand Down
1 change: 0 additions & 1 deletion src/components/layout/LayoutSidebarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type SidebarLink = {
route: Routes | string;
label: string;
icon?: ReactNode;
isTestnetOnly?: boolean;
nestedItems?: SidebarLink[];
};

Expand Down

0 comments on commit 23223ae

Please sign in to comment.