Skip to content

Commit

Permalink
feat(admin): show description if procedure list is empty
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Nov 30, 2024
1 parent fe62877 commit 6005a48
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 30 deletions.
36 changes: 21 additions & 15 deletions bundestag.io/admin/src/app/list/past/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,27 @@ export default async function Page({ searchParams }: { searchParams: { page?: st
return (
<>
<h1>Past procedures</h1>
<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />

{procedures.map((procedure) => (
<Entry
key={procedure.id}
title={procedure.title}
procedureId={procedure.procedureId}
votes={procedure.customData?.voteResults.partyVotes.map((vote) => ({
party: vote.party,
decision: vote.main,
}))}
/>
))}

<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />

{totalPages === 0 && <p>There are no past procedures.</p>}
{totalPages > 0 && (
<>
<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />

{procedures.map((procedure) => (
<Entry
key={procedure.id}
title={procedure.title}
procedureId={procedure.procedureId}
votes={procedure.customData?.voteResults.partyVotes.map((vote) => ({
party: vote.party,
decision: vote.main,
}))}
/>
))}

<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />
</>
)}
</>
);
}
35 changes: 20 additions & 15 deletions bundestag.io/admin/src/app/list/upcoming/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,26 @@ export default async function Page({ searchParams }: { searchParams: { page?: st
<>
<h1>Upcoming procedures</h1>

<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />

{procedures.map((procedure) => (
<Entry
key={procedure.id}
title={procedure.title}
procedureId={procedure.procedureId}
votes={procedure.customData?.voteResults.partyVotes.map((vote) => ({
party: vote.party,
decision: vote.main,
}))}
/>
))}

<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />
{totalPages === 0 && <p>There are no upcoming procedures.</p>}
{totalPages > 0 && (
<>
<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />

{procedures.map((procedure) => (
<Entry
key={procedure.id}
title={procedure.title}
procedureId={procedure.procedureId}
votes={procedure.customData?.voteResults.partyVotes.map((vote) => ({
party: vote.party,
decision: vote.main,
}))}
/>
))}

<PaginationNavigation currentPage={currentPage} totalPages={totalPages} />
</>
)}
</>
);
}

0 comments on commit 6005a48

Please sign in to comment.