Skip to content

Commit

Permalink
filter incomplete synergies in after menu (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpolletvillard authored and keldaan-ag committed May 26, 2023
1 parent bee2e5e commit 753c7f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/public/src/pages/component/after/after-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
.after-menu .player-team-synergies {
display: flex;
align-items: center;
padding: 0;
}

.after-menu .player-team-synergies img:not(:first-of-type) {
Expand Down
13 changes: 9 additions & 4 deletions app/public/src/pages/component/after/after-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useRef } from "react"
import React from "react"
import { useAppSelector } from "../../../hooks"
import Avatar from "../avatar"
import Team from "./team"
import { getRankLabel } from "../../../../../../app/types/strings/Strings"
import "./after-menu.css"
import SynergyIcon from "../icons/synergy-icon"
import EloRank from "elo-rank"
import { ISimplePlayer } from "../../../../../types"
import { ExpPlace } from "../../../../../types/Config"
import { ExpPlace, TypeTrigger } from "../../../../../types/Config"
import { Synergy } from "../../../../../types/enum/Synergy"
import "./after-menu.css"

function computeElo(players: ISimplePlayer[], player: ISimplePlayer) {
const eloEngine = new EloRank()
Expand Down Expand Up @@ -102,7 +103,7 @@ export default function AfterMenu() {
</td>
<td>
<ul className="player-team-synergies">
{v.synergies.map((s) => (
{v.synergies.filter(isNotIncomplete).map((s) => (
<React.Fragment key={s.name}>
<SynergyIcon type={s.name} />
<span>{s.value}</span>
Expand All @@ -119,3 +120,7 @@ export default function AfterMenu() {
</div>
)
}

function isNotIncomplete(s: { name: Synergy, value: number }){
return s.value >= TypeTrigger[s.name][0]
}

0 comments on commit 753c7f5

Please sign in to comment.