-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=fortnite | ||
-- page=Module:MatchSummary | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Lua = require('Module:Lua') | ||
|
||
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') | ||
|
||
local CustomMatchSummary = {} | ||
|
||
---@param args table | ||
---@return Html | ||
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) | ||
if not game.map then | ||
return | ||
end | ||
|
||
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} | ||
) | ||
} | ||
end | ||
|
||
return CustomMatchSummary |