From a90331f670ead8d250821d5a6cdbaa2ff75fad47 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 16:23:44 +0200 Subject: [PATCH 01/26] add controls --- .../Widget/Participants/Team/CardsGroup.lua | 9 ++- .../Participants/Team/ParticipantControls.lua | 59 +++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index cbcde9019ca..cce93d37bb4 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -9,6 +9,7 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') +local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Widget = Lua.import('Module:Widget') local AnalyticsWidget = Lua.import('Module:Widget/Analytics') @@ -17,6 +18,8 @@ local Div = HtmlWidgets.Div local ParticipantsTeamCard = Lua.import('Module:Widget/Participants/Team/Card') local Switch = Lua.import('Module:Widget/Switch') +local globalVars = PageVariableNamespace() + ---@class ParticipantsTeamCardsGroup: Widget ---@operator call(table): ParticipantsTeamCardsGroup local ParticipantsTeamCardsGroup = Class.new(Widget) @@ -28,10 +31,12 @@ function ParticipantsTeamCardsGroup:render() return end + local showSwitches = not globalVars:get('teamParticipantControlsRendered') + return Div{ classes = { 'team-participant' }, children = { - Div{ + showSwitches and Div{ classes = { 'team-participant__switches' }, children = { AnalyticsWidget{ @@ -58,7 +63,7 @@ function ParticipantsTeamCardsGroup:render() }, } } - }, + } or nil, AnalyticsWidget{ analyticsName = 'Team participants card', children = Div{ diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua new file mode 100644 index 00000000000..887e671102c --- /dev/null +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -0,0 +1,59 @@ +--- +-- @Liquipedia +-- page=Module:Widget/Participants/Team/ParticipantControls +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Lua = require('Module:Lua') + +local Class = Lua.import('Module:Class') +local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') + +local Widget = Lua.import('Module:Widget') +local AnalyticsWidget = Lua.import('Module:Widget/Analytics') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local Div = HtmlWidgets.Div +local Switch = Lua.import('Module:Widget/Switch') + +local globalVars = PageVariableNamespace() + +---@class ParticipantsTeamParticipantControls: Widget +---@operator call(table): ParticipantsTeamParticipantControls +local ParticipantsTeamParticipantControls = Class.new(Widget) + +---@return Widget? +function ParticipantsTeamParticipantControls:render() + globalVars:set('teamParticipantControlsRendered', 'true') + + return Div{ + classes = { 'team-participant__controls' }, + children = { + AnalyticsWidget{ + analyticsName = 'ParticipantsShowRostersSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants show rosters', + }, + children = Switch{ + label = 'Show rosters', + switchGroup = 'team-cards-show-rosters', + defaultActive = false, + collapsibleSelector = '.team-participant-card', + }, + }, + AnalyticsWidget{ + analyticsName = 'ParticipantsCompactSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants compact', + }, + children = Switch{ + label = 'Compact view', + switchGroup = 'team-cards-compact', + defaultActive = true, + }, + } + } + } +end + +return ParticipantsTeamParticipantControls From 995b8d60926819df00e3d9e231cd359dda45d3f1 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 20:02:54 +0200 Subject: [PATCH 02/26] fix building --- .../Widget/Participants/Team/CardsGroup.lua | 87 ++++++++++--------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index cce93d37bb4..6f29081cac3 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -33,49 +33,58 @@ function ParticipantsTeamCardsGroup:render() local showSwitches = not globalVars:get('teamParticipantControlsRendered') - return Div{ - classes = { 'team-participant' }, - children = { - showSwitches and Div{ - classes = { 'team-participant__switches' }, - children = { - AnalyticsWidget{ - analyticsName = 'ParticipantsShowRostersSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants show rosters', - }, - children = Switch{ - label = 'Show rosters', - switchGroup = 'team-cards-show-rosters', - defaultActive = false, - collapsibleSelector = '.team-participant-card', - }, + local switches + if showSwitches then + switches = Div{ + classes = { 'team-participant__switches' }, + children = { + AnalyticsWidget{ + analyticsName = 'ParticipantsShowRostersSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants show rosters', + }, + children = Switch{ + label = 'Show rosters', + switchGroup = 'team-cards-show-rosters', + defaultActive = false, + collapsibleSelector = '.team-participant-card', + }, + }, + AnalyticsWidget{ + analyticsName = 'ParticipantsCompactSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants compact', + }, + children = Switch{ + label = 'Compact view', + switchGroup = 'team-cards-compact', + defaultActive = true, }, - AnalyticsWidget{ - analyticsName = 'ParticipantsCompactSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants compact', - }, - children = Switch{ - label = 'Compact view', - switchGroup = 'team-cards-compact', - defaultActive = true, - }, - } - } - } or nil, - AnalyticsWidget{ - analyticsName = 'Team participants card', - children = Div{ - classes = { 'team-participant__grid' }, - children = Array.map(participants, function(participant) - return ParticipantsTeamCard{ - participant = participant, - } - end), } } } + end + + local children = { + switches, + AnalyticsWidget{ + analyticsName = 'Team participants card', + children = Div{ + classes = { 'team-participant__grid' }, + children = Array.map(participants, function(participant) + return ParticipantsTeamCard{ + participant = participant, + } + end), + } + } + } + + children = Array.filter(children, function(child) return child ~= nil end) + + return Div{ + classes = { 'team-participant' }, + children = children } end From aa884f9ae0a566fc4c7f9fbbce16f6821c77e278 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 20:14:32 +0200 Subject: [PATCH 03/26] debug logs --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 5 ++++- .../commons/Widget/Participants/Team/ParticipantControls.lua | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 6f29081cac3..a5d361c74bb 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -31,7 +31,10 @@ function ParticipantsTeamCardsGroup:render() return end - local showSwitches = not globalVars:get('teamParticipantControlsRendered') + local controlsRendered = globalVars:get('teamParticipantControlsRendered') + mw.log('CardsGroup DEBUG: teamParticipantControlsRendered =', controlsRendered) + local showSwitches = not controlsRendered + mw.log('CardsGroup DEBUG: showSwitches =', showSwitches) local switches if showSwitches then diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 887e671102c..2247cf943fe 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -24,7 +24,11 @@ local ParticipantsTeamParticipantControls = Class.new(Widget) ---@return Widget? function ParticipantsTeamParticipantControls:render() + local title = mw.title.getCurrentTitle().fullText + mw.log('ParticipantControls DEBUG: rendering on page:', title) globalVars:set('teamParticipantControlsRendered', 'true') + mw.log('ParticipantControls DEBUG: set teamParticipantControlsRendered = true') + mw.log('ParticipantControls DEBUG: verifying:', globalVars:get('teamParticipantControlsRendered')) return Div{ classes = { 'team-participant__controls' }, From 6b9af452e14913b01126e2da01868bdf02957736 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 20:17:41 +0200 Subject: [PATCH 04/26] more debugs --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index a5d361c74bb..03126a580c9 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -85,10 +85,16 @@ function ParticipantsTeamCardsGroup:render() children = Array.filter(children, function(child) return child ~= nil end) - return Div{ + mw.log('CardsGroup DEBUG: children count =', #children) + mw.log('CardsGroup DEBUG: children[1] =', children[1]) + mw.log('CardsGroup DEBUG: children[2] =', children[2]) + + local result = Div{ classes = { 'team-participant' }, children = children } + mw.log('CardsGroup DEBUG: Div returned successfully') + return result end return ParticipantsTeamCardsGroup From 620c6b2120e4229cc2c88a44559d63e213294f9e Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 20:26:37 +0200 Subject: [PATCH 05/26] use table --- .../Widget/Participants/Team/CardsGroup.lua | 44 +++++++------------ .../Participants/Team/ParticipantControls.lua | 4 -- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 03126a580c9..2621153921f 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -31,14 +31,11 @@ function ParticipantsTeamCardsGroup:render() return end - local controlsRendered = globalVars:get('teamParticipantControlsRendered') - mw.log('CardsGroup DEBUG: teamParticipantControlsRendered =', controlsRendered) - local showSwitches = not controlsRendered - mw.log('CardsGroup DEBUG: showSwitches =', showSwitches) + local showSwitches = not globalVars:get('teamParticipantControlsRendered') - local switches + local children = {} if showSwitches then - switches = Div{ + table.insert(children, Div{ classes = { 'team-participant__switches' }, children = { AnalyticsWidget{ @@ -65,36 +62,25 @@ function ParticipantsTeamCardsGroup:render() }, } } - } + }) end - local children = { - switches, - AnalyticsWidget{ - analyticsName = 'Team participants card', - children = Div{ - classes = { 'team-participant__grid' }, - children = Array.map(participants, function(participant) - return ParticipantsTeamCard{ - participant = participant, - } - end), - } + table.insert(children, AnalyticsWidget{ + analyticsName = 'Team participants card', + children = Div{ + classes = { 'team-participant__grid' }, + children = Array.map(participants, function(participant) + return ParticipantsTeamCard{ + participant = participant, + } + end), } - } - - children = Array.filter(children, function(child) return child ~= nil end) - - mw.log('CardsGroup DEBUG: children count =', #children) - mw.log('CardsGroup DEBUG: children[1] =', children[1]) - mw.log('CardsGroup DEBUG: children[2] =', children[2]) + }) - local result = Div{ + return Div{ classes = { 'team-participant' }, children = children } - mw.log('CardsGroup DEBUG: Div returned successfully') - return result end return ParticipantsTeamCardsGroup diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 2247cf943fe..887e671102c 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -24,11 +24,7 @@ local ParticipantsTeamParticipantControls = Class.new(Widget) ---@return Widget? function ParticipantsTeamParticipantControls:render() - local title = mw.title.getCurrentTitle().fullText - mw.log('ParticipantControls DEBUG: rendering on page:', title) globalVars:set('teamParticipantControlsRendered', 'true') - mw.log('ParticipantControls DEBUG: set teamParticipantControlsRendered = true') - mw.log('ParticipantControls DEBUG: verifying:', globalVars:get('teamParticipantControlsRendered')) return Div{ classes = { 'team-participant__controls' }, From e9e336e16e1386e359627a9a5a4964d5ccd3e033 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 20:47:49 +0200 Subject: [PATCH 06/26] test compact mode --- .../Widget/Participants/Team/CardsGroup.lua | 2 +- stylesheets/commons/TeamParticipantCard.scss | 104 +++++++++--------- 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 2621153921f..30d3979a0b6 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -36,7 +36,7 @@ function ParticipantsTeamCardsGroup:render() local children = {} if showSwitches then table.insert(children, Div{ - classes = { 'team-participant__switches' }, + classes = { 'team-participant__controls' }, children = { AnalyticsWidget{ analyticsName = 'ParticipantsShowRostersSwitch', diff --git a/stylesheets/commons/TeamParticipantCard.scss b/stylesheets/commons/TeamParticipantCard.scss index 60b03c36ce2..42548202afd 100644 --- a/stylesheets/commons/TeamParticipantCard.scss +++ b/stylesheets/commons/TeamParticipantCard.scss @@ -43,7 +43,7 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; gap: 0.5rem; } -.team-participant__switches { +.team-participant__controls { display: flex; gap: 0.5rem; } @@ -138,12 +138,12 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; $participant-icon-size-expanded ); - @media ( max-width: 767px ) { - @include set-participant-icon-size( - $participant-icon-wrapper-size-mobile, - $participant-icon-size-mobile - ); - } + @media ( max-width: 767px ) { + @include set-participant-icon-size( + $participant-icon-wrapper-size-mobile, + $participant-icon-size-mobile + ); + } } } } @@ -468,65 +468,67 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; } } -.team-participant:has( .switch-toggle-active#{ $compact-selector } ) { - .team-participant-card { - &__opponent--square-icon { - .team-template-image-icon, - .league-icon-small-image { - @include set-participant-icon-size( - $participant-icon-wrapper-size-compact, - $participant-icon-size-compact - ); - - @media ( max-width: 767px ) { +body:has( .switch-toggle-active#{ $compact-selector } ) { + .team-participant { + .team-participant-card { + &__opponent--square-icon { + .team-template-image-icon, + .league-icon-small-image { @include set-participant-icon-size( - $participant-icon-wrapper-size-mobile, - $participant-icon-size-mobile + $participant-icon-wrapper-size-compact, + $participant-icon-size-compact ); + + @media ( max-width: 767px ) { + @include set-participant-icon-size( + $participant-icon-wrapper-size-mobile, + $participant-icon-size-mobile + ); + } } } - } - - &__opponent-compact { - display: flex; - } - &__opponent-full { - display: none; - } + &__opponent-compact { + display: flex; + } - &__header { - position: static; - flex-direction: row; - width: auto; + &__opponent-full { + display: none; + } - .general-collapsible-default-toggle { + &__header { position: static; - top: initial; - right: initial; - transform: none; + flex-direction: row; + width: auto; + + .general-collapsible-default-toggle { + position: static; + top: initial; + right: initial; + transform: none; + } } - } - &__header-main { - display: contents; - } + &__header-main { + display: contents; + } - &__opponent { - flex-direction: row; - gap: 0.5rem; + &__opponent { + flex-direction: row; + gap: 0.5rem; - .team-template-text { - font-size: initial; + .team-template-text { + font-size: initial; + } } - } - &__qualifier--header { - display: none; - } + &__qualifier--header { + display: none; + } - &__qualifier--content { - display: flex; + &__qualifier--content { + display: flex; + } } } } From 77b522d38d883d1082ff980cc6b2ab32d3a359e7 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:07:31 +0200 Subject: [PATCH 07/26] add player info button --- .../Participants/Team/ParticipantControls.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 887e671102c..e4fa44b736c 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -12,9 +12,12 @@ local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Widget = Lua.import('Module:Widget') local AnalyticsWidget = Lua.import('Module:Widget/Analytics') +local Button = Lua.import('Module:Widget/Basic/Button') local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Div = HtmlWidgets.Div +local Icon = Lua.import('Module:Widget/Image/Icon/Fontawesome') local Switch = Lua.import('Module:Widget/Switch') +local WidgetUtil = Lua.import('Module:Widget/Util') local globalVars = PageVariableNamespace() @@ -26,9 +29,26 @@ local ParticipantsTeamParticipantControls = Class.new(Widget) function ParticipantsTeamParticipantControls:render() globalVars:set('teamParticipantControlsRendered', 'true') + local pageName = mw.title.getCurrentTitle().fullText + local link = mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { + pfRunQueryFormName = 'Tournament player information', + ['TPI[page]'] = pageName, + wpRunQuery = 'Run query' + }) + return Div{ classes = { 'team-participant__controls' }, children = { + Button{ + title = 'Click for additional player information', + variant = 'secondary', + size = 'sm', + link = link, + children = WidgetUtil.collect( + Icon{iconName = 'link'}, + 'Player Info' + ) + }, AnalyticsWidget{ analyticsName = 'ParticipantsShowRostersSwitch', analyticsProperties = { From 25bbfc659de9dc3c533d9b347ad344079d82d5e9 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:11:56 +0200 Subject: [PATCH 08/26] fix link --- .../commons/Widget/Participants/Team/ParticipantControls.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index e4fa44b736c..794a93a71ee 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -30,11 +30,11 @@ function ParticipantsTeamParticipantControls:render() globalVars:set('teamParticipantControlsRendered', 'true') local pageName = mw.title.getCurrentTitle().fullText - local link = mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { + local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { pfRunQueryFormName = 'Tournament player information', ['TPI[page]'] = pageName, wpRunQuery = 'Run query' - }) + })) return Div{ classes = { 'team-participant__controls' }, From eda0a3258c60eb8556baf561b65195e4bebec00c Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:15:06 +0200 Subject: [PATCH 09/26] external link --- .../commons/Widget/Participants/Team/ParticipantControls.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 794a93a71ee..5bb368c71e5 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -43,6 +43,7 @@ function ParticipantsTeamParticipantControls:render() title = 'Click for additional player information', variant = 'secondary', size = 'sm', + linktype = 'external', link = link, children = WidgetUtil.collect( Icon{iconName = 'link'}, From cb9b6fdea57d6768d22271b95829cdb56a2f1892 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:24:12 +0200 Subject: [PATCH 10/26] fix icon and style --- .../Widget/Participants/Team/ParticipantControls.lua | 2 +- stylesheets/commons/TeamParticipantCard.scss | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 5bb368c71e5..3af5e7d4441 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -46,7 +46,7 @@ function ParticipantsTeamParticipantControls:render() linktype = 'external', link = link, children = WidgetUtil.collect( - Icon{iconName = 'link'}, + Icon{iconName = 'internal_link'}, 'Player Info' ) }, diff --git a/stylesheets/commons/TeamParticipantCard.scss b/stylesheets/commons/TeamParticipantCard.scss index 42548202afd..062226e7726 100644 --- a/stylesheets/commons/TeamParticipantCard.scss +++ b/stylesheets/commons/TeamParticipantCard.scss @@ -46,6 +46,7 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; .team-participant__controls { display: flex; gap: 0.5rem; + align-items: center; } .team-participant__grid { @@ -138,12 +139,12 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; $participant-icon-size-expanded ); - @media ( max-width: 767px ) { - @include set-participant-icon-size( - $participant-icon-wrapper-size-mobile, + @media ( max-width: 767px ) { + @include set-participant-icon-size( + $participant-icon-wrapper-size-mobile, $participant-icon-size-mobile ); - } + } } } } From 90cb7eeeeacd3bdc78beb81ec232e679c0ffae8a Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:32:57 +0200 Subject: [PATCH 11/26] make player info button optional --- .../Participants/Team/ParticipantControls.lua | 82 +++++++++++-------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 3af5e7d4441..a2984ebf0ae 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -7,6 +7,7 @@ local Lua = require('Module:Lua') +local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') @@ -34,47 +35,56 @@ function ParticipantsTeamParticipantControls:render() pfRunQueryFormName = 'Tournament player information', ['TPI[page]'] = pageName, wpRunQuery = 'Run query' - })) + }) - return Div{ - classes = { 'team-participant__controls' }, - children = { - Button{ - title = 'Click for additional player information', - variant = 'secondary', - size = 'sm', - linktype = 'external', - link = link, - children = WidgetUtil.collect( - Icon{iconName = 'internal_link'}, - 'Player Info' - ) + local playerInfoButton + if self.props.playerinfo then + playerInfoButton = Button{ + title = 'Click for additional player information', + variant = 'secondary', + size = 'sm', + linktype = 'external', + link = link, + children = WidgetUtil.collect( + Icon{iconName = 'internal_link'}, + 'Player Info' + ) + } + end + + local children = { + playerInfoButton, + AnalyticsWidget{ + analyticsName = 'ParticipantsShowRostersSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants show rosters', + }, + children = Switch{ + label = 'Show rosters', + switchGroup = 'team-cards-show-rosters', + defaultActive = false, + collapsibleSelector = '.team-participant-card', + }, + }, + AnalyticsWidget{ + analyticsName = 'ParticipantsCompactSwitch', + analyticsProperties = { + ['track-value-as'] = 'participants compact', }, - AnalyticsWidget{ - analyticsName = 'ParticipantsShowRostersSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants show rosters', - }, - children = Switch{ - label = 'Show rosters', - switchGroup = 'team-cards-show-rosters', - defaultActive = false, - collapsibleSelector = '.team-participant-card', - }, + children = Switch{ + label = 'Compact view', + switchGroup = 'team-cards-compact', + defaultActive = true, }, - AnalyticsWidget{ - analyticsName = 'ParticipantsCompactSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants compact', - }, - children = Switch{ - label = 'Compact view', - switchGroup = 'team-cards-compact', - defaultActive = true, - }, - } } } + + children = Array.filter(children, function(child) return child ~= nil end) + + return Div{ + classes = { 'team-participant__controls' }, + children = children + } end return ParticipantsTeamParticipantControls From 5d5a6d71c822af378700f7aa3e938fa44146db33 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:38:06 +0200 Subject: [PATCH 12/26] syntax --- .../commons/Widget/Participants/Team/ParticipantControls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index a2984ebf0ae..bfbed659098 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -35,7 +35,7 @@ function ParticipantsTeamParticipantControls:render() pfRunQueryFormName = 'Tournament player information', ['TPI[page]'] = pageName, wpRunQuery = 'Run query' - }) + })) local playerInfoButton if self.props.playerinfo then From 19e6435d371d75fca9008db239d0e2fa5ea704dd Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:46:57 +0200 Subject: [PATCH 13/26] fix empty check --- .../commons/Widget/Participants/Team/ParticipantControls.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index bfbed659098..57812b71023 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -9,6 +9,7 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') +local Logic = Lua.import('Module:Logic') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Widget = Lua.import('Module:Widget') @@ -38,7 +39,7 @@ function ParticipantsTeamParticipantControls:render() })) local playerInfoButton - if self.props.playerinfo then + if Logic.isNotEmpty(self.props.playerinfo) then playerInfoButton = Button{ title = 'Click for additional player information', variant = 'secondary', From 3c1acc18e7b8b1acf9173fdcd8df7a9bdd03e289 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Fri, 27 Feb 2026 21:55:17 +0200 Subject: [PATCH 14/26] fix rendering --- .../Widget/Participants/Team/ParticipantControls.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 57812b71023..50d2a80207a 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -7,7 +7,6 @@ local Lua = require('Module:Lua') -local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local Logic = Lua.import('Module:Logic') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') @@ -39,7 +38,7 @@ function ParticipantsTeamParticipantControls:render() })) local playerInfoButton - if Logic.isNotEmpty(self.props.playerinfo) then + if Logic.readBool(self.props.playerinfo) then playerInfoButton = Button{ title = 'Click for additional player information', variant = 'secondary', @@ -53,7 +52,7 @@ function ParticipantsTeamParticipantControls:render() } end - local children = { + local children = WidgetUtil.collect( playerInfoButton, AnalyticsWidget{ analyticsName = 'ParticipantsShowRostersSwitch', @@ -78,9 +77,7 @@ function ParticipantsTeamParticipantControls:render() defaultActive = true, }, } - } - - children = Array.filter(children, function(child) return child ~= nil end) + ) return Div{ classes = { 'team-participant__controls' }, From a972e4c34c190b8d3a5e585842a9aeeff3292b36 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 12:14:28 +0200 Subject: [PATCH 15/26] clean up --- .../commons/TeamParticipants/Controller.lua | 1 + .../Widget/Participants/Team/CardsGroup.lua | 68 +++++++------------ .../Participants/Team/ParticipantControls.lua | 14 +++- stylesheets/commons/TeamParticipantCard.scss | 4 +- 4 files changed, 37 insertions(+), 50 deletions(-) diff --git a/lua/wikis/commons/TeamParticipants/Controller.lua b/lua/wikis/commons/TeamParticipants/Controller.lua index dd5e8127bbd..6e77d11ba9e 100644 --- a/lua/wikis/commons/TeamParticipants/Controller.lua +++ b/lua/wikis/commons/TeamParticipants/Controller.lua @@ -48,6 +48,7 @@ function TeamParticipantsController.fromTemplate(frame) Array.forEach(parsedData.participants, TeamParticipantsRepository.setPageVars) return TeamParticipantsDisplay{ participants = parsedData.participants, + playerinfo = args.playerinfo, mergeStaffTabIfOnlyOneStaff = Logic.nilOr( Logic.readBoolOrNil(args.mergeStaffTabIfOnlyOneStaff), Logic.readBool(Config.mergeStaffTabIfOnlyOneStaff) ) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 30d3979a0b6..7729ffa2848 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -16,12 +16,19 @@ local AnalyticsWidget = Lua.import('Module:Widget/Analytics') local HtmlWidgets = Lua.import('Module:Widget/Html/All') local Div = HtmlWidgets.Div local ParticipantsTeamCard = Lua.import('Module:Widget/Participants/Team/Card') -local Switch = Lua.import('Module:Widget/Switch') +local ParticipantControls = Lua.import('Module:Widget/Participants/Team/ParticipantControls') +local WidgetUtil = Lua.import('Module:Widget/Util') -local globalVars = PageVariableNamespace() +local teamParticipantsVars = PageVariableNamespace('TeamParticipants') + +---@class ParticipantsTeamCardsGroupProps +---@field participants TeamParticipant[]|nil +---@field playerinfo boolean|string|nil +---@field mergeStaffTabIfOnlyOneStaff boolean|nil ---@class ParticipantsTeamCardsGroup: Widget ----@operator call(table): ParticipantsTeamCardsGroup +---@operator call(ParticipantsTeamCardsGroupProps): ParticipantsTeamCardsGroup +---@field props ParticipantsTeamCardsGroupProps local ParticipantsTeamCardsGroup = Class.new(Widget) ---@return Widget? @@ -31,51 +38,22 @@ function ParticipantsTeamCardsGroup:render() return end - local showSwitches = not globalVars:get('teamParticipantControlsRendered') + local showSwitches = not teamParticipantsVars:get('controlsRendered') - local children = {} - if showSwitches then - table.insert(children, Div{ - classes = { 'team-participant__controls' }, - children = { - AnalyticsWidget{ - analyticsName = 'ParticipantsShowRostersSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants show rosters', - }, - children = Switch{ - label = 'Show rosters', - switchGroup = 'team-cards-show-rosters', - defaultActive = false, - collapsibleSelector = '.team-participant-card', - }, - }, - AnalyticsWidget{ - analyticsName = 'ParticipantsCompactSwitch', - analyticsProperties = { - ['track-value-as'] = 'participants compact', - }, - children = Switch{ - label = 'Compact view', - switchGroup = 'team-cards-compact', - defaultActive = true, - }, - } + local children = WidgetUtil.collect( + showSwitches and ParticipantControls{playerinfo = self.props.playerinfo} or nil, + AnalyticsWidget{ + analyticsName = 'Team participants card', + children = Div{ + classes = { 'team-participant__grid' }, + children = Array.map(participants, function(participant) + return ParticipantsTeamCard{ + participant = participant, + } + end), } - }) - end - - table.insert(children, AnalyticsWidget{ - analyticsName = 'Team participants card', - children = Div{ - classes = { 'team-participant__grid' }, - children = Array.map(participants, function(participant) - return ParticipantsTeamCard{ - participant = participant, - } - end), } - }) + ) return Div{ classes = { 'team-participant' }, diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 50d2a80207a..1e0838d9924 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -20,15 +20,23 @@ local Icon = Lua.import('Module:Widget/Image/Icon/Fontawesome') local Switch = Lua.import('Module:Widget/Switch') local WidgetUtil = Lua.import('Module:Widget/Util') -local globalVars = PageVariableNamespace() +local teamParticipantsVars = PageVariableNamespace('TeamParticipants') + +---@class ParticipantsTeamParticipantControlsProps +---@field playerinfo boolean|string|nil ---@class ParticipantsTeamParticipantControls: Widget ----@operator call(table): ParticipantsTeamParticipantControls +---@operator call(ParticipantsTeamParticipantControlsProps): ParticipantsTeamParticipantControls +---@field props ParticipantsTeamParticipantControlsProps local ParticipantsTeamParticipantControls = Class.new(Widget) +ParticipantsTeamParticipantControls.defaultProps = { + playerinfo = false, +} + ---@return Widget? function ParticipantsTeamParticipantControls:render() - globalVars:set('teamParticipantControlsRendered', 'true') + teamParticipantsVars:set('controlsRendered', 'true') local pageName = mw.title.getCurrentTitle().fullText local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { diff --git a/stylesheets/commons/TeamParticipantCard.scss b/stylesheets/commons/TeamParticipantCard.scss index 062226e7726..c202ec485e0 100644 --- a/stylesheets/commons/TeamParticipantCard.scss +++ b/stylesheets/commons/TeamParticipantCard.scss @@ -142,8 +142,8 @@ $compact-selector: '[data-switch-group="team-cards-compact"]'; @media ( max-width: 767px ) { @include set-participant-icon-size( $participant-icon-wrapper-size-mobile, - $participant-icon-size-mobile - ); + $participant-icon-size-mobile + ); } } } From e201807456809702000981e41828c84b0592dca4 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 12:26:45 +0200 Subject: [PATCH 16/26] set scope correctly --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 8 +++++++- .../Widget/Participants/Team/ParticipantControls.lua | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 7729ffa2848..b2998eeb6e9 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -38,7 +38,13 @@ function ParticipantsTeamCardsGroup:render() return end - local showSwitches = not teamParticipantsVars:get('controlsRendered') + local externalControlsRendered = teamParticipantsVars:get('externalControlsRendered') + local cardsGroupControlsRendered = teamParticipantsVars:get('cardsGroupControlsRendered') + local showSwitches = not externalControlsRendered and not cardsGroupControlsRendered + + if showSwitches then + teamParticipantsVars:set('cardsGroupControlsRendered', 'true') + end local children = WidgetUtil.collect( showSwitches and ParticipantControls{playerinfo = self.props.playerinfo} or nil, diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 1e0838d9924..ddc6e131237 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -36,7 +36,7 @@ ParticipantsTeamParticipantControls.defaultProps = { ---@return Widget? function ParticipantsTeamParticipantControls:render() - teamParticipantsVars:set('controlsRendered', 'true') + teamParticipantsVars:set('externalControlsRendered', 'true') local pageName = mw.title.getCurrentTitle().fullText local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { From cc3ca073d098793181598dd6c0c7eb309e8b626d Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 12:57:56 +0200 Subject: [PATCH 17/26] every group own controls if external controls not set --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index b2998eeb6e9..33a7c4d6264 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -38,13 +38,7 @@ function ParticipantsTeamCardsGroup:render() return end - local externalControlsRendered = teamParticipantsVars:get('externalControlsRendered') - local cardsGroupControlsRendered = teamParticipantsVars:get('cardsGroupControlsRendered') - local showSwitches = not externalControlsRendered and not cardsGroupControlsRendered - - if showSwitches then - teamParticipantsVars:set('cardsGroupControlsRendered', 'true') - end + local showSwitches = not teamParticipantsVars:get('externalControlsRendered') local children = WidgetUtil.collect( showSwitches and ParticipantControls{playerinfo = self.props.playerinfo} or nil, From 87be20dd63189dcb7304615225088ed8ac353f2a Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 13:11:05 +0200 Subject: [PATCH 18/26] fix control rendering from card groups --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 2 +- .../Widget/Participants/Team/ParticipantControls.lua | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 33a7c4d6264..3829cbd6607 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -41,7 +41,7 @@ function ParticipantsTeamCardsGroup:render() local showSwitches = not teamParticipantsVars:get('externalControlsRendered') local children = WidgetUtil.collect( - showSwitches and ParticipantControls{playerinfo = self.props.playerinfo} or nil, + showSwitches and ParticipantControls{playerinfo = self.props.playerinfo, external = false} or nil, AnalyticsWidget{ analyticsName = 'Team participants card', children = Div{ diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index ddc6e131237..3aebc8259cc 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -24,6 +24,7 @@ local teamParticipantsVars = PageVariableNamespace('TeamParticipants') ---@class ParticipantsTeamParticipantControlsProps ---@field playerinfo boolean|string|nil +---@field external boolean|nil ---@class ParticipantsTeamParticipantControls: Widget ---@operator call(ParticipantsTeamParticipantControlsProps): ParticipantsTeamParticipantControls @@ -32,11 +33,14 @@ local ParticipantsTeamParticipantControls = Class.new(Widget) ParticipantsTeamParticipantControls.defaultProps = { playerinfo = false, + external = false, } ---@return Widget? function ParticipantsTeamParticipantControls:render() - teamParticipantsVars:set('externalControlsRendered', 'true') + if Logic.readBool(self.props.external) then + teamParticipantsVars:set('externalControlsRendered', 'true') + end local pageName = mw.title.getCurrentTitle().fullText local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { From 85832da41296ace9b5630a5c1e62983db321181f Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 14:45:44 +0200 Subject: [PATCH 19/26] alternative --- lua/wikis/commons/TeamParticipants/Controller.lua | 7 +++++++ .../commons/Widget/Participants/Team/CardsGroup.lua | 8 +++----- .../Participants/Team/ParticipantControls.lua | 13 +++++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lua/wikis/commons/TeamParticipants/Controller.lua b/lua/wikis/commons/TeamParticipants/Controller.lua index 6e77d11ba9e..e0c5162df73 100644 --- a/lua/wikis/commons/TeamParticipants/Controller.lua +++ b/lua/wikis/commons/TeamParticipants/Controller.lua @@ -14,6 +14,7 @@ local Info = Lua.import('Module:Info', {loadData = true}) local Json = Lua.import('Module:Json') local Logic = Lua.import('Module:Logic') local Lpdb = Lua.import('Module:Lpdb') +local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Table = Lua.import('Module:Table') local TeamParticipantsWikiParser = Lua.import('Module:TeamParticipants/Parse/Wiki') @@ -22,6 +23,8 @@ local TeamService = Lua.import('Module:Service/Team') local TeamParticipantsDisplay = Lua.import('Module:Widget/Participants/Team/CardsGroup') +local teamParticipantsVars = PageVariableNamespace('TeamParticipants') + local TeamParticipantsController = {} local AUTO_IMPORTED_STAFF_ROLES = { @@ -46,9 +49,13 @@ function TeamParticipantsController.fromTemplate(frame) Array.forEach(parsedData.participants, TeamParticipantsRepository.save) end Array.forEach(parsedData.participants, TeamParticipantsRepository.setPageVars) + + local showControls = not teamParticipantsVars:get('externalControlsRendered') + return TeamParticipantsDisplay{ participants = parsedData.participants, playerinfo = args.playerinfo, + showControls = showControls, mergeStaffTabIfOnlyOneStaff = Logic.nilOr( Logic.readBoolOrNil(args.mergeStaffTabIfOnlyOneStaff), Logic.readBool(Config.mergeStaffTabIfOnlyOneStaff) ) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 3829cbd6607..0552e49c522 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -9,7 +9,6 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') -local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') local Widget = Lua.import('Module:Widget') local AnalyticsWidget = Lua.import('Module:Widget/Analytics') @@ -19,11 +18,10 @@ local ParticipantsTeamCard = Lua.import('Module:Widget/Participants/Team/Card') local ParticipantControls = Lua.import('Module:Widget/Participants/Team/ParticipantControls') local WidgetUtil = Lua.import('Module:Widget/Util') -local teamParticipantsVars = PageVariableNamespace('TeamParticipants') - ---@class ParticipantsTeamCardsGroupProps ---@field participants TeamParticipant[]|nil ---@field playerinfo boolean|string|nil +---@field showControls boolean|nil ---@field mergeStaffTabIfOnlyOneStaff boolean|nil ---@class ParticipantsTeamCardsGroup: Widget @@ -38,10 +36,10 @@ function ParticipantsTeamCardsGroup:render() return end - local showSwitches = not teamParticipantsVars:get('externalControlsRendered') + local showControls = self.props.showControls ~= false local children = WidgetUtil.collect( - showSwitches and ParticipantControls{playerinfo = self.props.playerinfo, external = false} or nil, + showControls and ParticipantControls{playerinfo = self.props.playerinfo} or nil, AnalyticsWidget{ analyticsName = 'Team participants card', children = Div{ diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 3aebc8259cc..a67117d3fed 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -24,7 +24,6 @@ local teamParticipantsVars = PageVariableNamespace('TeamParticipants') ---@class ParticipantsTeamParticipantControlsProps ---@field playerinfo boolean|string|nil ----@field external boolean|nil ---@class ParticipantsTeamParticipantControls: Widget ---@operator call(ParticipantsTeamParticipantControlsProps): ParticipantsTeamParticipantControls @@ -33,15 +32,17 @@ local ParticipantsTeamParticipantControls = Class.new(Widget) ParticipantsTeamParticipantControls.defaultProps = { playerinfo = false, - external = false, } +---@param args ParticipantsTeamParticipantControlsProps +---@return ParticipantsTeamParticipantControls +function ParticipantsTeamParticipantControls.fromTemplate(args) + teamParticipantsVars:set('externalControlsRendered', 'true') + return ParticipantsTeamParticipantControls(args) +end + ---@return Widget? function ParticipantsTeamParticipantControls:render() - if Logic.readBool(self.props.external) then - teamParticipantsVars:set('externalControlsRendered', 'true') - end - local pageName = mw.title.getCurrentTitle().fullText local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { pfRunQueryFormName = 'Tournament player information', From 15d218da3e011f0420d22cc1ed78697374732055 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 15:54:58 +0200 Subject: [PATCH 20/26] get args --- .../Widget/Participants/Team/ParticipantControls.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index a67117d3fed..5e24b73a7e7 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -7,6 +7,7 @@ local Lua = require('Module:Lua') +local Arguments = Lua.import('Module:Arguments') local Class = Lua.import('Module:Class') local Logic = Lua.import('Module:Logic') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') @@ -34,9 +35,10 @@ ParticipantsTeamParticipantControls.defaultProps = { playerinfo = false, } ----@param args ParticipantsTeamParticipantControlsProps +---@param frame Frame ---@return ParticipantsTeamParticipantControls -function ParticipantsTeamParticipantControls.fromTemplate(args) +function ParticipantsTeamParticipantControls.fromTemplate(frame) + local args = Arguments.getArgs(frame) teamParticipantsVars:set('externalControlsRendered', 'true') return ParticipantsTeamParticipantControls(args) end From a7fb740ef1ca34a6917dcb0257ce6c9d7e7568bd Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 16:41:06 +0200 Subject: [PATCH 21/26] move link creation inside conditional its used under --- .../Participants/Team/ParticipantControls.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 5e24b73a7e7..6d89f7263f4 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -45,15 +45,14 @@ end ---@return Widget? function ParticipantsTeamParticipantControls:render() - local pageName = mw.title.getCurrentTitle().fullText - local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { - pfRunQueryFormName = 'Tournament player information', - ['TPI[page]'] = pageName, - wpRunQuery = 'Run query' - })) - local playerInfoButton if Logic.readBool(self.props.playerinfo) then + local pageName = mw.title.getCurrentTitle().fullText + local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { + pfRunQueryFormName = 'Tournament player information', + ['TPI[page]'] = pageName, + wpRunQuery = 'Run query' + })) playerInfoButton = Button{ title = 'Click for additional player information', variant = 'secondary', From abc76b4e218cbb96a4e0fc6be1345b860c4a0f32 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 21:22:06 +0200 Subject: [PATCH 22/26] rename prop and boolean early --- lua/wikis/commons/TeamParticipants/Controller.lua | 2 +- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 4 ++-- .../Widget/Participants/Team/ParticipantControls.lua | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/wikis/commons/TeamParticipants/Controller.lua b/lua/wikis/commons/TeamParticipants/Controller.lua index e0c5162df73..360f6fd1d96 100644 --- a/lua/wikis/commons/TeamParticipants/Controller.lua +++ b/lua/wikis/commons/TeamParticipants/Controller.lua @@ -54,7 +54,7 @@ function TeamParticipantsController.fromTemplate(frame) return TeamParticipantsDisplay{ participants = parsedData.participants, - playerinfo = args.playerinfo, + showPlayerInfo = Logic.readBool(args.playerinfo), showControls = showControls, mergeStaffTabIfOnlyOneStaff = Logic.nilOr( Logic.readBoolOrNil(args.mergeStaffTabIfOnlyOneStaff), Logic.readBool(Config.mergeStaffTabIfOnlyOneStaff) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index 0552e49c522..c1574de2cd5 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -20,7 +20,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util') ---@class ParticipantsTeamCardsGroupProps ---@field participants TeamParticipant[]|nil ----@field playerinfo boolean|string|nil +---@field showPlayerInfo boolean ---@field showControls boolean|nil ---@field mergeStaffTabIfOnlyOneStaff boolean|nil @@ -39,7 +39,7 @@ function ParticipantsTeamCardsGroup:render() local showControls = self.props.showControls ~= false local children = WidgetUtil.collect( - showControls and ParticipantControls{playerinfo = self.props.playerinfo} or nil, + showControls and ParticipantControls{showPlayerInfo = self.props.showPlayerInfo} or nil, AnalyticsWidget{ analyticsName = 'Team participants card', children = Div{ diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 6d89f7263f4..4dfa827bab2 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -24,7 +24,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util') local teamParticipantsVars = PageVariableNamespace('TeamParticipants') ---@class ParticipantsTeamParticipantControlsProps ----@field playerinfo boolean|string|nil +---@field showPlayerInfo boolean ---@class ParticipantsTeamParticipantControls: Widget ---@operator call(ParticipantsTeamParticipantControlsProps): ParticipantsTeamParticipantControls @@ -32,7 +32,7 @@ local teamParticipantsVars = PageVariableNamespace('TeamParticipants') local ParticipantsTeamParticipantControls = Class.new(Widget) ParticipantsTeamParticipantControls.defaultProps = { - playerinfo = false, + showPlayerInfo = false, } ---@param frame Frame @@ -46,7 +46,7 @@ end ---@return Widget? function ParticipantsTeamParticipantControls:render() local playerInfoButton - if Logic.readBool(self.props.playerinfo) then + if Logic.readBool(self.props.showPlayerInfo) then local pageName = mw.title.getCurrentTitle().fullText local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { pfRunQueryFormName = 'Tournament player information', From 5dce63749e36caed0da54d3f3b9a26cae625674b Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Mon, 2 Mar 2026 21:36:12 +0200 Subject: [PATCH 23/26] remove the redundant default --- lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua index c1574de2cd5..5525179dd8b 100644 --- a/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua +++ b/lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua @@ -21,7 +21,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util') ---@class ParticipantsTeamCardsGroupProps ---@field participants TeamParticipant[]|nil ---@field showPlayerInfo boolean ----@field showControls boolean|nil +---@field showControls boolean ---@field mergeStaffTabIfOnlyOneStaff boolean|nil ---@class ParticipantsTeamCardsGroup: Widget @@ -36,7 +36,7 @@ function ParticipantsTeamCardsGroup:render() return end - local showControls = self.props.showControls ~= false + local showControls = self.props.showControls local children = WidgetUtil.collect( showControls and ParticipantControls{showPlayerInfo = self.props.showPlayerInfo} or nil, From 1e1211a6d1f35b4fc29d78f27f39824ef8547488 Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 3 Mar 2026 10:16:16 +0200 Subject: [PATCH 24/26] clean up controls --- .../Participants/Team/ParticipantControls.lua | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 4dfa827bab2..9374ada8a09 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -44,30 +44,32 @@ function ParticipantsTeamParticipantControls.fromTemplate(frame) end ---@return Widget? -function ParticipantsTeamParticipantControls:render() - local playerInfoButton - if Logic.readBool(self.props.showPlayerInfo) then - local pageName = mw.title.getCurrentTitle().fullText - local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { - pfRunQueryFormName = 'Tournament player information', - ['TPI[page]'] = pageName, - wpRunQuery = 'Run query' - })) - playerInfoButton = Button{ - title = 'Click for additional player information', - variant = 'secondary', - size = 'sm', - linktype = 'external', - link = link, - children = WidgetUtil.collect( - Icon{iconName = 'internal_link'}, - 'Player Info' - ) - } +function ParticipantsTeamParticipantControls:_buildPlayerInfoButton() + if not Logic.readBool(self.props.showPlayerInfo) then + return nil end + local pageName = mw.title.getCurrentTitle().fullText + local link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament_player_information', { + pfRunQueryFormName = 'Tournament player information', + ['TPI[page]'] = pageName, + wpRunQuery = 'Run query' + })) + + return Button{ + title = 'Click for additional player information', + variant = 'secondary', + size = 'sm', + linktype = 'external', + link = link, + children = { Icon{iconName = 'internal_link'}, 'Player Info' } + } +end + +---@return Widget? +function ParticipantsTeamParticipantControls:render() local children = WidgetUtil.collect( - playerInfoButton, + self:_buildPlayerInfoButton(), AnalyticsWidget{ analyticsName = 'ParticipantsShowRostersSwitch', analyticsProperties = { From 89b35baa8c6927a7e186ad8b7e2e394e74f6675f Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 3 Mar 2026 12:10:33 +0200 Subject: [PATCH 25/26] constructor instead of fromTemplate --- .../Participants/Team/ParticipantControls.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 9374ada8a09..43f786b41de 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -7,7 +7,6 @@ local Lua = require('Module:Lua') -local Arguments = Lua.import('Module:Arguments') local Class = Lua.import('Module:Class') local Logic = Lua.import('Module:Logic') local PageVariableNamespace = Lua.import('Module:PageVariableNamespace') @@ -25,24 +24,22 @@ local teamParticipantsVars = PageVariableNamespace('TeamParticipants') ---@class ParticipantsTeamParticipantControlsProps ---@field showPlayerInfo boolean +---@field externalUsage boolean ---@class ParticipantsTeamParticipantControls: Widget ---@operator call(ParticipantsTeamParticipantControlsProps): ParticipantsTeamParticipantControls ---@field props ParticipantsTeamParticipantControlsProps -local ParticipantsTeamParticipantControls = Class.new(Widget) +local ParticipantsTeamParticipantControls = Class.new(Widget, function(self, props) + if Logic.readBool(props.externalUsage) then + teamParticipantsVars:set('externalControlsRendered', 'true') + end +end) ParticipantsTeamParticipantControls.defaultProps = { showPlayerInfo = false, + externalUsage = false, } ----@param frame Frame ----@return ParticipantsTeamParticipantControls -function ParticipantsTeamParticipantControls.fromTemplate(frame) - local args = Arguments.getArgs(frame) - teamParticipantsVars:set('externalControlsRendered', 'true') - return ParticipantsTeamParticipantControls(args) -end - ---@return Widget? function ParticipantsTeamParticipantControls:_buildPlayerInfoButton() if not Logic.readBool(self.props.showPlayerInfo) then From 4ab2304ab4733987838ca7a44a19f6fd76c9575b Mon Sep 17 00:00:00 2001 From: Eetu Rantanen Date: Tue, 3 Mar 2026 12:35:30 +0200 Subject: [PATCH 26/26] pass the prop --- lua/wikis/commons/TeamParticipants/Controller.lua | 2 +- .../commons/Widget/Participants/Team/ParticipantControls.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/TeamParticipants/Controller.lua b/lua/wikis/commons/TeamParticipants/Controller.lua index 360f6fd1d96..45960bb575f 100644 --- a/lua/wikis/commons/TeamParticipants/Controller.lua +++ b/lua/wikis/commons/TeamParticipants/Controller.lua @@ -54,7 +54,7 @@ function TeamParticipantsController.fromTemplate(frame) return TeamParticipantsDisplay{ participants = parsedData.participants, - showPlayerInfo = Logic.readBool(args.playerinfo), + showPlayerInfo = Logic.readBool(args.showplayerinfo), showControls = showControls, mergeStaffTabIfOnlyOneStaff = Logic.nilOr( Logic.readBoolOrNil(args.mergeStaffTabIfOnlyOneStaff), Logic.readBool(Config.mergeStaffTabIfOnlyOneStaff) diff --git a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua index 43f786b41de..da98256456a 100644 --- a/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua +++ b/lua/wikis/commons/Widget/Participants/Team/ParticipantControls.lua @@ -33,6 +33,7 @@ local ParticipantsTeamParticipantControls = Class.new(Widget, function(self, pro if Logic.readBool(props.externalUsage) then teamParticipantsVars:set('externalControlsRendered', 'true') end + self.props.showPlayerInfo = Logic.readBool(self.props.showPlayerInfo or self.props.showplayerinfo) end) ParticipantsTeamParticipantControls.defaultProps = {