fix the correct base point for sorting

This commit is contained in:
phyzical 2022-03-21 21:23:34 +08:00
parent 5532b81285
commit 796881f35d

@ -19,6 +19,7 @@ import { IRouter } from "../../ui/Router";
import { Faction } from "../Faction"; import { Faction } from "../Faction";
import { joinFaction } from "../FactionHelpers"; import { joinFaction } from "../FactionHelpers";
import { Factions } from "../Factions"; import { Factions } from "../Factions";
import { FactionNames } from "../data/FactionNames";
export const InvitationsSeen: string[] = []; export const InvitationsSeen: string[] = [];
@ -79,9 +80,10 @@ 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) => const allFactions = Object.values(FactionNames).map(faction => faction as string)
allJoinedFactions.indexOf(a) - allJoinedFactions.indexOf(b)); const allJoinedFactions = props.player.factions.sort((a, b) =>
allFactions.indexOf(a) - allFactions.indexOf(b));
return ( return (
<Container disableGutters maxWidth="md" sx={{ mx: 0, mb: 10 }}> <Container disableGutters maxWidth="md" sx={{ mx: 0, mb: 10 }}>