Skip to content

Commit f9127d8

Browse files
authored
fix(hackathons): 2-column grid and pagination on teams tab (#560)
Teams tab was rendering as a single column with no pager, so teams past the first page were unreachable. Use the existing Pagination component wired to the API's pagination.totalPages and switch the grid to two columns from the lg breakpoint.
1 parent 324e588 commit f9127d8

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

  • app/(landing)/hackathons/[slug]/components/tabs/contents

app/(landing)/hackathons/[slug]/components/tabs/contents/FindTeam.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import TeamCard from './teams/TeamCard';
2020
import MyTeamView from './teams/MyTeamView';
2121
import { BoundlessButton } from '@/components/buttons/BoundlessButton';
22+
import Pagination from '@/components/ui/pagination';
2223
import {
2324
DropdownMenu,
2425
DropdownMenuContent,
@@ -91,6 +92,7 @@ const FindTeam = () => {
9192
const teams = (teamsResponse?.data?.teams || []).filter(
9293
t => !myTeam || t.id !== myTeam.id
9394
);
95+
const totalPages = teamsResponse?.data?.pagination?.totalPages ?? 1;
9496

9597
const handleJoin = (team: Team) => {
9698
setSelectedTeam(team);
@@ -264,16 +266,23 @@ const FindTeam = () => {
264266
</p>
265267
</div>
266268
) : teams.length > 0 ? (
267-
<div className='grid grid-cols-1 gap-6 md:grid-cols-1'>
268-
{teams.map(team => (
269-
<TeamCard
270-
key={team.id}
271-
team={team}
272-
onJoin={() => handleJoin(team)}
273-
onMessageLeader={handleMessageLeader}
274-
/>
275-
))}
276-
</div>
269+
<>
270+
<div className='grid grid-cols-1 gap-6 lg:grid-cols-2'>
271+
{teams.map(team => (
272+
<TeamCard
273+
key={team.id}
274+
team={team}
275+
onJoin={() => handleJoin(team)}
276+
onMessageLeader={handleMessageLeader}
277+
/>
278+
))}
279+
</div>
280+
<Pagination
281+
currentPage={page}
282+
totalPages={totalPages}
283+
onPageChange={setPage}
284+
/>
285+
</>
277286
) : (
278287
<div className='flex flex-col items-center justify-center space-y-6 rounded-3xl border border-white/5 bg-[#0D0E10] py-24 text-center'>
279288
<div className='flex h-20 w-20 items-center justify-center rounded-full bg-white/5'>

0 commit comments

Comments
 (0)