Skip to content

refactor: extract bracket opponent entry as separate widget#7668

Open
ElectricalBoy wants to merge 12 commits into
mainfrom
bracket-opponent-entry
Open

refactor: extract bracket opponent entry as separate widget#7668
ElectricalBoy wants to merge 12 commits into
mainfrom
bracket-opponent-entry

Conversation

@ElectricalBoy

Copy link
Copy Markdown
Collaborator

Summary

This PR removes OpponentDisplay.BracketOpponentEntry (and its subclasses), replacing with widget3-based components.

How did you test this change?

dev in LoL/sc2/smash

@Rathoz

Rathoz commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Smash's custom score container gone?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors bracket opponent rendering by removing the legacy OpponentDisplay.BracketOpponentEntry-based implementation and replacing it with widget3 components (Widget/Match/Bracket/OpponentEntry, .../Opponent, .../ScoreContainer, .../Score). It also updates several wikis to either rely on the shared bracket display directly or provide wiki-specific widget overrides.

Changes:

  • Introduces widget3 bracket opponent entry + score display components in commons, and updates the shared bracket display to use them.
  • Replaces Trackmania/RocketLeague custom OpponentDisplay + custom bracket display overrides with Widget/Match/Bracket/ScoreContainer/Custom modules.
  • Updates Starcraft/Starcraft2 bracket container configuration hooks to inject bracket config (match summary, opponent entry), and simplifies some wiki-specific routing.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lua/wikis/trackmania/Widget/Match/Bracket/ScoreContainer/Custom.lua Adds Trackmania widget3 score container to support additional scores/status logic.
lua/wikis/trackmania/OpponentDisplay/Custom.lua Removes legacy Trackmania BracketOpponentEntry override (migrated to widgets).
lua/wikis/trackmania/MatchGroup/Display/Bracket/Custom.lua Removes Trackmania custom bracket container (now uses shared bracket display).
lua/wikis/trackmania/Brkts/WikiSpecific.lua Routes Trackmania bracket container to shared MatchGroup/Display/Bracket.
lua/wikis/starcraft2/Widget/Match/Bracket/ScoreContainer/Custom.lua Adds Starcraft2 score container alias module.
lua/wikis/starcraft2/Brkts/WikiSpecific.lua Adds bracket-container config wrapper (match summary + opponent entry).
lua/wikis/starcraft/Widget/Match/Bracket/ScoreContainer/Custom.lua Adds Starcraft score container alias module.
lua/wikis/starcraft/Brkts/WikiSpecific.lua Adds bracket-container config wrapper (match summary + opponent entry).
lua/wikis/smash/MatchGroup/Display/Bracket/Custom.lua Removes Smash custom bracket display (previously added character/head row).
lua/wikis/smash/Brkts/WikiSpecific.lua Removes Smash matchgroup container override, relying on base routing.
lua/wikis/rocketleague/Widget/Match/Bracket/ScoreContainer/Custom.lua Adds RocketLeague widget3 score container for additional scores.
lua/wikis/rocketleague/OpponentDisplay/Custom.lua Removes legacy RocketLeague BracketOpponentEntry override (migrated to widgets).
lua/wikis/rocketleague/MatchGroup/Display/Bracket/Custom.lua Removes RocketLeague custom bracket container (now uses shared bracket display).
lua/wikis/rocketleague/Brkts/WikiSpecific.lua Simplifies RocketLeague WikiSpecific to just use the base implementation.
lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Starcraft.lua Adds shared Starcraft-specific score container widget.
lua/wikis/commons/Widget/Match/Bracket/ScoreContainer/Custom.lua Adds shared “Custom” score container passthrough module.
lua/wikis/commons/Widget/Match/Bracket/ScoreContainer.lua Adds shared default score container widget (uses OpponentDisplay.InlineScore*).
lua/wikis/commons/Widget/Match/Bracket/Score.lua Adds widget3 bracket score display component (HTML structure + bolding).
lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua Adds Starcraft-specific opponent entry wrapper (faction bg + custom opponent renderer).
lua/wikis/commons/Widget/Match/Bracket/OpponentEntry.lua Adds shared widget3 bracket opponent entry component (highlighting + score container inclusion).
lua/wikis/commons/Widget/Match/Bracket/Opponent/Starcraft.lua Adds Starcraft-specific opponent renderer (teams/players/literals).
lua/wikis/commons/Widget/Match/Bracket/Opponent.lua Adds shared default opponent renderer (teams/players/literals).
lua/wikis/commons/OpponentDisplay/Starcraft.lua Removes legacy Starcraft BracketOpponentEntry class implementation.
lua/wikis/commons/OpponentDisplay.lua Removes legacy BracketOpponentEntry + BracketScore, switches to widget3 Html primitives.
lua/wikis/commons/MatchGroup/Display/Helper.lua Adds addOpponentHighlightToProps helper for widget3 props tables.
lua/wikis/commons/MatchGroup/Display/Bracket.lua Updates shared bracket display to use widget3 OpponentEntry and remove post-call HTML mutations.
lua/wikis/commons/Bracket/Template.lua Updates template bracket container to new blank opponent + widget3 placeholder opponent entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/wikis/commons/Bracket/Template.lua
Comment thread lua/wikis/starcraft/Brkts/WikiSpecific.lua Outdated
Comment thread lua/wikis/starcraft2/Brkts/WikiSpecific.lua Outdated
Comment thread lua/wikis/commons/Widget/Match/Bracket/OpponentEntry/Starcraft.lua
Comment on lines +29 to +36
local function InlineScoreSpecial(score)
if score == -1 then
return ''
elseif score == 0 and Opponent.isTbd(opponent) then
return ''
end
return tostring(score)
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

---Displays a score or status of the opponent, as a string.
---@param props {opponent: RocketLeagueStandardOpponent, status: string?, score: number?}
---@return number|string
function CustomOpponentDisplay.InlineScoreSpecial(props)
if props.score == -1 then
return ''
end
if props.score == 0 and Opponent.isTbd(props.opponent) then
return ''
end
return tostring(props.score)
end

technically true, but this is consistent with the current behavior
imo okay to leave as-is

Comment thread lua/wikis/smash/Brkts/WikiSpecific.lua
@ElectricalBoy

ElectricalBoy commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Smash's custom score container gone?

intended for several reasons:

  • it basically breaks with any match without m2g detail
  • the icons take up an absurd amount of space which basically makes player names unreadable
    (see smash:MLG Anaheim 2014/Championship Bracket for example)
  • it's pretty much incompatible with matches involving MBR
  • matchlists use numeric scores so it's better for consistency

@hjpalpha

Copy link
Copy Markdown
Collaborator

Smash's custom score container gone?

intended for several reasons:

  • it basically breaks with any match without m2g detail
  • the icons take up an absurd amount of space which basically makes player names unreadable
    (see smash:MLG Anaheim 2014/Championship Bracket for example)
  • it's pretty much incompatible with matches involving MBR
  • matchlists use numeric scores so it's better for consistency

fwiw smash will cry because of this change

@ElectricalBoy ElectricalBoy force-pushed the bracket-opponent-entry branch from 7d93853 to fc765c5 Compare June 29, 2026 13:46
@ElectricalBoy

Copy link
Copy Markdown
Collaborator Author

fwiw smash will cry because of this change

their match1 had a mix of numeric score display and the character display
and imo killing the latter makes the code far more maintainable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants