From 2358b970b14bd4cae293c719e643370a3115b1ad Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:37:57 +0900 Subject: [PATCH 1/7] props type annotation --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index cbcde9019ca..9bf0e922d81 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -19,6 +19,7 @@ local Switch = Lua.import('Module:Widget/Switch') ---@class ParticipantsTeamCardsGroup: Widget ---@operator call(table): ParticipantsTeamCardsGroup +---@field props {participants: TeamParticipant[]} local ParticipantsTeamCardsGroup = Class.new(Widget) ---@return Widget? From 7a4c89b3c00f2c9eeb7213fdcc8c797752f5a121 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:38:06 +0900 Subject: [PATCH 2/7] add groups support --- .../commons/TeamParticipants/Parse/Wiki.lua | 3 +- .../Widget/Participants/Team/CardsGroup.lua | 38 ++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua index 382aaa0e53a..e55755f61a4 100644 --- a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua +++ b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua @@ -23,7 +23,7 @@ local TeamParticipantsWikiParser = {} ---@alias TeamParticipant {opponent: standardOpponent, notes: {text: string, highlighted: boolean}[], aliases: string[], ---qualification: QualificationStructure?, shouldImportFromDb: boolean, date: integer, ----potentialQualifiers: standardOpponent[]?, warnings: string[]?} +---potentialQualifiers: standardOpponent[]?, warnings: string[]?, participantGroup: string?} ---@alias QualificationMethod 'invite'|'qual' ---@alias QualificationType 'tournament'|'external'|'other' @@ -183,6 +183,7 @@ function TeamParticipantsWikiParser.parseParticipant(input, defaultDate) potentialQualifiers = potentialQualifiers, warnings = warnings, shouldImportFromDb = Logic.readBool(input.import), + participantGroup = String.nilIfEmpty(input.group), date = date, } end diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 9bf0e922d81..7ee83f43c4f 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -9,6 +9,9 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') +local Logic = Lua.import('Module:Logic') +local Operator = Lua.import('Module:Operator') +local Tabs = Lua.import('Module:Tabs') local Widget = Lua.import('Module:Widget') local AnalyticsWidget = Lua.import('Module:Widget/Analytics') @@ -29,6 +32,15 @@ function ParticipantsTeamCardsGroup:render() return end + local participantGroups = Array.groupBy(participants, Operator.property('participantGroup')) + + local tabArgs = {} + + Array.forEach(participantGroups, function (group, groupIndex) + tabArgs['name' .. groupIndex] = Logic.emptyOr(group[1].participantGroup, 'Unnamed') + tabArgs['content' .. groupIndex] = ParticipantsTeamCardsGroup._createParticipantGroup(group) + end) + return Div{ classes = { 'team-participant' }, children = { @@ -60,17 +72,23 @@ function ParticipantsTeamCardsGroup:render() } } }, - AnalyticsWidget{ - analyticsName = 'Team participants card', - children = Div{ - classes = { 'team-participant__grid' }, - children = Array.map(participants, function(participant) - return ParticipantsTeamCard{ - participant = participant, - } - end), + Tabs.dynamic(tabArgs) + } + } +end + +---@private +---@param participantGroup TeamParticipant[] +function ParticipantsTeamCardsGroup._createParticipantGroup(participantGroup) + AnalyticsWidget{ + analyticsName = 'Team participants card', + children = Div{ + classes = { 'team-participant__grid' }, + children = Array.map(participantGroup, function(participant) + return ParticipantsTeamCard{ + participant = participant, } - } + end), } } end From 9288bfca47104cfb999aaaf1558c4dec71d00583 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:41:40 +0900 Subject: [PATCH 3/7] add return keyword --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 7ee83f43c4f..09dffd241da 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -80,7 +80,7 @@ end ---@private ---@param participantGroup TeamParticipant[] function ParticipantsTeamCardsGroup._createParticipantGroup(participantGroup) - AnalyticsWidget{ + return AnalyticsWidget{ analyticsName = 'Team participants card', children = Div{ classes = { 'team-participant__grid' }, From 74062a97089cd4935831e4b5b8c9c14c73fc9989 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:56:51 +0900 Subject: [PATCH 4/7] handle nil --- lua/wikis/commons/TeamParticipants/Parse/Wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua index e55755f61a4..f4054a064aa 100644 --- a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua +++ b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua @@ -183,7 +183,7 @@ function TeamParticipantsWikiParser.parseParticipant(input, defaultDate) potentialQualifiers = potentialQualifiers, warnings = warnings, shouldImportFromDb = Logic.readBool(input.import), - participantGroup = String.nilIfEmpty(input.group), + participantGroup = String.nilIfEmpty(input.group) or '', date = date, } end From f6c9f2250d92d8b6bf0a319da0272b917c3eec0a Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 12:00:47 +0900 Subject: [PATCH 5/7] suppress header for single group --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 09dffd241da..924fa5cbf61 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -40,6 +40,7 @@ function ParticipantsTeamCardsGroup:render() tabArgs['name' .. groupIndex] = Logic.emptyOr(group[1].participantGroup, 'Unnamed') tabArgs['content' .. groupIndex] = ParticipantsTeamCardsGroup._createParticipantGroup(group) end) + tabArgs.suppressHeader = true return Div{ classes = { 'team-participant' }, From 0fe96cdcb7c2b9f9236368ceff938f653c4ad694 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 12:04:01 +0900 Subject: [PATCH 6/7] remove redundant nilIfEmpty --- lua/wikis/commons/TeamParticipants/Parse/Wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua index f4054a064aa..34eedb2b0c0 100644 --- a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua +++ b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua @@ -183,7 +183,7 @@ function TeamParticipantsWikiParser.parseParticipant(input, defaultDate) potentialQualifiers = potentialQualifiers, warnings = warnings, shouldImportFromDb = Logic.readBool(input.import), - participantGroup = String.nilIfEmpty(input.group) or '', + participantGroup = input.group or '', date = date, } end From 11a9368c49562d6ae38560dbee436aacc467220b Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Wed, 21 Jan 2026 12:06:43 +0900 Subject: [PATCH 7/7] update type annotation participantGroup may be empty, but never nil --- lua/wikis/commons/TeamParticipants/Parse/Wiki.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua index 34eedb2b0c0..b0c26746b25 100644 --- a/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua +++ b/lua/wikis/commons/TeamParticipants/Parse/Wiki.lua @@ -23,7 +23,7 @@ local TeamParticipantsWikiParser = {} ---@alias TeamParticipant {opponent: standardOpponent, notes: {text: string, highlighted: boolean}[], aliases: string[], ---qualification: QualificationStructure?, shouldImportFromDb: boolean, date: integer, ----potentialQualifiers: standardOpponent[]?, warnings: string[]?, participantGroup: string?} +---potentialQualifiers: standardOpponent[]?, warnings: string[]?, participantGroup: string} ---@alias QualificationMethod 'invite'|'qual' ---@alias QualificationType 'tournament'|'external'|'other'