Skip to content

Commit b29b95c

Browse files
committed
chore: clean up for prod
1 parent f6188f8 commit b29b95c

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

apps/dashboard/src/@3rdweb-sdk/react/hooks/useEmbeddedWallets.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useQuery } from "@tanstack/react-query";
1+
import { keepPreviousData, useQuery } from "@tanstack/react-query";
22
import { THIRDWEB_EWS_API_HOST } from "constants/urls";
33
import type { WalletUser } from "thirdweb/wallets";
44
import { embeddedWalletsKeys } from "../cache-keys";
@@ -17,8 +17,7 @@ export function useEmbeddedWallets(clientId: string, page: number) {
1717
const url = new URL(
1818
`${THIRDWEB_EWS_API_HOST}/api/2024-05-05/account/list`,
1919
);
20-
// TODO: replace this with the real thing
21-
url.searchParams.append("clientId", "5574e050c33e91d4526218dc7c7d2af0");
20+
url.searchParams.append("clientId", clientId);
2221
url.searchParams.append("page", page.toString());
2322

2423
const res = await fetch(url.href, {
@@ -33,12 +32,12 @@ export function useEmbeddedWallets(clientId: string, page: number) {
3332
}
3433

3534
const json = await res.json();
36-
3735
return json as {
3836
users: WalletUser[];
3937
totalPages: number;
4038
};
4139
},
40+
placeholderData: keepPreviousData,
4241
enabled: !!user?.address && isLoggedIn && !!clientId,
4342
});
4443
}

apps/dashboard/src/components/embedded-wallets/Users/index.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import {
1010
TooltipTrigger,
1111
} from "@/components/ui/tooltip";
1212
import { useEmbeddedWallets } from "@3rdweb-sdk/react/hooks/useEmbeddedWallets";
13+
import { Spinner } from "@chakra-ui/react";
1314
import { createColumnHelper } from "@tanstack/react-table";
1415
import { TWTable } from "components/shared/TWTable";
1516
import { format } from "date-fns/format";
1617
import Papa from "papaparse";
1718
import { useCallback, useState } from "react";
1819
import type { WalletUser } from "thirdweb/wallets";
1920

20-
const ACTIVE_THRESHOLD_DAYS = 30;
2121
const getUserIdentifier = (accounts: WalletUser["linkedAccounts"]) => {
2222
const mainDetail = accounts[0]?.details;
2323
return (
@@ -144,16 +144,20 @@ export const InAppWalletUsersPageContent = (props: {
144144
Download as .csv
145145
</Button>
146146

147-
{/* <div className="flex items-center justify-end gap-2">
148-
<p className="text-muted-foreground text-sm">
149-
Active last {ACTIVE_THRESHOLD_DAYS} days
150-
</p>
151-
<Switch checked={true} disabled={wallets.length === 0} />
152-
</div> */}
147+
<div className="flex items-center justify-end gap-2">
148+
{walletsQuery.isPlaceholderData && (
149+
<>
150+
<Spinner className="size-4" />
151+
<p className="text-muted-foreground text-sm">
152+
Loading page {activePage} of {totalPages}
153+
</p>
154+
</>
155+
)}
156+
</div>
153157
</div>
154158

155159
<TWTable
156-
title="active in-app wallets"
160+
title="in-app wallets"
157161
data={wallets}
158162
columns={columns}
159163
isPending={walletsQuery.isPending}

0 commit comments

Comments
 (0)