mirror of
https://github.com/evroon/bracket.git
synced 2026-06-11 18:24:38 -04:00
Sort stage items (#324)
This commit is contained in:
@@ -155,16 +155,18 @@ export default function Brackets({
|
||||
const stages_map = Object.fromEntries(
|
||||
swrStagesResponse.data.data.map((x: StageWithStageItems) => [x.id, x])
|
||||
);
|
||||
const rounds = stages_map[selectedStageId].stage_items.map((stageItem: StageItemWithRounds) =>
|
||||
getRoundsGridCols(
|
||||
stageItem,
|
||||
tournamentData,
|
||||
swrStagesResponse,
|
||||
swrCourtsResponse,
|
||||
swrUpcomingMatchesResponse,
|
||||
readOnly
|
||||
)
|
||||
);
|
||||
const rounds = stages_map[selectedStageId].stage_items
|
||||
.sort((i1: StageItemWithRounds, i2: StageItemWithRounds) => (i1.name > i2.name ? 1 : 0))
|
||||
.map((stageItem: StageItemWithRounds) =>
|
||||
getRoundsGridCols(
|
||||
stageItem,
|
||||
tournamentData,
|
||||
swrStagesResponse,
|
||||
swrCourtsResponse,
|
||||
swrUpcomingMatchesResponse,
|
||||
readOnly
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -140,15 +140,17 @@ function StageColumn({
|
||||
return null;
|
||||
}
|
||||
|
||||
const rows = stage.stage_items.map((stageItem: StageItemWithRounds) => (
|
||||
<StageItemRow
|
||||
key={stageItem.id}
|
||||
teamsMap={teamsMap}
|
||||
tournament={tournament}
|
||||
stageItem={stageItem}
|
||||
swrStagesResponse={swrStagesResponse}
|
||||
/>
|
||||
));
|
||||
const rows = stage.stage_items
|
||||
.sort((i1: StageItemWithRounds, i2: StageItemWithRounds) => (i1.name > i2.name ? 1 : 0))
|
||||
.map((stageItem: StageItemWithRounds) => (
|
||||
<StageItemRow
|
||||
key={stageItem.id}
|
||||
teamsMap={teamsMap}
|
||||
tournament={tournament}
|
||||
stageItem={stageItem}
|
||||
swrStagesResponse={swrStagesResponse}
|
||||
/>
|
||||
));
|
||||
|
||||
return (
|
||||
<Grid.Col mb="1rem" sm={6} lg={4} xl={3} key={stage.id}>
|
||||
|
||||
Reference in New Issue
Block a user