Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(match2): standardize BR game details #5190

Merged
merged 1 commit into from
Dec 10, 2024
Merged
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
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
Loading