Skip to content
Open
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
28 changes: 24 additions & 4 deletions lua/wikis/commons/Widget/MainPage/ThisDay/Content.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ local Lua = require('Module:Lua')

local Class = Lua.import('Module:Class')
local DateExt = Lua.import('Module:Date/Ext')
local Info = Lua.import('Module:Info', {loadData = true})
local Logic = Lua.import('Module:Logic')
local Page = Lua.import('Module:Page')
local String = Lua.import('Module:StringUtils')
local Template = Lua.import('Module:Template')

local Widget = Lua.import('Module:Widget')
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local Div = HtmlWidgets.Div
local Link = Lua.import('Module:Widget/Basic/Link')
local Small = HtmlWidgets.Small
local ThisDayBirthday = Lua.import('Module:Widget/ThisDay/Birthday')
local ThisDayPatch = Lua.import('Module:Widget/ThisDay/Patch')
local ThisDayTournament = Lua.import('Module:Widget/ThisDay/Tournament')
local WidgetUtil = Lua.import('Module:Widget/Util')

---@type ThisDayConfig
local Config = Info.config.thisDay or {}

---@class ThisDayContent: Widget
---@field props { month: integer?, day: integer?, birthdayListPage: string? }
---@field props { month: integer?, day: integer?, birthdayListPage: string?, noTwitter: boolean?}
---@operator call(table): ThisDayContent
local ThisDayContent = Class.new(Widget)
ThisDayContent.defaultProps = {
Expand All @@ -32,14 +39,27 @@ ThisDayContent.defaultProps = {
function ThisDayContent:render()
local month = self.props.month
local day = self.props.day
local frame = mw.getCurrentFrame()
local birthdayListPage = self.props.birthdayListPage
local showBirthdayList = String.isNotEmpty(birthdayListPage) and Page.exists(birthdayListPage --[[@as string]])
return WidgetUtil.collect(
Div{
attributes = { id = 'this-day-facts' },
children = {
Template.safeExpand(frame, 'Liquipedia:This day/' .. month .. '/' .. day)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will remove the ability for trivia? (not that there's much if any?).

If we remove the trivia, then the "add trivia" link should be removed (L77-86)

Copy link
Collaborator

Choose a reason for hiding this comment

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

imo fine to remove entirely

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well we would have to clean up existing thisday pages first if we want to make trivia work with the new setup...
I don't really mind either way; probably something to discuss with the community first

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think even though it isn't used as much, I'd still prefer to keep this. (Atleast I've had some occasions on LoL where there actually was some interesting things that popped up) But I can also bring this forward in the community team meeting later today

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think yeah we want to keep the trivia

ThisDayTournament{
month = month,
day = day
},
ThisDayBirthday{
month = month,
day = day,
hideIfEmpty = Logic.readBool(Config.hideEmptyBirthdayList),
noTwitter = self.props.noTwitter
},
ThisDayPatch{
month = month,
day = day,
hideIfEmpty = not Logic.readBool(Config.showEmptyPatchList)
}
}
},
showBirthdayList and HtmlWidgets.Fragment{
Expand Down
Loading