-
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.
break widget, "checkmark" widget, move logic to MGI
- Loading branch information
Showing
5 changed files
with
107 additions
and
41 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
27 changes: 27 additions & 0 deletions
27
components/widget/match/summary/widget_match_summary_break.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,27 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=commons | ||
-- page=Module:Widget/Match/Summary/Break | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
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 Div = HtmlWidgets.Div | ||
|
||
---@class MatchSummaryBreak: Widget | ||
---@operator call(table): MatchSummaryBreak | ||
local MatchSummaryBreak = Class.new(Widget) | ||
|
||
---@return Widget | ||
function MatchSummaryBreak:render() | ||
return Div{ | ||
classes = {'brkts-popup-break'}, | ||
} | ||
end | ||
|
||
return MatchSummaryBreak |
55 changes: 55 additions & 0 deletions
55
components/widget/match/summary/widget_match_summary_game_winloss_indicator.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,55 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=commons | ||
-- page=Module:Widget/Match/Summary/GameWinLossIndicator | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Class = require('Module:Class') | ||
local Icon = require('Module:Icon') | ||
local Logic = require('Module:Logic') | ||
local Lua = require('Module:Lua') | ||
|
||
local Widget = Lua.import('Module:Widget') | ||
local HtmlWidgets = Lua.import('Module:Widget/Html/All') | ||
local Div = HtmlWidgets.Div | ||
|
||
local ICONS = { | ||
win = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'}, | ||
draw = Icon.makeIcon{iconName = 'draw', color = 'bright-sun-text', size = '110%'}, | ||
loss = Icon.makeIcon{iconName = 'loss', color = 'cinnabar-text', size = '110%'}, | ||
empty = '[[File:NoCheck.png|link=|16px]]', | ||
} | ||
|
||
---@class MatchSummaryGameWinLossIndicator: Widget | ||
---@operator call(table): MatchSummaryGameWinLossIndicator | ||
local MatchSummaryGameWinLossIndicator = Class.new(Widget) | ||
|
||
---@return Widget | ||
function MatchSummaryGameWinLossIndicator:render() | ||
local winner = self.props.winner | ||
|
||
local icon | ||
if winner == self.props.opponentIndex then | ||
icon = ICONS.win | ||
elseif winner == 0 then | ||
icon = ICONS.draw | ||
elseif Logic.isNotEmpty(winner) then | ||
icon = ICONS.loss | ||
else | ||
icon = ICONS.empty | ||
end | ||
|
||
return Div{ | ||
classes = {'brkts-popup-spaced'}, | ||
css = { | ||
['line-height'] = '17px', | ||
['margin-left'] = '1%', | ||
['margin-right'] = '1%', | ||
}, | ||
children = {icon}, | ||
} | ||
end | ||
|
||
return MatchSummaryGameWinLossIndicator |