Skip to content

Commit

Permalink
feat(match2): standardize BR game details (#5190)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz authored Dec 10, 2024
1 parent ab4695d commit 5c9dd57
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 147 deletions.
22 changes: 1 addition & 21 deletions components/match2/wikis/apexlegends/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class ApexMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/fortnite/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class FortniteMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/freefire/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class FreefireMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/naraka/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class NarakaMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/pubg/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class PubgMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/pubgmobile/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class PubgmMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
22 changes: 1 addition & 21 deletions components/match2/wikis/underlords/game_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
local CustomGameSummary = {}

local Lua = require('Module:Lua')
local Page = require('Module:Page')

local MatchGroupUtil = Lua.import('Module:MatchGroup/Util')

local SummaryHelper = Lua.import('Module:MatchSummary/Ffa')
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')

---@class UnderlordsMatchGroupUtilGame: MatchGroupUtilGame
---@field stream table
Expand All @@ -39,28 +36,11 @@ function CustomGameSummary.getGameByMatchId(props)
matchId = match.matchId,
idx = props.gameIdx,
children = {
CustomGameSummary._createGameDetails(game),
MatchSummaryWidgets.GameDetails{game = game},
MatchSummaryWidgets.PointsDistribution{scores = scoringData},
SummaryHelper.standardGame(game)
}
}
end

---@param game table
---@return Widget
function CustomGameSummary._createGameDetails(game)
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule',
items = {
{
icon = MatchSummaryWidgets.CountdownIcon{game = game},
content = MatchSummaryWidgets.GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}
}
end

return CustomGameSummary
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local Lua = require('Module:Lua')
Widgets.ContentItemContainer = Lua.import('Module:Widget/Match/Summary/Ffa/ContentItemContainer')
Widgets.CountdownIcon = Lua.import('Module:Widget/Match/Summary/Ffa/CountdownIcon')
Widgets.GameCountdown = Lua.import('Module:Widget/Match/Summary/Ffa/GameCountdown')
Widgets.GameDetails = Lua.import('Module:Widget/Match/Summary/Ffa/GameDetails')
Widgets.GamesSchedule = Lua.import('Module:Widget/Match/Summary/Ffa/GamesSchedule')
Widgets.Header = Lua.import('Module:Widget/Match/Summary/Ffa/Header')
Widgets.PointsDistribution = Lua.import('Module:Widget/Match/Summary/Ffa/PointsDistribution')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
-- @Liquipedia
-- wiki=commons
-- page=Module:Widget/Match/Summary/Ffa/GameDetails
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Class = require('Module:Class')
local Lua = require('Module:Lua')
local Page = require('Module:Page')

local Widget = Lua.import('Module:Widget')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local ContentItemContainer = Lua.import('Module:Widget/Match/Summary/Ffa/ContentItemContainer')
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome')
local CountdownIcon = Lua.import('Module:Widget/Match/Summary/Ffa/CountdownIcon')
local GameCountdown = Lua.import('Module:Widget/Match/Summary/Ffa/GameCountdown')

---@class MatchSummaryFfaGameDetails: Widget
---@operator call(table): MatchSummaryFfaGameDetails
local MatchSummaryFfaGameDetails = Class.new(Widget)

---@return Widget
function MatchSummaryFfaGameDetails:render()
local game = self.props.game
assert(game, 'No game provided')

return ContentItemContainer{contentClass = 'panel-content__game-schedule', items = {
{
icon = CountdownIcon{game = game},
content = GameCountdown{game = game},
},
game.map and {
icon = IconWidget{iconName = 'map'},
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)},
} or nil,
}}
end

return MatchSummaryFfaGameDetails

0 comments on commit 5c9dd57

Please sign in to comment.