Skip to content

Commit 27d5a81

Browse files
[Dashboard] Add transaction filtering by Queue ID and wallet address (#8162)
1 parent dbadc23 commit 27d5a81

File tree

2 files changed

+57
-19
lines changed

2 files changed

+57
-19
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/tx-table-ui.tsx

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Badge } from "@/components/ui/badge";
1313
import { Button } from "@/components/ui/button";
1414
import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
1515
import { CopyTextButton } from "@/components/ui/CopyTextButton";
16+
import { Input } from "@/components/ui/input";
1617
import { Label } from "@/components/ui/label";
1718
import {
1819
Select,
@@ -49,6 +50,8 @@ export function TransactionsTableUI(props: {
4950
getData: (params: {
5051
page: number;
5152
status: TransactionStatus | undefined;
53+
id: string | undefined;
54+
from: string | undefined;
5255
}) => Promise<TransactionsResponse>;
5356
project: Project;
5457
teamSlug: string;
@@ -60,13 +63,15 @@ export function TransactionsTableUI(props: {
6063
const [status, setStatus] = useState<TransactionStatus | undefined>(
6164
undefined,
6265
);
66+
const [id, setId] = useState<string | undefined>(undefined);
67+
const [from, setFrom] = useState<string | undefined>(undefined);
6368
const [page, setPage] = useState(1);
6469

6570
const pageSize = 10;
6671
const transactionsQuery = useQuery({
6772
placeholderData: keepPreviousData,
68-
queryFn: () => props.getData({ page, status }),
69-
queryKey: ["transactions", props.project.id, page, status],
73+
queryFn: () => props.getData({ page, status, id, from }),
74+
queryKey: ["transactions", props.project.id, page, status, id, from],
7075
refetchInterval: autoUpdate ? 4_000 : false,
7176
});
7277

@@ -84,33 +89,58 @@ export function TransactionsTableUI(props: {
8489

8590
return (
8691
<div className="overflow-hidden rounded-lg border border-border bg-card">
87-
<div className="flex flex-col gap-4 rounded-lg rounded-b-none px-6 py-6 lg:flex-row lg:justify-between">
88-
<div>
89-
<h2 className="font-semibold text-2xl tracking-tight">
90-
Transaction History
91-
</h2>
92-
<p className="text-muted-foreground text-sm">
93-
Transactions sent from server wallets
94-
</p>
95-
</div>
92+
<div className="flex flex-col gap-4 rounded-lg rounded-b-none px-6 py-6">
93+
<div className="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
94+
<div>
95+
<h2 className="font-semibold text-2xl tracking-tight">
96+
Transaction History
97+
</h2>
98+
<p className="text-muted-foreground text-sm">
99+
Transactions sent from server wallets
100+
</p>
101+
</div>
96102

97-
<div className="flex items-center justify-end gap-5 border-border border-t pt-4 lg:border-none lg:pt-0">
98-
<div className="flex shrink-0 items-center gap-2">
103+
<div className="flex shrink-0 items-center gap-2 border-border border-t pt-4 lg:border-none lg:pt-0">
99104
<Label htmlFor={autoUpdateId}>Auto Update</Label>
100105
<Switch
101106
checked={autoUpdate}
102107
id={autoUpdateId}
103108
onCheckedChange={(v) => setAutoUpdate(!!v)}
104109
/>
105110
</div>
106-
<StatusSelector
107-
setStatus={(v) => {
108-
setStatus(v);
109-
// reset page
111+
</div>
112+
113+
<div className="flex flex-wrap items-center justify-end gap-3">
114+
<Input
115+
className="max-w-[250px]"
116+
onChange={(e) => {
117+
const value = e.target.value.trim();
118+
setId(value || undefined);
110119
setPage(1);
111120
}}
112-
status={status}
121+
placeholder="Filter by Queue ID"
122+
value={id || ""}
113123
/>
124+
<Input
125+
className="max-w-[250px]"
126+
onChange={(e) => {
127+
const value = e.target.value.trim();
128+
setFrom(value || undefined);
129+
setPage(1);
130+
}}
131+
placeholder="Filter by wallet address"
132+
value={from || ""}
133+
/>
134+
<div>
135+
<StatusSelector
136+
setStatus={(v) => {
137+
setStatus(v);
138+
// reset page
139+
setPage(1);
140+
}}
141+
status={status}
142+
/>
143+
</div>
114144
</div>
115145
</div>
116146

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/tx-table/tx-table.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ export function TransactionsTable(props: {
1616
return (
1717
<TransactionsTableUI
1818
client={props.client}
19-
getData={async ({ page, status }) => {
19+
getData={async ({ page, status, id, from }) => {
2020
return await getTransactions({
2121
page,
2222
project: props.project,
2323
status,
24+
id,
25+
from,
2426
});
2527
}}
2628
project={props.project}
@@ -34,10 +36,14 @@ async function getTransactions({
3436
project,
3537
page,
3638
status,
39+
id,
40+
from,
3741
}: {
3842
project: Project;
3943
page: number;
4044
status: TransactionStatus | undefined;
45+
id: string | undefined;
46+
from: string | undefined;
4147
}) {
4248
const transactions = await engineCloudProxy<{ result: TransactionsResponse }>(
4349
{
@@ -52,6 +58,8 @@ async function getTransactions({
5258
limit: "20",
5359
page: page.toString(),
5460
status: status ?? undefined,
61+
id: id ?? undefined,
62+
from: from ?? undefined,
5563
},
5664
},
5765
);

0 commit comments

Comments
 (0)