diff --git a/apps/fallback/src/app/dashboard/page.tsx b/apps/fallback/src/app/dashboard/page.tsx index 60aa4a3..2a069c1 100644 --- a/apps/fallback/src/app/dashboard/page.tsx +++ b/apps/fallback/src/app/dashboard/page.tsx @@ -1,8 +1,10 @@ import MorphoLogoSvg from "@morpho-org/uikit/assets/morpho.svg?react"; import { Button } from "@morpho-org/uikit/components/shadcn/button"; import { WalletMenu } from "@morpho-org/uikit/components/wallet-menu"; +import { getChainSlug } from "@morpho-org/uikit/lib/utils"; import { ExternalLink } from "lucide-react"; -import { useState } from "react"; +import { useMemo, useState } from "react"; +import { useChains } from "wagmi"; import { BorrowSubPage } from "./borrow-subpage"; import { EarnSubPage } from "./earn-subpage"; @@ -20,9 +22,15 @@ export default function Page() { const [selectedSubPage, setSelectedSubPage] = useState(SubPage.Earn); const [selectedChainSlug, setSelectedChainSlug] = useState("ethereum"); + const chains = useChains(); + const selectedChainId = useMemo( + () => chains.find((chain) => getChainSlug(chain) === selectedChainSlug)?.id, + [chains, selectedChainSlug], + ); + return (
-
+
diff --git a/apps/fallback/src/components/header.tsx b/apps/fallback/src/components/header.tsx index 3f59c42..8f876b6 100644 --- a/apps/fallback/src/components/header.tsx +++ b/apps/fallback/src/components/header.tsx @@ -1,12 +1,18 @@ import { Button } from "@morpho-org/uikit/components/shadcn/button"; +import { useKeyedState } from "@morpho-org/uikit/hooks/use-keyed-state"; import { cn } from "@morpho-org/uikit/lib/utils"; import { XIcon } from "lucide-react"; import { useState } from "react"; +import { useChains } from "wagmi"; -import { GITHUB_REPO_URL } from "@/lib/constants"; +import { CHAIN_DEPRECATION_DATES, GITHUB_REPO_URL } from "@/lib/constants"; -export function Header({ className, children, ...props }: React.ComponentProps<"div">) { +export function Header({ className, children, chainId, ...props }: React.ComponentProps<"div"> & { chainId?: number }) { const [shouldShowBanner, setShouldShowBanner] = useState(true); + const [shouldShowDeprecationBanner, setShouldShowDeprecationBanner] = useKeyedState(true, chainId, { persist: true }); + const chains = useChains(); + const chainName = chains.find((chain) => chain.id === chainId)?.name; + const deprecationDate = chainId !== undefined ? CHAIN_DEPRECATION_DATES[chainId] : undefined; return (
@@ -24,6 +30,17 @@ export function Header({ className, children, ...props }: React.ComponentProps<" )} + {deprecationDate !== undefined && shouldShowDeprecationBanner && ( + + )}
{children}
diff --git a/apps/fallback/src/lib/constants.ts b/apps/fallback/src/lib/constants.ts index 982195e..df9d4e6 100644 --- a/apps/fallback/src/lib/constants.ts +++ b/apps/fallback/src/lib/constants.ts @@ -1,5 +1,52 @@ +import { tac } from "@morpho-org/uikit/lib/chains"; +import { + abstract, + bsc, + celo, + corn, + etherlink, + fraxtal, + hemi, + ink, + lisk, + mode as modeMainnet, + scroll as scrollMainnet, + sei, + soneium, + sonic, + zircuit, +} from "wagmi/chains"; + export const GITHUB_OWNER = "morpho-org"; export const GITHUB_REPO = "morpho-lite-apps"; export const GITHUB_REPO_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}`; export const TERMS_OF_USE = "https://cdn.morpho.org/documents/Morpho_Terms_of_Use.pdf"; + +/** + * Chains scheduled to be removed from the fallback app, mapped to the date + * after which they will no longer be supported. Chains in this map show a + * deprecation banner with the given date; after the date, remove the chain + * from `wagmi-config.ts` entirely. + * + * Format: `[chainId]: "Month DD, YYYY"` (e.g. `"May 15, 2026"`) + */ +const DEPRECATION_DATE = "May 7, 2026"; +export const CHAIN_DEPRECATION_DATES: Record = { + [abstract.id]: DEPRECATION_DATE, + [bsc.id]: DEPRECATION_DATE, + [celo.id]: DEPRECATION_DATE, + [corn.id]: DEPRECATION_DATE, + [etherlink.id]: DEPRECATION_DATE, + [fraxtal.id]: DEPRECATION_DATE, + [hemi.id]: DEPRECATION_DATE, + [ink.id]: DEPRECATION_DATE, + [lisk.id]: DEPRECATION_DATE, + [modeMainnet.id]: DEPRECATION_DATE, + [scrollMainnet.id]: DEPRECATION_DATE, + [sei.id]: DEPRECATION_DATE, + [soneium.id]: DEPRECATION_DATE, + [sonic.id]: DEPRECATION_DATE, + [tac.id]: DEPRECATION_DATE, + [zircuit.id]: DEPRECATION_DATE, +};