feat: don't show tagline everywhere

This commit is contained in:
Kalane 2024-12-15 13:03:36 +01:00
parent 5bd1c798e7
commit cfed65a4a9
No known key found for this signature in database
GPG key ID: B389A4E3DFF8E414
4 changed files with 32 additions and 17 deletions

View file

@ -177,7 +177,7 @@
</Tooltip> </Tooltip>
<div class="ml-1 flex flex-col items-start justify-center leading-none"> <div class="ml-1 flex flex-col items-start justify-center leading-none">
<router-link <router-link
v-if="player.summonerSpell1" v-if="!player.name.includes('-BOT')"
:to="{ :to="{
name: 'summoner', name: 'summoner',
params: { region: $route.params.region, name: player.name }, params: { region: $route.params.region, name: player.name },
@ -186,13 +186,13 @@
'font-semibold text-yellow-400': account.id === player.summonerId, 'font-semibold text-yellow-400': account.id === player.summonerId,
}" }"
class="text-overflow w-[5.5rem] overflow-hidden whitespace-nowrap text-left text-xs text-white hover:text-blue-200" class="text-overflow w-[5.5rem] overflow-hidden whitespace-nowrap text-left text-xs text-white hover:text-blue-200"
>{{ player.name.replace('-', '#') }}</router-link >{{ nameWithoutTagLine(player.name) }}</router-link
> >
<div <div
v-else v-else
class="text-overflow w-[5.5rem] overflow-hidden whitespace-nowrap text-left text-xs text-white" class="text-overflow w-[5.5rem] overflow-hidden whitespace-nowrap text-left text-xs text-white"
> >
{{ player.name.replace('-', '#') }} {{ nameWithoutTagLine(player.name) }}
</div> </div>
<div class="text-xxs text-teal-500"> <div class="text-xxs text-teal-500">
{{ player.champion.name }} {{ player.champion.name }}
@ -309,6 +309,7 @@ import { mapActions, mapState } from 'vuex'
import DotsLoader from '@/components/Common/DotsLoader.vue' import DotsLoader from '@/components/Common/DotsLoader.vue'
import Tooltip from '@/components/Common/Tooltip.vue' import Tooltip from '@/components/Common/Tooltip.vue'
import MatchItems from '@/components/Match/MatchItems.vue' import MatchItems from '@/components/Match/MatchItems.vue'
import { nameWithoutTagLine } from '@/helpers/functions'
export default { export default {
components: { components: {
@ -397,6 +398,7 @@ export default {
this.displayRunes(player.perks) this.displayRunes(player.perks)
}, },
nameWithoutTagLine,
...mapActions('cdragon', ['displayRunes']), ...mapActions('cdragon', ['displayRunes']),
}, },
} }

View file

@ -133,22 +133,22 @@
class="ml-4 flex items-center leading-none" class="ml-4 flex items-center leading-none"
> >
<router-link <router-link
v-if="ally.account_id !== '0' && account.accountId !== ally.account_id" v-if="ally.puuid !== 'BOT' && account.puuid !== ally.puuid"
@click.native="$event.stopImmediatePropagation()" @click.native="$event.stopImmediatePropagation()"
:to="{ :to="{
name: 'summoner', name: 'summoner',
params: { region: $route.params.region, name: ally.name }, params: { region: $route.params.region, name: ally.name },
}" }"
:class="isSummonerProfile(ally.account_id)" :class="isSummonerProfile(ally.puuid)"
class="text-overflow w-16 overflow-hidden whitespace-nowrap text-right text-xs font-medium hover:text-white" class="text-overflow w-16 overflow-hidden whitespace-nowrap text-right text-xs font-medium hover:text-white"
>{{ ally.name.replace('-', '#') }}</router-link >{{ nameWithoutTagLine(ally.name) }}
> </router-link>
<div <div
v-else v-else
:class="isSummonerProfile(ally.account_id)" :class="isSummonerProfile(ally.puuid)"
class="text-overflow w-16 overflow-hidden whitespace-nowrap text-right text-xs font-medium" class="text-overflow w-16 overflow-hidden whitespace-nowrap text-right text-xs font-medium"
> >
{{ ally.name.replace('-', '#') }} {{ nameWithoutTagLine(ally.name) }}
</div> </div>
<div <div
:class="index !== 0 ? '-mt-1' : ''" :class="index !== 0 ? '-mt-1' : ''"
@ -168,20 +168,20 @@
class="h-6 w-6 rounded-full bg-blue-1000 bg-cover bg-center" class="h-6 w-6 rounded-full bg-blue-1000 bg-cover bg-center"
></div> ></div>
<router-link <router-link
v-if="data.enemyTeam[index].account_id !== '0'" v-if="data.enemyTeam[index].puuid !== 'BOT'"
@click.native="$event.stopImmediatePropagation()" @click.native="$event.stopImmediatePropagation()"
:to="{ :to="{
name: 'summoner', name: 'summoner',
params: { region: $route.params.region, name: data.enemyTeam[index].name }, params: { region: $route.params.region, name: data.enemyTeam[index].name },
}" }"
class="text-overflow ml-1 w-16 overflow-hidden whitespace-nowrap text-left text-xs font-medium text-blue-200 hover:text-white" class="text-overflow ml-1 w-16 overflow-hidden whitespace-nowrap text-left text-xs font-medium text-blue-200 hover:text-white"
>{{ data.enemyTeam[index].name.replace('-', '#') }}</router-link >{{ nameWithoutTagLine(data.enemyTeam[index].name) }}
> </router-link>
<div <div
v-else v-else
class="text-overflow ml-1 w-16 overflow-hidden whitespace-nowrap text-left text-xs font-medium text-blue-200" class="text-overflow ml-1 w-16 overflow-hidden whitespace-nowrap text-left text-xs font-medium text-blue-200"
> >
{{ data.enemyTeam[index].name.replace('-', '#') }} {{ nameWithoutTagLine(data.enemyTeam[index].name) }}
</div> </div>
</div> </div>
</div> </div>
@ -218,6 +218,7 @@ import Tooltip from '@/components/Common/Tooltip.vue'
import DetailedMatch from '@/components/Match/DetailedMatch.vue' import DetailedMatch from '@/components/Match/DetailedMatch.vue'
import MatchItems from '@/components/Match/MatchItems.vue' import MatchItems from '@/components/Match/MatchItems.vue'
import Ripple from '@/components/Common/Ripple.vue' import Ripple from '@/components/Common/Ripple.vue'
import { nameWithoutTagLine } from '@/helpers/functions'
export default { export default {
components: { components: {
@ -260,12 +261,13 @@ export default {
this.matchDetails(this.data.matchId) this.matchDetails(this.data.matchId)
} }
}, },
isSummonerProfile(account_id) { isSummonerProfile(puuid) {
return { return {
'font-bold text-white': this.account.accountId === account_id, 'font-bold text-white': this.account.puuid === puuid,
'text-blue-200': this.account.accountId !== account_id, 'text-blue-200': this.account.puuid !== puuid,
} }
}, },
nameWithoutTagLine,
...mapActions('detailedMatch', ['matchDetails']), ...mapActions('detailedMatch', ['matchDetails']),
}, },
} }

View file

@ -25,7 +25,7 @@
<router-link <router-link
:to="{ name: 'summoner', params: { region: $route.params.region, name: mate.name } }" :to="{ name: 'summoner', params: { region: $route.params.region, name: mate.name } }"
class="w-2/4 truncate hover:text-teal-200" class="w-2/4 truncate hover:text-teal-200"
>{{ mate.name.replace('-', '#') }}</router-link >{{ nameWithoutTagLine(mate.name) }}</router-link
> >
<div class="w-1/4">{{ mate.wins }} / {{ mate.losses }}</div> <div class="w-1/4">{{ mate.wins }} / {{ mate.losses }}</div>
<div class="w-1/4"> <div class="w-1/4">
@ -67,6 +67,7 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Tooltip from '@/components/Common/Tooltip.vue' import Tooltip from '@/components/Common/Tooltip.vue'
import { nameWithoutTagLine } from '@/helpers/functions'
export default { export default {
components: { components: {
@ -103,6 +104,7 @@ export default {
winrate(wins, count) { winrate(wins, count) {
return (wins * 100) / count return (wins * 100) / count
}, },
nameWithoutTagLine,
}, },
} }
</script> </script>

View file

@ -52,3 +52,12 @@ export function createCDragonAssetUrl(iconPath) {
const name = iconPath.split('/assets/')[1].toLowerCase() const name = iconPath.split('/assets/')[1].toLowerCase()
return `https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/${name}` return `https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/${name}`
} }
/**
* Remove tagLine from a name
* @param {String} name
*/
export function nameWithoutTagLine(name) {
const separator = name.lastIndexOf('-')
return separator === -1 ? name : name.slice(0, separator)
}