refactor(match2): grid-based matchsummary to widget3#7772
refactor(match2): grid-based matchsummary to widget3#7772ElectricalBoy wants to merge 19 commits into
Conversation
yikes
0e9b719 to
fca500f
Compare
| ---@param defaultProps P | ||
| ---@return Component<P> | ||
| ---@overload fun(implProps: MatchSummaryGameRowComponentImpl): Component<MatchSummaryGameRowProps> | ||
| function MatchSummaryGameRow.createComponent(implProps, defaultProps) |
There was a problem hiding this comment.
what does the "impl" stand for?
There was a problem hiding this comment.
implementation
There was a problem hiding this comment.
Pull request overview
Refactors match summary rendering to the Widget3 component model by converting the shared GameRow implementation to a component factory and updating multiple wiki-specific MatchSummary.lua modules to use the new createComponent API.
Changes:
- Converted
Widget/Match/Summary/GameRowfrom a class-based widget to a Widget3 component factory (createComponent) with an impl table. - Updated multiple game wikis’
MatchSummaryimplementations to useGameRow.createComponentand the new static helpers (mapDisplay,lengthDisplay,scoreDisplay). - Tightened/standardized CSS prop typing via
HtmlStylePropsand updated HTML widget usage (Html/All→Html) where touched.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/wikis/valorant/MatchSummary.lua | Migrates Valorant match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/rainbowsix/MatchSummary.lua | Migrates Rainbow Six match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/overwatch/MatchSummary.lua | Migrates Overwatch match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/mobilelegends/MatchSummary.lua | Migrates Mobile Legends match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/leagueoflegends/MatchSummary.lua | Migrates LoL match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/identityv/MatchSummary.lua | Migrates IdentityV match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/honorofkings/MatchSummary.lua | Migrates HoK match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/dota2/MatchSummary.lua | Migrates Dota 2 match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/deadlock/MatchSummary.lua | Migrates Deadlock match summary row to GameRow.createComponent and Widget3 return types. |
| lua/wikis/counterstrike/MatchSummary.lua | Updates Counter-Strike row override to the new scoreDisplay calling convention. |
| lua/wikis/ageofempires/MatchSummary.lua | Migrates AoE match summary row to GameRow.createComponent and Html module usage. |
| lua/wikis/commons/Widget/Match/Summary/GameRow.lua | Core refactor: introduces createComponent, moves helpers to static functions, updates rendering to Widget3. |
| lua/wikis/commons/Widget/Match/Summary/GameCenter.lua | Updates CSS prop typing to HtmlStyleProps. |
| lua/wikis/commons/Widget/Component.lua | Introduces HtmlStyleProps alias for consistent CSS typing. |
Comments suppressed due to low confidence (5)
lua/wikis/overwatch/MatchSummary.lua:43
- Returning a table literal here can create a non-array table when optional widgets (Mvp/CharacterBanTable) return nil. MatchSummary/Base later calls WidgetUtil.collect on the result; if the table has gaps, Array.isArray() is false and rendering can break. Build the list without gaps (e.g., start with {GamesContainer} and append optional elements via table.insert).
return {
MatchSummaryWidgets.GamesContainer{
children = Array.map(match.games, function (game, gameIndex)
if Logic.isEmpty(game.map) then
return
lua/wikis/mobilelegends/MatchSummary.lua:54
- Returning a table literal here can create a non-array table when optional widgets (Mvp/CharacterBanTable) return nil. MatchSummary/Base later passes createBody() into WidgetUtil.collect; if Array.isArray() is false due to gaps, the raw table is inserted and can break rendering. Build the body list incrementally (table.insert) so nil entries are skipped and the result remains a proper array.
return {
MatchSummaryWidgets.GamesContainer{
children = Array.map(match.games, function (game, gameIndex)
if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and not hasCharacterData(game) then
return
lua/wikis/identityv/MatchSummary.lua:50
- Returning a table literal here can create a non-array table when optional widgets (Mvp/MapVeto/CharacterBanTable) return nil. MatchSummary/Base later wraps the body via WidgetUtil.collect; if Array.isArray() is false due to gaps, the raw table is inserted and can break rendering. Build the body list incrementally (table.insert) so nil entries are skipped and the result remains a proper array.
return {
MatchSummaryWidgets.GamesContainer{
children = Array.map(match.games, function (game, gameIndex)
if not game.map and not CustomMatchSummary.hasScores(game) then
return
lua/wikis/honorofkings/MatchSummary.lua:54
- Returning a table literal here can create a non-array table when optional widgets (Mvp/CharacterBanTable) return nil. MatchSummary/Base later passes this into WidgetUtil.collect; if Array.isArray() is false due to gaps, the raw table is inserted and can break rendering. Build the body list without gaps (e.g., start with {GamesContainer} and append optional elements via table.insert).
return {
MatchSummaryWidgets.GamesContainer{
children = Array.map(match.games, function (game, gameIndex)
if Logic.isEmpty(game.length) and Logic.isEmpty(game.winner) and not hasCharacterData(game) then
return
lua/wikis/deadlock/MatchSummary.lua:50
- Returning a table literal here can create a non-array table when optional widgets (CharacterBanTable) return nil. MatchSummary/Base later passes this into WidgetUtil.collect; if Array.isArray() is false due to gaps, the raw table is inserted and can break rendering. Build the body list without gaps (e.g., start with {GamesContainer} and append optional elements via table.insert).
return {
MatchSummaryWidgets.GamesContainer{
children = Array.map(match.games, function (game, gameIndex)
if game.status == STATUS_NOT_PLAYED then
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return { | ||
| MatchSummaryWidgets.GamesContainer{ | ||
| gridLayout = 'standard', | ||
| children = Array.map(match.games, function (game, gameIndex) | ||
| if Logic.isEmpty(game.map) then | ||
| return |
| return { | ||
| MatchSummaryWidgets.GamesContainer{ | ||
| gridLayout = 'standard', | ||
| children = Array.map(match.games, function (game, gameIndex) | ||
| if Logic.isEmpty(game.map) then | ||
| return |
| return { | ||
| MatchSummaryWidgets.GamesContainer{ | ||
| gridLayout = 'standard', | ||
| children = Array.map(match.games, function (game, gameIndex) | ||
| if game.status == STATUS_NOT_PLAYED then | ||
| return |
| return { | ||
| MatchSummaryWidgets.GamesContainer{ | ||
| gridLayout = 'standard', | ||
| children = Array.map(match.games, function (game, gameIndex) | ||
| if game.status == STATUS_NOT_PLAYED then | ||
| return |
| function GameRowComponentImpl._createOpponentDisplay(game, opponentId) | ||
| local flipped = opponentId == 1 | ||
| return Array.map( | ||
| Array.sortBy( | ||
| Array.filter(self.props.game.opponents[opponentId].players, Table.isNotEmpty), | ||
| Array.filter(game.opponents[opponentId].players, Table.isNotEmpty), | ||
| Operator.property('index') | ||
| ), | ||
| function (player) | ||
| return self:_createParticipant(player, flipped) | ||
| return GameRowComponentImpl._createParticipant(player, flipped) |
| return GameRowComponentImpl._createOpponentDisplay(props.game, opponentIndex) | ||
| end |
| ---@param props MatchSummaryGameRowProps | ||
| ---@param opponentIndex integer | ||
| ---@return Widget | ||
| function DeadlockMatchSummaryGameRow:createGameOpponentView(opponentIndex) | ||
| local props = self.props | ||
| ---@return VNode | ||
| function GameRowComponentImpl.createGameOpponentView(props, opponentIndex) |
How did you test this change?
dev in AoE / LoL