diff --git a/apps/namadillo/src/App/AccountOverview/NavigationFooter.tsx b/apps/namadillo/src/App/AccountOverview/NavigationFooter.tsx index 7dfe73789..ebc76ce6a 100644 --- a/apps/namadillo/src/App/AccountOverview/NavigationFooter.tsx +++ b/apps/namadillo/src/App/AccountOverview/NavigationFooter.tsx @@ -1,6 +1,5 @@ import { ActionButton, Heading, Stack } from "@namada/components"; -import GovernanceRoutes from "App/Governance/routes"; -import StakingRoutes from "App/Staking/routes"; +import { routes } from "App/routes"; export const NavigationFooter = (): JSX.Element => { return ( @@ -11,7 +10,7 @@ export const NavigationFooter = (): JSX.Element => { { { const location = useLocation(); @@ -36,46 +48,97 @@ export const MainRoutes = (): JSX.Element => { // Avoid animation being fired twice when navigating inside settings modal routes const settingsAnimationKey = - location.pathname.indexOf(SettingsRoutes.index()) > -1 ? + location.pathname.indexOf(routes.settings) > -1 ? "settings-modal" : location.pathname; return ( <> - } errorElement={}> + } + errorElement={} + > + {/* Home */} } /> - } /> + + {/* Staking */} + } /> } + path={routes.stakingBondingIncrement} + element={} /> - } /> + } /> + } + /> + + {/* Governance */} + } /> + } + /> + } /> + } /> + + {/* Masp */} + {features.maspEnabled && ( + }> + } /> + } /> + } /> + + )} + + {/* Ibc */} {features.ibcTransfersEnabled && ( - } /> + }> + } /> + } /> + } /> + )} + + {/* Transfer */} + {features.namTransfersEnabled && ( + }> + } /> + + )} + + {/* Other */} + } /> + + {/* Modals */} - } - errorElement={} - /> - } - errorElement={} - /> - } - errorElement={} - /> - } - /> + }> + {/* Settings */} + }> + } /> + } /> + } + /> + } + /> + + + {/* Other Modals */} + } /> + } /> + } + /> + diff --git a/apps/namadillo/src/App/Common/NotFound.tsx b/apps/namadillo/src/App/Common/NotFound.tsx new file mode 100644 index 000000000..7e93534cd --- /dev/null +++ b/apps/namadillo/src/App/Common/NotFound.tsx @@ -0,0 +1,13 @@ +import { ErrorBox } from "./ErrorBox"; + +export const NotFound = (): JSX.Element => { + return ( + + ); +}; diff --git a/apps/namadillo/src/App/Governance/AllProposalsTable.tsx b/apps/namadillo/src/App/Governance/AllProposalsTable.tsx index d9062aa6e..f03226544 100644 --- a/apps/namadillo/src/App/Governance/AllProposalsTable.tsx +++ b/apps/namadillo/src/App/Governance/AllProposalsTable.tsx @@ -4,12 +4,13 @@ import { Proposal, isProposalStatus, proposalStatuses } from "@namada/types"; import { mapUndefined } from "@namada/utils"; import { Search } from "App/Common/Search"; import { TableWithPaginator } from "App/Common/TableWithPaginator"; +import { routes } from "App/routes"; import { paginatedProposalsFamily } from "atoms/proposals"; import clsx from "clsx"; import { useAtomValue } from "jotai"; import { useEffect, useState } from "react"; import { GoCheckCircleFill, GoInfo } from "react-icons/go"; -import { useNavigate } from "react-router-dom"; +import { generatePath, useNavigate } from "react-router-dom"; import { proposalStatusToString, proposalTypeStringToString, @@ -17,7 +18,6 @@ import { secondsToTimeString, } from "utils"; import { StatusLabel, TypeLabel } from "./ProposalLabels"; -import GovernanceRoutes from "./routes"; const Table: React.FC< { @@ -50,7 +50,11 @@ const Table: React.FC< "[&_td:first-child]:rounded-s-md [&_td:last-child]:rounded-e-md" ), onClick: () => { - navigate(GovernanceRoutes.proposal(proposal.id).url); + navigate( + generatePath(routes.governanceProposal, { + proposalId: proposal.id.toString(), + }) + ); }, cells: [ // ID diff --git a/apps/namadillo/src/App/Governance/Governance.tsx b/apps/namadillo/src/App/Governance/Governance.tsx deleted file mode 100644 index 783951942..000000000 --- a/apps/namadillo/src/App/Governance/Governance.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Route, Routes } from "react-router-dom"; -import { GovernanceOverview } from "./GovernanceOverview"; -import { ProposalAndVote } from "./ProposalAndVote"; -import { SubmitVote } from "./SubmitVote"; -import { ViewJson } from "./ViewJson"; -import GovernanceRoutes from "./routes"; - -export const Governance: React.FC = () => ( -
- - } /> - } - /> - } - /> - } /> - -
-); diff --git a/apps/namadillo/src/App/Governance/LiveGovernanceProposals.tsx b/apps/namadillo/src/App/Governance/LiveGovernanceProposals.tsx index a8272019b..8287eddb1 100644 --- a/apps/namadillo/src/App/Governance/LiveGovernanceProposals.tsx +++ b/apps/namadillo/src/App/Governance/LiveGovernanceProposals.tsx @@ -1,12 +1,12 @@ import { SegmentedBar, Stack } from "@namada/components"; import { Proposal, VoteType, voteTypes } from "@namada/types"; +import { routes } from "App/routes"; import BigNumber from "bignumber.js"; import clsx from "clsx"; import { GoInfo } from "react-icons/go"; -import { useNavigate } from "react-router-dom"; +import { generatePath, useNavigate } from "react-router-dom"; import { secondsToDateTimeString } from "utils"; import { StatusLabel, TypeLabel, VotedLabel } from "./ProposalLabels"; -import GovernanceRoutes from "./routes"; import { colors } from "./types"; const ProposalListItem: React.FC<{ @@ -33,7 +33,13 @@ const ProposalListItem: React.FC<{ navigate(GovernanceRoutes.proposal(proposal.id).url)} + onClick={() => + navigate( + generatePath(routes.governanceProposal, { + proposalId: proposal.id.toString(), + }) + ) + } className={clsx( "group/proposal cursor-pointer text-sm", "rounded-md bg-[#191919] p-4" @@ -85,8 +91,9 @@ export const LiveGovernanceProposals: React.FC< className="dark-scrollbar overscroll-contain overflow-x-auto" > {proposals.map((proposal) => { - const vote = votedProposals.find((v) => v.proposalId === proposal.id) - ?.vote; + const vote = votedProposals.find( + (v) => v.proposalId === proposal.id + )?.vote; return ( = ({ proposalId }) => (
- + Governance {" "} /  Proposal {proposalIdToString(proposalId)} @@ -96,7 +95,7 @@ const Breadcrumbs: React.FC<{ proposalId: bigint }> = ({ proposalId }) => ( const BackButton: React.FC = () => ( @@ -320,7 +321,12 @@ const VoteButton: React.FC<{ return { disabled, - onClick: () => navigate(GovernanceRoutes.submitVote(proposalId).url), + onClick: () => + navigate( + generatePath(routes.governanceSubmitVote, { + proposalId: proposalId.toString(), + }) + ), text, }; } diff --git a/apps/namadillo/src/App/Governance/UpcomingProposals.tsx b/apps/namadillo/src/App/Governance/UpcomingProposals.tsx index fe78eee4d..bc8e4d72d 100644 --- a/apps/namadillo/src/App/Governance/UpcomingProposals.tsx +++ b/apps/namadillo/src/App/Governance/UpcomingProposals.tsx @@ -1,9 +1,9 @@ import { SegmentedBar, Stack } from "@namada/components"; -import GovernanceRoutes from "./routes"; import { Proposal } from "@namada/types"; +import { routes } from "App/routes"; import clsx from "clsx"; -import { useNavigate } from "react-router-dom"; +import { generatePath, useNavigate } from "react-router-dom"; import { StatusLabel, TypeLabel } from "./ProposalLabels"; const ProposalListItem: React.FC<{ @@ -22,7 +22,13 @@ const ProposalListItem: React.FC<{ navigate(GovernanceRoutes.proposal(proposal.id).url)} + onClick={() => + navigate( + generatePath(routes.governanceProposal, { + proposalId: proposal.id.toString(), + }) + ) + } className={clsx( "group/proposal cursor-pointer text-sm", "rounded-md bg-[#191919] p-4" diff --git a/apps/namadillo/src/App/Governance/ViewJson.tsx b/apps/namadillo/src/App/Governance/ViewJson.tsx index 680155de5..ada5ae86c 100644 --- a/apps/namadillo/src/App/Governance/ViewJson.tsx +++ b/apps/namadillo/src/App/Governance/ViewJson.tsx @@ -1,16 +1,16 @@ import { useAtomValue } from "jotai"; -import { useNavigate } from "react-router-dom"; +import { generatePath, useNavigate } from "react-router-dom"; import { Modal } from "@namada/components"; import { PgfTarget, Proposal } from "@namada/types"; import { assertNever, copyToClipboard } from "@namada/utils"; import { ModalContainer } from "App/Common/ModalContainer"; +import { routes } from "App/routes"; import { proposalFamily } from "atoms/proposals"; import clsx from "clsx"; import { useProposalIdParam } from "hooks"; import { useState } from "react"; import { GoCheck, GoCopy } from "react-icons/go"; -import GovernanceRoutes from "./routes"; type DefaultData = Uint8Array; @@ -142,7 +142,11 @@ export const ViewJson: React.FC = () => { } const onCloseModal = (): void => - navigate(GovernanceRoutes.proposal(proposalId).url); + navigate( + generatePath(routes.governanceProposal, { + proposalId: proposalId.toString(), + }) + ); return ( diff --git a/apps/namadillo/src/App/Governance/index.ts b/apps/namadillo/src/App/Governance/index.ts deleted file mode 100644 index 27f9db425..000000000 --- a/apps/namadillo/src/App/Governance/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Governance } from "./Governance"; diff --git a/apps/namadillo/src/App/Governance/routes.ts b/apps/namadillo/src/App/Governance/routes.ts deleted file mode 100644 index 016a3a472..000000000 --- a/apps/namadillo/src/App/Governance/routes.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createRouteOutput, RouteOutput } from "utils/routes"; - -export const index = (): string => `/governance`; - -const routeOutput = createRouteOutput(index); - -export const overview = (): RouteOutput => routeOutput(`/`); - -export const proposal = (proposalId?: bigint): RouteOutput => - routeOutput(`/proposal/${proposalIdString(proposalId)}`); - -export const submitVote = (proposalId?: bigint): RouteOutput => - routeOutput(`/submit-vote/${proposalIdString(proposalId)}`); - -export const viewJson = (proposalId?: bigint): RouteOutput => - routeOutput(`/json/${proposalIdString(proposalId)}`); - -const proposalIdString = (proposalId?: bigint): string => - typeof proposalId === "undefined" ? ":proposalId" : proposalId.toString(); - -export default { - index, - overview, - proposal, - submitVote, - viewJson, -}; diff --git a/apps/namadillo/src/App/Ibc/IbcLayout.tsx b/apps/namadillo/src/App/Ibc/IbcLayout.tsx new file mode 100644 index 000000000..955a8c697 --- /dev/null +++ b/apps/namadillo/src/App/Ibc/IbcLayout.tsx @@ -0,0 +1,14 @@ +import { PageWithSidebar } from "App/Common/PageWithSidebar"; +import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner"; +import { Outlet } from "react-router-dom"; + +export const IbcLayout: React.FC = () => { + return ( + + + + + ); +}; diff --git a/apps/namadillo/src/App/Ibc/IbcShieldAll.tsx b/apps/namadillo/src/App/Ibc/IbcShieldAll.tsx new file mode 100644 index 000000000..c1f0507e9 --- /dev/null +++ b/apps/namadillo/src/App/Ibc/IbcShieldAll.tsx @@ -0,0 +1,9 @@ +import { Panel } from "@namada/components"; + +export const IbcShieldAll: React.FC = () => { + return ( + +
IBC: ShieldAll (WIP)
+
+ ); +}; diff --git a/apps/namadillo/src/App/Ibc/Ibc.tsx b/apps/namadillo/src/App/Ibc/IbcTransfer.tsx similarity index 99% rename from apps/namadillo/src/App/Ibc/Ibc.tsx rename to apps/namadillo/src/App/Ibc/IbcTransfer.tsx index e3be5b628..ca2e5e704 100644 --- a/apps/namadillo/src/App/Ibc/Ibc.tsx +++ b/apps/namadillo/src/App/Ibc/IbcTransfer.tsx @@ -20,7 +20,7 @@ const rpc = "https://rpc-t.cosmos.nodestake.top"; const buttonStyles = "bg-white my-2 p-2 block"; -export const Ibc: React.FC = () => { +export const IbcTransfer: React.FC = () => { const [error, setError] = useState(""); const [address, setAddress] = useState(""); const [alias, setAlias] = useState(""); diff --git a/apps/namadillo/src/App/Ibc/IbcWithdraw.tsx b/apps/namadillo/src/App/Ibc/IbcWithdraw.tsx new file mode 100644 index 000000000..760440d2c --- /dev/null +++ b/apps/namadillo/src/App/Ibc/IbcWithdraw.tsx @@ -0,0 +1,9 @@ +import { Panel } from "@namada/components"; + +export const IbcWithdraw: React.FC = () => { + return ( + +
IBC: Withdraw (WIP)
+
+ ); +}; diff --git a/apps/namadillo/src/App/Ibc/index.ts b/apps/namadillo/src/App/Ibc/index.ts deleted file mode 100644 index 863deea33..000000000 --- a/apps/namadillo/src/App/Ibc/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Ibc } from "./Ibc"; diff --git a/apps/namadillo/src/App/Ibc/routes.ts b/apps/namadillo/src/App/Ibc/routes.ts deleted file mode 100644 index 369def705..000000000 --- a/apps/namadillo/src/App/Ibc/routes.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const index = (): string => `/ibc`; - -export default { - index, -}; diff --git a/apps/namadillo/src/App/Layout/ActiveAccount.tsx b/apps/namadillo/src/App/Layout/ActiveAccount.tsx index 125b0b5df..9e492a9ed 100644 --- a/apps/namadillo/src/App/Layout/ActiveAccount.tsx +++ b/apps/namadillo/src/App/Layout/ActiveAccount.tsx @@ -1,5 +1,5 @@ import { CopyToClipboardControl, Tooltip } from "@namada/components"; -import SwitchAccountRoutes from "App/SwitchAccount/routes"; +import { routes } from "App/routes"; import { defaultAccountAtom, disconnectAccountAtom } from "atoms/accounts"; import clsx from "clsx"; import { useAtomValue } from "jotai"; @@ -39,7 +39,7 @@ export const ActiveAccount = (): JSX.Element => { - {location.pathname !== SettingsRoutes.index() && ( + {location.pathname !== routes.settings && (
diff --git a/apps/namadillo/src/App/Settings/routes.ts b/apps/namadillo/src/App/Settings/routes.ts deleted file mode 100644 index def0bbfe1..000000000 --- a/apps/namadillo/src/App/Settings/routes.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RouteOutput, createRouteOutput } from "utils/routes"; - -export const index = (): string => "/settings"; - -export const routeOutput = createRouteOutput(index); - -export const currencySelection = (): RouteOutput => routeOutput("/currency"); - -export const advanced = (): RouteOutput => routeOutput("/advanced"); - -export const features = (): RouteOutput => routeOutput("/features"); - -export const signArbitrary = (): RouteOutput => routeOutput("/sign-arbitrary"); - -export default { index, currencySelection, advanced, signArbitrary, features }; diff --git a/apps/namadillo/src/App/Setup/ChainLoader.tsx b/apps/namadillo/src/App/Setup/ChainLoader.tsx index b6ea79c9a..43a087424 100644 --- a/apps/namadillo/src/App/Setup/ChainLoader.tsx +++ b/apps/namadillo/src/App/Setup/ChainLoader.tsx @@ -1,6 +1,6 @@ import { AtomErrorBoundary } from "App/Common/AtomErrorBoundary"; import { ErrorBox } from "App/Common/ErrorBox"; -import SettingsRoutes from "App/Settings/routes"; +import { routes } from "App/routes"; import { chainAtom } from "atoms/chain"; import { useAtomValue } from "jotai"; import { ReactNode } from "react"; @@ -15,7 +15,7 @@ const UpdateSettingsButton = (): JSX.Element => {