From 295b4b9f3199db6b11cae789d736cf14ef42edd8 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 10 Mar 2026 10:36:22 +0200 Subject: [PATCH 1/4] adjust logic --- .../Widget/Participants/Team/Roster.lua | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/Roster.lua b/lua/wikis/commons/Widget/Participants/Team/Roster.lua index cd85e116bc0..3faa1a00d82 100644 --- a/lua/wikis/commons/Widget/Participants/Team/Roster.lua +++ b/lua/wikis/commons/Widget/Participants/Team/Roster.lua @@ -46,6 +46,20 @@ local PERSON_TYPE_TO_TAB = { staff = TAB_ENUM.STAFF, } +---@param player table +---@return boolean +local function isStaffMember(player) + local playerType = player.extradata.type + if playerType == 'staff' then + return true + end + if playerType == 'former' then + local roles = player.extradata.roles or {} + return not Array.all(roles, function(role) return role.type ~= RoleUtil.ROLE_TYPE.STAFF end) + end + return false +end + -- The biz logic behind the role display is somewhat complicated. -- There's 2 areas we show the role, left-role and right-role -- * Right-role: @@ -136,7 +150,16 @@ function ParticipantsTeamRoster:render() local tabTypeEnum, tabData = tabTuple[1], tabTuple[2] local tabPlayers = Array.filter(participant.opponent.players or {}, function(player) local personType = player.extradata.type - return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum + if tabTypeEnum == TAB_ENUM.STAFF then + return personType == 'staff' or isStaffMember(player) + elseif tabTypeEnum == TAB_ENUM.FORMER then + return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum and not isStaffMember(player) + else + return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum + end + end) + tabPlayers = Array.sortBy(tabPlayers, function(player) + return player.extradata.type == 'former' and 1 or 0 end) return { order = tabData.order, From d3c9cd97a760b24ffce81922ad4dc3b03a1596bc Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 10 Mar 2026 14:16:11 +0200 Subject: [PATCH 2/4] move all formers to former tab with subheaders --- .../Participants/Team/PotentialQualifiers.lua | 2 +- .../Widget/Participants/Team/Roster.lua | 64 +++++++++++++++++-- stylesheets/commons/TeamParticipantCard.scss | 28 ++++---- 3 files changed, 73 insertions(+), 21 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/PotentialQualifiers.lua b/lua/wikis/commons/Widget/Participants/Team/PotentialQualifiers.lua index 0945255a2ae..e5e5dcea239 100644 --- a/lua/wikis/commons/Widget/Participants/Team/PotentialQualifiers.lua +++ b/lua/wikis/commons/Widget/Participants/Team/PotentialQualifiers.lua @@ -30,7 +30,7 @@ function PotentialQualifiers:render() local children = { Div{ - classes = {'team-participant-card__potential-qualifiers-title'}, + classes = {'team-participant-card__subheader'}, children = 'Potential qualifiers' }, Div{ diff --git a/lua/wikis/commons/Widget/Participants/Team/Roster.lua b/lua/wikis/commons/Widget/Participants/Team/Roster.lua index 3faa1a00d82..c637fcce65c 100644 --- a/lua/wikis/commons/Widget/Participants/Team/Roster.lua +++ b/lua/wikis/commons/Widget/Participants/Team/Roster.lua @@ -124,6 +124,62 @@ function ParticipantsTeamRoster:render() end return orderA < orderB end) + + -- Split into former players and former staff + local formerPlayers = Array.filter(players, function(player) + return player.extradata.type == 'former' and not isStaffMember(player) + end) + local formerStaff = Array.filter(players, function(player) + return player.extradata.type == 'former' and isStaffMember(player) + end) + + -- If we have former players or staff, render with subheaders + if #formerPlayers > 0 or #formerStaff > 0 then + local function makeRosterSection(sectionPlayers) + return Div{ + classes = { 'team-participant-roster' }, + children = Array.map(sectionPlayers, function(player, index) + local playerTeam = participant.opponent.template ~= player.team and player.team or nil + local playerTeamAsOpponent = playerTeam and Opponent.readOpponentArgs{ + type = Opponent.team, + template = playerTeam, + } or nil + local roleLeft, roleRight = getRoleDisplays(player) + return ParticipantsTeamMember{ + player = player, + team = playerTeamAsOpponent, + even = index % 2 == 0, + roleLeft = roleLeft, + roleRight = roleRight, + trophies = player.extradata.trophies or 0, + } + end) + } + end + + local children = {} + if #formerPlayers > 0 then + table.insert(children, Div{ + classes = {'team-participant-card__subheader'}, + children = 'Players' + }) + table.insert(children, makeRosterSection(formerPlayers)) + end + if #formerStaff > 0 then + table.insert(children, Div{ + classes = {'team-participant-card__subheader'}, + children = 'Staff' + }) + table.insert(children, makeRosterSection(formerStaff)) + end + + return Div{ + classes = { 'team-participant-roster' }, + children = children + } + end + + -- Otherwise render as a single roster (for non-former tabs) return Div{ classes = { 'team-participant-roster' }, children = Array.map(players, function(player, index) @@ -140,7 +196,6 @@ function ParticipantsTeamRoster:render() roleLeft = roleLeft, roleRight = roleRight, trophies = player.extradata.trophies or 0, - strikethrough = player.extradata.type == 'former', } end) } @@ -151,16 +206,13 @@ function ParticipantsTeamRoster:render() local tabPlayers = Array.filter(participant.opponent.players or {}, function(player) local personType = player.extradata.type if tabTypeEnum == TAB_ENUM.STAFF then - return personType == 'staff' or isStaffMember(player) + return personType == 'staff' elseif tabTypeEnum == TAB_ENUM.FORMER then - return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum and not isStaffMember(player) + return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum or (personType == 'former' and isStaffMember(player)) else return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum end end) - tabPlayers = Array.sortBy(tabPlayers, function(player) - return player.extradata.type == 'former' and 1 or 0 - end) return { order = tabData.order, title = tabData.title, diff --git a/stylesheets/commons/TeamParticipantCard.scss b/stylesheets/commons/TeamParticipantCard.scss index c202ec485e0..7f0fa6364e9 100644 --- a/stylesheets/commons/TeamParticipantCard.scss +++ b/stylesheets/commons/TeamParticipantCard.scss @@ -427,20 +427,6 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; flex-direction: column; gap: 0.25rem; - &-title { - padding: 0 0.5rem; - font-size: 0.875rem; - font-weight: bold; - - .theme--light & { - color: var( --clr-secondary-25 ); - } - - .theme--dark & { - color: var( --clr-secondary-90 ); - } - } - &-list { display: flex; flex-direction: column; @@ -467,6 +453,20 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; } } } + + &__subheader { + padding: 0 0.5rem; + font-size: 0.875rem; + font-weight: bold; + + .theme--light & { + color: var( --clr-secondary-25 ); + } + + .theme--dark & { + color: var( --clr-secondary-90 ); + } + } } body:has( .switch-toggle-active#{ $compact-selector } ) { From c71372255ff49eb79fc40e84c1971e867f17bee4 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 10 Mar 2026 16:56:46 +0200 Subject: [PATCH 3/4] add a extradata field to preserve the type=former for staff members for the ui --- lua/wikis/commons/TeamParticipants/Parse/Wiki.lua | 2 ++ lua/wikis/commons/Widget/Participants/Team/Roster.lua | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua index fbe9807ba4e..653b96f49dc 100644 --- a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua +++ b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua @@ -203,6 +203,7 @@ function TeamParticipantsWikiParser.parsePlayer(playerInput) local resultsInput = Logic.readBoolOrNil(playerInput.results) local roles = RoleUtil.readRoleArgs(playerInput.role) local playerType = playerInput.type or 'player' + local isFormer = playerType == 'former' local hasNoStaffRoles = Array.all(roles, function(role) return role.type ~= RoleUtil.ROLE_TYPE.STAFF end) @@ -214,6 +215,7 @@ function TeamParticipantsWikiParser.parsePlayer(playerInput) roles = roles, trophies = tonumber(playerInput.trophies), type = playerType, + isFormer = isFormer, played = Logic.nilOr(playedInput, true), results = Logic.nilOr(resultsInput, playedInput, true), } diff --git a/lua/wikis/commons/Widget/Participants/Team/Roster.lua b/lua/wikis/commons/Widget/Participants/Team/Roster.lua index c637fcce65c..8cdf917b32b 100644 --- a/lua/wikis/commons/Widget/Participants/Team/Roster.lua +++ b/lua/wikis/commons/Widget/Participants/Team/Roster.lua @@ -53,10 +53,6 @@ local function isStaffMember(player) if playerType == 'staff' then return true end - if playerType == 'former' then - local roles = player.extradata.roles or {} - return not Array.all(roles, function(role) return role.type ~= RoleUtil.ROLE_TYPE.STAFF end) - end return false end @@ -127,10 +123,10 @@ function ParticipantsTeamRoster:render() -- Split into former players and former staff local formerPlayers = Array.filter(players, function(player) - return player.extradata.type == 'former' and not isStaffMember(player) + return player.extradata.isFormer and not isStaffMember(player) end) local formerStaff = Array.filter(players, function(player) - return player.extradata.type == 'former' and isStaffMember(player) + return player.extradata.isFormer and isStaffMember(player) end) -- If we have former players or staff, render with subheaders @@ -208,7 +204,7 @@ function ParticipantsTeamRoster:render() if tabTypeEnum == TAB_ENUM.STAFF then return personType == 'staff' elseif tabTypeEnum == TAB_ENUM.FORMER then - return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum or (personType == 'former' and isStaffMember(player)) + return player.extradata.isFormer else return PERSON_TYPE_TO_TAB[personType] == tabTypeEnum end From c7ea65d03adb56911e3b54c7df6fceb57921ebeb Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 10 Mar 2026 17:07:33 +0200 Subject: [PATCH 4/4] remove redundant helper function --- .../commons/Widget/Participants/Team/Roster.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/Roster.lua b/lua/wikis/commons/Widget/Participants/Team/Roster.lua index 8cdf917b32b..4b44724d732 100644 --- a/lua/wikis/commons/Widget/Participants/Team/Roster.lua +++ b/lua/wikis/commons/Widget/Participants/Team/Roster.lua @@ -46,16 +46,6 @@ local PERSON_TYPE_TO_TAB = { staff = TAB_ENUM.STAFF, } ----@param player table ----@return boolean -local function isStaffMember(player) - local playerType = player.extradata.type - if playerType == 'staff' then - return true - end - return false -end - -- The biz logic behind the role display is somewhat complicated. -- There's 2 areas we show the role, left-role and right-role -- * Right-role: @@ -123,10 +113,10 @@ function ParticipantsTeamRoster:render() -- Split into former players and former staff local formerPlayers = Array.filter(players, function(player) - return player.extradata.isFormer and not isStaffMember(player) + return player.extradata.isFormer and player.extradata.type ~= 'staff' end) local formerStaff = Array.filter(players, function(player) - return player.extradata.isFormer and isStaffMember(player) + return player.extradata.isFormer and player.extradata.type == 'staff' end) -- If we have former players or staff, render with subheaders