Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions components/alert/AlertCharacterMetrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@
<template #no-results>
<div class="text-2xl text-white font-bold my-6">No results!</div>
</template>
<template #[`item.character.name`]="{ item }">
<NuxtLink
:to="profileHref('character', item.character.id)"
class="label gray border whitespace-nowrap"
>
{{ item.character.name }}
</NuxtLink>
</template>
<template #[`item.character.outfit.name`]="{ item }">
<NuxtLink
v-if="hasOutfit(item.character.outfit)"
:to="profileHref('outfit', item.character.outfit.id)"
class="label gray border whitespace-nowrap"
>
{{ item.character.outfit.name }}
</NuxtLink>
<span v-else class="text-gray-500">{{
item.character.outfit.name
}}</span>
</template>
<template #expanded-item="{ headers }">
<td :colspan="headers.length">
Detailed player specific metrics coming soon! This will include
Expand Down Expand Up @@ -155,6 +175,8 @@ import { timeText } from '~/utilities/TimeHelper'
import { InstanceOutfitWarsResponseInterface } from '~/interfaces/InstanceOutfitWarsResponseInterface'
import { Ps2AlertsEventType } from '~/ps2alerts-constants/ps2AlertsEventType'
import CountdownSpinner from '~/components/common/CountdownSpinner.vue'
import { profileLink } from '~/utilities/ProfileApi'
import { World } from '~/ps2alerts-constants/world'

export default Vue.extend({
name: 'AlertCharacterMetrics',
Expand Down Expand Up @@ -250,6 +272,16 @@ export default Vue.extend({
this.init()
},
methods: {
// Links use the alert's own server; an outfit record's embedded world can be stale
profileHref(type: 'character' | 'outfit', id: string): string {
// The outfitwar prop defaults to a placeholder with no world
const outfitwar = this.outfitwar as { world?: World } | undefined
return profileLink(type, id, this.alert?.world ?? outfitwar?.world)
},
// Outfit ids 0 to 4 are the "no outfit" placeholders
hasOutfit(outfit?: { id: string }): boolean {
return !!outfit && parseInt(outfit.id, 10) > 4
},
reset() {
this.loaded = false
this.clearTimers()
Expand Down
22 changes: 22 additions & 0 deletions components/alert/AlertOutfitMetrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@
<template #no-results>
<div class="text-2xl text-white font-bold my-6">No results!</div>
</template>
<template #[`item.outfit.name`]="{ item }">
<NuxtLink
v-if="hasOutfit(item.outfit)"
:to="profileHref('outfit', item.outfit.id)"
class="label gray border whitespace-nowrap"
>
{{ item.outfit.name }}
</NuxtLink>
<span v-else class="text-gray-500">{{ item.outfit.name }}</span>
</template>
<template
v-if="alert.features && alert.features.xpm"
#expanded-item="{ item }"
Expand Down Expand Up @@ -217,6 +227,8 @@ import { AlertOutfitTableDataInterface } from '~/interfaces/alert/AlertOutfitTab
import { timeText } from '~/utilities/TimeHelper'
import { InstanceOutfitWarsResponseInterface } from '~/interfaces/InstanceOutfitWarsResponseInterface'
import CountdownSpinner from '~/components/common/CountdownSpinner.vue'
import { profileLink } from '~/utilities/ProfileApi'
import { World } from '~/ps2alerts-constants/world'

export default Vue.extend({
name: 'AlertOutfitMetrics',
Expand Down Expand Up @@ -300,6 +312,16 @@ export default Vue.extend({
this.init()
},
methods: {
// Links use the alert's own server; an outfit record's embedded world can be stale
profileHref(type: 'character' | 'outfit', id: string): string {
// The outfitwar prop defaults to a placeholder with no world
const outfitwar = this.outfitwar as { world?: World } | undefined
return profileLink(type, id, this.alert?.world ?? outfitwar?.world)
},
// Outfit ids 0 to 4 are the "no outfit" placeholders
hasOutfit(outfit?: { id: string }): boolean {
return !!outfit && parseInt(outfit.id, 10) > 4
},
reset() {
this.loaded = false
this.clearTimers()
Expand Down
Loading