Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 24 additions & 24 deletions lua/wikis/apexlegends/Infobox/Map/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ local Injector = Lua.import('Module:Widget/Injector')
local Map = Lua.import('Module:Infobox/Map')

local Widgets = Lua.import('Module:Widget/All')
local WidgetTable = Lua.import('Module:Widget/Table2/All')
local Cell = Widgets.Cell
local Title = Widgets.Title
local TableCell = Widgets.TableCell
local TableRow = Widgets.TableRow
local WidgetTable = Widgets.TableOld

---@class ApexMapInfobox: MapInfobox
local CustomMap = Class.new(Map)
Expand Down Expand Up @@ -52,17 +50,19 @@ function CustomInjector:parse(id, widgets)
if id == 'custom' then
Array.appendWith(widgets,
Cell{name = 'Game Mode(s)', children = {args.gamemode}},
Cell{name = 'Played in ALGS', children = {self.caller:_createSpan(args)}}
Cell{name = 'Played in ALGS', children = {self.caller:_playedInAlgsDisplay(args)}}
)

if String.isEmpty(args.ring) then return widgets end

local rows = {self.caller:_createRingTableHeader()}
Array.forEach(self.caller:getAllArgsForBase(args, 'ring'), function(ringData)
table.insert(rows, self.caller:_createRingTableRow(ringData))
end)
local rows = Array.extend(
{self.caller:_createRingTableHeader()},
Array.map(self.caller:getAllArgsForBase(args, 'ring'), function(ringData)
return self.caller:_createRingTableRow(ringData)
end)
)

local ringTable = WidgetTable{
local ringTable = WidgetTable.Table{
classes = {'fo-nttax-infobox' ,'wiki-bordercolor-light'}, --row alternating bg
css = {
['text-align'] = 'center',
Expand All @@ -83,30 +83,30 @@ function CustomInjector:parse(id, widgets)
return widgets
end

---@return WidgetTableRow
---@return Renderable
function CustomMap:_createRingTableHeader()
return TableRow{css = {['font-weight'] = 'bold'}, children = {
TableCell{children = {'Ring'}},
TableCell{children = {'Wait (s)'}},
TableCell{children = {'Close Time (s)'}},
TableCell{children = {'Damage per tick'}},
TableCell{children = {'End Diameter (m)'}},
}} -- bg needed
return WidgetTable.Row{children = {
WidgetTable.CellHeader{children = {'Ring'}},
WidgetTable.CellHeader{children = {'Wait (s)'}},
WidgetTable.CellHeader{children = {'Close Time (s)'}},
WidgetTable.CellHeader{children = {'Damage per tick'}},
WidgetTable.CellHeader{children = {'End Diameter (m)'}},
}}
end

---@param ringData string
---@return WidgetTableRow
---@return Renderable
function CustomMap:_createRingTableRow(ringData)
local cells = {}
for _, item in ipairs(mw.text.split(ringData, ',')) do
table.insert(cells, TableCell{children = {item}})
end
return TableRow{children = cells}
return WidgetTable.Row{
children = Array.map(Array.parseCommaSeparatedString(ringData), function(item)
return WidgetTable.Cell{children = {item}}
end)
}
end

---@param args table
---@return string
function CustomMap:_createSpan(args)
function CustomMap:_playedInAlgsDisplay(args)
local sep = ' - '
local spanEnd = args.spanend
if String.isEmpty(args.spanstart) then
Expand Down
5 changes: 0 additions & 5 deletions lua/wikis/commons/Widget/All.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ Widgets.ShopMerch = Lua.import('Module:Widget/Infobox/ShopMerch')
Widgets.Title = Lua.import('Module:Widget/Infobox/Title')
Widgets.Venue = Lua.import('Module:Widget/Infobox/Venue')

--- Table Widgets (div-table) (will be removed)
Widgets.TableOld = Lua.import('Module:Widget/Table/Old')
Widgets.TableRow = Lua.import('Module:Widget/Table/Row')
Widgets.TableCell = Lua.import('Module:Widget/Table/Cell')

--- Data Table Widgets (html-table)
Widgets.DataTable = Lua.import('Module:Widget/Basic/DataTable')

Expand Down
48 changes: 0 additions & 48 deletions lua/wikis/commons/Widget/Table/Cell.lua

This file was deleted.

57 changes: 0 additions & 57 deletions lua/wikis/commons/Widget/Table/Old.lua

This file was deleted.

47 changes: 0 additions & 47 deletions lua/wikis/commons/Widget/Table/Row.lua

This file was deleted.

65 changes: 4 additions & 61 deletions stylesheets/commons/Prizepooltable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ table.prizepooltable.collapsed .prizepooltablehide {
background-color: var( --prize-pool-header-background-color, inherit );
}

.csstable-widget.prizepooltable {
border: 0.125rem solid var( --prize-pool-header-background-color );

.csstable-widget-row,
.csstable-widget-cell {
border: 0;
}

.csstable-widget-row:nth-child( odd ):not( .prizepooltable-header ):not( .ppt-toggle-expand ) {
background-color: var( --prize-pool-alt-background-color );
}
}

/* Background colours */

tr.bg-first,
Expand All @@ -100,8 +87,7 @@ div.bg-first,
tr.bg-p1,
div.bg-p1,
tr.background-color-first-place,
div.background-color-first-place,
div.csstable-widget-row.background-color-first-place > .csstable-widget-cell {
div.background-color-first-place {
border-bottom: 0.125rem solid var( --prize-pool-gold, transparent );
}

Expand Down Expand Up @@ -135,8 +121,7 @@ div.bg-second,
tr.bg-p2,
div.bg-p2,
tr.background-color-second-place,
div.background-color-second-place,
div.csstable-widget-row.background-color-second-place > .csstable-widget-cell {
div.background-color-second-place {
border-bottom: 0.125rem solid var( --prize-pool-silver, transparent );
}

Expand Down Expand Up @@ -170,8 +155,7 @@ div.bg-third,
tr.bg-p3,
div.bg-p3,
tr.background-color-third-place,
div.background-color-third-place,
div.csstable-widget-row.background-color-third-place > .csstable-widget-cell {
div.background-color-third-place {
border-bottom: 0.125rem solid var( --prize-pool-bronze, transparent );
}

Expand Down Expand Up @@ -205,8 +189,7 @@ div.bg-fourth,
tr.bg-p4,
div.bg-p4,
tr.background-color-fourth-place,
div.background-color-fourth-place,
div.csstable-widget-row.background-color-fourth-place > .csstable-widget-cell {
div.background-color-fourth-place {
border-bottom: 0.125rem solid var( --prize-pool-copper, transparent );
}

Expand All @@ -220,29 +203,10 @@ div.background-color-fourth-place > *.prizepooltable-place {
color: #ffffff;
}

div.csstable-widget-row.bg-win {
div.prizepooltable > & {
/* need the `!important` due to bg-win ( sadly ) having an important in one of its definitions ... */
background-color: inherit !important;
}

> .csstable-widget-cell {
border-bottom: 0.125rem solid var( --clr-forest-background-color, transparent );
}
}

div.bg-win > *.prizepooltable-place {
background-color: var( --clr-forest-background-color, inherit );
}

div.csstable-widget-row.bg-lose {
background-color: inherit;

> .csstable-widget-cell {
border-bottom: 0.125rem solid var( --clr-cinnabar-background-color, transparent );
}
}

div.bg-lose > *.prizepooltable-place {
background-color: var( --clr-cinnabar-background-color, inherit );
}
Expand Down Expand Up @@ -285,27 +249,6 @@ Author: Rathoz
display: none !important;
}

.csstable-widget {
border-right: 1px solid var( --table-border-color, #bbbbbb );
border-bottom: 1px solid var( --table-border-color, #bbbbbb );
display: inline-grid;

&-row:not( .ppt-toggle-expand ) {
display: contents;
}

&-cell {
border-left: 1px solid var( --table-border-color, #bbbbbb );
border-top: 1px solid var( --table-border-color, #bbbbbb );
background: inherit;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
}

.ppt-toggle-expand {
grid-column: 1 / -1;

Expand Down
Loading