-
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.
refactor(match2): fully standardize game countdown and games schedule (…
…#5152) * refactor(match2): fully standardize game countdown and games schedule * Update components/widget/match/summary/ffa/widget_match_summary_ffa_games_schedule.lua * update golden
- Loading branch information
Showing
11 changed files
with
118 additions
and
125 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
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
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
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
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
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
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
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
51 changes: 51 additions & 0 deletions
51
components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua
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=commons | ||
-- page=Module:Widget/Match/Summary/Ffa/GameCountdown | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Class = require('Module:Class') | ||
local Date = require('Module:Date/Ext') | ||
local Lua = require('Module:Lua') | ||
local Table = require('Module:Table') | ||
local Timezone = require('Module:Timezone') | ||
local VodLink = require('Module:VodLink') | ||
|
||
local Widget = Lua.import('Module:Widget') | ||
local HtmlWidgets = Lua.import('Module:Widget/Html/All') | ||
|
||
---@class MatchSummaryFfaGameCountdown: Widget | ||
---@operator call(table): MatchSummaryFfaGameCountdown | ||
local MatchSummaryFfaGameCountdown = Class.new(Widget) | ||
|
||
---@return Widget? | ||
function MatchSummaryFfaGameCountdown:render() | ||
local game = self.props.game | ||
if not game then | ||
return nil | ||
end | ||
|
||
local timestamp = Date.readTimestamp(game.date) | ||
if not timestamp then | ||
return | ||
end | ||
-- TODO Use local TZ | ||
local dateString = Date.formatTimestamp('F j, Y - H:i', timestamp) .. ' ' .. Timezone.getTimezoneString('UTC') | ||
|
||
local streamParameters = Table.merge(game.stream, { | ||
date = dateString, | ||
finished = game.winner ~= nil and 'true' or nil, | ||
}) | ||
|
||
return HtmlWidgets.Div{ | ||
classes = {'match-countdown-block'}, | ||
children = { | ||
require('Module:Countdown')._create(streamParameters), | ||
game.vod and VodLink.display{vod = game.vod} or nil, | ||
}, | ||
} | ||
end | ||
|
||
return MatchSummaryFfaGameCountdown |
56 changes: 56 additions & 0 deletions
56
components/widget/match/summary/ffa/widget_match_summary_ffa_games_schedule.lua
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,56 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=commons | ||
-- page=Module:Widget/Match/Summary/Ffa/GamesSchedule | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Array = require('Module:Array') | ||
local Class = require('Module:Class') | ||
local Lua = require('Module:Lua') | ||
|
||
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 CountdownIcon = Lua.import('Module:Widget/Match/Summary/Ffa/CountdownIcon') | ||
local GameCountdown = Lua.import('Module:Widget/Match/Summary/Ffa/GameCountdown') | ||
|
||
---@class MatchSummaryFfaGamesSchedule: Widget | ||
---@operator call(table): MatchSummaryFfaGamesSchedule | ||
local MatchSummaryFfaGamesSchedule = Class.new(Widget) | ||
|
||
---@return Widget? | ||
function MatchSummaryFfaGamesSchedule:render() | ||
if not self.props.games or #self.props.games == 0 then | ||
return nil | ||
end | ||
|
||
return ContentItemContainer{collapsed = true, collapsible = true, title = 'Schedule', children = { | ||
HtmlWidgets.Ul{ | ||
classes = {'panel-content__game-schedule'}, | ||
children = Array.map(self.props.games, function (game, idx) | ||
return HtmlWidgets.Li{ | ||
children = { | ||
HtmlWidgets.Span{ | ||
children = CountdownIcon{ | ||
game = game, | ||
additionalClasses = {'panel-content__game-schedule__icon'} | ||
}, | ||
}, | ||
HtmlWidgets.Span{ | ||
classes = {'panel-content__game-schedule__title'}, | ||
children = 'Game ' .. idx .. ':', | ||
}, | ||
HtmlWidgets.Div{ | ||
classes = {'panel-content__game-schedule__container'}, | ||
children = GameCountdown{game = game}, | ||
}, | ||
}, | ||
} | ||
end) | ||
} | ||
}} | ||
end | ||
|
||
return MatchSummaryFfaGamesSchedule |
Oops, something went wrong.