From 50284b6c2e9c6ac9b4604870abf56507911eddce Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Sat, 17 Jun 2023 23:43:07 +0100 Subject: [PATCH] Update team details to have highlight role --- .../src/views/sub-views/TeamPublicDetails.vue | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/website/src/views/sub-views/TeamPublicDetails.vue b/website/src/views/sub-views/TeamPublicDetails.vue index d1aaff8f..aa2c651a 100644 --- a/website/src/views/sub-views/TeamPublicDetails.vue +++ b/website/src/views/sub-views/TeamPublicDetails.vue @@ -10,19 +10,22 @@ - + {{ player?.name }} {{ player?.name }} {{ player?.discord_tag }} {{ player?.battletag }} - + - + - {{ staff?.name }} + + + {{ staff?.name }} + {{ staff?.discord_tag }} {{ staff?.battletag }} @@ -57,8 +60,13 @@ export default { }); }, staff() { - if (this.team?.staff?.length) return this.team.staff; - return this.team.limited_players.filter(p => p.name && p.role === "Staff").map(p => ({ ...p, limited: true })); + let staff = this.team.staff; + if (!staff?.length) staff = (this.team.limited_players || []).filter(p => p.name && p.role === "Staff").map(p => ({ ...p, limited: true })); + return (staff || []).sort((a, b) => { + if ((a.is_captain || a.highlight_role) === (b.is_captain || b.highlight_role)) return 0; + if ((a.is_captain || a.highlight_role)) return -1; + if ((b.is_captain || b.highlight_role)) return 1; + }); } }, methods: {