Skip to content

Commit

Permalink
Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Sep 21, 2023
1 parent 563ef6e commit 70d3ac4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
22 changes: 16 additions & 6 deletions components/match2/commons/match_group_display_bracket_as_list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local DisplayUtil = require('Module:DisplayUtil')
local FnUtil = require('Module:FnUtil')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local Operator = require('Module:Operator')
local Table = require('Module:Table')
local TypeUtil = require('Module:TypeUtil')

Expand Down Expand Up @@ -107,12 +108,17 @@ function BracketListDisplay.Bracket(props)
end

function BracketListDisplay.computeHeaders(bracket, config)
local matchOrdering = function(match1, match2)
if match1.coordinates.roundIndex == match2.coordinates.roundIndex then
return match1.coordinates.matchIndexInRound < match2.coordinates.matchIndexInRound
end
return match1.coordinates.roundIndex < match2.coordinates.roundIndex
end
-- Group the inheritedHeader (Round followed by MatchInRound)
local headers = Array.groupAdjacentBy(Array.sortBy(Array.extractValues(bracket.bracketDatasById), FnUtil.identity, function (m1, m2)
return m1.coordinates.roundIndex == m2.coordinates.roundIndex and m1.coordinates.matchIndexInRound < m2.coordinates.matchIndexInRound or m1.coordinates.roundIndex < m2.coordinates.roundIndex
end), function (match)
return match.inheritedHeader
end)
local headers = Array.groupAdjacentBy(
Array.sortBy(Array.extractValues(bracket.bracketDatasById), FnUtil.identity, matchOrdering),
Operator.property('inheritedHeader')
)

-- Suffix headers with multiple match with indication which match is it
headers = Array.map(headers, function(headerGroup)
Expand Down Expand Up @@ -170,7 +176,11 @@ Display component for a match
]]
function BracketListDisplay.Match(props)
DisplayUtil.assertPropTypes(props, BracketListDisplay.propTypes.Match)
local matchNode = mw.html.create('div'):addClass('navigation-content'):attr('id', 'navigationContent' .. props.index):addClass(props.index > 1 and 'is--hidden' or nil)
local matchNode = mw.html.create('div')
:addClass('navigation-content')
:attr('id', 'navigationContent' .. props.index)
:addClass(props.index > 1 and 'is--hidden' or nil)

local matchSummaryNode = DisplayUtil.TryPureComponent(props.MatchSummaryContainer, {
bracketId = props.match.matchId:match('^(.*)_'), -- everything up to the final '_'
matchId = props.match.matchId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ local FnUtil = require('Module:FnUtil')
local Json = require('Module:Json')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local Operator = require('Module:Operator')
local Streams = require('Module:Links/Stream')
local String = require('Module:StringUtils')
local Table = require('Module:Table')
Expand Down Expand Up @@ -175,7 +174,7 @@ function MatchFunctions.parseSetting(match)
return match['opponent' .. idx] and (tonumber(match['p' .. idx]) or 0) or nil
end))

-- Up/Down colors and
-- Up/Down colors and status
match.statusSettings = {
advTitle = match.advtitle,
outTitle = match.outtitle,
Expand Down
29 changes: 21 additions & 8 deletions components/match2/wikis/apexlegends/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,28 @@ function CustomMatchSummary._createHeader(match)
end

function CustomMatchSummary._createPointsDistributionTable(match)
local wrapper = mw.html.create(nil)
local scoring = Table.copy(match.extradata.scoring)
wrapper:tag('h5'):addClass('panel-content__button'):addClass('is--collapsed'):attr('tabindex', 0):wikitext('Points Distribution')
local wrapper = mw.html.create()
wrapper:tag('h5')
:addClass('panel-content__button')
:addClass('is--collapsed')
:attr('tabindex', 0)
:wikitext('Points Distribution')

local function createItem(icon, iconColor, title, desc)
return mw.html.create('li'):addClass('panel-content__points-distribution__list-item')
:tag('span'):addClass('panel-content__points-distribution__icon'):addClass(iconColor):tag('i'):addClass(icon):allDone()
:tag('span'):addClass('panel-content__points-distribution__icon'):addClass(iconColor)
:tag('i'):addClass(icon):allDone()
:tag('span'):addClass('panel-content__points-distribution__title'):wikitext(title):allDone()
:tag('span'):wikitext(desc):allDone()
end

local pointDist = wrapper:tag('div')
pointDist:addClass('panel-content__container'):addClass('is--hidden'):attr('id', 'panelContent1'):attr('role', 'tabpanel'):attr('hidden')
:addClass('panel-content__container')
:addClass('is--hidden')
:attr('id', 'panelContent1')
:attr('role', 'tabpanel')
:attr('hidden')

local pointsList = pointDist:tag('ul'):addClass('panel-content__points-distribution')
pointsList:node(createItem('fas fa-skull', '1 kill', (Table.extract(scoring, 'kill') or '') .. ' kill point'))
Expand Down Expand Up @@ -180,7 +189,8 @@ local matchstuff = {
local icon, color = CustomMatchSummary._getIcon(opponent.placement)
return mw.html.create()
:tag('i'):addClass('panel-table__cell-rank__icon'):addClass(icon):addClass(color):done()
:tag('span'):addClass('panel-table__cell-rank__text'):wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
:tag('span'):addClass('panel-table__cell-rank__text')
:wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
end,
},
},
Expand Down Expand Up @@ -220,7 +230,8 @@ local matchstuff = {
local icon, color = CustomMatchSummary._getIcon(opponent.placement)
return mw.html.create()
:tag('i'):addClass('panel-table__cell-game__icon'):addClass(icon):addClass(color):done()
:tag('span'):addClass('panel-table__cell-game__text'):wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
:tag('span'):addClass('panel-table__cell-game__text')
:wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
end,
},
},
Expand Down Expand Up @@ -249,7 +260,8 @@ function CustomMatchSummary._createOverallStandings(match)
gameHeader:tag('div'):addClass('panel-table__cell-game'):addClass('cell--game-details')
:tag('i'):addClass(CustomMatchSummary._countdownIcon(game)):addClass('cell--game-details-icon'):done()
:tag('p'):addClass('panel-table__cell-game'):addClass('cell--game-details-title'):wikitext('Game ', idx):done()
:tag('p'):addClass('panel-table__cell-game'):addClass('cell--game-details-date'):node(CustomMatchSummary._gameCountdown(game)):done()
:tag('p'):addClass('panel-table__cell-game'):addClass('cell--game-details-date')
:node(CustomMatchSummary._gameCountdown(game)):done()
for _, column in ipairs(matchstuff.game) do
gameHeader:tag('div'):node(column.header.value):addClass('panel-table__cell-game'):addClass(column.class)
end
Expand Down Expand Up @@ -296,7 +308,8 @@ local gamestuff = {
local icon, color = CustomMatchSummary._getIcon(opponent.placement)
return mw.html.create()
:tag('i'):addClass('panel-table__cell-rank__icon'):addClass(icon):addClass(color):done()
:tag('span'):addClass('panel-table__cell-rank__text'):wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
:tag('span'):addClass('panel-table__cell-rank__text')
:wikitext(CustomMatchSummary._displayRank(opponent.placement)):done()
end,
},
},
Expand Down

0 comments on commit 70d3ac4

Please sign in to comment.