Skip to content

Commit

Permalink
Merge pull request #92 from JJ1898/player-history-scene
Browse files Browse the repository at this point in the history
Add Player History Scene
  • Loading branch information
slmnio authored Jan 18, 2022
2 parents 851b9fe + 7c69af4 commit ced7f3b
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 16 deletions.
78 changes: 78 additions & 0 deletions website/src/components/broadcast/PlayerHero.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<div class="hero-card d-flex flex-column flex-center" v-if="hero">
<div class="hero-top h-100 flex-center flex-column">
<div class="hero-card-title d-flex flex-column flex-center">Favorite Hero</div>
<div class="hero-name py-2 d-flex flex-row text-center flex-center font-weight-bold">
<span v-if="roleIcon" class="hero-icon" v-html="roleIcon"></span>
<span class="hero-real-name">{{ heroName }}</span>
</div>
<div class="hero-role d-flex flex-row text-center">{{ heroRole }}</div>
</div>
<div class="hero-portrait d-flex flex-row flex-center" v-if="heroPortraitURL">
<img :src="heroPortraitURL"/>
</div>
</div>
</template>

<script>
import { getRoleSVG } from "@/utils/content-utils";
export default {
name: "PlayerHero",
props: ["hero"],
computed: {
heroName() {
return this.hero?.name || null;
},
heroRole() {
if (!this.hero?.name) return null;
return this.hero.role;
},
roleIcon() {
return getRoleSVG(this.heroRole);
},
heroPortraitURL() {
return this.hero?.main_image?.[0]?.url;
}
},
methods: {
getRoleSVG
}
};
</script>
<style scoped>
.hero-top {
flex-grow: 1;
}
.hero-card-title {
font-size: 1.5em;
}
.hero-name {
font-size: 3em;
line-height: 1;
}
.hero-role {
font-size: 1.2em;
}
.hero-icon {
margin-right: 0.05em;
height: 1em;
width: 1em;
}
.hero-icon >>> svg {
vertical-align: text-bottom;
}
.hero-portrait {
height: 547px;
width: 296px;
}
</style>
126 changes: 126 additions & 0 deletions website/src/components/broadcast/PlayerHistory.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<template>
<GenericOverlay class="player-history-overlay" :title="customTitle">
<div class="career-wrapper d-flex flex-center">
<div class="hero-segment d-flex flex-column flex-center" v-if="hero">
<div class="hero-card h-100 d-flex flex-column">
<PlayerHero class="h-100" :hero="hero"></PlayerHero>
</div>
</div>
<div class="teams-wrapper flex-column flex-center">
<div class="first-event d-flex flex-center mb-3" v-if="firstEvent">
<div class="first-event-text mr-3">First event</div>
<NewEventDisplay :event="firstEvent"/>
</div>

<div class="title d-flex flex-column text-center mb-2">Team History</div>
<div class="player-teams d-flex flex-wrap flex-center">
<PlayerTeamDisplay :team="team" v-for="team in playerTeams" v-bind:key="team.id" :showName="true"/>
</div>
</div>
</div>
</GenericOverlay>
</template>

<script>
import GenericOverlay from "@/components/broadcast/roots/GenericOverlay";
import { sortEvents } from "@/utils/sorts";
import { ReactiveArray, ReactiveRoot, ReactiveThing } from "@/utils/reactive";
import PlayerTeamDisplay from "@/components/broadcast/auction/PlayerTeamDisplay";
import PlayerHero from "@/components/broadcast/PlayerHero";
import NewEventDisplay from "@/views/lists/NewEventDisplay";
export default {
name: "PlayerHistory",
components: { PlayerTeamDisplay, GenericOverlay, PlayerHero, NewEventDisplay },
props: ["title", "broadcast", "showMinor", "britishSpelling"],
computed: {
customTitle() {
if (this.player?.name) return (this.player.name + "'s Career");
return "Player Career";
},
highlightedPlayerID() {
if (!this.broadcast?.highlight_player?.length) return null;
return this.broadcast?.highlight_player[0];
},
player() {
return ReactiveRoot(this.highlightedPlayerID, {
member_of: ReactiveArray("member_of", {
theme: ReactiveThing("theme"),
event: ReactiveThing("event", {
theme: ReactiveThing("theme")
})
})
});
},
hero() {
if (!this.player?.favourite_hero) return null;
return ReactiveRoot(this.player?.favourite_hero[0]); // british spelling MyEyes
},
playerTeams() {
if (!this.player?.member_of) return [];
return this.player.member_of.filter(t => {
if (!t) return;
if (!t.event) return;
if (!this.showMinor && t.minor_team) return false;
// if (!t.ranking_sort) return false;
return true;
}).sort((a, b) => sortEvents(a.event, b.event));
},
firstEvent() {
const events = [...(this.player?.member_of || [])]
.map(t => t.event)
.filter(e => e?.start_date)
.sort(sortEvents);
return events[0];
}
// TODO: Get a list of all events a player has participated in, sort by date, and display the start date of the earliest event as "Player Since"
}
};
</script>
<style scoped>
.player-history-overlay >>> .generic-overlay-body {
padding: 0;
}
.career-wrapper {
height: 100%;
width: 100%;
}
.hero-segment {
overflow: hidden;
height: 740px;
width: 296px;
flex-shrink: 0;
background-color: rgba(0, 0, 0, .2);
}
.teams-wrapper {
min-width: 900px;
flex-grow: 1;
padding: 0 50px;
}
.teams-label {
float: top;
}
.teams-wrapper >>> .player-team-display,
.teams-wrapper >>> .team-name {
width: 176px;
}
.teams-wrapper .title {
font-size: 3em;
font-weight: bold;
text-transform: uppercase;
}
.first-event {
font-size: 1.25em;
}
.first-event-text {
font-size: 1.2em;
font-weight: bold;
}
.first-event >>> .event-name {
margin: 0 0.3em 0 0 !important;
}
.player-teams {
max-height: 530px;
overflow: hidden;
}
</style>
27 changes: 19 additions & 8 deletions website/src/components/broadcast/auction/PlayerTeamDisplay.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<template>
<div class="player-team-display d-flex" :style="teamBG">
<div class="team-logo box flex-center">
<div class="team-logo-inner bg-center" :style="teamLogo"></div>
<div class="event-logo-inner bg-center" :style="eventLogo"></div>
</div>
<div class="team-rank box flex-center">
<div class="ranking-text">{{ team.ranking_text }}</div>
<div class="player-team-display d-flex flex-column" :style="teamBG">
<div class="team-name flex-center text-center font-weight-bold" v-if="showName">{{ team.name }}</div>
<div class="team-full-box d-flex">
<div class="team-logo box flex-center">
<div class="team-logo-inner bg-center" :style="teamLogo"></div>
<div class="event-logo-inner bg-center" :style="eventLogo"></div>
</div>
<div class="team-rank box flex-center">
<div class="ranking-text">{{ rankingText }}</div>
</div>
</div>
</div>
</template>
Expand All @@ -16,7 +19,7 @@ import { cssImage } from "@/utils/content-utils";
export default {
name: "PlayerTeamDisplay",
props: ["team"],
props: ["team", "showName"],
computed: {
teamBG() {
return logoBackground1(this.team);
Expand All @@ -26,12 +29,20 @@ export default {
},
eventLogo() {
return cssImage("backgroundImage", this.team?.event?.theme, ["small_logo", "default_logo"], 100);
},
rankingText() {
if (!this.team?.ranking_text) return "N/A";
return this.team?.ranking_text;
}
}
};
</script>
<style scoped>
.team-name {
line-height: .8;
min-height: 28px;
}
.player-team-display {
margin: .5em;
}
Expand Down
4 changes: 3 additions & 1 deletion website/src/router/broadcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import SeasonHistoryOverlay from "@/components/broadcast/roots/SeasonHistoryOver
import IframeOverlay from "@/components/broadcast/roots/IframeOverlay";
import TallyTransmitter from "@/components/broadcast/roots/TallyTransmitter";
import TallyViewer from "@/components/broadcast/roots/TallyViewer";
import PlayerHistory from "@/components/broadcast/PlayerHistory";

export default [
{ path: "ingame", component: IngameOverlay, props: route => ({ codes: route.query.codes }) },
Expand Down Expand Up @@ -86,5 +87,6 @@ export default [
{ path: "auction", component: AuctionOverlay, props: route => ({ category: route.query.category }) },
{ path: "ad-read", component: AdReadOverlay, props: route => ({ extraDelay: route.query.delay }) },
{ path: "logos", component: LogoAdOverlay },
{ path: "staff", component: StaffOverlay }
{ path: "staff", component: StaffOverlay },
{ path: "player-history", component: PlayerHistory, props: route => ({ showMinor: route.query.minor }) }
];
14 changes: 7 additions & 7 deletions website/src/views/lists/NewEventDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,30 @@ export default {

<style scoped>
.event {
border-bottom-width: 4px;
border-bottom-width: .25em;
border-bottom-style: solid;
min-height: 58px;
}
.event:hover {
color: inherit;
}
.event-block {
width: 50px;
height: 40px;
width: 3em;
height: 2.5em;
flex-shrink: 0;
margin-right: 2px;
margin-right: .125em;
}
.event {
align-items: center;
}
.event-block-logo {
width: calc(100% - 8px);
height: calc(100% - 6px);
width: calc(100% - .5em);
height: calc(100% - .3em);
}
.event-name {
font-size: 1.2em;
line-height: 1;
margin: 0 4px 4px 0;
margin: 0 .25em .25em 0;
}
.event.team-display .event-name {
font-weight: bold;
Expand Down

0 comments on commit ced7f3b

Please sign in to comment.