Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathoz committed Oct 17, 2024
1 parent b2ec91b commit 1bb79d3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
5 changes: 2 additions & 3 deletions components/match2/wikis/dota2/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ function CustomMatchSummary.createBody(match)
end

if MatchPage.isEnabledFor(match) then
body:addRow(MatchSummary.Row():addElement(
MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId}
))
body.root:node(MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId})

end

-- Iterate each map
Expand Down
4 changes: 1 addition & 3 deletions components/match2/wikis/leagueoflegends/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ function CustomMatchSummary.createBody(match)
end

if MatchPage.isEnabledFor(match) then
body:addRow(MatchSummary.Row():addElement(
MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId}
))
body.root:node(MatchSummaryWidgets.MatchPageLink{matchId = match.extradata.originalmatchid or match.matchId})
end

-- Iterate each map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local Widget = Lua.import('Module:Widget')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local Div, Center = HtmlWidgets.Div, HtmlWidgets.Center
local Link = Lua.import('Module:Widget/Basic/Link')
local MatchSummaryRow = Lua.import('Module:Widget/Match/Summary/Row')

---@class MatchSummaryMatchPageLink: Widget
---@operator call(table): MatchSummaryMatchPageLink
Expand All @@ -24,16 +25,12 @@ function MatchSummaryMatchPageLink:render()
return
end

return Div{classes = {'brkts-popup-mvp'}, css = {['font-size'] = '85%'}, children = Center{children =
Link{
link = 'Match:ID_' .. self.props.matchId,
children = 'Match Page',
css = {
display = 'block',
margin = 'auto',
},
return MatchSummaryRow{classes = {'brkts-popup-mvp'}, css = {['font-size'] = '85%'}, children =
Center{
children = Link{link = 'Match:ID_' .. self.props.matchId, children = 'Match Page'},
css = {display = 'block', margin = 'auto'},
}
}}
}
end

return MatchSummaryMatchPageLink
32 changes: 32 additions & 0 deletions components/widget/match/summary/widget_match_summary_row.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
-- @Liquipedia
-- wiki=commons
-- page=Module:Widget/Match/Summary/Row
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Class = require('Module:Class')
local Lua = require('Module:Lua')

local Widget = Lua.import('Module:Widget')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local Div = HtmlWidgets.Div

---@class MatchSummaryRow: Widget
---@operator call(table): MatchSummaryRow
local MatchSummaryRow = Class.new(Widget)
MatchSummaryRow.defaultProps = {
classes = {},
}

---@return Widget
function MatchSummaryRow:render()
return Div{
classes = {'brkts-popup-body-element', unpack(self.props.classes)},
css = self.props.css,
children = self.props.children,
}
end

return MatchSummaryRow

0 comments on commit 1bb79d3

Please sign in to comment.