From eaf50b9fb675e61503938639df7b162324626cf9 Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Wed, 10 Jun 2026 16:32:18 +0900
Subject: [PATCH 01/10] make typechecker behave
---
lua/wikis/commons/OpponentDisplay/Starcraft.lua | 4 +---
lua/wikis/rocketleague/OpponentDisplay/Custom.lua | 3 +++
lua/wikis/trackmania/OpponentDisplay/Custom.lua | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lua/wikis/commons/OpponentDisplay/Starcraft.lua b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
index 8e8f82da49d..7b253d435fb 100644
--- a/lua/wikis/commons/OpponentDisplay/Starcraft.lua
+++ b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
@@ -28,10 +28,8 @@ local StarcraftOpponentDisplay = Table.copy(OpponentDisplay)
---@field opponent StarcraftStandardOpponent
---Display component for an opponent entry appearing in a bracket match.
----@class StarcraftBracketOpponentEntry
+---@class StarcraftBracketOpponentEntry: BracketOpponentEntry
---@operator call(...): StarcraftBracketOpponentEntry
----@field content Html
----@field root Html
local BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry,
---@param self self
---@param opponent StarcraftStandardOpponent
diff --git a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua b/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
index 12a46ea86f1..550f473ce54 100644
--- a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
+++ b/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
@@ -13,8 +13,11 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+---@class RocketLeagueOpponentDisplay: OpponentDisplay
local CustomOpponentDisplay = Table.deepCopy(OpponentDisplay)
+---@class RocketLeagueBracketOpponentEntry: BracketOpponentEntry
+---@operator call(...): RocketLeagueBracketOpponentEntry
CustomOpponentDisplay.BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry, function(self) end)
---@class RocketLeagueStandardOpponent:standardOpponent
diff --git a/lua/wikis/trackmania/OpponentDisplay/Custom.lua b/lua/wikis/trackmania/OpponentDisplay/Custom.lua
index 0854aa795c9..0abebbc58df 100644
--- a/lua/wikis/trackmania/OpponentDisplay/Custom.lua
+++ b/lua/wikis/trackmania/OpponentDisplay/Custom.lua
@@ -14,12 +14,15 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+---@class TrackmaniaOpponentDisplay: OpponentDisplay
local OpponentDisplayCustom = Table.deepCopy(OpponentDisplay)
local SCORE_STATUS = 'S'
local NO_SCORE = -1
local ZERO_SCORE = 0
+---@class TrackmaniaBracketOpponentEntry: BracketOpponentEntry
+---@operator call(...): TrackmaniaBracketOpponentEntry
OpponentDisplayCustom.BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry)
---@class TrackmaniaStandardOpponent:standardOpponent
From 45bcfd88682678d9c7f443bdc0e41c58df9f7512 Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Wed, 10 Jun 2026 16:37:10 +0900
Subject: [PATCH 02/10] extract score display
---
lua/wikis/commons/OpponentDisplay.lua | 32 +++----------------
.../commons/OpponentDisplay/Starcraft.lua | 5 +--
.../commons/Widget/Match/Bracket/All.lua | 14 ++++++++
.../commons/Widget/Match/Bracket/Score.lua | 25 +++++++++++++++
.../rocketleague/OpponentDisplay/Custom.lua | 14 ++++----
.../trackmania/OpponentDisplay/Custom.lua | 8 +++--
6 files changed, 60 insertions(+), 38 deletions(-)
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/All.lua
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/Score.lua
diff --git a/lua/wikis/commons/OpponentDisplay.lua b/lua/wikis/commons/OpponentDisplay.lua
index 29ca59e5ee1..04e95954b71 100644
--- a/lua/wikis/commons/OpponentDisplay.lua
+++ b/lua/wikis/commons/OpponentDisplay.lua
@@ -20,6 +20,7 @@ local Opponent = Lua.import('Module:Opponent')
local PlayerDisplay = Lua.import('Module:Player/Display/Custom')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
+local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
local BlockTeam = Lua.import('Module:Widget/TeamDisplay/Block')
local TeamInline = Lua.import('Module:Widget/TeamDisplay/Inline')
@@ -104,18 +105,18 @@ end
---Adds scores to BracketOpponentEntry
---@param opponent standardOpponent
function OpponentDisplay.BracketOpponentEntry:addScores(opponent)
- local score1Node = OpponentDisplay.BracketScore({
+ local score1Node = BracketDisplayComponents.Score{
isWinner = opponent.placement == 1 or opponent.advances,
scoreText = OpponentDisplay.InlineScore(opponent),
- })
+ }
self.root:node(score1Node)
local score2Node
if opponent.score2 then
- score2Node = OpponentDisplay.BracketScore({
+ score2Node = BracketDisplayComponents.Score{
isWinner = opponent.placement2 == 1,
scoreText = OpponentDisplay.InlineScore2(opponent),
- })
+ }
end
self.root:node(score2Node)
@@ -369,27 +370,4 @@ function OpponentDisplay.InlineScore2(opponent)
end
end
-OpponentDisplay.propTypes.BracketScore = {
- isWinner = 'boolean?',
- scoreText = 'any',
-}
-
----Displays a score within the context of a bracket opponent entry.
----@param props {isWinner: boolean?, scoreText: string|number?}
----@return Html
-function OpponentDisplay.BracketScore(props)
- DisplayUtil.assertPropTypes(props, OpponentDisplay.propTypes.BracketScore)
-
- local scoreText = props.scoreText
- if props.isWinner then
- scoreText = '' .. scoreText .. ''
- end
-
- return mw.html.create('div'):addClass('brkts-opponent-score-outer')
- :node(
- mw.html.create('div'):addClass('brkts-opponent-score-inner')
- :wikitext(scoreText)
- )
-end
-
return OpponentDisplay
diff --git a/lua/wikis/commons/OpponentDisplay/Starcraft.lua b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
index 7b253d435fb..938fb1327e3 100644
--- a/lua/wikis/commons/OpponentDisplay/Starcraft.lua
+++ b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
@@ -17,6 +17,7 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local WidgetUtil = Lua.import('Module:Widget/Util')
@@ -65,13 +66,13 @@ local BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry,
---Adds scores to BracketOpponentEntry
---@param opponent StarcraftStandardOpponent
function BracketOpponentEntry:addScores(opponent)
- self.root:node(OpponentDisplay.BracketScore{
+ self.root:node(BracketDisplayComponents.Score{
isWinner = opponent.placement == 1 or opponent.advances,
scoreText = StarcraftOpponentDisplay.InlineScore(opponent),
})
if opponent.score2 then
- self.root:node(OpponentDisplay.BracketScore{
+ self.root:node(BracketDisplayComponents.Score{
isWinner = opponent.placement2 == 1,
scoreText = StarcraftOpponentDisplay.InlineScore2(opponent),
})
diff --git a/lua/wikis/commons/Widget/Match/Bracket/All.lua b/lua/wikis/commons/Widget/Match/Bracket/All.lua
new file mode 100644
index 00000000000..60f669137aa
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/All.lua
@@ -0,0 +1,14 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/All
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Widgets = {}
+
+local Lua = require('Module:Lua')
+
+Widgets.Score = Lua.import('Module:Widget/Match/Bracket/Score')
+
+return Widgets
diff --git a/lua/wikis/commons/Widget/Match/Bracket/Score.lua b/lua/wikis/commons/Widget/Match/Bracket/Score.lua
new file mode 100644
index 00000000000..d27a30b75e8
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/Score.lua
@@ -0,0 +1,25 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/Score
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Component = Lua.import('Module:Widget/Component')
+local Html = Lua.import('Module:Widget/Html')
+
+---@param props {isWinner: boolean?, scoreText: Renderable?}
+---@return VNode
+local function BracketScoreDisplay(props)
+ return Html.Div{
+ classes = {'brkts-opponent-score-outer'},
+ children = Html.Div{
+ classes = {'brkts-opponent-score-inner'},
+ children = props.isWinner and Html.B{children = props.scoreText} or props.scoreText
+ }
+ }
+end
+
+return Component.component(BracketScoreDisplay)
diff --git a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua b/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
index 550f473ce54..047f7f56b5a 100644
--- a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
+++ b/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
@@ -13,6 +13,8 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
+
---@class RocketLeagueOpponentDisplay: OpponentDisplay
local CustomOpponentDisplay = Table.deepCopy(OpponentDisplay)
@@ -31,33 +33,33 @@ function CustomOpponentDisplay.BracketOpponentEntry:addScores(opponent)
return
end
- local score1Node = OpponentDisplay.BracketScore({
+ local score1Node = BracketDisplayComponents.Score{
isWinner = extradata.set1win,
scoreText = CustomOpponentDisplay.InlineScoreSpecial{
opponent = opponent, score = extradata.score1
},
- })
+ }
self.root:node(score1Node)
local score2Node
if extradata.score2 or opponent.score2 then
- score2Node = OpponentDisplay.BracketScore({
+ score2Node = BracketDisplayComponents.Score{
isWinner = extradata.set2win,
scoreText = CustomOpponentDisplay.InlineScoreSpecial{
opponent = opponent, score = extradata.score2
},
- })
+ }
end
self.root:node(score2Node)
local score3Node
if extradata.score3 then
- score3Node = OpponentDisplay.BracketScore({
+ score3Node = BracketDisplayComponents.Score{
isWinner = extradata.set3win,
scoreText = CustomOpponentDisplay.InlineScoreSpecial{
opponent = opponent, score = extradata.score3
},
- })
+ }
end
self.root:node(score3Node)
diff --git a/lua/wikis/trackmania/OpponentDisplay/Custom.lua b/lua/wikis/trackmania/OpponentDisplay/Custom.lua
index 0abebbc58df..e31c2257227 100644
--- a/lua/wikis/trackmania/OpponentDisplay/Custom.lua
+++ b/lua/wikis/trackmania/OpponentDisplay/Custom.lua
@@ -14,6 +14,8 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
+
---@class TrackmaniaOpponentDisplay: OpponentDisplay
local OpponentDisplayCustom = Table.deepCopy(OpponentDisplay)
@@ -37,18 +39,18 @@ function OpponentDisplayCustom.BracketOpponentEntry:addScores(opponent)
OpponentDisplay.BracketOpponentEntry.addScores(self, opponent)
return
end
- self.root:node(OpponentDisplay.BracketScore{
+ self.root:node(BracketDisplayComponents.Score{
isWinner = extradata.set1win,
scoreText = OpponentDisplayCustom.InlineScore(opponent, 1),
})
if opponent.extradata.score2 or opponent.score2 then
- self.root:node(OpponentDisplay.BracketScore{
+ self.root:node(BracketDisplayComponents.Score{
isWinner = extradata.set2win,
scoreText = OpponentDisplayCustom.InlineScore(opponent, 2),
})
end
if opponent.extradata.score3 then
- self.root:node(OpponentDisplay.BracketScore{
+ self.root:node(BracketDisplayComponents.Score{
isWinner = extradata.set3win,
scoreText = OpponentDisplayCustom.InlineScore(opponent, 3)
})
From e0c4a3a8980e3103d52db7aa1ccf4857114f2cd3 Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Wed, 10 Jun 2026 16:49:53 +0900
Subject: [PATCH 03/10] use widget3 html
---
lua/wikis/commons/OpponentDisplay.lua | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lua/wikis/commons/OpponentDisplay.lua b/lua/wikis/commons/OpponentDisplay.lua
index 04e95954b71..46506300284 100644
--- a/lua/wikis/commons/OpponentDisplay.lua
+++ b/lua/wikis/commons/OpponentDisplay.lua
@@ -19,7 +19,7 @@ local TypeUtil = Lua.import('Module:TypeUtil')
local Opponent = Lua.import('Module:Opponent')
local PlayerDisplay = Lua.import('Module:Player/Display/Custom')
-local HtmlWidgets = Lua.import('Module:Widget/Html/All')
+local Html = Lua.import('Module:Widget/Html')
local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
local BlockTeam = Lua.import('Module:Widget/TeamDisplay/Block')
local TeamInline = Lua.import('Module:Widget/TeamDisplay/Inline')
@@ -212,7 +212,7 @@ function OpponentDisplay.BlockOpponent(props)
if opponent.type == Opponent.team then
if props.showTbd == false and Opponent.isTbd(opponent) then
- return HtmlWidgets.Fragment{}
+ return Html.Fragment{}
end
return OpponentDisplay.BlockTeamContainer{
flip = props.flip,
@@ -238,9 +238,9 @@ function OpponentDisplay.BlockOpponent(props)
end
---@param props BlockOpponentProps
----@return Widget
+---@return VNode
function OpponentDisplay.BlockPlayers(props)
- return HtmlWidgets.Div{
+ return Html.Div{
classes = Array.extend('block-players-wrapper', props.additionalClasses),
children = OpponentDisplay.getBlockPlayerNodes(props)
}
@@ -303,11 +303,11 @@ OpponentDisplay.propTypes.BlockLiteral = {
---Displays the name of a literal opponent as a block element.
---@param props {flip: boolean?, name: string, overflow: OverflowModes, additionalClasses: string[]?}
----@return Widget
+---@return VNode
function OpponentDisplay.BlockLiteral(props)
DisplayUtil.assertPropTypes(props, OpponentDisplay.propTypes.BlockLiteral)
- return HtmlWidgets.Div{
+ return Html.Div{
classes = Array.extend(
'brkts-opponent-block-literal',
props.flip and 'flipped' or nil,
@@ -326,15 +326,15 @@ OpponentDisplay.propTypes.BlockScore = {
---Displays a score within the context of a block element.
---@param props {isWinner: boolean?, scoreText: string|number?, additionalClasses: string[]?}
----@return Widget
+---@return VNode
function OpponentDisplay.BlockScore(props)
DisplayUtil.assertPropTypes(props, OpponentDisplay.propTypes.BlockScore)
local scoreText = props.scoreText
- return HtmlWidgets.Div{
+ return Html.Div{
classes = props.additionalClasses,
- children = props.isWinner and HtmlWidgets.B{children = scoreText} or scoreText
+ children = props.isWinner and Html.B{children = scoreText} or scoreText
}
end
From dc59f75dd03f7026dc6ff77f6919395d026c71cd Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Wed, 10 Jun 2026 17:40:43 +0900
Subject: [PATCH 04/10] isolate score container
---
.../commons/Widget/Match/Bracket/All.lua | 1 +
.../Widget/Match/Bracket/ScoreContainer.lua | 31 +++++++
.../Match/Bracket/ScoreContainer/Custom.lua | 10 +++
.../Bracket/ScoreContainer/Starcraft.lua | 31 +++++++
.../rocketleague/OpponentDisplay/Custom.lua | 85 -------------------
.../Match/Bracket/ScoreContainer/Custom.lua | 54 ++++++++++++
.../Match/Bracket/ScoreContainer/Custom.lua | 10 +++
.../Match/Bracket/ScoreContainer/Custom.lua | 10 +++
.../trackmania/OpponentDisplay/Custom.lua | 84 ------------------
.../Match/Bracket/ScoreContainer/Custom.lua | 64 ++++++++++++++
10 files changed, 211 insertions(+), 169 deletions(-)
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/ScoreContainer.lua
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Custom.lua
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Starcraft.lua
delete mode 100644 lua/wikis/rocketleague/OpponentDisplay/Custom.lua
create mode 100644 lua/wikis/rocketleague/Widget/Match/Bracket/ScoreContainer/Custom.lua
create mode 100644 lua/wikis/starcraft/Widget/Match/Bracket/ScoreContainer/Custom.lua
create mode 100644 lua/wikis/starcraft2/Widget/Match/Bracket/ScoreContainer/Custom.lua
delete mode 100644 lua/wikis/trackmania/OpponentDisplay/Custom.lua
create mode 100644 lua/wikis/trackmania/Widget/Match/Bracket/ScoreContainer/Custom.lua
diff --git a/lua/wikis/commons/Widget/Match/Bracket/All.lua b/lua/wikis/commons/Widget/Match/Bracket/All.lua
index 60f669137aa..c730fbcd477 100644
--- a/lua/wikis/commons/Widget/Match/Bracket/All.lua
+++ b/lua/wikis/commons/Widget/Match/Bracket/All.lua
@@ -10,5 +10,6 @@ local Widgets = {}
local Lua = require('Module:Lua')
Widgets.Score = Lua.import('Module:Widget/Match/Bracket/Score')
+Widgets.ScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Custom')
return Widgets
diff --git a/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer.lua b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer.lua
new file mode 100644
index 00000000000..27f8c7f50fa
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer.lua
@@ -0,0 +1,31 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+
+local BracketScoreDisplay = Lua.import('Module:Widget/Match/Bracket/Score')
+local Component = Lua.import('Module:Widget/Component')
+
+---@param props {opponent: standardOpponent}
+---@return VNode[]
+local function BracketScoreContainer(props)
+ local opponent = props.opponent
+ return {
+ BracketScoreDisplay{
+ isWinner = opponent.placement == 1 or opponent.advances,
+ scoreText = OpponentDisplay.InlineScore(opponent),
+ },
+ opponent.placement2 and BracketScoreDisplay{
+ isWinner = opponent.placement2 == 1,
+ scoreText = OpponentDisplay.InlineScore2(opponent),
+ } or nil,
+ }
+end
+
+return Component.component(BracketScoreContainer)
diff --git a/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Custom.lua b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Custom.lua
new file mode 100644
index 00000000000..bd3aeb889cc
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Custom.lua
@@ -0,0 +1,10 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Custom
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+return Lua.import('Module:Widget/Match/Bracket/ScoreContainer')
diff --git a/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Starcraft.lua b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Starcraft.lua
new file mode 100644
index 00000000000..33ce816c3ee
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Starcraft.lua
@@ -0,0 +1,31 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Starcraft
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local OpponentDisplay = Lua.import('Module:OpponentDisplay/Starcraft')
+
+local BracketScoreDisplay = Lua.import('Module:Widget/Match/Bracket/Score')
+local Component = Lua.import('Module:Widget/Component')
+
+---@param props {opponent: StarcraftStandardOpponent}
+---@return VNode[]
+local function StarcraftBracketScoreContainer(props)
+ local opponent = props.opponent
+ return {
+ BracketScoreDisplay{
+ isWinner = opponent.placement == 1 or opponent.advances,
+ scoreText = OpponentDisplay.InlineScore(opponent),
+ },
+ opponent.placement2 and BracketScoreDisplay{
+ isWinner = opponent.placement2 == 1,
+ scoreText = OpponentDisplay.InlineScore2(opponent),
+ } or nil,
+ }
+end
+
+return Component.component(StarcraftBracketScoreContainer)
diff --git a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua b/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
deleted file mode 100644
index 047f7f56b5a..00000000000
--- a/lua/wikis/rocketleague/OpponentDisplay/Custom.lua
+++ /dev/null
@@ -1,85 +0,0 @@
----
--- @Liquipedia
--- page=Module:OpponentDisplay/Custom
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Lua = require('Module:Lua')
-
-local Class = Lua.import('Module:Class')
-local Table = Lua.import('Module:Table')
-
-local Opponent = Lua.import('Module:Opponent')
-local OpponentDisplay = Lua.import('Module:OpponentDisplay')
-
-local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
-
----@class RocketLeagueOpponentDisplay: OpponentDisplay
-local CustomOpponentDisplay = Table.deepCopy(OpponentDisplay)
-
----@class RocketLeagueBracketOpponentEntry: BracketOpponentEntry
----@operator call(...): RocketLeagueBracketOpponentEntry
-CustomOpponentDisplay.BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry, function(self) end)
-
----@class RocketLeagueStandardOpponent:standardOpponent
----@field extradata table?
-
----@param opponent RocketLeagueStandardOpponent
-function CustomOpponentDisplay.BracketOpponentEntry:addScores(opponent)
- local extradata = opponent.extradata or {}
- if not extradata.additionalScores then
- OpponentDisplay.BracketOpponentEntry.addScores(self, opponent)
- return
- end
-
- local score1Node = BracketDisplayComponents.Score{
- isWinner = extradata.set1win,
- scoreText = CustomOpponentDisplay.InlineScoreSpecial{
- opponent = opponent, score = extradata.score1
- },
- }
- self.root:node(score1Node)
-
- local score2Node
- if extradata.score2 or opponent.score2 then
- score2Node = BracketDisplayComponents.Score{
- isWinner = extradata.set2win,
- scoreText = CustomOpponentDisplay.InlineScoreSpecial{
- opponent = opponent, score = extradata.score2
- },
- }
- end
- self.root:node(score2Node)
-
- local score3Node
- if extradata.score3 then
- score3Node = BracketDisplayComponents.Score{
- isWinner = extradata.set3win,
- scoreText = CustomOpponentDisplay.InlineScoreSpecial{
- opponent = opponent, score = extradata.score3
- },
- }
- end
- self.root:node(score3Node)
-
- if (opponent.placement2 or opponent.placement or 0) == 1
- or opponent.advances then
- self.content:addClass('brkts-opponent-win')
- end
-end
-
----Displays a score or status of the opponent, as a string.
----@param props {opponent: RocketLeagueStandardOpponent, status: string?, score: number?}
----@return number|string
-function CustomOpponentDisplay.InlineScoreSpecial(props)
- if props.score == -1 then
- return ''
- end
- if props.score == 0 and Opponent.isTbd(props.opponent) then
- return ''
- end
- return tostring(props.score)
-end
-
-return CustomOpponentDisplay
diff --git a/lua/wikis/rocketleague/Widget/Match/Bracket/ScoreContainer/Custom.lua b/lua/wikis/rocketleague/Widget/Match/Bracket/ScoreContainer/Custom.lua
new file mode 100644
index 00000000000..e7f6cce2cdf
--- /dev/null
+++ b/lua/wikis/rocketleague/Widget/Match/Bracket/ScoreContainer/Custom.lua
@@ -0,0 +1,54 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Custom
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Opponent = Lua.import('Module:Opponent/Custom')
+
+local BracketScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer')
+local BracketScoreDisplay = Lua.import('Module:Widget/Match/Bracket/Score')
+local Component = Lua.import('Module:Widget/Component')
+local WidgetUtil = Lua.import('Module:Widget/Util')
+
+---@param props {opponent: standardOpponent}
+---@return VNode[]
+local function RocketLeagueBracketScoreContainer(props)
+ local opponent = props.opponent
+ local extradata = opponent.extradata or {}
+ if not extradata.additionalScores then
+ return BracketScoreContainer(props)
+ end
+
+ ---Displays a score or status of the opponent, as a string.
+ ---@param score number?
+ ---@return string
+ local function InlineScoreSpecial(score)
+ if score == -1 then
+ return ''
+ elseif score == 0 and Opponent.isTbd(opponent) then
+ return ''
+ end
+ return tostring(score)
+ end
+
+ return WidgetUtil.collect(
+ BracketScoreDisplay{
+ isWinner = extradata.set1win,
+ scoreText = InlineScoreSpecial(extradata.score1),
+ },
+ (extradata.score2 or opponent.score2) and BracketScoreDisplay{
+ isWinner = extradata.set2win,
+ scoreText = InlineScoreSpecial(extradata.score2),
+ } or nil,
+ extradata.score3 and BracketScoreDisplay{
+ isWinner = extradata.set3win,
+ scoreText = InlineScoreSpecial(extradata.score3),
+ } or nil
+ )
+end
+
+return Component.component(RocketLeagueBracketScoreContainer)
diff --git a/lua/wikis/starcraft/Widget/Match/Bracket/ScoreContainer/Custom.lua b/lua/wikis/starcraft/Widget/Match/Bracket/ScoreContainer/Custom.lua
new file mode 100644
index 00000000000..b8290af5ae9
--- /dev/null
+++ b/lua/wikis/starcraft/Widget/Match/Bracket/ScoreContainer/Custom.lua
@@ -0,0 +1,10 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Custom
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+return Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Starcraft')
diff --git a/lua/wikis/starcraft2/Widget/Match/Bracket/ScoreContainer/Custom.lua b/lua/wikis/starcraft2/Widget/Match/Bracket/ScoreContainer/Custom.lua
new file mode 100644
index 00000000000..b8290af5ae9
--- /dev/null
+++ b/lua/wikis/starcraft2/Widget/Match/Bracket/ScoreContainer/Custom.lua
@@ -0,0 +1,10 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Custom
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+return Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Starcraft')
diff --git a/lua/wikis/trackmania/OpponentDisplay/Custom.lua b/lua/wikis/trackmania/OpponentDisplay/Custom.lua
deleted file mode 100644
index e31c2257227..00000000000
--- a/lua/wikis/trackmania/OpponentDisplay/Custom.lua
+++ /dev/null
@@ -1,84 +0,0 @@
----
--- @Liquipedia
--- page=Module:OpponentDisplay/Custom
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Lua = require('Module:Lua')
-
-local Class = Lua.import('Module:Class')
-local Logic = Lua.import('Module:Logic')
-local Table = Lua.import('Module:Table')
-
-local Opponent = Lua.import('Module:Opponent')
-local OpponentDisplay = Lua.import('Module:OpponentDisplay')
-
-local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
-
----@class TrackmaniaOpponentDisplay: OpponentDisplay
-local OpponentDisplayCustom = Table.deepCopy(OpponentDisplay)
-
-local SCORE_STATUS = 'S'
-local NO_SCORE = -1
-local ZERO_SCORE = 0
-
----@class TrackmaniaBracketOpponentEntry: BracketOpponentEntry
----@operator call(...): TrackmaniaBracketOpponentEntry
-OpponentDisplayCustom.BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry)
-
----@class TrackmaniaStandardOpponent:standardOpponent
----@field score3 number?
----@field status3 string?
----@field extradata table?
-
----@param opponent TrackmaniaStandardOpponent
-function OpponentDisplayCustom.BracketOpponentEntry:addScores(opponent)
- local extradata = opponent.extradata or {}
- if not extradata.additionalScores then
- OpponentDisplay.BracketOpponentEntry.addScores(self, opponent)
- return
- end
- self.root:node(BracketDisplayComponents.Score{
- isWinner = extradata.set1win,
- scoreText = OpponentDisplayCustom.InlineScore(opponent, 1),
- })
- if opponent.extradata.score2 or opponent.score2 then
- self.root:node(BracketDisplayComponents.Score{
- isWinner = extradata.set2win,
- scoreText = OpponentDisplayCustom.InlineScore(opponent, 2),
- })
- end
- if opponent.extradata.score3 then
- self.root:node(BracketDisplayComponents.Score{
- isWinner = extradata.set3win,
- scoreText = OpponentDisplayCustom.InlineScore(opponent, 3)
- })
- end
- if (opponent.placement2 or opponent.placement or 0) == 1
- or opponent.advances then
- self.content:addClass('brkts-opponent-win')
- end
-end
-
----@param opponent TrackmaniaStandardOpponent
----@param scoreIndex integer|string
----@return number|string
-function OpponentDisplayCustom.InlineScore(opponent, scoreIndex)
- scoreIndex = scoreIndex or ''
- local status = opponent['status' .. scoreIndex] or opponent.extradata['status' .. scoreIndex]
- local score = tonumber(opponent['score' .. scoreIndex] or opponent.extradata['score' .. scoreIndex])
-
- if Logic.isNotEmpty(status) and status ~= SCORE_STATUS then
- return status
- end
-
- score = score or 0
- if (score == ZERO_SCORE and Opponent.isTbd(opponent)) or score == NO_SCORE then
- return ''
- end
-
- return score
-end
-
-return OpponentDisplayCustom
diff --git a/lua/wikis/trackmania/Widget/Match/Bracket/ScoreContainer/Custom.lua b/lua/wikis/trackmania/Widget/Match/Bracket/ScoreContainer/Custom.lua
new file mode 100644
index 00000000000..6a12f2cfee2
--- /dev/null
+++ b/lua/wikis/trackmania/Widget/Match/Bracket/ScoreContainer/Custom.lua
@@ -0,0 +1,64 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/ScoreContainer/Custom
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Logic = Lua.import('Module:Logic')
+local Opponent = Lua.import('Module:Opponent/Custom')
+
+local BracketScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer')
+local BracketScoreDisplay = Lua.import('Module:Widget/Match/Bracket/Score')
+local Component = Lua.import('Module:Widget/Component')
+local WidgetUtil = Lua.import('Module:Widget/Util')
+
+---@param props {opponent: standardOpponent}
+---@return VNode[]
+local function TrackmaniaBracketScoreContainer(props)
+ local opponent = props.opponent
+ local extradata = opponent.extradata or {}
+ if not extradata.additionalScores then
+ return BracketScoreContainer(props)
+ end
+
+ ---@param scoreIndex integer|string
+ ---@return number|string
+ local function InlineScoreSpecial(scoreIndex)
+ scoreIndex = scoreIndex or ''
+ local status = opponent['status' .. (
+ scoreIndex == 1 and '' or scoreIndex
+ )] or opponent.extradata['status' .. scoreIndex]
+ local score = tonumber(opponent['score' .. scoreIndex] or opponent.extradata['score' .. scoreIndex])
+
+ if Logic.isNotEmpty(status) and status ~= 'S' then
+ return status
+ end
+
+ score = score or 0
+ if (score == 0 and Opponent.isTbd(opponent)) or score == -1 then
+ return ''
+ end
+
+ return score
+ end
+
+ return WidgetUtil.collect(
+ BracketScoreDisplay{
+ isWinner = extradata.set1win,
+ scoreText = InlineScoreSpecial(1),
+ },
+ (extradata.score2 or opponent.score2) and BracketScoreDisplay{
+ isWinner = extradata.set2win,
+ scoreText = InlineScoreSpecial(2),
+ } or nil,
+ extradata.score3 and BracketScoreDisplay{
+ isWinner = extradata.set3win,
+ scoreText = InlineScoreSpecial(3),
+ } or nil
+ )
+end
+
+return Component.component(TrackmaniaBracketScoreContainer)
From 12f0640c0b1823e76678d46fddb3253b913e9634 Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Wed, 10 Jun 2026 18:29:10 +0900
Subject: [PATCH 05/10] add opponent entry widget
---
.../commons/MatchGroup/Display/Bracket.lua | 50 +++-------
.../commons/MatchGroup/Display/Helper.lua | 16 ++++
lua/wikis/commons/OpponentDisplay.lua | 94 -------------------
.../Widget/Match/Bracket/OpponentEntry.lua | 84 +++++++++++++++++
4 files changed, 113 insertions(+), 131 deletions(-)
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
diff --git a/lua/wikis/commons/MatchGroup/Display/Bracket.lua b/lua/wikis/commons/MatchGroup/Display/Bracket.lua
index 53d2f9b8927..a6cadedb961 100644
--- a/lua/wikis/commons/MatchGroup/Display/Bracket.lua
+++ b/lua/wikis/commons/MatchGroup/Display/Bracket.lua
@@ -20,8 +20,8 @@ local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
local WikiSpecific = Lua.import('Module:Brkts/WikiSpecific')
local Opponent = Lua.import('Module:Opponent/Custom')
-local OpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')
+local BracketOpponentEntry = Lua.import('Module:Widget/Match/Bracket/OpponentEntry')
local MatchInfoIcon = Lua.import('Module:Widget/Match/InfoIcon')
local NON_BREAKING_SPACE = ' '
@@ -29,7 +29,7 @@ local OPPONENT_HEIGHT_PADDING = 4
---@class BracketConfigOptions
---@field MatchSummaryContainer function?
----@field OpponentEntry function?
+---@field OpponentEntry Component?
---@field forceShortName boolean?
---@field headerHeight number?
---@field headerMargin number?
@@ -65,7 +65,7 @@ local OPPONENT_HEIGHT_PADDING = 4
---@field matchesById table
---@class BracketDisplayMatchProps
----@field OpponentEntry function
+---@field OpponentEntry Component
---@field MatchSummaryContainer function
---@field match MatchGroupUtilMatch
---@field forceShortName boolean
@@ -119,7 +119,7 @@ function BracketDisplay.Bracket(props)
local propsConfig = props.config or {}
local config = {
MatchSummaryContainer = propsConfig.MatchSummaryContainer or DisplayHelper.DefaultMatchSummaryContainer,
- OpponentEntry = propsConfig.OpponentEntry or BracketDisplay.OpponentEntry,
+ OpponentEntry = propsConfig.OpponentEntry or BracketOpponentEntry,
forceShortName = propsConfig.forceShortName or defaultConfig.forceShortName,
headerHeight = propsConfig.headerHeight or defaultConfig.headerHeight,
headerMargin = propsConfig.headerMargin or defaultConfig.headerMargin,
@@ -540,11 +540,11 @@ function BracketDisplay.NodeBody(props)
type = 'literal',
name = match.bracketData.qualLoseLiteral or '',
})
- qualLoseNode = BracketDisplay.Qualified({
+ qualLoseNode = BracketDisplay.Qualified{
OpponentEntry = config.OpponentEntry,
height = config.opponentHeight,
opponent = opponent,
- })
+ }
:css('margin-top', config.matchMargin + 6 .. 'px')
:css('margin-bottom', config.matchMargin .. 'px')
end
@@ -573,15 +573,13 @@ function BracketDisplay.Match(props)
local matchNode = mw.html.create('div'):addClass('brkts-match brkts-match-popup-wrapper')
for ix, opponent in ipairs(props.match.opponents) do
- local opponentEntryNode = props.OpponentEntry({
+ local opponentEntryNode = props.OpponentEntry{
displayType = 'bracket',
forceShortName = props.forceShortName,
height = props.opponentHeight,
opponent = opponent,
- })
- :addClass(ix == #props.match.opponents and 'brkts-opponent-entry-last' or nil)
- :css('height', props.opponentHeight .. 'px')
- DisplayHelper.addOpponentHighlight(opponentEntryNode, opponent)
+ classes = ix == #props.match.opponents and {'brkts-opponent-entry-last'} or nil,
+ }
matchNode:node(opponentEntryNode)
end
@@ -610,17 +608,15 @@ function BracketDisplay.Match(props)
end
---Display component for a qualification spot.
----@param props {OpponentEntry: function, height: number, opponent: standardOpponent}
+---@param props {OpponentEntry: Component, height: number, opponent: standardOpponent}
---@return Html
function BracketDisplay.Qualified(props)
- local opponentEntryNode = props.OpponentEntry({
+ local opponentEntryNode = props.OpponentEntry{
displayType = 'bracket-qualified',
height = props.height,
opponent = props.opponent,
- })
- :addClass('brkts-opponent-entry-last')
- :css('height', props.height .. 'px')
- DisplayHelper.addOpponentHighlight(opponentEntryNode, props.opponent)
+ classes = {'brkts-opponent-entry-last'},
+ }
return mw.html.create('div'):addClass('brkts-qualified')
:node(opponentEntryNode)
@@ -816,24 +812,4 @@ function BracketDisplay.getRunnerUpOpponent(match, bracketResetMatch)
end
end
---[[
-Display component for an opponent in a bracket match. Shows the name and flag
-of the opponent, as well as the opponent's scores.
-
-This is the default opponent entry component. Specific wikis may override this
-by passing in a different props.OpponentEntry in the Bracket component.
-]]
----@param props {opponent: standardOpponent, displayType: string, forceShortName: boolean?, height: number}
----@return Html
-function BracketDisplay.OpponentEntry(props)
- local opponentEntry = OpponentDisplay.BracketOpponentEntry(
- props.opponent,
- {forceShortName = props.forceShortName, showTbd = false}
- )
- if props.displayType == 'bracket' then
- opponentEntry:addScores(props.opponent)
- end
- return opponentEntry.root
-end
-
return BracketDisplay
diff --git a/lua/wikis/commons/MatchGroup/Display/Helper.lua b/lua/wikis/commons/MatchGroup/Display/Helper.lua
index 943e72250e0..7680b5d503c 100644
--- a/lua/wikis/commons/MatchGroup/Display/Helper.lua
+++ b/lua/wikis/commons/MatchGroup/Display/Helper.lua
@@ -42,6 +42,22 @@ function DisplayHelper.addOpponentHighlight(node, opponent)
:attr('aria-label', Opponent.toName(opponent))
end
+---@param props HtmlNodeProps
+---@param opponent standardOpponent
+---@return HtmlNodeProps
+function DisplayHelper.addOpponentHighlightToProps(props, opponent)
+ if Opponent.isTbd(opponent) then
+ return props
+ end
+ props.classes = props.classes or {}
+ table.insert(props.classes, 'brkts-opponent-hover')
+
+ props.attributes = props.attributes or {}
+ props.attributes['aria-label'] = Opponent.toName(opponent)
+
+ return props
+end
+
-- Expands a header code by making a RPC call.
---@param headerCode string
---@return string[]
diff --git a/lua/wikis/commons/OpponentDisplay.lua b/lua/wikis/commons/OpponentDisplay.lua
index 46506300284..6acef677e32 100644
--- a/lua/wikis/commons/OpponentDisplay.lua
+++ b/lua/wikis/commons/OpponentDisplay.lua
@@ -32,100 +32,6 @@ local OpponentDisplay = {propTypes = {}, types = {}}
OpponentDisplay.types.TeamStyle = TypeUtil.literalUnion('standard', 'short', 'bracket', 'hybrid', 'icon', 'dynamic')
---@alias teamStyle 'standard'|'short'|'bracket'|'hybrid'|'icon'|'dynamic'
----Display component for an opponent entry appearing in a bracket match.
----@class BracketOpponentEntry
----@operator call(...): BracketOpponentEntry
----@field content Html
----@field root Html
-OpponentDisplay.BracketOpponentEntry = Class.new(
- ---@param self self
- ---@param opponent standardOpponent
- ---@param options {forceShortName: boolean, showTbd: boolean}
- function(self, opponent, options)
- self.content = mw.html.create('div'):addClass('brkts-opponent-entry-left')
-
- if opponent.type == Opponent.team then
- if options.showTbd ~= false or not Opponent.isTbd(opponent) then
- self:createTeam(opponent.template or 'tbd', options)
- end
- elseif Opponent.typeIsParty(opponent.type) then
- self:createPlayers(opponent, options)
- elseif opponent.type == Opponent.literal then
- self:createLiteral(opponent.name or '')
- end
-
- self.root = mw.html.create('div'):addClass('brkts-opponent-entry')
- :node(self.content)
- end
-)
-
----Creates team display as BracketOpponentEntry
----@param template string
----@param options {forceShortName: boolean}
-function OpponentDisplay.BracketOpponentEntry:createTeam(template, options)
- options = options or {}
- local forceShortName = options.forceShortName
-
- local opponentNode = OpponentDisplay.BlockTeamContainer{
- showLink = false,
- style = forceShortName and 'short' or 'hybrid',
- template = template,
- }
-
- self.content:node(opponentNode)
-end
-
----Creates party display as BracketOpponentEntry
----@param opponent standardOpponent
----@param options {showTbd: boolean?}
-function OpponentDisplay.BracketOpponentEntry:createPlayers(opponent, options)
- local playerNode = OpponentDisplay.BlockPlayers({
- opponent = opponent,
- overflow = 'ellipsis',
- showLink = false,
- showTbd = options.showTbd,
- })
- self.content:node(playerNode)
-
- if opponent.type == Opponent.solo then
- self.content:addClass(Faction.bgClass(opponent.players[1].faction))
- end
-end
-
----Creates literal display as BracketOpponentEntry
----@param name string
-function OpponentDisplay.BracketOpponentEntry:createLiteral(name)
- local literal = OpponentDisplay.BlockLiteral({
- name = name,
- overflow = 'ellipsis',
- })
- self.content:node(literal)
-end
-
----Adds scores to BracketOpponentEntry
----@param opponent standardOpponent
-function OpponentDisplay.BracketOpponentEntry:addScores(opponent)
- local score1Node = BracketDisplayComponents.Score{
- isWinner = opponent.placement == 1 or opponent.advances,
- scoreText = OpponentDisplay.InlineScore(opponent),
- }
- self.root:node(score1Node)
-
- local score2Node
- if opponent.score2 then
- score2Node = BracketDisplayComponents.Score{
- isWinner = opponent.placement2 == 1,
- scoreText = OpponentDisplay.InlineScore2(opponent),
- }
- end
- self.root:node(score2Node)
-
- if (opponent.placement2 or opponent.placement or 0) == 1
- or opponent.advances then
- self.content:addClass('brkts-opponent-win')
- end
-end
-
---@class InlineOpponentProps
---@field flip boolean?
---@field opponent standardOpponent
diff --git a/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
new file mode 100644
index 00000000000..f50d2543b32
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
@@ -0,0 +1,84 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/OpponentEntry
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Array = Lua.import('Module:Array')
+local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper')
+local Faction = Lua.import('Module:Faction')
+local Opponent = Lua.import('Module:Opponent/Custom')
+local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+
+local Component = Lua.import('Module:Widget/Component')
+local Html = Lua.import('Module:Widget/Html')
+local ScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Custom')
+
+---@class BracketOpponentEntryProps
+---@field classes string[]?
+---@field opponent standardOpponent
+---@field height number
+---@field forceShortName boolean?
+---@field showTbd boolean?
+---@field displayType string
+
+---@param props BracketOpponentEntryProps
+---@return VNode
+local function createOpponentDisplay(props)
+ local opponent = props.opponent
+ if opponent.type == Opponent.team then
+ if props.showTbd ~= false or not Opponent.isTbd(opponent) then
+ return OpponentDisplay.BlockTeamContainer{
+ showLink = false,
+ style = props.forceShortName and 'short' or 'hybrid',
+ template = opponent.template or 'tbd',
+ }
+ end
+ elseif Opponent.typeIsParty(opponent.type) then
+ return OpponentDisplay.BlockPlayers{
+ opponent = opponent,
+ overflow = 'ellipsis',
+ showLink = false,
+ showTbd = props.showTbd,
+ }
+ end
+ -- Literal opponent type
+ return OpponentDisplay.BlockLiteral{
+ name = Opponent.toName(opponent),
+ overflow = 'ellipsis',
+ }
+end
+
+---@param props BracketOpponentEntryProps
+---@return VNode
+local function BracketOpponentEntry(props)
+ local opponent = props.opponent
+ local win = (opponent.placement2 or opponent.placement or 0) == 1
+ or opponent.advances
+ return Html.Div(DisplayHelper.addOpponentHighlightToProps(
+ {
+ classes = Array.extend(
+ 'brkts-opponent-entry',
+ props.classes
+ ),
+ css = props.height and {height = props.height .. 'px'} or nil,
+ children = Html.Div{
+ classes = Array.extend(
+ 'brkts-opponent-entry-left',
+ win and 'brkts-opponent-win' or nil,
+ opponent.type == Opponent.solo and Faction.bgClass(opponent.players[1].faction) or nil
+ ),
+ children = {
+ createOpponentDisplay(props),
+ props.displayType == 'bracket' and ScoreContainer(props) or nil
+ }
+ }
+ },
+ props.opponent
+ ))
+end
+
+return Component.component(BracketOpponentEntry, {showTbd = false})
From 242288f731f78efdfad531a4f6503fad406a73ae Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Tue, 16 Jun 2026 16:08:31 +0900
Subject: [PATCH 06/10] starcraft
---
.../commons/OpponentDisplay/Starcraft.lua | 60 +----------------
.../commons/Widget/Match/Bracket/Opponent.lua | 47 +++++++++++++
.../Match/Bracket/Opponent/Starcraft.lua | 46 +++++++++++++
.../Widget/Match/Bracket/OpponentEntry.lua | 66 +++++++------------
.../Match/Bracket/OpponentEntry/Starcraft.lua | 29 ++++++++
lua/wikis/starcraft/Brkts/WikiSpecific.lua | 16 ++++-
lua/wikis/starcraft2/Brkts/WikiSpecific.lua | 16 ++++-
7 files changed, 176 insertions(+), 104 deletions(-)
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/Opponent.lua
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/Opponent/Starcraft.lua
create mode 100644 lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua
diff --git a/lua/wikis/commons/OpponentDisplay/Starcraft.lua b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
index 938fb1327e3..dccd16e86eb 100644
--- a/lua/wikis/commons/OpponentDisplay/Starcraft.lua
+++ b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
@@ -28,64 +28,6 @@ local StarcraftOpponentDisplay = Table.copy(OpponentDisplay)
---@class StarcraftBlockOpponentProps: BlockOpponentProps
---@field opponent StarcraftStandardOpponent
----Display component for an opponent entry appearing in a bracket match.
----@class StarcraftBracketOpponentEntry: BracketOpponentEntry
----@operator call(...): StarcraftBracketOpponentEntry
-local BracketOpponentEntry = Class.new(OpponentDisplay.BracketOpponentEntry,
- ---@param self self
- ---@param opponent StarcraftStandardOpponent
- ---@param options {forceShortName: boolean, showTbd: boolean}
- function(self, opponent, options)
- local showFactionBackground = opponent.type == Opponent.solo
- or opponent.type == Opponent.duo and opponent.isArchon
-
- self.content = mw.html.create('div'):addClass('brkts-opponent-entry-left')
- :addClass(showFactionBackground and Faction.bgClass(opponent.players[1].faction) or nil)
-
- if opponent.type == Opponent.team then
- if options.showTbd ~= false or not Opponent.isTbd(opponent) then
- self:createTeam(opponent.template or 'tbd', options)
- end
- elseif Opponent.typeIsParty(opponent.type) then
- self.content:node(StarcraftOpponentDisplay.BlockOpponent{
- opponent = opponent,
- overflow = 'ellipsis',
- playerClass = 'starcraft-bracket-block-player',
- showLink = false,
- showTbd = options.showTbd,
- })
- else
- self:createLiteral(opponent.name or '')
- end
-
- self.root = mw.html.create('div'):addClass('brkts-opponent-entry')
- :node(self.content)
- end
-)
-
----Adds scores to BracketOpponentEntry
----@param opponent StarcraftStandardOpponent
-function BracketOpponentEntry:addScores(opponent)
- self.root:node(BracketDisplayComponents.Score{
- isWinner = opponent.placement == 1 or opponent.advances,
- scoreText = StarcraftOpponentDisplay.InlineScore(opponent),
- })
-
- if opponent.score2 then
- self.root:node(BracketDisplayComponents.Score{
- isWinner = opponent.placement2 == 1,
- scoreText = StarcraftOpponentDisplay.InlineScore2(opponent),
- })
- end
-
- if (opponent.placement2 or opponent.placement or 0) == 1
- or opponent.advances then
- self.content:addClass('brkts-opponent-win')
- end
-end
-
-StarcraftOpponentDisplay.BracketOpponentEntry = BracketOpponentEntry
-
---Displays an opponent as a block element. The width of the component is
---determined by its layout context, and not of the opponent.
---@param props StarcraftBlockOpponentProps
@@ -110,7 +52,7 @@ end
---Displays a player opponent (solo, duo, trio, or quad) as a block element.
---@param props StarcraftBlockOpponentProps
----@return Widget
+---@return Renderable
function StarcraftOpponentDisplay.BlockPlayers(props)
local opponent = props.opponent
local showFaction = props.showFaction ~= false
diff --git a/lua/wikis/commons/Widget/Match/Bracket/Opponent.lua b/lua/wikis/commons/Widget/Match/Bracket/Opponent.lua
new file mode 100644
index 00000000000..668d043801f
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/Opponent.lua
@@ -0,0 +1,47 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/Opponent
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Opponent = Lua.import('Module:Opponent/Custom')
+local OpponentDisplay = Lua.import('Module:OpponentDisplay')
+
+local Component = Lua.import('Module:Widget/Component')
+
+---@class BracketOpponentProps
+---@field opponent standardOpponent
+---@field forceShortName boolean?
+---@field showTbd boolean?
+
+---@param props BracketOpponentProps
+---@return VNode
+local function BracketOpponent(props)
+ local opponent = props.opponent
+ if opponent.type == Opponent.team then
+ if props.showTbd ~= false or not Opponent.isTbd(opponent) then
+ return OpponentDisplay.BlockTeamContainer{
+ showLink = false,
+ style = props.forceShortName and 'short' or 'hybrid',
+ template = opponent.template or 'tbd',
+ }
+ end
+ elseif Opponent.typeIsParty(opponent.type) then
+ return OpponentDisplay.BlockPlayers{
+ opponent = opponent,
+ overflow = 'ellipsis',
+ showLink = false,
+ showTbd = props.showTbd,
+ }
+ end
+ -- Literal opponent type
+ return OpponentDisplay.BlockLiteral{
+ name = Opponent.toName(opponent),
+ overflow = 'ellipsis',
+ }
+end
+
+return Component.component(BracketOpponent)
diff --git a/lua/wikis/commons/Widget/Match/Bracket/Opponent/Starcraft.lua b/lua/wikis/commons/Widget/Match/Bracket/Opponent/Starcraft.lua
new file mode 100644
index 00000000000..0ab0617f44a
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/Opponent/Starcraft.lua
@@ -0,0 +1,46 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/Opponent/Starcraft
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Opponent = Lua.import('Module:Opponent/Custom')
+local OpponentDisplay = Lua.import('Module:OpponentDisplay/Starcraft')
+
+local Component = Lua.import('Module:Widget/Component')
+
+---@class StarcraftBracketOpponentProps: BracketOpponentProps
+---@field opponent StarcraftStandardOpponent
+
+---@param props StarcraftBracketOpponentProps
+---@return Renderable
+local function StarcraftBracketOpponent(props)
+ local opponent = props.opponent
+ if opponent.type == Opponent.team then
+ if props.showTbd ~= false or not Opponent.isTbd(opponent) then
+ return OpponentDisplay.BlockTeamContainer{
+ showLink = false,
+ style = props.forceShortName and 'short' or 'hybrid',
+ template = opponent.template or 'tbd',
+ }
+ end
+ elseif Opponent.typeIsParty(opponent.type) then
+ return OpponentDisplay.BlockOpponent{
+ opponent = opponent,
+ overflow = 'ellipsis',
+ playerClass = 'starcraft-bracket-block-player',
+ showLink = false,
+ showTbd = props.showTbd,
+ }
+ end
+ -- Literal opponent type
+ return OpponentDisplay.BlockLiteral{
+ name = Opponent.toName(opponent),
+ overflow = 'ellipsis',
+ }
+end
+
+return Component.component(StarcraftBracketOpponent)
diff --git a/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
index f50d2543b32..112589ec91d 100644
--- a/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
+++ b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua
@@ -10,47 +10,19 @@ local Lua = require('Module:Lua')
local Array = Lua.import('Module:Array')
local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper')
local Faction = Lua.import('Module:Faction')
+local Logic = Lua.import('Module:Logic')
local Opponent = Lua.import('Module:Opponent/Custom')
-local OpponentDisplay = Lua.import('Module:OpponentDisplay')
local Component = Lua.import('Module:Widget/Component')
local Html = Lua.import('Module:Widget/Html')
local ScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Custom')
----@class BracketOpponentEntryProps
+---@class BracketOpponentEntryProps: BracketOpponentProps
---@field classes string[]?
----@field opponent standardOpponent
---@field height number
----@field forceShortName boolean?
----@field showTbd boolean?
---@field displayType string
-
----@param props BracketOpponentEntryProps
----@return VNode
-local function createOpponentDisplay(props)
- local opponent = props.opponent
- if opponent.type == Opponent.team then
- if props.showTbd ~= false or not Opponent.isTbd(opponent) then
- return OpponentDisplay.BlockTeamContainer{
- showLink = false,
- style = props.forceShortName and 'short' or 'hybrid',
- template = opponent.template or 'tbd',
- }
- end
- elseif Opponent.typeIsParty(opponent.type) then
- return OpponentDisplay.BlockPlayers{
- opponent = opponent,
- overflow = 'ellipsis',
- showLink = false,
- showTbd = props.showTbd,
- }
- end
- -- Literal opponent type
- return OpponentDisplay.BlockLiteral{
- name = Opponent.toName(opponent),
- overflow = 'ellipsis',
- }
-end
+---@field showFactionBackground boolean?
+---@field BracketOpponent Component?
---@param props BracketOpponentEntryProps
---@return VNode
@@ -58,6 +30,7 @@ local function BracketOpponentEntry(props)
local opponent = props.opponent
local win = (opponent.placement2 or opponent.placement or 0) == 1
or opponent.advances
+ local BracketOpponent = props.BracketOpponent or Lua.import('Module:Widget/Match/Bracket/Opponent')
return Html.Div(DisplayHelper.addOpponentHighlightToProps(
{
classes = Array.extend(
@@ -65,20 +38,27 @@ local function BracketOpponentEntry(props)
props.classes
),
css = props.height and {height = props.height .. 'px'} or nil,
- children = Html.Div{
- classes = Array.extend(
- 'brkts-opponent-entry-left',
- win and 'brkts-opponent-win' or nil,
- opponent.type == Opponent.solo and Faction.bgClass(opponent.players[1].faction) or nil
- ),
- children = {
- createOpponentDisplay(props),
- props.displayType == 'bracket' and ScoreContainer(props) or nil
- }
+ children = {
+ Html.Div{
+ classes = Array.extend(
+ 'brkts-opponent-entry-left',
+ win and 'brkts-opponent-win' or nil,
+ Logic.nilOr(
+ props.showFactionBackground, opponent.type == Opponent.solo
+ ) and Faction.bgClass(opponent.players[1].faction) or nil
+ ),
+ children = BracketOpponent(props),
+ },
+ props.displayType == 'bracket' and ScoreContainer(props) or nil
}
},
props.opponent
))
end
-return Component.component(BracketOpponentEntry, {showTbd = false})
+return Component.component(
+ BracketOpponentEntry,
+ {
+ showTbd = false
+ }
+)
diff --git a/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua
new file mode 100644
index 00000000000..b3c705f7922
--- /dev/null
+++ b/lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua
@@ -0,0 +1,29 @@
+---
+-- @Liquipedia
+-- page=Module:Widget/Match/Bracket/OpponentEntry
+--
+-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
+--
+
+local Lua = require('Module:Lua')
+
+local Opponent = Lua.import('Module:Opponent/Starcraft')
+
+local Component = Lua.import('Module:Widget/Component')
+local BracketOpponentEntry = Lua.import('Module:Widget/Match/Bracket/OpponentEntry')
+local StarcraftBracketOpponent = Lua.import('Module:Widget/Match/Bracket/Opponent/Starcraft')
+
+---@class StarcraftBracketOpponentEntryProps: BracketOpponentEntryProps
+---@field opponent StarcraftStandardOpponent
+
+---@param props StarcraftBracketOpponentEntryProps
+---@return VNode
+local function StarcraftBracketOpponentEntry(props)
+ local opponent = props.opponent
+ props.BracketOpponent = StarcraftBracketOpponent
+ props.showFactionBackground = opponent.type == Opponent.solo
+ or opponent.type == Opponent.duo and opponent.isArchon
+ return BracketOpponentEntry(props)
+end
+
+return Component.component(StarcraftBracketOpponentEntry, {showTbd = false})
diff --git a/lua/wikis/starcraft/Brkts/WikiSpecific.lua b/lua/wikis/starcraft/Brkts/WikiSpecific.lua
index e3f843e0739..5fbfb065b9c 100644
--- a/lua/wikis/starcraft/Brkts/WikiSpecific.lua
+++ b/lua/wikis/starcraft/Brkts/WikiSpecific.lua
@@ -11,6 +11,7 @@ local FnUtil = Lua.import('Module:FnUtil')
local Table = Lua.import('Module:Table')
local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')
+local StarcraftBracketOpponentEntry = Lua.import('Module:Widget/Match/Bracket/OpponentEntry')
---@class StarcraftBrktsWikiSpecific: BrktsWikiSpecific
local WikiSpecific = Table.copy(BaseWikiSpecific)
@@ -38,7 +39,7 @@ function WikiSpecific.getMatchGroupContainer(matchGroupType, maxOpponentCount)
end
local Bracket = Lua.import('Module:MatchGroup/Display/Bracket')
- return WikiSpecific.adjustMatchGroupContainerConfig(Bracket.BracketContainer)
+ return WikiSpecific.adjustBracketContainerConfig(Bracket.BracketContainer)
end
---@param displayContainer function
@@ -51,6 +52,19 @@ function WikiSpecific.adjustMatchGroupContainerConfig(displayContainer)
end
end
+---@param displayContainer fun(props: {bracketId: string, config: BracketConfigOptions}): Html
+---@return fun(props: {bracketId: string, config: BracketConfigOptions}): Html
+function WikiSpecific.adjustBracketContainerConfig(displayContainer)
+ local StarcraftMatchSummary = Lua.import('Module:MatchSummary/Starcraft')
+ return function(props)
+ local config = Table.merge(props.config, {
+ MatchSummaryContainer = StarcraftMatchSummary.getByMatchId,
+ OpponentEntry = StarcraftBracketOpponentEntry
+ })
+ return displayContainer(Table.merge(props, {config = config}))
+ end
+end
+
---@param displayMode string
---@return function?
function WikiSpecific.getMatchContainer(displayMode)
diff --git a/lua/wikis/starcraft2/Brkts/WikiSpecific.lua b/lua/wikis/starcraft2/Brkts/WikiSpecific.lua
index 4a6ec507795..d929032b966 100644
--- a/lua/wikis/starcraft2/Brkts/WikiSpecific.lua
+++ b/lua/wikis/starcraft2/Brkts/WikiSpecific.lua
@@ -11,6 +11,7 @@ local FnUtil = Lua.import('Module:FnUtil')
local Table = Lua.import('Module:Table')
local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')
+local StarcraftBracketOpponentEntry = Lua.import('Module:Widget/Match/Bracket/OpponentEntry')
---@class Starcraft2BrktsWikiSpecific: BrktsWikiSpecific
local WikiSpecific = Table.copy(BaseWikiSpecific)
@@ -38,7 +39,7 @@ function WikiSpecific.getMatchGroupContainer(matchGroupType, maxOpponentCount)
end
local Bracket = Lua.import('Module:MatchGroup/Display/Bracket')
- return WikiSpecific.adjustMatchGroupContainerConfig(Bracket.BracketContainer)
+ return WikiSpecific.adjustBracketContainerConfig(Bracket.BracketContainer)
end
---@param displayContainer function
@@ -51,6 +52,19 @@ function WikiSpecific.adjustMatchGroupContainerConfig(displayContainer)
end
end
+---@param displayContainer fun(props: {bracketId: string, config: BracketConfigOptions}): Html
+---@return fun(props: {bracketId: string, config: BracketConfigOptions}): Html
+function WikiSpecific.adjustBracketContainerConfig(displayContainer)
+ local StarcraftMatchSummary = Lua.import('Module:MatchSummary/Starcraft')
+ return function(props)
+ local config = Table.merge(props.config, {
+ MatchSummaryContainer = StarcraftMatchSummary.getByMatchId,
+ OpponentEntry = StarcraftBracketOpponentEntry
+ })
+ return displayContainer(Table.merge(props, {config = config}))
+ end
+end
+
---@param displayMode string
---@return function?
function WikiSpecific.getMatchContainer(displayMode)
From d3f708014d6e4f77b49381c561f6f61be076c51e Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Tue, 16 Jun 2026 16:47:20 +0900
Subject: [PATCH 07/10] clean unused imports
---
lua/wikis/commons/OpponentDisplay.lua | 3 ---
lua/wikis/commons/OpponentDisplay/Starcraft.lua | 2 --
lua/wikis/commons/Widget/Match/Bracket/All.lua | 15 ---------------
3 files changed, 20 deletions(-)
delete mode 100644 lua/wikis/commons/Widget/Match/Bracket/All.lua
diff --git a/lua/wikis/commons/OpponentDisplay.lua b/lua/wikis/commons/OpponentDisplay.lua
index 6acef677e32..8395c065372 100644
--- a/lua/wikis/commons/OpponentDisplay.lua
+++ b/lua/wikis/commons/OpponentDisplay.lua
@@ -8,9 +8,7 @@
local Lua = require('Module:Lua')
local Array = Lua.import('Module:Array')
-local Class = Lua.import('Module:Class')
local DisplayUtil = Lua.import('Module:DisplayUtil')
-local Faction = Lua.import('Module:Faction')
local Logic = Lua.import('Module:Logic')
local Math = Lua.import('Module:MathUtil')
local Table = Lua.import('Module:Table')
@@ -20,7 +18,6 @@ local Opponent = Lua.import('Module:Opponent')
local PlayerDisplay = Lua.import('Module:Player/Display/Custom')
local Html = Lua.import('Module:Widget/Html')
-local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
local BlockTeam = Lua.import('Module:Widget/TeamDisplay/Block')
local TeamInline = Lua.import('Module:Widget/TeamDisplay/Inline')
diff --git a/lua/wikis/commons/OpponentDisplay/Starcraft.lua b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
index dccd16e86eb..2d370a94004 100644
--- a/lua/wikis/commons/OpponentDisplay/Starcraft.lua
+++ b/lua/wikis/commons/OpponentDisplay/Starcraft.lua
@@ -8,7 +8,6 @@
local Lua = require('Module:Lua')
local Array = Lua.import('Module:Array')
-local Class = Lua.import('Module:Class')
local Faction = Lua.import('Module:Faction')
local Icon = Lua.import('Module:Icon')
local Logic = Lua.import('Module:Logic')
@@ -17,7 +16,6 @@ local Table = Lua.import('Module:Table')
local Opponent = Lua.import('Module:Opponent')
local OpponentDisplay = Lua.import('Module:OpponentDisplay')
-local BracketDisplayComponents = Lua.import('Module:Widget/Match/Bracket/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local WidgetUtil = Lua.import('Module:Widget/Util')
diff --git a/lua/wikis/commons/Widget/Match/Bracket/All.lua b/lua/wikis/commons/Widget/Match/Bracket/All.lua
deleted file mode 100644
index c730fbcd477..00000000000
--- a/lua/wikis/commons/Widget/Match/Bracket/All.lua
+++ /dev/null
@@ -1,15 +0,0 @@
----
--- @Liquipedia
--- page=Module:Widget/Match/Bracket/All
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Widgets = {}
-
-local Lua = require('Module:Lua')
-
-Widgets.Score = Lua.import('Module:Widget/Match/Bracket/Score')
-Widgets.ScoreContainer = Lua.import('Module:Widget/Match/Bracket/ScoreContainer/Custom')
-
-return Widgets
From 153181a8cc6bc88ccdbeb01949ef3be0015175b4 Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Tue, 16 Jun 2026 16:55:52 +0900
Subject: [PATCH 08/10] widget3
---
lua/wikis/commons/Bracket/Template.lua | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lua/wikis/commons/Bracket/Template.lua b/lua/wikis/commons/Bracket/Template.lua
index 6ef6cfbc259..b8e8af6946a 100644
--- a/lua/wikis/commons/Bracket/Template.lua
+++ b/lua/wikis/commons/Bracket/Template.lua
@@ -18,6 +18,8 @@ local MatchGroupCoordinates = Lua.import('Module:MatchGroup/Coordinates')
local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
local Opponent = Lua.import('Module:Opponent')
+local Html = Lua.import('Module:Widget/Html')
+
---@class BracketTemplateBracket
---@field bracketDatasById table
---@field rootMatchIds string[]
@@ -57,14 +59,14 @@ end
function BracketTemplate.BracketContainer(props)
local matchRecords = MatchGroupUtil.fetchMatchRecords(props.bracketId)
Array.forEach(matchRecords, function(match)
- match.match2opponents = {{type = Opponent.literal, name = '', match2players = {}}}
+ match.match2opponents = {Opponent.blank(Opponent.literal)}
end)
local bracket = MatchGroupUtil.makeMatchGroup(matchRecords) --[[@as MatchGroupUtilBracket]]
return BracketDisplay.Bracket({
bracket = bracket,
config = Table.merge(props.config, {
- OpponentEntry = function() return mw.html.create('div'):addClass('brkts-opponent-entry') end,
+ OpponentEntry = function() return Html.Div{classes = {'brkts-opponent-entry'}} end,
matchHasDetails = function() return false end,
})
})
From 708a52a524c6ab0a89a78a69eb71a0a199d4826c Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Tue, 16 Jun 2026 17:15:39 +0900
Subject: [PATCH 09/10] kick custom
---
lua/wikis/rocketleague/Brkts/WikiSpecific.lua | 18 +----
.../MatchGroup/Display/Bracket/Custom.lua | 42 ------------
lua/wikis/smash/Brkts/WikiSpecific.lua | 28 +-------
.../MatchGroup/Display/Bracket/Custom.lua | 66 -------------------
lua/wikis/trackmania/Brkts/WikiSpecific.lua | 2 +-
.../MatchGroup/Display/Bracket/Custom.lua | 42 ------------
6 files changed, 3 insertions(+), 195 deletions(-)
delete mode 100644 lua/wikis/rocketleague/MatchGroup/Display/Bracket/Custom.lua
delete mode 100644 lua/wikis/smash/MatchGroup/Display/Bracket/Custom.lua
delete mode 100644 lua/wikis/trackmania/MatchGroup/Display/Bracket/Custom.lua
diff --git a/lua/wikis/rocketleague/Brkts/WikiSpecific.lua b/lua/wikis/rocketleague/Brkts/WikiSpecific.lua
index 94f50699394..22d325d50be 100644
--- a/lua/wikis/rocketleague/Brkts/WikiSpecific.lua
+++ b/lua/wikis/rocketleague/Brkts/WikiSpecific.lua
@@ -7,20 +7,4 @@
local Lua = require('Module:Lua')
-local Table = Lua.import('Module:Table')
-
-local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')
-
----@class RocketleagueBrktsWikiSpecific: BrktsWikiSpecific
-local WikiSpecific = Table.copy(BaseWikiSpecific)
-
----@param matchGroupType string
----@param maxOpponentCount integer
----@return function
-function WikiSpecific.getMatchGroupContainer(matchGroupType, maxOpponentCount)
- return matchGroupType == 'matchlist'
- and Lua.import('Module:MatchGroup/Display/Matchlist').MatchlistContainer
- or Lua.import('Module:MatchGroup/Display/Bracket/Custom').BracketContainer
-end
-
-return WikiSpecific
+return Lua.import('Module:Brkts/WikiSpecific/Base')
diff --git a/lua/wikis/rocketleague/MatchGroup/Display/Bracket/Custom.lua b/lua/wikis/rocketleague/MatchGroup/Display/Bracket/Custom.lua
deleted file mode 100644
index 7e4f9958aee..00000000000
--- a/lua/wikis/rocketleague/MatchGroup/Display/Bracket/Custom.lua
+++ /dev/null
@@ -1,42 +0,0 @@
----
--- @Liquipedia
--- page=Module:MatchGroup/Display/Bracket/Custom
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Lua = require('Module:Lua')
-
-local Table = Lua.import('Module:Table')
-
-local BracketDisplay = Lua.import('Module:MatchGroup/Display/Bracket')
-local CustomOpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
-
-local CustomBracketDisplay = {propTypes = {}}
-
----@param props {bracketId: string, config: BracketConfigOptions}
----@return Html
-function CustomBracketDisplay.BracketContainer(props)
- return BracketDisplay.Bracket({
- bracket = MatchGroupUtil.fetchMatchGroup(props.bracketId) --[[@as MatchGroupUtilBracket]],
- config = Table.merge(props.config, {
- OpponentEntry = CustomBracketDisplay.OpponentEntry,
- })
- })
-end
-
----@param props {opponent: standardOpponent, displayType: string, forceShortName: boolean?, height: number}
----@return Html
-function CustomBracketDisplay.OpponentEntry(props)
- local opponentEntry = CustomOpponentDisplay.BracketOpponentEntry(
- props.opponent,
- {forceShortName = props.forceShortName, showTbd = false}
- )
- if props.displayType == 'bracket' then
- opponentEntry:addScores(props.opponent)
- end
- return opponentEntry.root
-end
-
-return CustomBracketDisplay
diff --git a/lua/wikis/smash/Brkts/WikiSpecific.lua b/lua/wikis/smash/Brkts/WikiSpecific.lua
index 9e0e1dabef6..4089b74a787 100644
--- a/lua/wikis/smash/Brkts/WikiSpecific.lua
+++ b/lua/wikis/smash/Brkts/WikiSpecific.lua
@@ -7,31 +7,5 @@
local Lua = require('Module:Lua')
-local Logic = Lua.import('Module:Logic')
-local Table = Lua.import('Module:Table')
+return Lua.import('Module:Brkts/WikiSpecific/Base')
-local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')
-
----@class SmashBrktsWikiSpecific: BrktsWikiSpecific
-local WikiSpecific = Table.copy(BaseWikiSpecific)
-
----@param matchGroupType string
----@param maxOpponentCount integer
----@return function
-function WikiSpecific.getMatchGroupContainer(matchGroupType, maxOpponentCount)
- return matchGroupType == 'matchlist'
- and Lua.import('Module:MatchGroup/Display/Matchlist').MatchlistContainer
- or Lua.import('Module:MatchGroup/Display/Bracket/Custom').BracketContainer
-end
-
----@param match table
----@return boolean
-function WikiSpecific.matchHasDetails(match)
- return match.dateIsExact
- or Logic.isNotEmpty(match.vod)
- or not Table.isEmpty(match.links)
- or Logic.isNotEmpty(match.comment)
- or 0 < #match.games
-end
-
-return WikiSpecific
diff --git a/lua/wikis/smash/MatchGroup/Display/Bracket/Custom.lua b/lua/wikis/smash/MatchGroup/Display/Bracket/Custom.lua
deleted file mode 100644
index a623874221c..00000000000
--- a/lua/wikis/smash/MatchGroup/Display/Bracket/Custom.lua
+++ /dev/null
@@ -1,66 +0,0 @@
----
--- @Liquipedia
--- page=Module:MatchGroup/Display/Bracket/Custom
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Lua = require('Module:Lua')
-
-local Array = Lua.import('Module:Array')
-local Characters = Lua.import('Module:Characters')
-local Table = Lua.import('Module:Table')
-
-local Opponent = Lua.import('Module:Opponent/Custom')
-local OpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')
-
-local BracketDisplay = Lua.import('Module:MatchGroup/Display/Bracket')
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
-
-local CustomBracketDisplay = {propTypes = {}}
-
----@param props {bracketId: string, config: BracketConfigOptions}
----@return Html
-function CustomBracketDisplay.BracketContainer(props)
- return BracketDisplay.Bracket({
- bracket = MatchGroupUtil.fetchMatchGroup(props.bracketId) --[[@as MatchGroupUtilBracket]],
- config = Table.merge(props.config, {
- OpponentEntry = CustomBracketDisplay.OpponentEntry,
- })
- })
-end
-
----@param props {opponent: SmashStandardOpponent, displayType: string, forceShortName: boolean?, height: number}
----@return Html
-function CustomBracketDisplay.OpponentEntry(props)
- local opponentEntry = OpponentDisplay.BracketOpponentEntry(
- props.opponent,
- {forceShortName = props.forceShortName, showTbd = false}
- )
- if props.displayType == 'bracket' and props.opponent.type == Opponent.solo then
- CustomBracketDisplay._addHeads(opponentEntry, props.opponent)
- if props.opponent.placement == 1 then
- opponentEntry.content:addClass('brkts-opponent-win')
- end
- elseif props.displayType == 'bracket' then
- opponentEntry:addScores(props.opponent)
- end
- return opponentEntry.root
-end
-
----@param opponentEntry BracketOpponentEntry
----@param opponent SmashStandardOpponent
-function CustomBracketDisplay._addHeads(opponentEntry, opponent)
- local game = opponent.players[1].game
- local charactersNode = mw.html.create('div'):css('display', 'flex'):css('align-items', 'center')
- Array.forEach(opponent.players[1].heads or {}, function(headData)
- charactersNode:node(
- mw.html.create('span')
- :node(Characters.GetIconAndName{headData.name, game = game})
- :css('opacity', headData.status == 0 and '0.3' or nil)
- )
- end)
- opponentEntry.root:node(charactersNode)
-end
-
-return CustomBracketDisplay
diff --git a/lua/wikis/trackmania/Brkts/WikiSpecific.lua b/lua/wikis/trackmania/Brkts/WikiSpecific.lua
index 1bfb2a38e90..19015c5cabf 100644
--- a/lua/wikis/trackmania/Brkts/WikiSpecific.lua
+++ b/lua/wikis/trackmania/Brkts/WikiSpecific.lua
@@ -23,7 +23,7 @@ function WikiSpecific.getMatchGroupContainer(matchGroupType, maxOpponentCount)
return MatchList.MatchlistContainer
end
- local Bracket = Lua.import('Module:MatchGroup/Display/Bracket/Custom')
+ local Bracket = Lua.import('Module:MatchGroup/Display/Bracket')
return Bracket.BracketContainer
end
diff --git a/lua/wikis/trackmania/MatchGroup/Display/Bracket/Custom.lua b/lua/wikis/trackmania/MatchGroup/Display/Bracket/Custom.lua
deleted file mode 100644
index 91e91607555..00000000000
--- a/lua/wikis/trackmania/MatchGroup/Display/Bracket/Custom.lua
+++ /dev/null
@@ -1,42 +0,0 @@
----
--- @Liquipedia
--- page=Module:MatchGroup/Display/Bracket/Custom
---
--- Please see https://github.com/Liquipedia/Lua-Modules to contribute
---
-
-local Lua = require('Module:Lua')
-
-local Table = Lua.import('Module:Table')
-
-local BracketDisplay = Lua.import('Module:MatchGroup/Display/Bracket')
-local CustomOpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')
-local MatchGroupUtil = Lua.import('Module:MatchGroup/Util/Custom')
-
-local CustomBracketDisplay = {propTypes = {}}
-
----@param props {bracketId: string, config: BracketConfigOptions}
----@return Html
-function CustomBracketDisplay.BracketContainer(props)
- return BracketDisplay.Bracket({
- bracket = MatchGroupUtil.fetchMatchGroup(props.bracketId) --[[@as MatchGroupUtilBracket]],
- config = Table.merge(props.config, {
- OpponentEntry = CustomBracketDisplay.OpponentEntry,
- })
- })
-end
-
----@param props {opponent: standardOpponent, displayType: string, forceShortName: boolean?, height: number}
----@return unknown
-function CustomBracketDisplay.OpponentEntry(props)
- local opponentEntry = CustomOpponentDisplay.BracketOpponentEntry(
- props.opponent,
- {forceShortName = props.forceShortName, showTbd = false}
- )
- if props.displayType == 'bracket' then
- opponentEntry:addScores(props.opponent)
- end
- return opponentEntry.root
-end
-
-return CustomBracketDisplay
From 1acd126ed4ad45fd442f643a1721a2ca6df47e9e Mon Sep 17 00:00:00 2001
From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com>
Date: Tue, 16 Jun 2026 17:39:02 +0900
Subject: [PATCH 10/10] restore Smash.matchHasDetails
---
lua/wikis/smash/Brkts/WikiSpecific.lua | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/lua/wikis/smash/Brkts/WikiSpecific.lua b/lua/wikis/smash/Brkts/WikiSpecific.lua
index 4089b74a787..ed3db671d4b 100644
--- a/lua/wikis/smash/Brkts/WikiSpecific.lua
+++ b/lua/wikis/smash/Brkts/WikiSpecific.lua
@@ -7,5 +7,22 @@
local Lua = require('Module:Lua')
-return Lua.import('Module:Brkts/WikiSpecific/Base')
+local Logic = Lua.import('Module:Logic')
+local Table = Lua.import('Module:Table')
+local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')
+
+---@class SmashBrktsWikiSpecific: BrktsWikiSpecific
+local WikiSpecific = Table.copy(BaseWikiSpecific)
+
+---@param match table
+---@return boolean
+function WikiSpecific.matchHasDetails(match)
+ return match.dateIsExact
+ or Logic.isNotEmpty(match.vod)
+ or not Table.isEmpty(match.links)
+ or Logic.isNotEmpty(match.comment)
+ or 0 < #match.games
+end
+
+return WikiSpecific