Skip to content

Commit cdcb491

Browse files
RathozMischiefCS
authored andcommitted
refactor(match2): remove date param in createGame (and fix some annotations) (#7968)
* refactor: remove date param in createGame (and fix some annotations * anno mistake from merge
1 parent d4ca7b2 commit cdcb491

44 files changed

Lines changed: 133 additions & 175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎lua/wikis/apexlegends/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
1515
local CustomMatchSummary = {}
1616

1717
---@param args table
18-
---@return Widget
18+
---@return Renderable
1919
function CustomMatchSummary.getByMatchId(args)
2020
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
2121
end
2222

23-
---@param date string
2423
---@param game MatchGroupUtilGame
2524
---@param gameIndex integer
26-
---@return Widget?
27-
function CustomMatchSummary.createGame(date, game, gameIndex)
25+
---@return Renderable?
26+
function CustomMatchSummary.createGame(game, gameIndex)
2827
if not game.map then
2928
return
3029
end

‎lua/wikis/arenafps/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
1515
local CustomMatchSummary = {}
1616

1717
---@param args table
18-
---@return Widget
18+
---@return Renderable
1919
function CustomMatchSummary.getByMatchId(args)
2020
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
2121
end
2222

23-
---@param date string
2423
---@param game MatchGroupUtilGame
2524
---@param gameIndex integer
26-
---@return Widget?
27-
function CustomMatchSummary.createGame(date, game, gameIndex)
25+
---@return Renderable?
26+
function CustomMatchSummary.createGame(game, gameIndex)
2827
if not game.map then
2928
return
3029
end

‎lua/wikis/artifact/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ local IconImage = Lua.import('Module:Widget/Image/Icon/Image')
1818
local WidgetUtil = Lua.import('Module:Widget/Util')
1919

2020
---@param args table
21-
---@return Widget
21+
---@return Renderable
2222
function CustomMatchSummary.getByMatchId(args)
2323
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '420px', teamStyle = 'bracket'})
2424
end
2525

26-
---@param date string
2726
---@param game MatchGroupUtilGame
2827
---@param gameIndex integer
29-
---@return Widget?
30-
function CustomMatchSummary.createGame(date, game, gameIndex)
28+
---@return Renderable?
29+
function CustomMatchSummary.createGame(game, gameIndex)
3130
local characterData = {
3231
(((game.opponents[1] or {}).players or {})[1] or {}).characters,
3332
(((game.opponents[2] or {}).players or {})[1] or {}).characters,

‎lua/wikis/autochess/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
1414
local CustomMatchSummary = {}
1515

1616
---@param args table
17-
---@return Widget
17+
---@return Renderable
1818
function CustomMatchSummary.getByMatchId(args)
1919
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
2020
end
2121

22-
---@param date string
2322
---@param game MatchGroupUtilGame
2423
---@param gameIndex integer
25-
---@return Widget?
26-
function CustomMatchSummary.createGame(date, game, gameIndex)
24+
---@return Renderable?
25+
function CustomMatchSummary.createGame(game, gameIndex)
2726
return MatchSummaryWidgets.Row{
2827
classes = {'brkts-popup-body-game'},
2928
children = WidgetUtil.collect(

‎lua/wikis/battalion/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
1515
local CustomMatchSummary = {}
1616

1717
---@param args table
18-
---@return Widget
18+
---@return Renderable
1919
function CustomMatchSummary.getByMatchId(args)
2020
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
2121
end
2222

23-
---@param date string
2423
---@param game MatchGroupUtilGame
2524
---@param gameIndex integer
26-
---@return Widget?
27-
function CustomMatchSummary.createGame(date, game, gameIndex)
25+
---@return Renderable?
26+
function CustomMatchSummary.createGame(game, gameIndex)
2827
if not game.map then
2928
return
3029
end

‎lua/wikis/battlerite/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All')
1616
local WidgetUtil = Lua.import('Module:Widget/Util')
1717

1818
---@param args table
19-
---@return Widget
19+
---@return Renderable
2020
function CustomMatchSummary.getByMatchId(args)
2121
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, {width = '400px', teamStyle = 'bracket'})
2222
end
2323

24-
---@param date string
2524
---@param game MatchGroupUtilGame
2625
---@param gameIndex integer
27-
---@return Widget?
28-
function CustomMatchSummary.createGame(date, game, gameIndex)
26+
---@return Renderable?
27+
function CustomMatchSummary.createGame(game, gameIndex)
2928
return MatchSummaryWidgets.Row{
3029
classes = {'brkts-popup-body-game'},
3130
children = WidgetUtil.collect(

‎lua/wikis/callofduty/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
1515
local CustomMatchSummary = {}
1616

1717
---@param args table
18-
---@return Widget
18+
---@return Renderable
1919
function CustomMatchSummary.getByMatchId(args)
2020
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
2121
end
2222

23-
---@param date string
2423
---@param game MatchGroupUtilGame
2524
---@param gameIndex integer
26-
---@return Widget?
27-
function CustomMatchSummary.createGame(date, game, gameIndex)
25+
---@return Renderable?
26+
function CustomMatchSummary.createGame(game, gameIndex)
2827
if not game.map then
2928
return
3029
end

‎lua/wikis/clashofclans/MatchSummary.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ local WidgetUtil = Lua.import('Module:Widget/Util')
2020
local CustomMatchSummary = {}
2121

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

56-
---@param date string
5756
---@param game MatchGroupUtilGame
5857
---@param gameIndex integer
59-
---@return Widget?
60-
function CustomMatchSummary.createGame(date, game, gameIndex)
58+
---@return Renderable?
59+
function CustomMatchSummary.createGame(game, gameIndex)
6160
local scores = Array.map(game.opponents, Operator.property('score'))
6261
if Table.isEmpty(scores) then
6362
return

‎lua/wikis/clashroyale/MatchSummary.lua‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ local DEFAULT_CARD = 'default'
2828
local CustomMatchSummary = {}
2929

3030
---@param args table
31-
---@return Widget
31+
---@return Renderable
3232
function CustomMatchSummary.getByMatchId(args)
3333
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
3434
end
3535

3636
---@param match MatchGroupUtilMatch
37-
---@return Widget[]
37+
---@return Renderable[]
3838
function CustomMatchSummary.createBody(match)
3939
local isTeamGame = Array.any(match.opponents, function(opponent) return opponent.type == Opponent.team end)
4040
local games
@@ -55,7 +55,7 @@ end
5555
---@param game MatchGroupUtilGame
5656
---@param gameIndex integer
5757
---@param date string
58-
---@return Widget
58+
---@return Renderable
5959
function CustomMatchSummary._createGame(game, gameIndex, date)
6060
local cardData = Array.map(game.opponents, function(opponent)
6161
return Array.map(opponent.players or {}, function(player)
@@ -91,7 +91,7 @@ function CustomMatchSummary._createGame(game, gameIndex, date)
9191
end
9292

9393
---@param match MatchGroupUtilMatch
94-
---@return Widget[]
94+
---@return Renderable[]
9595
function CustomMatchSummary._createTeamMatchBody(match)
9696
local _, subMatches = Array.groupBy(match.games, Operator.property('subgroup'))
9797
subMatches = Array.map(subMatches, function(subMatch)
@@ -179,7 +179,7 @@ end
179179
---@param subMatchIndex integer
180180
---@param subMatch table
181181
---@param extradata table
182-
---@return Widget
182+
---@return Renderable
183183
function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, extradata)
184184
-- Add submatch header
185185
local header
@@ -203,7 +203,7 @@ function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, ex
203203
:css('text-align', 'right')
204204
:css('width', '40%')
205205
:node(OpponentDisplay.BlockPlayers{
206-
opponent = {players = players[1]},
206+
opponent = {players = players[1], type = 'solo', extradata = {}},
207207
overflow = 'ellipsis',
208208
showLink = true,
209209
flip = true,
@@ -230,7 +230,7 @@ function CustomMatchSummary._createSubMatch(players, subMatchIndex, subMatch, ex
230230
:css('text-align', 'left')
231231
:css('width', '40%')
232232
:node(OpponentDisplay.BlockPlayers{
233-
opponent = {players = players[2]},
233+
opponent = {players = players[2], type = 'solo', extradata = {}},
234234
overflow = 'ellipsis',
235235
showLink = true,
236236
flip = false,

‎lua/wikis/commons/MatchSummary/Base.lua‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ local TBD = Abbreviation.make{text = 'TBD', title = 'To Be Determined'}
3232
---@class CustomMatchSummaryInterface
3333
---@field createBody? fun(match: MatchGroupUtilMatch): Renderable|Renderable[] @deprecated
3434
---@field createGames? fun(match: MatchGroupUtilMatch): Renderable|Renderable[] @deprecated (but better than createBody)
35-
---@field createGame? fun(date: string, game: table, gameIndex: integer): Renderable|Renderable[] @deprecated
35+
---@field createGame? fun(game: table, gameIndex: integer): Renderable|Renderable[] @deprecated
3636
---@field GameRow? Component<MatchSummaryGameRowProps>
3737
---@field createFooter? fun(match: MatchGroupUtilMatch): Renderable|Renderable[]
3838

@@ -97,9 +97,8 @@ function MatchSummary.createDefaultBody(match, CustomMatchSummary, options)
9797
end
9898
elseif createGames then
9999
nodes = createGames(match)
100-
else
101-
---@diagnostic disable-next-line: param-type-mismatch fixed in another PR
102-
nodes = Array.map(match.games, FnUtil.curry(createGame, match.date))
100+
elseif createGame then
101+
nodes = Array.map(match.games, createGame)
103102
end
104103

105104
return WidgetUtil.collect(

0 commit comments

Comments
 (0)