Skip to content

Commit 691c276

Browse files
committed
feat: add tab navigation for workerpool details, deals, and access
1 parent 6970d14 commit 691c276

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/routes/$chainSlug/_layout/workerpool/$workerpoolAddress.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import { createFileRoute } from '@tanstack/react-router';
55
import { LoaderCircle } from 'lucide-react';
66
import WorkerpoolIcon from '@/components/icons/WorkerpoolIcon';
77
import { BackButton } from '@/components/ui/BackButton';
8+
import { useTabParam } from '@/hooks/usePageParam';
89
import { DetailsTable } from '@/modules/DetailsTable';
910
import { ErrorAlert } from '@/modules/ErrorAlert';
11+
import { Tabs } from '@/modules/Tabs';
1012
import { SearcherBar } from '@/modules/search/SearcherBar';
1113
import { WorkerpoolDealsTable } from '@/modules/workerpools/workerpool/WorkerpoolDealsTable';
1214
import { buildWorkerpoolDetails } from '@/modules/workerpools/workerpool/buildWorkerpoolDetails';
@@ -57,6 +59,12 @@ function useWorkerpoolData(workerpoolAddress: string, chainId: number) {
5759
}
5860

5961
function WorkerpoolsRoute() {
62+
const tabLabels = ['DETAILS', 'DEALS', 'ACCESS'];
63+
const [currentTab, setCurrentTab] = useTabParam(
64+
'workerpoolTab',
65+
tabLabels,
66+
0
67+
);
6068
const { chainId } = useUserStore();
6169
const { workerpoolAddress } = Route.useParams();
6270
const {
@@ -107,14 +115,20 @@ function WorkerpoolsRoute() {
107115
</div>
108116
</div>
109117

110-
<div className="space-y-10">
111-
{hasPastError && !workerpoolDetails ? (
118+
<Tabs
119+
currentTab={currentTab}
120+
tabLabels={tabLabels}
121+
onTabChange={setCurrentTab}
122+
/>
123+
{currentTab === 0 &&
124+
(hasPastError && !workerpoolDetails ? (
112125
<ErrorAlert message="An error occurred during deal details loading." />
113126
) : (
114127
<DetailsTable details={workerpoolDetails || {}} zebra={false} />
115-
)}
128+
))}
129+
{currentTab === 1 && (
116130
<WorkerpoolDealsTable workerpoolAddress={workerpoolAddress} />
117-
</div>
131+
)}
118132
</div>
119133
);
120134
}

0 commit comments

Comments
 (0)