Skip to content

Commit

Permalink
Fix buttons in admin event cards
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Aug 16, 2023
1 parent d759800 commit 28b6edc
Showing 1 changed file with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Link as RouterLink } from "react-router-dom";
import {
ListItem,
ListItemButton,
ListItemSecondaryAction,
ListItemText,
Expand All @@ -23,22 +24,34 @@ function roundClearable(round, competitionEvent) {

function AdminRoundListItem({ round, competitionEvent, competitionId }) {
return (
<ListItemButton
<ListItem
key={round.id}
component={RouterLink}
to={`/admin/competitions/${competitionId}/rounds/${round.id}`}
disabled={!round.open}
secondaryAction={
<ListItemSecondaryAction>
{roundOpenable(round, competitionEvent) && (
<OpenRoundButton
round={round}
competitionEvent={competitionEvent}
/>
)}
{roundClearable(round, competitionEvent) && (
<ClearRoundButton
round={round}
competitionEvent={competitionEvent}
/>
)}
</ListItemSecondaryAction>
}
disablePadding
>
<ListItemText primary={round.name} />
<ListItemSecondaryAction>
{roundOpenable(round, competitionEvent) && (
<OpenRoundButton round={round} competitionEvent={competitionEvent} />
)}
{roundClearable(round, competitionEvent) && (
<ClearRoundButton round={round} competitionEvent={competitionEvent} />
)}
</ListItemSecondaryAction>
</ListItemButton>
<ListItemButton
component={RouterLink}
to={`/admin/competitions/${competitionId}/rounds/${round.id}`}
disabled={!round.open}
>
<ListItemText primary={round.name} />
</ListItemButton>
</ListItem>
);
}

Expand Down

0 comments on commit 28b6edc

Please sign in to comment.