From 3695b0bd30679cbb4597eba2fdd0927df9888d1a Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Thu, 24 Oct 2024 11:59:51 +0200 Subject: [PATCH] refactor(match2): mapVeto into widget --- .../match2/commons/match_summary_base.lua | 201 +++--------------- .../wikis/counterstrike/match_summary.lua | 4 +- .../wikis/criticalops/match_summary.lua | 3 +- .../match2/wikis/heroes/match_summary.lua | 3 +- .../match2/wikis/rainbowsix/match_summary.lua | 3 +- .../match2/wikis/splatoon/match_summary.lua | 3 +- .../match2/wikis/valorant/match_summary.lua | 3 +- .../wikis/worldoftanks/match_summary.lua | 3 +- .../match2/wikis/zula/match_summary.lua | 3 +- .../summary/widget_match_summary_all.lua | 1 + .../summary/widget_match_summary_map_veto.lua | 52 +++++ .../widget_match_summary_map_veto_round.lua | 72 +++++++ .../widget_match_summary_map_veto_start.lua | 53 +++++ 13 files changed, 210 insertions(+), 194 deletions(-) create mode 100644 components/widget/match/summary/widget_match_summary_map_veto.lua create mode 100644 components/widget/match/summary/widget_match_summary_map_veto_round.lua create mode 100644 components/widget/match/summary/widget_match_summary_map_veto_start.lua diff --git a/components/match2/commons/match_summary_base.lua b/components/match2/commons/match_summary_base.lua index 60c4a20748c..dc60bb44d9b 100644 --- a/components/match2/commons/match_summary_base.lua +++ b/components/match2/commons/match_summary_base.lua @@ -26,16 +26,7 @@ local OpponentLibraries = require('Module:OpponentLibraries') local Opponent = OpponentLibraries.Opponent local OpponentDisplay = OpponentLibraries.OpponentDisplay -local ARROW_LEFT = '[[File:Arrow sans left.svg|15x15px|link=|Left team starts]]' -local ARROW_RIGHT = '[[File:Arrow sans right.svg|15x15px|link=|Right team starts]]' -local DEFAULT_VETO_TYPE_TO_TEXT = { - ban = 'BAN', - pick = 'PICK', - decider = 'DECIDER', - defaultban = 'DEFAULT BAN', -} local TBD = Abbreviation.make('TBD', 'To Be Determined') -local VETO_DECIDER = 'decider' ---just a base class to avoid anno warnings ---@class MatchSummaryRowInterface @@ -352,155 +343,6 @@ function Match:create() return self.root end --- Map Veto Class ----@class VetoDisplay: MatchSummaryRowInterface ----@operator call: self ----@field root Html ----@field table Html ----@field vetoTypeToText table ----@field game string? ----@field emptyMapDisplay string -local MapVeto = Class.new( - function(self, options) - self.root = mw.html.create('div') - :addClass('brkts-popup-mapveto') - - self.table = self.root:tag('table') - :addClass('wikitable-striped') - :addClass('collapsible') - :addClass('collapsed') - - self.vetoTypeToText = options.vetoTypeToText or DEFAULT_VETO_TYPE_TO_TEXT - self.game = options.game - self.emptyMapDisplay = options.emptyMapDisplay or TBD - - self:createHeader() - end -) - ----@return self -function MapVeto:createHeader() - self.table:tag('tr') - :tag('th'):css('width','33%'):done() - :tag('th'):css('width','34%'):wikitext('Map Veto'):done() - :tag('th'):css('width','33%'):done() - return self -end - ----@param firstVeto number? ----@param format string? ----@return self -function MapVeto:vetoStart(firstVeto, format) - format = format and ('Veto format: ' .. format) - local textLeft - local textCenter - local textRight - if firstVeto == 1 then - textLeft = 'Start Map Veto' - textCenter = ARROW_LEFT - textRight = format - elseif firstVeto == 2 then - textLeft = format - textCenter = ARROW_RIGHT - textRight = 'Start Map Veto' - else - return self - end - - self.table:tag('tr'):addClass('brkts-popup-mapveto-vetostart') - :tag('th'):wikitext(textLeft):done() - :tag('th'):wikitext(textCenter):done() - :tag('th'):wikitext(textRight):done() - - return self -end - ----@param map string? ----@return self -function MapVeto:addDecider(map) - local row = mw.html.create('tr'):addClass('brkts-popup-mapveto-vetoround') - - self:addColumnVetoType(row, 'brkts-popup-mapveto-decider', self.vetoTypeToText.decider) - self:addColumnVetoMap(row, self:displayMap(map)) - self:addColumnVetoType(row, 'brkts-popup-mapveto-decider', self.vetoTypeToText.decider) - - self.table:node(row) - return self -end - ----@param vetoType string? ----@param map1 string? ----@param map2 string? ----@return self -function MapVeto:addRound(vetoType, map1, map2) - map1, map2 = self:displayMaps(map1, map2) - - local vetoText = self.vetoTypeToText[vetoType] - - if not vetoText then return self end - - local class = 'brkts-popup-mapveto-' .. vetoType - - local row = mw.html.create('tr'):addClass('brkts-popup-mapveto-vetoround') - - self:addColumnVetoMap(row, map1) - self:addColumnVetoType(row, class, vetoText) - self:addColumnVetoMap(row, map2) - - self.table:node(row) - return self -end - ----@param map1 string? ----@param map2 string? ----@return string ----@return string -function MapVeto:displayMaps(map1, map2) - if Logic.isEmpty(map1) and Logic.isEmpty(map2) then - return TBD, TBD - end - - return self:displayMap(map1), self:displayMap(map2) -end - ----@param map string? ----@return string -function MapVeto:displayMap(map) - if not map then - return self.emptyMapDisplay - end - if not self.game then - return Page.makeInternalLink(map) or self.emptyMapDisplay - end - return Page.makeInternalLink(map, map .. '/' .. self.game) or self.emptyMapDisplay -end - ----@param row Html ----@param styleClass string ----@param vetoText string ----@return self -function MapVeto:addColumnVetoType(row, styleClass, vetoText) - row:tag('td') - :tag('span') - :addClass(styleClass) - :addClass('brkts-popup-mapveto-vetotype') - :wikitext(vetoText) - return self -end - ----@param row Html ----@param map string ----@return self -function MapVeto:addColumnVetoMap(row, map) - row:tag('td'):wikitext(map) - return self -end - ----@return Html -function MapVeto:create() - return self.root -end - ---@class MatchSummary ---@operator call(string?):MatchSummary ---@field Header MatchSummaryHeader @@ -508,8 +350,6 @@ end ---@field Row MatchSummaryRow ---@field Footer MatchSummaryFooter ---@field Match MatchSummaryMatch ----@field MapVeto VetoDisplay ----@field DEFAULT_VETO_TYPE_TO_TEXT table ---@field matches Html[]? ---@field headerElement Html? ---@field root Html? @@ -519,8 +359,6 @@ MatchSummary.Body = Body MatchSummary.Row = Row MatchSummary.Footer = Footer MatchSummary.Match = Match -MatchSummary.MapVeto = MapVeto -MatchSummary.DEFAULT_VETO_TYPE_TO_TEXT = DEFAULT_VETO_TYPE_TO_TEXT ---@param width string? ---@return MatchSummary @@ -737,27 +575,36 @@ function MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, options) return matchSummary:create() end ----@param vetoData table ----@param options {game: string?, vetoTypeToText:table?, emptyMapDisplay: string?}? ----@return VetoDisplay? -function MatchSummary.defaultMapVetoDisplay(vetoData, options) - if Logic.isEmpty(vetoData) then +---@param mapVetoes table +---@param options {game: string?, emptyMapDisplay: string?}? +---@return {firstVeto: integer?, vetoFormat: string?, vetoRounds: table[]}? +function MatchSummary.preProcessMapVeto(mapVetoes, options) + if Logic.isEmpty(mapVetoes) then return end - local mapVeto = MapVeto(options or {}) - Array.forEach(vetoData, function(vetoRound) - if vetoRound.vetostart then - mapVeto:vetoStart(tonumber(vetoRound.vetostart), vetoRound.format) + options = options or {} + local mapInputToDisplay = function(map) + if Logic.isEmpty(map) then + return {name = options.emptyMapDisplay or TBD} end - if vetoRound.type == VETO_DECIDER then - mapVeto:addDecider(vetoRound.decider) - else - mapVeto:addRound(vetoRound.type, vetoRound.team1, vetoRound.team2) + if options.game then + return {name = map, link = map .. '/' .. options.game} end - end) + return {name = map, link = map} + end - return mapVeto + return { + firstVeto = tonumber(mapVetoes[1].vetostart), + vetoFormat = mapVetoes[1].format, + vetoRounds = Array.map(mapVetoes, function(vetoRound) + return { + type = vetoRound.type, + map1 = mapInputToDisplay(vetoRound.team1 or vetoRound.decider), + map2 = mapInputToDisplay(vetoRound.team2), + } + end) + } end ---@param games table[] diff --git a/components/match2/wikis/counterstrike/match_summary.lua b/components/match2/wikis/counterstrike/match_summary.lua index ea3d8d0c786..59df3b28aa0 100644 --- a/components/match2/wikis/counterstrike/match_summary.lua +++ b/components/match2/wikis/counterstrike/match_summary.lua @@ -150,12 +150,10 @@ function CustomMatchSummary.createBody(match) end local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto, {game = match.game}) - return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMap), - mapVeto and mapVeto:create() or nil, + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game})), MatchSummaryWidgets.MatchComment{children = matchStatusText} or nil )} end diff --git a/components/match2/wikis/criticalops/match_summary.lua b/components/match2/wikis/criticalops/match_summary.lua index 3d969914480..8df408cfb55 100644 --- a/components/match2/wikis/criticalops/match_summary.lua +++ b/components/match2/wikis/criticalops/match_summary.lua @@ -113,12 +113,11 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto, {game = match.game}) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMap), - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game})) )} end diff --git a/components/match2/wikis/heroes/match_summary.lua b/components/match2/wikis/heroes/match_summary.lua index c5053e45fa6..ed15660f6e0 100644 --- a/components/match2/wikis/heroes/match_summary.lua +++ b/components/match2/wikis/heroes/match_summary.lua @@ -39,7 +39,6 @@ end function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp local characterBansData = MatchSummary.buildCharacterBanData(match.games, MAX_NUM_BANS) - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto, {emptyMapDisplay = FP}) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, @@ -47,7 +46,7 @@ function CustomMatchSummary.createBody(match) MatchSummaryWidgets.Mvp(match.extradata.mvp), MatchSummaryWidgets.CharacterBanTable{bans = characterBansData, date = match.date}, MatchSummaryWidgets.Casters{casters = match.extradata.casters}, - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {emptyMapDisplay = FP})) )} end diff --git a/components/match2/wikis/rainbowsix/match_summary.lua b/components/match2/wikis/rainbowsix/match_summary.lua index 57220f07e81..eb79246afa8 100644 --- a/components/match2/wikis/rainbowsix/match_summary.lua +++ b/components/match2/wikis/rainbowsix/match_summary.lua @@ -246,14 +246,13 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto, {game = 'siege'}) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMap), MatchSummaryWidgets.Mvp(match.extradata.mvp), MatchSummaryWidgets.Casters{casters = match.extradata.casters}, - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = 'siege'})) )} end diff --git a/components/match2/wikis/splatoon/match_summary.lua b/components/match2/wikis/splatoon/match_summary.lua index 1e2de1f86c2..2d48b8a260f 100644 --- a/components/match2/wikis/splatoon/match_summary.lua +++ b/components/match2/wikis/splatoon/match_summary.lua @@ -38,13 +38,12 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createGame), MatchSummaryWidgets.Mvp(match.extradata.mvp), - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto)) )} end diff --git a/components/match2/wikis/valorant/match_summary.lua b/components/match2/wikis/valorant/match_summary.lua index 4934fd0256d..18557156724 100644 --- a/components/match2/wikis/valorant/match_summary.lua +++ b/components/match2/wikis/valorant/match_summary.lua @@ -159,14 +159,13 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMap), MatchSummaryWidgets.Mvp(match.extradata.mvp), MatchSummaryWidgets.Casters{casters = match.extradata.casters}, - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto)) )} end diff --git a/components/match2/wikis/worldoftanks/match_summary.lua b/components/match2/wikis/worldoftanks/match_summary.lua index b1334a07b9c..b6ce498cd43 100644 --- a/components/match2/wikis/worldoftanks/match_summary.lua +++ b/components/match2/wikis/worldoftanks/match_summary.lua @@ -38,14 +38,13 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto, {emptyMapDisplay = NONE}) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMapRow), MatchSummaryWidgets.Mvp(match.extradata.mvp), MatchSummaryWidgets.Casters{casters = match.extradata.casters}, - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {emptyMapDisplay = NONE})) )} end diff --git a/components/match2/wikis/zula/match_summary.lua b/components/match2/wikis/zula/match_summary.lua index c01a9a85a8d..6715af5b4ec 100644 --- a/components/match2/wikis/zula/match_summary.lua +++ b/components/match2/wikis/zula/match_summary.lua @@ -113,12 +113,11 @@ end ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) local showCountdown = match.timestamp ~= DateExt.defaultTimestamp - local mapVeto = MatchSummary.defaultMapVetoDisplay(match.extradata.mapveto) return MatchSummaryWidgets.Body{children = WidgetUtil.collect( showCountdown and MatchSummaryWidgets.Row{children = DisplayHelper.MatchCountdownBlock(match)} or nil, Array.map(match.games, CustomMatchSummary._createMap), - mapVeto and mapVeto:create() or nil + MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto)) )} end diff --git a/components/widget/match/summary/widget_match_summary_all.lua b/components/widget/match/summary/widget_match_summary_all.lua index f6008801092..3c504461c1f 100644 --- a/components/widget/match/summary/widget_match_summary_all.lua +++ b/components/widget/match/summary/widget_match_summary_all.lua @@ -19,6 +19,7 @@ Widgets.Character = Lua.import('Module:Widget/Match/Summary/Character') Widgets.GameCenter = Lua.import('Module:Widget/Match/Summary/GameCenter') Widgets.GameComment = Lua.import('Module:Widget/Match/Summary/GameComment') Widgets.GameWinLossIndicator = Lua.import('Module:Widget/Match/Summary/GameWinLossIndicator') +Widgets.MapVeto = Lua.import('Module:Widget/Match/Summary/MapVeto') Widgets.MatchComment = Lua.import('Module:Widget/Match/Summary/MatchComment') Widgets.MatchPageLink = Lua.import('Module:Widget/Match/Summary/MatchPageLink') Widgets.Mvp = Lua.import('Module:Widget/Match/Summary/Mvp') diff --git a/components/widget/match/summary/widget_match_summary_map_veto.lua b/components/widget/match/summary/widget_match_summary_map_veto.lua new file mode 100644 index 00000000000..0d7f2932e90 --- /dev/null +++ b/components/widget/match/summary/widget_match_summary_map_veto.lua @@ -0,0 +1,52 @@ +--- +-- @Liquipedia +-- wiki=commons +-- page=Module:Widget/Match/Summary/MapVeto +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Array = require('Module:Array') +local Class = require('Module:Class') +local Logic = require('Module:Logic') +local Lua = require('Module:Lua') + +local Widget = Lua.import('Module:Widget') +local WidgetUtil = Lua.import('Module:Widget/Util') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local MapVetoStart = Lua.import('Module:Widget/Match/Summary/MapVetoStart') +local MapVetoRound = Lua.import('Module:Widget/Match/Summary/MapVetoRound') + +---@class MatchSummaryMapVeto: Widget +---@operator call(table): MatchSummaryMapVeto +local MatchSummaryMapVeto = Class.new(Widget) + +---@return Widget? +function MatchSummaryMapVeto:render() + if Logic.isEmpty(self.props.vetoRounds) then + return + end + + local firstVeto = tonumber(self.props.vetoRounds[1].vetostart) + local vetoFormat = self.props.vetoRounds[1].format + + return HtmlWidgets.Div{ + classes = {'brkts-popup-mapveto'}, + children = HtmlWidgets.Table{ + classes = {'wikitable-striped', 'collapsible', 'collapsed'}, + children = WidgetUtil.collect( + HtmlWidgets.Tr{children = { + HtmlWidgets.Th{css = {width = '33%'}}, + HtmlWidgets.Th{css = {width = '34%'}, children = 'Map Veto'}, + HtmlWidgets.Th{css = {width = '33%'}}, + }}, + MapVetoStart{firstVeto = firstVeto, vetoFormat = vetoFormat}, + Array.map(self.props.vetoRounds, function(veto) + return MapVetoRound{vetoType = veto.type, map1 = veto.map1, map2 = veto.map2} + end) + ) + } + } +end + +return MatchSummaryMapVeto diff --git a/components/widget/match/summary/widget_match_summary_map_veto_round.lua b/components/widget/match/summary/widget_match_summary_map_veto_round.lua new file mode 100644 index 00000000000..bb3e2a75fa6 --- /dev/null +++ b/components/widget/match/summary/widget_match_summary_map_veto_round.lua @@ -0,0 +1,72 @@ +--- +-- @Liquipedia +-- wiki=commons +-- page=Module:Widget/Match/Summary/MapVetoRound +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Class = require('Module:Class') +local Lua = require('Module:Lua') + +local Widget = Lua.import('Module:Widget') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local Link = Lua.import('Module:Widget/Basic/Link') + +local DEFAULT_VETO_TYPE_TO_TEXT = { + ban = 'BAN', + pick = 'PICK', + decider = 'DECIDER', + defaultban = 'DEFAULT BAN', +} +local VETO_DECIDER = 'decider' + +---@class MatchSummaryMapVetoRound: Widget +---@operator call(table): MatchSummaryMapVetoRound +local MatchSummaryMapVetoRound = Class.new(Widget) + +---@return Widget? +function MatchSummaryMapVetoRound:render() + if not self.props.vetoType then + return + end + -- TODO Support Osu's "protect" type + local vetoText = DEFAULT_VETO_TYPE_TO_TEXT[self.props.vetoType] + if not vetoText then + return + end + + local function displayMap(map) + if not map.page then + return map + end + return Link{ + children = map.name, + link = map.page, + } + end + + local typeClass = 'brkts-popup-mapveto-' .. self.props.vetoType + local function createVetoTypeElement() + return HtmlWidgets.Span{classes = {typeClass, 'brkts-popup-mapveto-vetotype'}, text = vetoText} + end + + local children + if self.props.vetoType == VETO_DECIDER then + children = { + HtmlWidgets.Td{children = createVetoTypeElement()}, + HtmlWidgets.Td{children = displayMap(self.props.map1)}, + HtmlWidgets.Td{children = createVetoTypeElement()}, + } + else + children = { + HtmlWidgets.Td{children = displayMap(self.props.map1)}, + HtmlWidgets.Td{children = createVetoTypeElement()}, + HtmlWidgets.Td{children = displayMap(self.props.map2)}, + } + end + + return HtmlWidgets.Tr{classes = 'brkts-popup-mapveto-vetoround', children = children} +end + +return MatchSummaryMapVetoRound diff --git a/components/widget/match/summary/widget_match_summary_map_veto_start.lua b/components/widget/match/summary/widget_match_summary_map_veto_start.lua new file mode 100644 index 00000000000..a5b2826255e --- /dev/null +++ b/components/widget/match/summary/widget_match_summary_map_veto_start.lua @@ -0,0 +1,53 @@ +--- +-- @Liquipedia +-- wiki=commons +-- page=Module:Widget/Match/Summary/MapVetoStart +-- +-- Please see https://github.com/Liquipedia/Lua-Modules to contribute +-- + +local Array = require('Module:Array') +local Class = require('Module:Class') +local Lua = require('Module:Lua') + +local Widget = Lua.import('Module:Widget') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') + +local ARROW_LEFT = '[[File:Arrow sans left.svg|15x15px|link=|Left team starts]]' +local ARROW_RIGHT = '[[File:Arrow sans right.svg|15x15px|link=|Right team starts]]' + +---@class MatchSummaryMapVetoStart: Widget +---@operator call(table): MatchSummaryMapVetoStart +local MatchSummaryMapVetoStart = Class.new(Widget) + +---@return Widget? +function MatchSummaryMapVetoStart:render() + if not self.props.firstVeto then + return + end + + local format = self.props.vetoFormat and ('Veto Format: ' .. self.props.vetoFormat) or nil + local children = {} + if self.props.firstVeto == 1 then + children = { + 'Start Map Veto', + ARROW_LEFT, + format, + } + elseif self.props.firstVeto == 2 then + children = { + format, + ARROW_RIGHT, + 'Start Map Veto', + } + end + + return HtmlWidgets.Tr{ + classes = {'brkts-popup-mapveto-vetostart'}, + children = Array.map(children, function(child) + return HtmlWidgets.Th{children = child} + end) + } +end + +return MatchSummaryMapVetoStart