fix: add names back in live tab

This commit is contained in:
Kalane 2024-11-07 19:57:59 +01:00
parent ed9dd523ba
commit 4b15e9707d
No known key found for this signature in database
GPG key ID: B389A4E3DFF8E414
6 changed files with 31 additions and 4 deletions

View file

@ -73,13 +73,16 @@
v-if="!player.bot" v-if="!player.bot"
:to="{ :to="{
name: 'summoner', name: 'summoner',
params: { region: $route.params.region, name: player.summonerName }, params: {
region: $route.params.region,
name: player.gameName + '-' + player.tagLine,
},
}" }"
:class="[ :class="[
player.summonerId === account.id ? 'text-yellow-500' : 'hover:text-blue-200', player.summonerId === account.id ? 'text-yellow-500' : 'hover:text-blue-200',
]" ]"
class="font-semibold" class="font-semibold"
>{{ player.summonerName }}</router-link >{{ player.gameName + '#' + player.tagLine }}</router-link
> >
<div :class="[ally ? 'text-teal-300 ' : 'text-red-400 ']" class="text-xs"> <div :class="[ally ? 'text-teal-300 ' : 'text-red-400 ']" class="text-xs">
{{ player.champion.name }} {{ player.champion.name }}

View file

@ -34,6 +34,12 @@ class LiveMatchSerializer extends MatchSerializer {
redRoles = super.getTeamRoles(redTeam) redRoles = super.getTeamRoles(redTeam)
} }
// Accounts
const requestsAccounts = liveMatch.participants.map((p) =>
SummonerService.getAccount(p.puuid, region)
)
const accounts = await Promise.all(requestsAccounts)
// Ranks // Ranks
const requestsRanks = liveMatch.participants.map((p) => const requestsRanks = liveMatch.participants.map((p) =>
SummonerService.getRanked(p.summonerId, region) SummonerService.getRanked(p.summonerId, region)
@ -61,6 +67,7 @@ class LiveMatchSerializer extends MatchSerializer {
return { return {
...player, ...player,
role, role,
...accounts[index],
rank: ranks[index], rank: ranks[index],
champion: this.getChampion(player.championId), champion: this.getChampion(player.championId),
perks, perks,

View file

@ -207,6 +207,7 @@ export interface SerializedLiveMatchPlayer {
spell1Id: number spell1Id: number
spell2Id: number spell2Id: number
summonerId: string summonerId: string
summonerName: string gameName?: string
tagLine?: string
teamId: number teamId: number
} }

View file

@ -28,4 +28,15 @@ export default class AccountEndpoint {
'riot' 'riot'
).execute() ).execute()
} }
public byPuuid(puuid: string, region: string): Promise<AccountDto> {
return new JaxRequest(
getRiotRegion(region),
this.config,
`account/v1/accounts/by-puuid/${puuid}`,
this.limiter,
36000,
'riot'
).execute()
}
} }

View file

@ -33,8 +33,8 @@ export interface CurrentGameParticipantDTO {
profileIconId: number profileIconId: number
bot: boolean bot: boolean
teamId: number teamId: number
summonerName: string
summonerId: string summonerId: string
puuid: string
spell1Id: number spell1Id: number
spell2Id: number spell2Id: number
gameCustomizationObjects: GameCustomizationObjectDTO[] gameCustomizationObjects: GameCustomizationObjectDTO[]

View file

@ -5,6 +5,7 @@ import Summoner from 'App/Models/Summoner'
import { PlayerRankParsed } from 'App/Parsers/ParsedType' import { PlayerRankParsed } from 'App/Parsers/ParsedType'
import MatchPlayerRank from 'App/Models/MatchPlayerRank' import MatchPlayerRank from 'App/Models/MatchPlayerRank'
import { ACCOUNT_NAME_DELIMITER } from 'App/helpers' import { ACCOUNT_NAME_DELIMITER } from 'App/helpers'
import { AccountDto } from 'App/Services/Jax/src/Endpoints/AccountEndpoint'
export interface LeagueEntriesByQueue { export interface LeagueEntriesByQueue {
soloQ?: LeagueEntryByQueue soloQ?: LeagueEntryByQueue
@ -81,6 +82,10 @@ class SummonerService {
return null return null
} }
public async getAccount(puuid: string, region: string): Promise<AccountDto | null> {
return Jax.Account.byPuuid(puuid, region)
}
/** /**
* Return the full list of old and actual summoner names * Return the full list of old and actual summoner names
* @param account of the summoner * @param account of the summoner