Skip to content

feat(TeamCard): add Legacy wrapper#7486

Draft
Eetwalt wants to merge 45 commits into
mainfrom
tp-legacy
Draft

feat(TeamCard): add Legacy wrapper#7486
Eetwalt wants to merge 45 commits into
mainfrom
tp-legacy

Conversation

@Eetwalt
Copy link
Copy Markdown
Collaborator

@Eetwalt Eetwalt commented May 11, 2026

Summary

  • New Module:TeamCard/Legacy that parses legacy team-card wikitext (qualifier, notes, players, coaches, toggle/stash entries) and renders through the TeamParticipants controller pipeline
  • Maps players (status, dnp, trophies, dates), coaches (role/staff/status), and group-level defaults (status, default-dnp)
  • Handles tN player tabs with dedup, foldable toggle entries, and stash partitioning with malformed-structure surfacing
  • Renders notes via HtmlWidgets; uses Logic.isEmpty for key normalization
  • Adds golden-snapshot integration test and unit coverage for parsing/mapping helpers

How did you test this change?

dev


Stacked on #7466 (TeamParticipants join/leave dates) — enrichPlayerDates depends on it. Merge #7466 first; this branch will rebase onto main after.

@Eetwalt Eetwalt changed the title feat(TeamCard): add Legacy wrapper for legacy team-card wikitext feat(TeamCard): add Legacy wrapper May 11, 2026
@Eetwalt Eetwalt changed the base branch from main to tp-dates May 11, 2026 13:50
Comment on lines +82 to +116
if not Namespace.isMain() then
tpArgs.store = 'false'
end

local parsedData = TeamParticipantsWikiParser.parseWikiInput(tpArgs)
TeamParticipantsController.importParticipants(parsedData)
TeamParticipantsController.fillIncompleteRosters(parsedData)
TeamParticipantsController.enrichPlayerDates(parsedData)

local shouldStore = Logic.readBoolOrNil(tpArgs.store) ~= false
and Lpdb.isStorageEnabled()
if shouldStore then
Array.forEach(parsedData.participants, TeamParticipantsRepository.save)
end
Array.forEach(parsedData.participants, TeamParticipantsRepository.setPageVars)

local showControls = not teamParticipantsVars:get('externalControlsRendered')

local display = TeamParticipantsDisplay{
participants = parsedData.participants,
showPlayerInfo = toggleFolded.showPlayerInfo,
showControls = showControls,
}

teamParticipantsVars:set('externalControlsRendered', 'true')

local notesWidget
if #toggleFolded.notes > 0 then
notesWidget = HtmlWidgets.Div{
classes = {'team-participant__notes'},
children = Array.interleave(toggleFolded.notes, HtmlWidgets.Br{}),
}
end

return HtmlWidgets.Fragment{children = WidgetUtil.collect(notesWidget, display)}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use TeamParticipantsController.fromTemplate

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.

4f18c40

This should work to reduce duplication right? I don't think I can use fromTemplate as is

Copy link
Copy Markdown
Collaborator

@hjpalpha hjpalpha May 12, 2026

Choose a reason for hiding this comment

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

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.

Oh I guess, the anno needs updating then. Like this? 4299244

Comment thread lua/wikis/commons/TeamCard/Legacy.lua Outdated
Comment thread lua/wikis/commons/TeamCard/Legacy.lua Outdated
played = false
elseif sourceGroup == 'f' and Logic.readBool(tcArgs.formerdnpdefault) then
played = false
elseif sourceGroup ~= nil and Logic.readBool(tcArgs.noVarDefault) then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure this is the correct logic. But I'm always confused about noVarDefault

Comment thread lua/spec/teamcard_legacy_spec.lua Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Missing the LegacyCustom for the wiki?

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.

By design at the moment. We only need LegacyCustom file for wikis that need Lua-level arg rewriting (e.g. RocketLeague's sub1..3 → p1..3 aliasing). ArenaFPS uses standard TC args, so Template:TeamCard columns end invokes Module:TeamCard/Legacy|fn=run directly. We create them on-demand per wiki.

@hjpalpha
Copy link
Copy Markdown
Collaborator

blocked by #7492 for smash & fighters

Base automatically changed from tp-dates to main May 12, 2026 13:26
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.

3 participants