Skip to content
Open
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
10 changes: 6 additions & 4 deletions lua/wikis/commons/Widget/Participants/Team/Roster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ end
-- * Right-role:
-- * If the person has a specific status (did not play/former), display it first
-- * If there's a non-ingame role assigned, display it after the status
-- * Displays the remaining ingame roles (which are not displayed on the left) also.
-- * Returns an array of labels to display (can be multiple)
-- * Left-role:
-- * If the first role has an icon, we use that to render the left-role
-- * If not then we instead display the icon or text of the first ingame role
-- * If not then we instead display the icon of the first ingame role with icon
---@param player table
---@return string?, string[]?
local function getRoleDisplays(player)
Expand All @@ -69,8 +70,8 @@ local function getRoleDisplays(player)
return firstRole.icon
end
for _, role in ipairs(roles) do
if role.type == RoleUtil.ROLE_TYPE.INGAME then
return role.icon or role.display
if role.type == RoleUtil.ROLE_TYPE.INGAME and role.icon then
return role.icon
end
end
end
Expand All @@ -84,7 +85,7 @@ local function getRoleDisplays(player)
end
-- Add non-ingame role if present
for _, role in ipairs(roles) do
if role.type ~= RoleUtil.ROLE_TYPE.INGAME then
if role.type ~= RoleUtil.ROLE_TYPE.INGAME or not role.icon then
table.insert(rightRoles, role.display)
break
end
Expand Down Expand Up @@ -138,6 +139,7 @@ function ParticipantsTeamRoster:render()
end

---@param groups {label: string?, players: table[]}[]
---@return Widget
local makeRostersDisplay = function(groups)
local children = {}
for _, group in ipairs(groups) do
Expand Down
Loading