Skip to content
Draft
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions lua/wikis/apexlegends/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/arenafps/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/artifact/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ local IconImage = Lua.import('Module:Widget/Image/Icon/Image')
local WidgetUtil = Lua.import('Module:Widget/Util')

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '420px', teamStyle = 'bracket'})
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
local characterData = {
(((game.opponents[1] or {}).players or {})[1] or {}).characters,
(((game.opponents[2] or {}).players or {})[1] or {}).characters,
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/autochess/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
return MatchSummaryWidgets.Row{
classes = {'brkts-popup-body-game'},
children = WidgetUtil.collect(
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/battalion/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/battlerite/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All')
local WidgetUtil = Lua.import('Module:Widget/Util')

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px', teamStyle = 'bracket'})
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
return MatchSummaryWidgets.Row{
classes = {'brkts-popup-body-game'},
children = WidgetUtil.collect(
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/callofduty/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
3 changes: 1 addition & 2 deletions lua/wikis/chess/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ 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)
function CustomMatchSummary.createGame(game, gameIndex)
return MatchSummaryWidgets.Row{
classes = {'brkts-popup-body-game'},
children = WidgetUtil.collect(
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/clashofclans/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px'})
end
Expand Down Expand Up @@ -53,11 +53,10 @@ function CustomMatchSummary._time(game, opponentIndex)
:wikitext(Abbreviation.make{text = '(' .. os.date('%M:%S', time) .. ')', title = 'Total Time'})
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
local scores = Array.map(game.opponents, Operator.property('score'))
if Table.isEmpty(scores) then
return
Expand Down
14 changes: 7 additions & 7 deletions lua/wikis/clashroyale/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ local DEFAULT_CARD = 'default'
local CustomMatchSummary = {}

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
end

---@param match MatchGroupUtilMatch
---@return Widget[]
---@return Renderable[]
function CustomMatchSummary.createBody(match)
local isTeamGame = Array.any(match.opponents, function(opponent) return opponent.type == Opponent.team end)
local games
Expand All @@ -55,7 +55,7 @@ end
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@param date string
---@return Widget
---@return Renderable
function CustomMatchSummary._createGame(game, gameIndex, date)
local cardData = Array.map(game.opponents, function(opponent)
return Array.map(opponent.players or {}, function(player)
Expand Down Expand Up @@ -91,7 +91,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date)
end

---@param match MatchGroupUtilMatch
---@return Widget[]
---@return Renderable[]
function CustomMatchSummary._createTeamMatchBody(match)
local _, subMatches = Array.groupBy(match.games, Operator.property('subgroup'))
subMatches = Array.map(subMatches, function(subMatch)
Expand Down Expand Up @@ -179,7 +179,7 @@ end
---@param subMatchIndex integer
---@param subMatch table
---@param extradata table
---@return Widget
---@return Renderable
function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, extradata)
-- Add submatch header
local header
Expand All @@ -203,7 +203,7 @@ function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, ex
:css('text-align', 'right')
:css('width', '40%')
:node(OpponentDisplay.BlockPlayers{
opponent = {players = players[1]},
opponent = {players = players[1], type = 'solo', extradata = {}},
overflow = 'ellipsis',
showLink = true,
flip = true,
Expand All @@ -230,7 +230,7 @@ function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, ex
:css('text-align', 'left')
:css('width', '40%')
:node(OpponentDisplay.BlockPlayers{
opponent = {players = players[2]},
opponent = {players = players[2], type = 'solo', extradata = {}},
overflow = 'ellipsis',
showLink = true,
flip = false,
Expand Down
8 changes: 4 additions & 4 deletions lua/wikis/commons/MatchSummary/Base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local TBD = Abbreviation.make{text = 'TBD', title = 'To Be Determined'}

---@class CustomMatchSummaryInterface
---@field createBody? fun(match: MatchGroupUtilMatch): Renderable|Renderable[]
---@field createGame? fun(date: string, game: table, gameIndex: integer): Renderable|Renderable[]
---@field createGame? fun(game: table, gameIndex: integer): Renderable|Renderable[]
---@field createFooter? fun(match: MatchGroupUtilMatch): Renderable|Renderable[]

---@class MatchSummary
Expand Down Expand Up @@ -59,11 +59,11 @@ end

-- Default body function
---@param match MatchGroupUtilMatch
---@param createGame fun(date: string, game: table, gameIndex: integer): Renderable|Renderable[]
---@param createGame fun(game: table, gameIndex: integer): Renderable|Renderable[]
---@return Renderable[]
function MatchSummary.createDefaultBody(match, createGame)
return WidgetUtil.collect(
Array.map(match.games, FnUtil.curry(createGame, match.date)),
Array.map(match.games, createGame),
MatchSummaryWidgets.Mvp(match.extradata.mvp),
MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game}))
)
Expand Down Expand Up @@ -208,7 +208,7 @@ end
function MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, options)
assert(
(type(CustomMatchSummary.createBody) == 'function' or type(CustomMatchSummary.createGame) == 'function'),
'createBody(match) or createGame(date, game, gameIndex) must be implemented in Module:MatchSummary'
'createBody(match) or createGame(game, gameIndex) must be implemented in Module:MatchSummary'
)

options = options or {}
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/criticalops/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px'})
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/crossfire/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
if not game.map then
return
end
Expand Down
3 changes: 1 addition & 2 deletions lua/wikis/deltaforce/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Renderable?
function CustomMatchSummary.createGame(date, game, gameIndex)
function CustomMatchSummary.createGame(game, gameIndex)
---@param opponentIndex integer
---@return Renderable[]
local function makeTeamSection(opponentIndex)
Expand Down
12 changes: 6 additions & 6 deletions lua/wikis/easportsfc/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ local NO_CHECK = '[[File:NoCheck.png|link=]]'
local CustomMatchSummary = {}

---@param args table
---@return Widget
---@return Renderable
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
end

---@param match MatchGroupUtilMatch
---@return Widget[]
---@return Renderable[]
function CustomMatchSummary.createBody(match)
local hasSubMatches = Logic.readBool((match.extradata or {}).hassubmatches)

Expand All @@ -46,7 +46,7 @@ function CustomMatchSummary.createBody(match)
end

---@param game MatchGroupUtilGame
---@return MatchSummaryRow
---@return Renderable
function CustomMatchSummary._createGame(game)
return MatchSummaryWidgets.Row{
classes = {'brkts-popup-body-game'},
Expand All @@ -63,7 +63,7 @@ end

---@param game MatchGroupUtilGame
---@param match MatchGroupUtilMatch
---@return MatchSummaryRow
---@return Renderable
function CustomMatchSummary._createSubMatch(game, match)
local players = CustomMatchSummary._extractPlayersFromGame(game, match)

Expand Down Expand Up @@ -110,7 +110,7 @@ end

---@param game MatchGroupUtilGame
---@param opponentIndex integer
---@return string
---@return string?
function CustomMatchSummary._subMatchPenaltyScore(game, opponentIndex)
local scores = (game.extradata or {}).penaltyscores

Expand All @@ -137,7 +137,7 @@ function CustomMatchSummary._players(players, opponentIndex, winner)
:css('text-align', flip and 'right' or 'left')
:css('width', '35%')
:node(OpponentDisplay.BlockPlayers{
opponent = {players = players},
opponent = {players = players, type = 'solo', extradata = {}},
overflow = 'ellipsis',
showLink = true,
})
Expand Down
7 changes: 3 additions & 4 deletions lua/wikis/eva/MatchSummary.Lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
local CustomMatchSummary = {}

---@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)
---@return Renderable?
function CustomMatchSummary.createGame(game, gameIndex)
local function makeTeamSection(opponentIndex)
return {
MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex},
Expand Down
Loading
Loading