From d5c5fa0e2a86a40cf1a265c7414a688dcd5da484 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:27:01 +0900 Subject: [PATCH 1/2] type annotation --- lua/wikis/lab/MatchSummary.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/wikis/lab/MatchSummary.lua b/lua/wikis/lab/MatchSummary.lua index 60911d3df58..5c3df07d50c 100644 --- a/lua/wikis/lab/MatchSummary.lua +++ b/lua/wikis/lab/MatchSummary.lua @@ -12,10 +12,11 @@ local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') local WidgetUtil = Lua.import('Module:Widget/Util') +---@class LabMatchSummary: CustomMatchSummaryInterface local CustomMatchSummary = {} ---@param args table ----@return Widget +---@return Renderable function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) end @@ -23,7 +24,7 @@ end ---@param date string ---@param game MatchGroupUtilGame ---@param gameIndex integer ----@return Widget? +---@return VNode function CustomMatchSummary.createGame(date, game, gameIndex) local function makeTeamSection(opponentIndex) return { From df6514dd28f08053d95e5bc1e278aa0bdfe43732 Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:31:07 +0900 Subject: [PATCH 2/2] grid-based lab match summary --- lua/wikis/lab/MatchSummary.lua | 52 ++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/lua/wikis/lab/MatchSummary.lua b/lua/wikis/lab/MatchSummary.lua index 5c3df07d50c..55ce9ec4c95 100644 --- a/lua/wikis/lab/MatchSummary.lua +++ b/lua/wikis/lab/MatchSummary.lua @@ -7,40 +7,50 @@ local Lua = require('Module:Lua') +local Array = Lua.import('Module:Array') + local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') -local WidgetUtil = Lua.import('Module:Widget/Util') ---@class LabMatchSummary: CustomMatchSummaryInterface local CustomMatchSummary = {} +---@class LabMatchSummaryGameRowComponentProps: MatchSummaryGameRowComponentProps +local GameRowComponentProps = { + createGameOverview = MatchSummaryWidgets.GameRow.mapDisplay, +} + +local LabMatchSummaryGameRow = MatchSummaryWidgets.GameRow.createComponent(GameRowComponentProps) + ---@param args table ---@return Renderable function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) end ----@param date string ----@param game MatchGroupUtilGame ----@param gameIndex integer ----@return VNode -function CustomMatchSummary.createGame(date, game, gameIndex) - local function makeTeamSection(opponentIndex) - return { - MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex}, - DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) - } - end - - return MatchSummaryWidgets.Row{ - classes = {'brkts-popup-body-game'}, - children = WidgetUtil.collect( - MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(1)}, - MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)}, - MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(2), flipped = true}, - MatchSummaryWidgets.GameComment{children = game.comment} - ) +---@param match MatchGroupUtilMatch +---@return VNode[] +function CustomMatchSummary.createBody(match) + return { + MatchSummaryWidgets.GamesContainer{ + children = Array.map(match.games, function (game, gameIndex) + return LabMatchSummaryGameRow{game = game, gameIndex = gameIndex} + end) + }, + MatchSummaryWidgets.Mvp(match.extradata.mvp), + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game})) + } +end + + +---@param props MatchSummaryGameRowProps +---@param opponentIndex integer +---@return Renderable[] +function GameRowComponentProps.createGameOpponentView(props, opponentIndex) + local game = props.game + return { + DisplayHelper.MapScore(game.opponents[opponentIndex], game.status) } end