-
Notifications
You must be signed in to change notification settings - Fork 108
feat(match2): make sets available by default #7978
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
Open
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e443579
feat(match2): make sets available by default
Rathoz 9950803
calculate in matchFromRecord
Rathoz 629915e
set header
Rathoz 3696ee9
styling
Rathoz 539b843
safety check
Rathoz 5c354f5
lint
Rathoz 819c347
fix anno typos
Rathoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,99 @@ | ||
| --- | ||
| -- @Liquipedia | ||
| -- page=Module:Widget/Match/Summary/SetHeader | ||
| -- | ||
| -- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
| -- | ||
|
|
||
| local Lua = require('Module:Lua') | ||
|
|
||
| local Array = Lua.import('Module:Array') | ||
|
|
||
| local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') | ||
|
|
||
| local Component = Lua.import('Module:Widget/Component') | ||
| local Html = Lua.import('Module:Widget/Html') | ||
| local Span = Html.Span | ||
| local Div = Html.Div | ||
|
|
||
| local WinLossIndicator = Lua.import('Module:Widget/Match/Summary/GameWinLossIndicator') | ||
|
|
||
| ---@param props {set: MatchGroupUtilSubgroup} | ||
| ---@return VNode? | ||
| local function MatchSetHeader(props) | ||
| -- TODO: Move logic elsewhere in the future | ||
| local set = props.set | ||
| if not set then | ||
| return nil | ||
| end | ||
|
|
||
| local isStarted = Array.any(set.games, function (game) | ||
| return MatchGroupUtil.computeMatchPhase(game) ~= 'upcoming' | ||
| end) | ||
| local isFinished = Array.all(set.games, function (game) | ||
| return MatchGroupUtil.computeMatchPhase(game) == 'finished' | ||
| end) | ||
|
|
||
| local scoreLeft, scoreRight = 0, 0 | ||
| if isStarted then | ||
| Array.forEach(set.games, function(game) | ||
| if game.winner == 1 then | ||
| scoreLeft = scoreLeft + 1 | ||
| elseif game.winner == 2 then | ||
| scoreRight = scoreRight + 1 | ||
| end | ||
| end) | ||
| end | ||
|
|
||
| local winner | ||
| if isFinished then | ||
| if scoreLeft == scoreRight then | ||
| winner = 0 | ||
| elseif scoreLeft > scoreRight then | ||
| winner = 1 | ||
| elseif scoreRight > scoreLeft then | ||
| winner = 2 | ||
| end | ||
| end | ||
|
|
||
| return Div{ | ||
| classes = {'brkts-popup-body-grid-header-center'}, | ||
| children = { | ||
| Div{ | ||
| children = { | ||
| WinLossIndicator{winner = winner, opponentIndex = 1} | ||
| } | ||
| }, | ||
| Div{ | ||
| classes = {'match-info-header-scoreholder'}, | ||
| children = isStarted and { | ||
| Span{ | ||
| classes = { | ||
| 'match-info-header-scoreholder-score', | ||
| (winner == 0 or winner == 1) and 'match-info-header-winner' or nil | ||
| }, | ||
| children = scoreLeft, | ||
| }, | ||
| Span{ | ||
| classes = {'match-info-header-scoreholder-divider'}, | ||
| children = ':' | ||
| }, | ||
| Span{ | ||
| classes = { | ||
| 'match-info-header-scoreholder-score', | ||
| (winner == 0 or winner == 2) and 'match-info-header-winner' or nil | ||
| }, | ||
| children = scoreRight, | ||
| } | ||
| } or nil, | ||
| }, | ||
| Div{ | ||
| children = { | ||
| WinLossIndicator{winner = winner, opponentIndex = 2} | ||
| } | ||
| }, | ||
| } | ||
| } | ||
| end | ||
|
|
||
| return Component.component(MatchSetHeader) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -40,7 +40,6 @@ local MatchFunctions = { | |
| }, | ||
| } | ||
| local MapFunctions = { | ||
| ADD_SUB_GROUP = true, | ||
| BREAK_ON_EMPTY = true, | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.