Skip to content

Commit c6b4d15

Browse files
committed
Nebula: Recent Activity improvements in sidebar (#7055)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `TransactionsSection` component in the dashboard by modifying the transaction fetch limit and adding a filter for recent transactions. ### Detailed summary - Updated `className` of `ChainIconClient` to include `rounded-full border`. - Increased transaction limit from `10` to `20` in the URL query parameters. - Added a filter for transactions from the last three months using `filter_block_timestamp_gte`. - Changed the type of `json.data` from `WalletTransaction[]` to `WalletTransaction[]?`, allowing for undefined. - Implemented a fallback to return an empty array if `json.data` is undefined. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 0eff648 commit c6b4d15

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/TransactionsSection/TransactionsSection.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function TransactionInfo(props: {
8888
<div className="relative flex h-[48px] items-center gap-2.5 rounded-lg px-2 py-1 hover:bg-accent">
8989
<ChainIconClient
9090
client={props.client}
91-
className="size-8"
91+
className="size-8 rounded-full border"
9292
src={chainMeta?.icon?.url || ""}
9393
/>
9494

@@ -167,20 +167,29 @@ export function TransactionsSection(props: {
167167
const url = new URL(
168168
`https://insight.${isProd ? "thirdweb" : "thirdweb-dev"}.com/v1/wallets/${account.address}/transactions`,
169169
);
170-
url.searchParams.set("limit", "10");
170+
url.searchParams.set("limit", "20");
171171
url.searchParams.set("decode", "true");
172172
url.searchParams.set("clientId", nebulaAppThirdwebClient.clientId);
173173

174+
const threeMonthsAgoUnixTime = Math.floor(
175+
(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000) / 1000,
176+
);
177+
178+
url.searchParams.set(
179+
"filter_block_timestamp_gte",
180+
`${threeMonthsAgoUnixTime}`,
181+
);
182+
174183
for (const chain of chains) {
175184
url.searchParams.append("chain", chain.toString());
176185
}
177186

178187
const response = await fetch(url.toString());
179188
const json = (await response.json()) as {
180-
data: WalletTransaction[];
189+
data?: WalletTransaction[];
181190
};
182191

183-
return json.data;
192+
return json.data ?? [];
184193
},
185194
retry: false,
186195
enabled: !!account && !!activeChain,

0 commit comments

Comments
 (0)