From 834d047d30f017efe16e5900706cbe0d7079c5bd Mon Sep 17 00:00:00 2001 From: Hesketh2 <88981446+Hesketh2@users.noreply.github.com> Date: Wed, 25 Dec 2024 01:53:38 +0700 Subject: [PATCH] Add summary --- .../match2/wikis/fortnite/match_summary.lua | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 components/match2/wikis/fortnite/match_summary.lua diff --git a/components/match2/wikis/fortnite/match_summary.lua b/components/match2/wikis/fortnite/match_summary.lua new file mode 100644 index 0000000000..a832ade085 --- /dev/null +++ b/components/match2/wikis/fortnite/match_summary.lua @@ -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