add similar sort to the faction invite list

This commit is contained in:
phyzical 2022-03-21 20:13:28 +08:00
parent ca02bdefd1
commit 5532b81285

@ -79,6 +79,9 @@ export function FactionsRoot(props: IProps): React.ReactElement {
(augmentation: string) => !player.hasAugmentation(augmentation) (augmentation: string) => !player.hasAugmentation(augmentation)
).length; ).length;
} }
let allJoinedFactions = props.player.factions
allJoinedFactions = allJoinedFactions.sort((a, b) =>
allJoinedFactions.indexOf(a) - allJoinedFactions.indexOf(b));
return ( return (
<Container disableGutters maxWidth="md" sx={{ mx: 0, mb: 10 }}> <Container disableGutters maxWidth="md" sx={{ mx: 0, mb: 10 }}>
@ -92,11 +95,11 @@ export function FactionsRoot(props: IProps): React.ReactElement {
<Typography variant="h5" color="primary" mt={2} mb={1}> <Typography variant="h5" color="primary" mt={2} mb={1}>
Factions you have joined: Factions you have joined:
</Typography> </Typography>
{(props.player.factions.length > 0 && ( {(allJoinedFactions.length > 0 && (
<Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}> <Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}>
<Table padding="none" style={{ width: "fit-content" }}> <Table padding="none" style={{ width: "fit-content" }}>
<TableBody> <TableBody>
{props.player.factions.map((faction: string) => ( {allJoinedFactions.map((faction: string) => (
<TableRow key={faction}> <TableRow key={faction}>
<TableCell> <TableCell>
<Typography noWrap mb={1}> <Typography noWrap mb={1}>