Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4de3589
order points column before qualifies
Eetwalt Jun 15, 2026
bf0e623
display placements as plain numbers and ranges
Eetwalt Jun 15, 2026
974a7e7
colored number badge for top-3 placements
Eetwalt Jun 15, 2026
572e2ad
emit rowspan and colspan without column definitions
Eetwalt Jun 15, 2026
9a182b4
render via Table2 with reordered columns
Eetwalt Jun 15, 2026
d8983e4
restyle for Table2 redesign
Eetwalt Jun 15, 2026
44a551d
migrate award variant to Table2 and drop dead collapse code
Eetwalt Jun 15, 2026
e240501
correct collapse row offset for thead/tbody and fix stale annotations
Eetwalt Jun 15, 2026
cd88121
idempotent collapse toggle and placement-based toggle label
Eetwalt Jun 15, 2026
f1a5e99
class-based collapse, restore legacy data-cutafter path
Eetwalt Jun 16, 2026
17d3e5f
prevent table card stretching to taller flex sibling
Eetwalt Jun 16, 2026
52ff53c
fix toggle
Eetwalt Jun 16, 2026
26b4ded
style fixes
Eetwalt Jun 16, 2026
5d1f5f4
freetext align left
Eetwalt Jun 16, 2026
42693fa
use standard gold/silver/bronze placement colors for top-3 badges
Eetwalt Jun 18, 2026
785d03a
tint top-3 prize pool rows with pale gold/silver/bronze
Eetwalt Jun 18, 2026
12f7dae
white text for both
Eetwalt Jun 18, 2026
ae34ac1
render the show places in footer & use collapsible logic
Eetwalt Jun 23, 2026
620808f
wrap toggle text & icon
Eetwalt Jun 23, 2026
17f9d69
refactoring
Eetwalt Jun 23, 2026
6c5e394
cleanup comments
Eetwalt Jun 23, 2026
12cc412
chore: update visual snapshots
Eetwalt Jun 23, 2026
fa032dc
Cell to CellHeader
Eetwalt Jun 23, 2026
9ef6e85
right align points and percentages
Eetwalt Jun 23, 2026
58d244c
don't kick old styles
Eetwalt Jun 23, 2026
0f636d4
keep @protected
Eetwalt Jun 25, 2026
7417e9a
use Module:Placement
Eetwalt Jun 25, 2026
9966888
gate webkit scrollbar hiding behind @supports not (scrollbar-width: n…
Eetwalt Jun 25, 2026
a97d5f8
lower table2 zebra specificity with :where() and drop prizepool selec…
Eetwalt Jun 25, 2026
7720c64
drop redundant tostring
Eetwalt Jun 25, 2026
6ace7d2
drop redundant table.concat
Eetwalt Jun 25, 2026
09cfa11
annotate _opponentPrizeCells as private
Eetwalt Jun 25, 2026
930ca66
extract column alignment into prize type definitions and column const…
Eetwalt Jun 25, 2026
427fa0f
extend and use ChevronToggle
Eetwalt Jun 25, 2026
6427868
allow size change
Eetwalt Jun 25, 2026
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
6 changes: 6 additions & 0 deletions javascript/commons/Prizepooltable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
liquipedia.prizepooltable = {
init: function() {
document.querySelectorAll( '.prizepooltable' ).forEach( ( prizepooltable ) => {
// The redesigned (Table2) prize pool wraps its table in
// `.prizepool-table-wrapper` and collapses via general-collapsible, so it
// supplies its own toggle. Skip it here to avoid a duplicate legacy toggle.
if ( prizepooltable.closest( '.prizepool-table-wrapper' ) !== null ) {
return;
}
let cutAfter;
if ( typeof prizepooltable.dataset.cutafter !== 'undefined' ) {
cutAfter = parseInt( prizepooltable.dataset.cutafter );
Expand Down
2 changes: 1 addition & 1 deletion lua/spec/prize_pool_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ describe('prize pool', function()
currency = 'SEK',
}
},
{id = 'QUALIFIES1', type = 'QUALIFIES', index = 1, data = {title = 'A Display', link = 'A_Tournament'}},
{id = 'POINTS1', type = 'POINTS', index = 1, data = {title = 'Points', link = 'A Page'}},
{id = 'QUALIFIES1', type = 'QUALIFIES', index = 1, data = {title = 'A Display', link = 'A_Tournament'}},
{id = 'FREETEXT1', type = 'FREETEXT', index = 1, data = {title = 'A title'}},
},
ppt.prizes
Expand Down
Binary file modified lua/spec/snapshots/prize_pool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion lua/wikis/commons/Placement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ local prizepoolClasses = {
'background-color-first-place',
'background-color-second-place',
'background-color-third-place',
'background-color-fourth-place',
w = 'bg-win',
q = 'bg-win',
l = 'bg-lose',
Expand Down
92 changes: 26 additions & 66 deletions lua/wikis/commons/PrizePool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local Lua = require('Module:Lua')
local Array = Lua.import('Module:Array')
local Class = Lua.import('Module:Class')
local Json = Lua.import('Module:Json')
local Operator = Lua.import('Module:Operator')
local String = Lua.import('Module:StringUtils')

local Import = Lua.import('Module:PrizePool/Import')
Expand All @@ -20,18 +19,14 @@ local Placement = Lua.import('Module:PrizePool/Placement')
local Opponent = Lua.import('Module:Opponent/Custom')

local Widgets = Lua.import('Module:Widget/All')
local Div = Widgets.Div
local IconFa = Lua.import('Module:Widget/Image/Icon/Fontawesome')
local TableRow = Widgets.TableRow
local TableCell = Widgets.TableCell
local Span = Widgets.Span
local TableCell = Lua.import('Module:Widget/Table2/All').Cell

---@class PrizePool: BasePrizePool
---@operator call(...): PrizePool
---@field placements PrizePoolPlacement[]
local PrizePool = Class.new(BasePrizePool)

local NON_BREAKING_SPACE = ' '

---@param args table
function PrizePool:readPlacements(args)
local currentPlace = 0
Expand All @@ -52,16 +47,19 @@ function PrizePool:readPlacements(args)
end

---@param placement PrizePoolPlacement
---@return WidgetTableCell
---@return Renderable
function PrizePool:placeOrAwardCell(placement)
local placeCell = TableCell{
children = {placement:getMedal() or '', NON_BREAKING_SPACE, placement:_displayPlace()},
css = {['font-weight'] = 'bolder'},
local badgeClass = placement:getBadgeClass()
local placeDisplay = placement:_displayPlace()
local content = badgeClass
and Span{classes = {'prizepooltable-badge', badgeClass}, children = {placeDisplay}}
or placeDisplay

return TableCell{
children = {content},
classes = {'prizepooltable-place'},
rowspan = #placement.opponents,
}
placeCell.rowSpan = #placement.opponents

return placeCell
end

---@param placement PrizePoolPlacement
Expand All @@ -73,61 +71,23 @@ end
---@param placement PrizePoolPlacement
---@return boolean
function PrizePool:applyCutAfter(placement)
if placement.placeStart > self.options.cutafter then
return true
end
return false
end

---@param placement PrizePoolPlacement?
---@param nextPlacement PrizePoolPlacement
---@param rows WidgetTableRow[]
function PrizePool:applyToggleExpand(placement, nextPlacement, rows)
if placement ~= nil
and placement.placeStart <= self.options.cutafter
and placement.placeEnd >= self.options.cutafter
and placement ~= self.placements[#self.placements]
and nextPlacement.placeStart ~= placement.placeStart
and nextPlacement.placeEnd ~= placement.placeEnd then

table.insert(rows, self:_toggleExpand(placement.placeEnd + 1))
end
return placement.placeStart > self.options.cutafter
end

---@param placeStart number
---@return WidgetTableRow
function PrizePool:_toggleExpand(placeStart)
local placeEnd = self.placements[#self.placements].placeEnd

if self.options.hideafter < math.huge then
local lastCut = Array.max(
Array.filter(self.placements, function (placement)
return placement.placeEnd <= self.options.hideafter
end),
Operator.property('placeEnd')
)
placeEnd = lastCut.placeEnd
---@return {opentext: string, closetext: string}?
function PrizePool:_collapseText()
local visible = Array.filter(self.placements, function(placement)
return placement.placeStart <= self.options.hideafter
end)
local lastVisible = visible[#visible]
local firstHidden = Array.find(visible, function(placement)
return placement.placeStart > self.options.cutafter
end)
if not firstHidden or not lastVisible then
return nil
end

local text = 'place ' .. placeStart .. ' to ' .. placeEnd
local expandButton = TableCell{
children = Div{children = {
text,
'&nbsp;',
IconFa{iconName = 'expand'},
}},
classes = {'general-collapsible-expand-button'},
}
local collapseButton = TableCell{
children = Div{children = {
text,
'&nbsp;',
IconFa{iconName = 'collapse'},
}},
classes = {'general-collapsible-collapse-button'},
}

return TableRow{classes = {'ppt-toggle-expand'}, children = {expandButton, collapseButton}}
local text = 'place ' .. firstHidden.placeStart .. ' to ' .. lastVisible.placeEnd
return {opentext = text, closetext = text}
end

-- get the lpdbObjectName depending on opponenttype
Expand Down
54 changes: 8 additions & 46 deletions lua/wikis/commons/PrizePool/Award.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ local Placement = Lua.import('Module:PrizePool/Award/Placement')

local Opponent = Lua.import('Module:Opponent/Custom')

local Widgets = Lua.import('Module:Widget/All')
local Div = Widgets.Div
local IconFa = Lua.import('Module:Widget/Image/Icon/Fontawesome')
local TableRow = Widgets.TableRow
local TableCell = Widgets.TableCell
local TableCell = Lua.import('Module:Widget/Table2/All').Cell

--- @class AwardPrizePool: BasePrizePool
--- @operator call(...): AwardPrizePool
Expand Down Expand Up @@ -50,58 +46,24 @@ function AwardPrizePool:readPlacements(args)
end

---@param placement AwardPlacement
---@return WidgetTableCell
---@return Renderable
function AwardPrizePool:placeOrAwardCell(placement)
local awardCell = TableCell{
return TableCell{
children = {placement.award},
css = {['font-weight'] = 'bolder'},
classes = {'prizepooltable-place'},
rowspan = #placement.opponents,
}
awardCell.rowSpan = #placement.opponents

return awardCell
end

---@param placement AwardPlacement
---@return boolean
function AwardPrizePool:applyCutAfter(placement)
if (placement.previousTotalNumberOfParticipants + 1) > self.options.cutafter then
return true
end
return false
return (placement.previousTotalNumberOfParticipants + 1) > self.options.cutafter
end

---@param placement AwardPlacement?
---@param nextPlacement AwardPlacement
---@param rows WidgetTableRow[]
function AwardPrizePool:applyToggleExpand(placement, nextPlacement, rows)
if placement ~= nil
and (placement.previousTotalNumberOfParticipants + 1) <= self.options.cutafter
and placement.currentTotalNumberOfParticipants >= self.options.cutafter
and placement ~= self.placements[#self.placements] then

table.insert(rows, self:_toggleExpand())
end
end

---@return WidgetTableRow
function AwardPrizePool:_toggleExpand()
local expandButton = TableCell{
children = Div{children = {
'Show more Awards&nbsp;',
IconFa{iconName = 'expand'},
}},
classes = {'general-collapsible-expand-button'},
}
local collapseButton = TableCell{
children = Div{children = {
'Show less Awards&nbsp;',
IconFa{iconName = 'collapse'},
}},
classes = {'general-collapsible-collapse-button'},
}

return TableRow{classes = {'ppt-toggle-expand'}, children = {expandButton, collapseButton}}
---@return {opentext: string, closetext: string}?
function AwardPrizePool:_collapseText()
return {opentext = 'Show more Awards', closetext = 'Show less Awards'}
end

-- Get the lpdbObjectName depending on opponenttype
Expand Down
Loading
Loading