Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 33 additions & 22 deletions lua/wikis/lab/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +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 Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
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
Comment thread
Rathoz marked this conversation as resolved.


---@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

Expand Down
Loading