Skip to content

Commit

Permalink
Formatting run
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Sep 22, 2024
1 parent 44a98ed commit 8b25b48
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
8 changes: 6 additions & 2 deletions src/components/ListGames.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function ListGames({ fixedState }) {
} else {
gameEngine = GameFactory(info.uid);
}
return new Map(gameEngine.allvariants().map(rec => [rec.uid, rec.name]));
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
}, [metaGame]);

const data = useMemo(
Expand All @@ -89,7 +89,11 @@ function ListGames({ fixedState }) {
? rec.winner.map((w) => rec.players[w - 1].name)
: null,
variants:
"variants" in rec && rec.variants !== null ? rec.variants.map(id => variantMap.has(id) ? variantMap.get(id) : id) : null,
"variants" in rec && rec.variants !== null
? rec.variants.map((id) =>
variantMap.has(id) ? variantMap.get(id) : id
)
: null,
cbit: fixedState === "completed" || gameState === "completed" ? 1 : 0,
};
}),
Expand Down
25 changes: 16 additions & 9 deletions src/components/Me/ChallengeResponseModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,23 @@ function ChallengeResponseModal(props) {
challenge.variants === undefined ? 0 : challenge.variants.length;
let variantMap = new Map();
if (numVariants > 0) {
const info = gameinfo.get(challenge.metaGame);
let gameEngine;
if (info.playercounts.length > 1) {
gameEngine = GameFactory(info.uid, 2);
} else {
gameEngine = GameFactory(info.uid);
}
variantMap = new Map(gameEngine.allvariants().map(rec => [rec.uid, rec.name]));
const info = gameinfo.get(challenge.metaGame);
let gameEngine;
if (info.playercounts.length > 1) {
gameEngine = GameFactory(info.uid, 2);
} else {
gameEngine = GameFactory(info.uid);
}
variantMap = new Map(
gameEngine.allvariants().map((rec) => [rec.uid, rec.name])
);
}
const variants = numVariants > 0 ? challenge.variants.map(id => variantMap.has(id) ? variantMap.get(id) : id).join("; ") : null;
const variants =
numVariants > 0
? challenge.variants
.map((id) => (variantMap.has(id) ? variantMap.get(id) : id))
.join("; ")
: null;
desc =
t("ChallengeResponseDesc", {
opp: challenge.challenger.name,
Expand Down
21 changes: 14 additions & 7 deletions src/components/Me/ChallengeViewModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,23 @@ function ChallengeViewModal(props) {
challenge.variants === undefined ? 0 : challenge.variants.length;
let variantMap = new Map();
if (numVariants > 0) {
const info = gameinfo.get(challenge.metaGame);
let gameEngine;
if (info.playercounts.length > 1) {
const info = gameinfo.get(challenge.metaGame);
let gameEngine;
if (info.playercounts.length > 1) {
gameEngine = GameFactory(info.uid, 2);
} else {
} else {
gameEngine = GameFactory(info.uid);
}
variantMap = new Map(gameEngine.allvariants().map(rec => [rec.uid, rec.name]));
}
variantMap = new Map(
gameEngine.allvariants().map((rec) => [rec.uid, rec.name])
);
}
const variants = numVariants > 0 ? challenge.variants.map(id => variantMap.has(id) ? variantMap.get(id) : id).join("; ") : null;
const variants =
numVariants > 0
? challenge.variants
.map((id) => (variantMap.has(id) ? variantMap.get(id) : id))
.join("; ")
: null;
var challengeDesc = "";
var players = "";
const otherplayers = challenge.players
Expand Down
6 changes: 4 additions & 2 deletions src/components/StandingChallenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function StandingChallenges(props) {
} else {
gameEngine = GameFactory(info.uid);
}
return new Map(gameEngine.allvariants().map(rec => [rec.uid, rec.name]));
return new Map(gameEngine.allvariants().map((rec) => [rec.uid, rec.name]));
}, [metaGame]);

const data = useMemo(
Expand All @@ -297,7 +297,9 @@ function StandingChallenges(props) {
players: rec.players.filter((p) => p.id !== rec.challenger?.id),
rated: rec.rated,
seating: rec.seating,
variants: rec.variants.map(id => variantMap.has(id) ? variantMap.get(id) : id),
variants: rec.variants.map((id) =>
variantMap.has(id) ? variantMap.get(id) : id
),
comment: rec.comment,
};
}),
Expand Down

0 comments on commit 8b25b48

Please sign in to comment.