diff --git a/lua/wikis/commons/BroadcastTalentTable.lua b/lua/wikis/commons/BroadcastTalentTable.lua index 70ffd359e55..17484cb8290 100644 --- a/lua/wikis/commons/BroadcastTalentTable.lua +++ b/lua/wikis/commons/BroadcastTalentTable.lua @@ -12,14 +12,15 @@ local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local Flags = Lua.import('Module:Flags') local Game = Lua.import('Module:Game') -local HighlightConditions = Lua.import('Module:HighlightConditions') local LeagueIcon = Lua.import('Module:LeagueIcon') local Logic = Lua.import('Module:Logic') +local Lpdb = Lua.import('Module:Lpdb') local Namespace = Lua.import('Module:Namespace') local Operator = Lua.import('Module:Operator') local Page = Lua.import('Module:Page') local String = Lua.import('Module:StringUtils') local Table = Lua.import('Module:Table') +local Tournament = Lua.import('Module:Tournament') local Tier = Lua.import('Module:Tier/Custom') @@ -29,22 +30,41 @@ local ConditionNode = Condition.Node local Comparator = Condition.Comparator local BooleanOperator = Condition.BooleanOperator local ColumnName = Condition.ColumnName +local ConditionUtil = Condition.Util + +local Button = Lua.import('Module:Widget/Basic/Button') +local Dialog = Lua.import('Module:Widget/Basic/Dialog') +local HtmlWidgets = Lua.import('Module:Widget/Html/All') +local LinkWidget = Lua.import('Module:Widget/Basic/Link') +local TableWidgets = Lua.import('Module:Widget/Table2/All') +local UnorderedList = Lua.import('Module:Widget/List/Unordered') +local WidgetUtil = Lua.import('Module:Widget/Util') local DEFAULT_LIMIT = 500 local DEFAULT_ACHIEVEMENTS_LIMIT = 10 local NONBREAKING_SPACE = ' ' -local DASH = '–' -local DEFAULT_TIERTYPE = 'General' +local DASH = '–' local DEFAULT_ABOUT_LINK = 'Template:Weight/doc' local ACHIEVEMENTS_SORT_ORDER = 'weight desc, date desc' local ACHIEVEMENTS_IGNORED_STATUSES = {'cancelled', 'postponed'} local RESULTS_SORT_ORDER = 'date desc' ----@class BroadcastTalentTable ----@operator call():BroadcastTalentTable -local BroadcastTalentTable = Class.new(function(self, ...) self:init(...) end) +---@class EnrichedBroadcast +---@field date string +---@field pagename string +---@field parent string +---@field position string +---@field positions string[] +---@field language string +---@field extradata table + +---@class BroadcastTalentTable: BaseClass +---@operator call(table): BroadcastTalentTable +---@field broadcaster string? +---@field aliases string[] +local BroadcastTalentTable = Class.new(function(self, args) self:init(args) end) ----@class argsValues +---@class BroadcastTalentTableArgs ---@field broadcaster string? ---@field aliases string? ---@field showtiertype string|boolean|nil @@ -55,12 +75,12 @@ local BroadcastTalentTable = Class.new(function(self, ...) self:init(...) end) ---@field displayGameIcon string|boolean|nil ---@field useTickerNames string|boolean|nil ---@field limit string|number|nil ----@field aboutAchievementsLink string|boolean|nil +---@field aboutAchievementsLink string? ---@field onlyHighlightOnValue string? ---@field displayPartnerLists string|boolean|nil --- Init function for BroadcastTalentTable ----@param args argsValues +---@param args BroadcastTalentTableArgs ---@return self function BroadcastTalentTable:init(args) self:_readArgs(args) @@ -79,12 +99,13 @@ function BroadcastTalentTable.run(frame) return BroadcastTalentTable(Arguments.getArgs(frame)):create() end ----@param args table +---@private +---@param args BroadcastTalentTableArgs function BroadcastTalentTable:_readArgs(args) local isAchievementsTable = Logic.readBool(args.achievements) self.args = { - aboutAchievementsLink = args.aboutAchievementsLink or DEFAULT_ABOUT_LINK, + aboutAchievementsLink = Logic.emptyOr(args.aboutAchievementsLink, DEFAULT_ABOUT_LINK), showTierType = Logic.nilOr(Logic.readBoolOrNil(args.showtiertype), true), displayGameIcon = Logic.readBool(args.displayGameIcon), useTickerNames = Logic.readBool(args.useTickerNames), @@ -99,12 +120,15 @@ function BroadcastTalentTable:_readArgs(args) } local broadcaster = String.isNotEmpty(args.broadcaster) and args.broadcaster or self:_getBroadcaster() - self.broadcaster = broadcaster and mw.ext.TeamLiquidIntegration.resolve_redirect(broadcaster):gsub(' ', '_') or nil + self.broadcaster = Page.pageifyLink(broadcaster) - self.aliases = args.aliases and Array.map(mw.text.split(args.aliases:gsub(' ', '_'), ','), String.trim) or {} - table.insert(self.aliases, self.broadcaster) + self.aliases = Array.unique(Array.extend( + self.broadcaster, + Array.map(Array.parseCommaSeparatedString(args.aliases), Page.pageifyLink) + )) end +---@private ---@return string? function BroadcastTalentTable:_getBroadcaster() local title = mw.title.getCurrentTitle() @@ -116,67 +140,62 @@ function BroadcastTalentTable:_getBroadcaster() return title.baseText end ----@return table[]? +---@private +---@return table? function BroadcastTalentTable:_fetchTournaments() local args = self.args local conditions = ConditionTree(BooleanOperator.all) - local broadCasterConditions = ConditionTree(BooleanOperator.any) - for _, broadcaster in pairs(self.aliases) do - broadCasterConditions:add{ConditionNode(ColumnName('page'), Comparator.eq, broadcaster)} - end - conditions:add(broadCasterConditions) + conditions:add(ConditionUtil.anyOf(ColumnName('page'), self.aliases)) if args.year then - conditions:add{ConditionNode(ColumnName('date_year'), Comparator.eq, args.year)} + conditions:add(ConditionNode(ColumnName('date_year'), Comparator.eq, args.year)) else -- mirrors current implementation -- should we change it to use <= instead of < ? (same for >) if args.startDate then - conditions:add{ConditionNode(ColumnName('date'), Comparator.gt, args.startDate)} + conditions:add(ConditionNode(ColumnName('date'), Comparator.gt, args.startDate)) end if args.endDate then - conditions:add{ConditionNode(ColumnName('date'), Comparator.lt, args.endDate)} + conditions:add(ConditionNode(ColumnName('date'), Comparator.lt, args.endDate)) end end if args.isAchievementsTable then - Array.forEach(ACHIEVEMENTS_IGNORED_STATUSES, function(ignoredStatus) - conditions:add{ConditionNode(ColumnName('extradata_status'), Comparator.neq, ignoredStatus)} - end) + conditions:add(ConditionUtil.noneOf(ColumnName('extradata_status'), ACHIEVEMENTS_IGNORED_STATUSES)) end - -- double the limit for the query due to potentional merging of results further down the line - local queryLimit = args.limit * 2 + ---@type EnrichedBroadcast[] + local tournaments = {} - local queryData = mw.ext.LiquipediaDB.lpdb('broadcasters', { + ---@type table + local pageNames = {} + + Lpdb.executeMassQuery('broadcasters', { query = 'pagename, parent, date, extradata, language, position', conditions = conditions:toString(), order = args.sortBy, - limit = queryLimit, - }) - - if not queryData[1] then - return - end - - local tournaments = {} - local pageNames = {} - for _, tournament in pairs(queryData) do - tournament.extradata = tournament.extradata or {} - if not pageNames[tournament.pagename] or Logic.readBool(tournament.extradata.showmatch) then - tournament.positions = {tournament.position} - table.insert(tournaments, tournament) - if not Logic.readBool(tournament.extradata.showmatch) then - pageNames[tournament.pagename] = tournament + }, function (record) + if #tournaments == args.limit then + return false + end + ---@cast record EnrichedBroadcast + record.extradata = record.extradata or {} + if not pageNames[record.pagename] or Logic.readBool(record.extradata.showmatch) then + record.positions = {record.position} + table.insert(tournaments, record) + if not Logic.readBool(record.extradata.showmatch) then + pageNames[record.pagename] = record end else - table.insert(pageNames[tournament.pagename].positions, tournament.position) + table.insert(pageNames[record.pagename].positions, record.position) end - end + end) - tournaments = Array.sub(tournaments, 1, args.limit) + if Logic.isEmpty(tournaments) then + return + end if args.isAchievementsTable then table.sort(tournaments, function(item1, item2) @@ -185,10 +204,9 @@ function BroadcastTalentTable:_fetchTournaments() return {[''] = tournaments} end - local _ - _, tournaments = Array.groupBy(tournaments, function(tournament) return tournament.date:sub(1, 4) end) + local _, tournamentsByYear = Array.groupBy(tournaments, function(tournament) return tournament.date:sub(1, 4) end) - return tournaments + return tournamentsByYear end --- Creates the display @@ -198,138 +216,153 @@ function BroadcastTalentTable:create() return end - local display = mw.html.create('table') - :addClass('wikitable wikitable-striped sortable') - :css('text-align', 'center') - :node(self:_header()) - - for seperatorTitle, sectionData in Table.iter.spairs(self.tournaments, function (_, key1, key2) - return tonumber(key1) > tonumber(key2) end) do - - if String.isNotEmpty(seperatorTitle) then - display:node(BroadcastTalentTable._seperator(seperatorTitle)) - end - - for _, tournament in ipairs(sectionData) do - display:node(self:_row(tournament)) - end + local bodyElements = {} + + for separatorTitle, sectionData in Table.iter.spairs(self.tournaments, function (_, key1, key2) + return tonumber(key1) > tonumber(key2) + end) do + Array.extendWith( + bodyElements, + {BroadcastTalentTable._separator(separatorTitle)}, + Array.map(sectionData, function (broadcast) + return self:_row(broadcast) + end) + ) end - if self.args.isAchievementsTable then - display:node(self:_footer()) - end - - return mw.html.create('div') - :addClass('table-responsive') - :node(display) + return TableWidgets.Table{ + sortable = true, + columns = WidgetUtil.collect( + { + align = 'left', + sortType = 'isoDate' + }, + { + align = 'left', + shrink = true, + }, + self.args.displayGameIcon and {align = 'center'} or nil, + {align = 'center'}, + {align = 'left'}, + {align = 'left'}, + self.args.displayPartnerListColumn and { + align = 'right', + unsortable = true, + } or nil + ), + children = WidgetUtil.collect( + self:_header(), + -- Hidden tr that contains a td to prevent the first yearHeader from being inside thead + Logic.isNotEmpty(bodyElements) and HtmlWidgets.Tr{ + css = {display = 'none'}, + children = HtmlWidgets.Td{} + } or nil, + TableWidgets.TableBody{children = bodyElements} + ), + footer = self.args.isAchievementsTable and self:_footer() or nil + } end ----@return Html +---@private +---@return Widget function BroadcastTalentTable:_header() - local header = mw.html.create('tr') - :tag('th'):wikitext('Date'):css('width', '120px'):done() - :tag('th'):wikitext('Tier'):css('width', '50px'):done() - :tag('th'):wikitext('Tournament') - :attr('colspan', self.args.displayGameIcon and 3 or 2) - :css('width', self.args.displayGameIcon and '350px' or '300px'):done() - :tag('th'):wikitext('Position'):css('width', '130px'):done() - - if not self.args.displayPartnerListColumn then - return header - end - - return header:tag('th'):wikitext('Partner List'):css('width', '160px'):done() -end - ----@param seperatorTitle string|number ----@return Html -function BroadcastTalentTable._seperator(seperatorTitle) - return mw.html.create('tr'):addClass('sortbottom'):css('font-weight', 'bold') - :tag('td'):attr('colspan', 42):wikitext(seperatorTitle):done() + return TableWidgets.TableHeader{children = { + TableWidgets.Row{children = WidgetUtil.collect( + TableWidgets.CellHeader{children = {'Date'}}, + TableWidgets.CellHeader{children = {'Tier'}}, + TableWidgets.CellHeader{ + align = 'left', + colspan = self.args.displayGameIcon and 3 or 2, + children = {'Tournament'} + }, + TableWidgets.CellHeader{children = {'Position'}}, + self.args.displayPartnerListColumn and TableWidgets.CellHeader{children = {'Partners'}} or nil + )} + }} end ----@param tournament table ----@return Html -function BroadcastTalentTable:_row(tournament) - local row = mw.html.create('tr') - - tournament = BroadcastTalentTable._fetchTournamentData(tournament) - - if HighlightConditions.tournament(tournament, self.args) then - row:addClass('tournament-highlighted-bg') - end - - local tierDisplay, tierSortValue = self:_tierDisplay(tournament) - - row - :tag('td'):wikitext(tournament.date):done() - :tag('td'):wikitext(tierDisplay):attr('data-sort-value', tierSortValue):done() - - if self.args.displayGameIcon then - row:tag('td'):node(Game.icon{game = tournament.game}) - end - - row - :tag('td'):wikitext(LeagueIcon.display{ - icon = tournament.icon, - iconDark = tournament.icondark, - series = tournament.series, - date = tournament.date, - link = tournament.pagename, - name = tournament.name, - }):done() - :tag('td'):css('text-align', 'left'):wikitext(Page.makeInternalLink({}, - self:_tournamentDisplayName(tournament), - tournament.pagename - )):done() - :tag('td'):wikitext(table.concat(tournament.positions, '
')):done() - - if not self.args.displayPartnerListColumn then - return row +---@private +---@param separatorTitle string|number? +---@return Widget? +function BroadcastTalentTable._separator(separatorTitle) + if Logic.isEmpty(separatorTitle) then + return end - - return row:tag('td'):node(self:_partnerList(tournament)):done() + return TableWidgets.Row{ + section = 'subhead', + classes = {'sortbottom'}, + css = {['font-weight'] = 'bold'}, + children = TableWidgets.CellHeader{ + align = 'center', + colspan = 42, + children = separatorTitle + } + } end ----@param tournament table ----@return table -function BroadcastTalentTable._fetchTournamentData(tournament) - local queryData = mw.ext.LiquipediaDB.lpdb('tournament', { - conditions = '[[pagename::' .. tournament.parent .. ']] OR [[pagename::' .. tournament.pagename .. ']]', - query = 'name, tickername, icon, icondark, series, game, ' - .. 'liquipediatier, liquipediatiertype, publishertier, extradata', - }) - - local extradata = tournament.extradata or {} - if String.isNotEmpty(extradata.liquipediatier) then - tournament.liquipediatier = extradata.liquipediatier - end - if String.isNotEmpty(extradata.liquipediatiertype) then - tournament.liquipediatiertype = extradata.liquipediatiertype - end - - if type(queryData[1]) ~= 'table' then - return tournament - end - - queryData[1].tournamentExtradata = queryData[1].extradata - - return Table.merge(queryData[1], tournament) +---@private +---@param broadcast EnrichedBroadcast +---@return Html +function BroadcastTalentTable:_row(broadcast) + local tournament = Tournament.getTournament(broadcast.parent) + ---@cast tournament -nil + + local tierDisplay = Tier.display(tournament.liquipediaTier, tournament.liquipediaTierType, Table.merge( + tournament.tierOptions, + { + link = true, + shortIfBoth = true, + onlyTierTypeIfBoth = self.args.showTierType and String.isNotEmpty(tournament.liquipediaTierType) + } + )) + + return TableWidgets.Row{ + highlighted = tournament:isHighlighted(self.args), + children = WidgetUtil.collect( + TableWidgets.Cell{children = broadcast.date}, + TableWidgets.Cell{ + attributes = { + ['data-sort-value'] = Tier.toSortValue(tournament.liquipediaTier, tournament.liquipediaTierType) + }, + children = tierDisplay + }, + self.args.displayGameIcon and TableWidgets.Cell{ + children = Game.icon{game = tournament.game} + } or nil, + TableWidgets.Cell{children = LeagueIcon.display{ + icon = tournament.icon, + iconDark = tournament.iconDark, + series = tournament.series, + date = broadcast.date, + link = tournament.pageName, + name = tournament.fullName, + }}, + TableWidgets.Cell{ + align = 'left', + children = LinkWidget{ + link = tournament.pageName, + children = self:_tournamentDisplayName(broadcast, tournament) + } + }, + TableWidgets.Cell{children = Array.interleave(broadcast.positions, HtmlWidgets.Br{})}, + self.args.displayPartnerListColumn and TableWidgets.Cell{ + children = self:_partnerList(broadcast, tournament) + } or nil + ) + } end ----@param tournament table +---@private +---@param broadcast EnrichedBroadcast +---@param tournament StandardTournament ---@return string -function BroadcastTalentTable:_tournamentDisplayName(tournament) - -- this is not the extradata of the tournament but of the broadcaster (they got merged together) - local extradata = tournament.extradata or {} +function BroadcastTalentTable:_tournamentDisplayName(broadcast, tournament) + local extradata = broadcast.extradata or {} if Logic.readBool(extradata.showmatch) and String.isNotEmpty(extradata.showmatchname) then return extradata.showmatchname end - local displayName = String.isNotEmpty(tournament.tickername) - and self.args.useTickerNames and tournament.tickername - or String.isNotEmpty(tournament.name) and tournament.name - or tournament.parent:gsub('_', ' ') + local displayName = self.args.useTickerNames and tournament.displayName or tournament.fullName if not Logic.readBool(extradata.showmatch) then return displayName @@ -338,23 +371,12 @@ function BroadcastTalentTable:_tournamentDisplayName(tournament) return displayName .. ' - Showmatch' end ----@param tournament table ----@return string?, string -function BroadcastTalentTable:_tierDisplay(tournament) - local tier, tierType, options = Tier.parseFromQueryData(tournament) - assert(Tier.isValid(tier, tierType), 'Broadcaster event with unset or invalid tier/tiertype: ' .. tournament.pagename) - - options.link = true - options.shortIfBoth = true - options.onlyTierTypeIfBoth = self.args.showTierType and tournament.liquipediatiertype ~= DEFAULT_TIERTYPE - - return Tier.display(tier, tierType, options), Tier.toSortValue(tier, tierType) -end - ----@param tournament table ----@return Html|string -function BroadcastTalentTable:_partnerList(tournament) - local partners = self:_getPartners(tournament) +---@private +---@param broadcast EnrichedBroadcast +---@param tournament StandardTournament +---@return string|Widget +function BroadcastTalentTable:_partnerList(broadcast, tournament) + local partners = self:_getPartners(broadcast) if Table.isEmpty(partners) then return DASH @@ -363,55 +385,60 @@ function BroadcastTalentTable:_partnerList(tournament) partners = BroadcastTalentTable._removeDuplicatePartners(partners) Array.sortInPlaceBy(partners, Operator.property('page')) - local list = mw.html.create('ul') - for _, partner in ipairs(partners) do - list:tag('li'):wikitext(Flags.Icon{flag = partner.flag} .. NONBREAKING_SPACE - .. Page.makeInternalLink({}, partner.id, partner.page)) - end - - return mw.html.create('div') - :addClass('NavFrame collapsible broadcast-talent-partner-list-frame collapsed') - :tag('div'):addClass('NavHead'):addClass('transparent-bg'):done() - :tag('div'):addClass('NavContent broadcast-talent-partner-list'):node(list):done() + return Dialog{ + trigger = Button{ + children = 'Show', + variant = 'secondary', + size = 'xs', + }, + title = LinkWidget{ + link = tournament.pageName, + children = self:_tournamentDisplayName(broadcast, tournament) + }, + children = UnorderedList{ + children = Array.map(partners, function (partner) + return { + Flags.Icon{flag = partner.flag}, + NONBREAKING_SPACE, + LinkWidget{link = partner.page, children = partner.id} + } + end) + }, + } end ----@param tournament table ----@return table -function BroadcastTalentTable:_getPartners(tournament) - local conditions = ConditionTree(BooleanOperator.all) - :add{ - ConditionNode(ColumnName('parent'), Comparator.eq, tournament.parent), - } +---@private +---@param broadcast EnrichedBroadcast +---@return {id: string, page: string, flag: string}[] +function BroadcastTalentTable:_getPartners(broadcast) + local conditions = ConditionTree(BooleanOperator.all):add( + ConditionNode(ColumnName('parent'), Comparator.eq, broadcast.parent) + ) - local positionConditions = ConditionTree(BooleanOperator.any) - for _, position in pairs(tournament.positions) do - positionConditions:add{ConditionNode(ColumnName('position'), Comparator.eq, position)} - end - conditions:add(positionConditions) + conditions:add(ConditionUtil.anyOf(ColumnName('position'), broadcast.positions)) - for _, caster in pairs(self.aliases) do - conditions:add{ConditionNode(ColumnName('page'), Comparator.neq, caster)} - end + conditions:add(ConditionUtil.noneOf(ColumnName('page'), self.aliases)) - if String.isNotEmpty(tournament.language) then - conditions:add{ConditionNode(ColumnName('language'), Comparator.eq, tournament.language)} + if String.isNotEmpty(broadcast.language) then + conditions:add(ConditionNode(ColumnName('language'), Comparator.eq, broadcast.language)) end - local extradata = tournament.extradata or {} + local extradata = broadcast.extradata or {} if Logic.readBool(extradata.showmatch) then - conditions:add{ConditionNode(ColumnName('extradata_showmatch'), Comparator.eq, 'true')} + conditions:add(ConditionNode(ColumnName('extradata_showmatch'), Comparator.eq, 'true')) if String.isNotEmpty(extradata.showmatchname) then - conditions:add{ConditionNode(ColumnName('extradata_showmatchname'), Comparator.eq, extradata.showmatchname)} + conditions:add(ConditionNode(ColumnName('extradata_showmatchname'), Comparator.eq, extradata.showmatchname)) end end return mw.ext.LiquipediaDB.lpdb('broadcasters', { query = 'id, page, flag', - conditions = conditions:toString(), + conditions = tostring(conditions), }) end ----@param partners table +---@private +---@param partners {id: string, page: string, flag: string}[] ---@return {id: string, page: string, flag: string}[] function BroadcastTalentTable._removeDuplicatePartners(partners) local uniquePartners = Table.map(partners, function(_, partner) return partner.page, partner end) @@ -419,23 +446,31 @@ function BroadcastTalentTable._removeDuplicatePartners(partners) return Array.extractValues(uniquePartners) end ----@return Html +---@private +---@return Widget function BroadcastTalentTable:_footer() - local footer = mw.html.create('small') - :tag('span') - :css('float', 'left'):css('padding-left', '20px'):css('font-style', 'italic') - :wikitext(Page.makeInternalLink({}, 'About achievements', self.args.aboutAchievementsLink)) - :done() - :tag('b') - :wikitext(Page.makeInternalLink({}, - 'Broadcasts from any Tournament', - self.broadcaster .. '/Broadcasts#Detailed Broadcasts' - )):done() - :done() - - return mw.html.create('tr') - :tag('th'):attr('colspan', 42) - :node(footer) + return HtmlWidgets.Small{children = { + HtmlWidgets.Span{ + classes = {'mobile-hide'}, + css = { + float = 'left', + ['padding-left'] = '1rem', + ['font-style'] = 'italic', + }, + children = LinkWidget{children = 'About achievements', link = self.args.aboutAchievementsLink} + }, + HtmlWidgets.Span{ + classes = {'mobile-only'}, + children = LinkWidget{children = 'About achievements', link = self.args.aboutAchievementsLink} + }, + HtmlWidgets.Br{ + classes = {'mobile-only'} + }, + HtmlWidgets.B{children = LinkWidget{ + children = 'Broadcasts from any Tournament', + link = self.broadcaster .. '/Broadcasts#Detailed Broadcasts' + }} + }} end return BroadcastTalentTable diff --git a/lua/wikis/commons/Tournament.lua b/lua/wikis/commons/Tournament.lua index caf2eb2b469..2f62664f16d 100644 --- a/lua/wikis/commons/Tournament.lua +++ b/lua/wikis/commons/Tournament.lua @@ -14,7 +14,7 @@ local Lpdb = Lua.import('Module:Lpdb') local Logic = Lua.import('Module:Logic') local Page = Lua.import('Module:Page') local Table = Lua.import('Module:Table') -local Tier = Lua.import('Module:Tier/Utils') +local Tier = Lua.import('Module:Tier/Custom') local Tournament = {} @@ -33,7 +33,7 @@ local TOURNAMENT_PHASE = { ---@field iconDark string? ---@field series string? ---@field liquipediaTier integer|string|nil ----@field liquipediaTierType integer|string|nil +---@field liquipediaTierType string? ---@field game string? ---@field publisherTier string? @@ -44,6 +44,7 @@ local TOURNAMENT_PHASE = { ---@field featured boolean ---@field status string? ---@field phase TournamentPhase +---@field tierOptions table ---@field extradata table ---@field isHighlighted fun(self: StandardTournament, options?: table): boolean @@ -104,7 +105,7 @@ function Tournament.partialTournamentFromMatch(match) fullName = match.tournament, pageName = match.parent, liquipediaTier = Tier.toIdentifier(match.liquipediatier), - liquipediaTierType = Tier.toIdentifier(match.liquipediatiertype), + liquipediaTierType = Tier.toIdentifier(match.liquipediatiertype) --[[ @as string? ]], icon = match.icon, iconDark = match.iconDark, series = match.series, @@ -119,6 +120,7 @@ function Tournament.tournamentFromRecord(record) local extradata = record.extradata or {} local startDate = Tournament.parseDateRecord(Logic.nilOr(extradata.startdatetext, record.startdate)) local endDate = Tournament.parseDateRecord(Logic.nilOr(extradata.enddatetext, record.sortdate, record.enddate)) + local tier, tierType, tierOptions = Tier.parseFromQueryData(record) local tournament = { displayName = Logic.emptyOr(record.tickername, record.name) or record.pagename:gsub('_', ' '), @@ -126,8 +128,8 @@ function Tournament.tournamentFromRecord(record) pageName = record.pagename, startDate = startDate, endDate = endDate, - liquipediaTier = Tier.toIdentifier(record.liquipediatier), - liquipediaTierType = Tier.toIdentifier(record.liquipediatiertype), + liquipediaTier = Tier.toIdentifier(tier), + liquipediaTierType = Tier.toIdentifier(tierType) --[[ @as string? ]], publisherTier = record.publishertier, region = (record.locations or {}).region1, status = record.status, @@ -135,6 +137,7 @@ function Tournament.tournamentFromRecord(record) iconDark = record.icondark, series = record.series, game = record.game, + tierOptions = tierOptions, extradata = extradata, } diff --git a/lua/wikis/commons/Widget/Table2/Table.lua b/lua/wikis/commons/Widget/Table2/Table.lua index a2b6f43ffc4..d05bdce3e26 100644 --- a/lua/wikis/commons/Widget/Table2/Table.lua +++ b/lua/wikis/commons/Widget/Table2/Table.lua @@ -34,9 +34,9 @@ local Table2Contexts = Lua.import('Module:Widget/Contexts/Table2') ---@field variant 'generic'|'themed'? ---@field sortable (string|number|boolean)? ---@field striped (string|number|boolean)? ----@field caption Widget|Html|string|number? ----@field title Widget|Html|string|number? ----@field footer Widget|Html|string|number? +---@field caption Renderable|Renderable[]? +---@field title Renderable|Renderable[]? +---@field footer Renderable|Renderable[]? ---@field classes string[]? ---@field tableClasses string[]? ---@field columns Table2ColumnDef[]? @@ -79,12 +79,12 @@ function Table2:render() local captionNode = props.caption and HtmlWidgets.Div{ classes = {'table2__caption'}, - children = {props.caption}, + children = props.caption, } or nil local titleNode = props.title and HtmlWidgets.Div{ classes = {'table2__title'}, - children = {props.title}, + children = props.title, } or nil local tableChildren = props.children @@ -115,7 +115,7 @@ function Table2:render() local footerNode = props.footer and HtmlWidgets.Div{ classes = {'table2__footer'}, - children = {props.footer}, + children = props.footer, } or nil local tableWrapperNode = HtmlWidgets.Div{ diff --git a/stylesheets/commons/Miscellaneous.scss b/stylesheets/commons/Miscellaneous.scss index 3c40675fee7..2369d5af2a7 100644 --- a/stylesheets/commons/Miscellaneous.scss +++ b/stylesheets/commons/Miscellaneous.scss @@ -726,10 +726,6 @@ td.bold-white-text { .broadcast-talent-partner-list { margin-left: -0.5em; text-align: left; - - &-frame { - border: 0 !important; - } } /* tournament overview page boxes */