Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/wikis/commons/TeamParticipants/Controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function TeamParticipantsController.fromTemplate(frame)
end
Array.forEach(parsedData.participants, TeamParticipantsRepository.setPageVars)
return TeamParticipantsDisplay{
showPlayerInformationButton = Logic.readBool(args.playerinfo),
participants = parsedData.participants,
mergeStaffTabIfOnlyOneStaff = Logic.nilOr(
Logic.readBoolOrNil(args.mergeStaffTabIfOnlyOneStaff), Logic.readBool(Config.mergeStaffTabIfOnlyOneStaff)
Expand Down
32 changes: 28 additions & 4 deletions lua/wikis/commons/Widget/Participants/Team/CardsGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ local Class = Lua.import('Module:Class')

local Widget = Lua.import('Module:Widget')
local AnalyticsWidget = Lua.import('Module:Widget/Analytics')
local Button = Lua.import('Module:Widget/Basic/Button')
local IconFa = Lua.import('Module:Widget/Image/Icon/Fontawesome')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local Div = HtmlWidgets.Div
local ParticipantsTeamCard = Lua.import('Module:Widget/Participants/Team/Card')
local Switch = Lua.import('Module:Widget/Switch')
local WidgetUtil = Lua.import('Module:Widget/Util')

---@class ParticipantsTeamCardsGroupProps
---@field participants TeamParticipant[]?
---@field showPlayerInformationButton boolean?

---@class ParticipantsTeamCardsGroup: Widget
---@operator call(table): ParticipantsTeamCardsGroup
---@operator call(ParticipantsTeamCardsGroupProps): ParticipantsTeamCardsGroup
---@field props ParticipantsTeamCardsGroupProps
local ParticipantsTeamCardsGroup = Class.new(Widget)

---@return Widget?
Expand All @@ -33,7 +41,7 @@ function ParticipantsTeamCardsGroup:render()
children = {
Div{
classes = { 'team-participant__switches' },
children = {
children = WidgetUtil.collect(
AnalyticsWidget{
analyticsName = 'ParticipantsShowRostersSwitch',
analyticsProperties = {
Expand All @@ -56,8 +64,24 @@ function ParticipantsTeamCardsGroup:render()
switchGroup = 'team-cards-compact',
defaultActive = true,
},
}
}
},
self.props.showPlayerInformationButton and Button{
linktype = 'external',
link = tostring(mw.uri.fullUrl('Special:RunQuery/Tournament player information', {
pfRunQueryFormName = 'Tournament player information',
['TPI[page]'] = mw.title.getCurrentTitle().text,
wpRunQuery = 'Run query'
})),
size = 'sm',
variant = 'secondary',
title = 'Click for additional player information',
children = Array.interleave({
IconFa{iconName = 'link'},
'Player',
'Info'
}, ' ')
} or nil
)
},
AnalyticsWidget{
analyticsName = 'Team participants card',
Expand Down
1 change: 1 addition & 0 deletions stylesheets/commons/TeamParticipantCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ $compact-selector: '[data-switch-group="team-cards-compact"]';

.team-participant__switches {
display: flex;
align-items: center;
gap: 0.5rem;
}

Expand Down
Loading