diff --git a/app/[locale]/wallets/find-wallet/_components/find-wallet.tsx b/app/[locale]/wallets/find-wallet/_components/find-wallet.tsx deleted file mode 100644 index 5a50080d516..00000000000 --- a/app/[locale]/wallets/find-wallet/_components/find-wallet.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client" - -import type { ChildOnlyProp, Wallet } from "@/lib/types" - -import Breadcrumbs from "@/components/Breadcrumbs" -import FindWalletProductTable from "@/components/FindWalletProductTable" -import MainArticle from "@/components/MainArticle" - -import { useTranslation } from "@/hooks/useTranslation" -import { usePathname } from "@/i18n/routing" - -const Subtitle = ({ children }: ChildOnlyProp) => ( -

- {children} -

-) - -type Props = { - wallets: Wallet[] -} - -const FindWalletPage = ({ wallets }: Props) => { - const pathname = usePathname() - const { t } = useTranslation("page-wallets-find-wallet") - - return ( - -
- -

- {t("page-find-wallet-title")} -

- {t("page-find-wallet-description")} -
- - -
- ) -} - -export default FindWalletPage diff --git a/app/[locale]/wallets/find-wallet/page.tsx b/app/[locale]/wallets/find-wallet/page.tsx index 24e42889a64..e67d8986713 100644 --- a/app/[locale]/wallets/find-wallet/page.tsx +++ b/app/[locale]/wallets/find-wallet/page.tsx @@ -7,7 +7,10 @@ import { import { Lang } from "@/lib/types" +import Breadcrumbs from "@/components/Breadcrumbs" +import FindWalletProductTable from "@/components/FindWalletProductTable/lazy" import I18nProvider from "@/components/I18nProvider" +import MainArticle from "@/components/MainArticle" import { getMetadata } from "@/lib/utils/metadata" import { getRequiredNamespacesForPage } from "@/lib/utils/translations" @@ -17,10 +20,12 @@ import { getSupportedLocaleWallets, } from "@/lib/utils/wallets" -import FindWalletPage from "./_components/find-wallet" - const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => { const { locale } = await params + const t = await getTranslations({ + locale, + namespace: "page-wallets-find-wallet", + }) setRequestLocale(locale) @@ -45,7 +50,19 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => { return ( - + +
+ +

+ {t("page-find-wallet-title")} +

+

+ {t("page-find-wallet-description")} +

+
+ + +
) } diff --git a/src/components/FindWalletProductTable/index.tsx b/src/components/FindWalletProductTable/index.tsx index f75658e884f..dedaea9a93f 100644 --- a/src/components/FindWalletProductTable/index.tsx +++ b/src/components/FindWalletProductTable/index.tsx @@ -1,4 +1,6 @@ -import { useEffect, useMemo, useState } from "react" +"use client" + +import { useMemo, useState } from "react" import { ChainName, @@ -22,15 +24,11 @@ import WalletSubComponent from "./WalletSubComponent" import { useTranslation } from "@/hooks/useTranslation" const FindWalletProductTable = ({ wallets }: { wallets: Wallet[] }) => { + console.log({ wallets }) const { t } = useTranslation("page-wallets-find-wallet") const walletPersonas = useWalletPersonaPresets() const walletFilterOptions = useWalletFilters() const [filters, setFilters] = useState(walletFilterOptions) - const [isClient, setIsClient] = useState(false) - - useEffect(() => { - setIsClient(true) - }, []) const activeFilterKeys = useMemo(() => { const keys: string[] = [] @@ -101,10 +99,6 @@ const FindWalletProductTable = ({ wallets }: { wallets: Wallet[] }) => { }) } - if (!isClient) { - return null - } - if (!Array.isArray(wallets)) { return
Error loading wallets
} diff --git a/src/components/FindWalletProductTable/lazy.tsx b/src/components/FindWalletProductTable/lazy.tsx new file mode 100644 index 00000000000..c960f08e647 --- /dev/null +++ b/src/components/FindWalletProductTable/lazy.tsx @@ -0,0 +1,5 @@ +import dynamic from "next/dynamic" + +import Loading from "./loading" + +export default dynamic(() => import("."), { ssr: false, loading: Loading }) diff --git a/src/components/FindWalletProductTable/loading.tsx b/src/components/FindWalletProductTable/loading.tsx new file mode 100644 index 00000000000..18c76ceb344 --- /dev/null +++ b/src/components/FindWalletProductTable/loading.tsx @@ -0,0 +1,87 @@ +import { Skeleton, SkeletonLines } from "../ui/skeleton" + +const WalletSkeleton = () => ( + <> + {Array.from({ length: 3 }).map((_, idx) => ( +
+ + +
+ +
+ + + +
+ +
+ +
+
+
+ +
+
+ ))} + +) + +const Loading = () => ( +
+
+ {Array.from({ length: 5 }).map((_, idx) => ( + + ))} +
+
+
+
+ + +
+ +
+ +
+
+
+
+ +
+ + +
+
+ {Array.from({ length: 3 }).map((_, setIdx) => ( +
+ {Array.from({ length: 4 }).map((_, idx) => ( +
+ + + +
+ ))} +
+ ))} +
+
+
+ + +
+ +
+
+
+) + +export default Loading