-
Notifications
You must be signed in to change notification settings - Fork 104
feat(tournaments-ticker): add new redesigned ticker with variants for AB testing #7303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Eetwalt
wants to merge
52
commits into
main
Choose a base branch
from
new-tournament-list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+815
−182
Open
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
6bc7fd0
add synclevel prop for localstorage scope
Eetwalt 30d25f0
add subtle variant with left-border accent
Eetwalt ae142d8
add listitem row widget
Eetwalt f727a06
add list widget with contentswitch tabs
Eetwalt 9ee538b
switch tournament list to new list widget
Eetwalt e2e68b7
add listitem layout styles
Eetwalt 2ae3c3a
switch tournament list to new list widget
Eetwalt b6bebb5
remove synclevel prop and disable tab persistence
Eetwalt e15ec2c
remove defaults
Eetwalt 1bc1ac6
move data fetching to helper
Eetwalt 80cc59b
adjust layout and styles
Eetwalt b37e13d
adjust styling and spacing
Eetwalt 50f6943
fix layout
Eetwalt 8de7429
try out aoe
Eetwalt 4211ae5
show game icon
Eetwalt b6757ca
new colors and variants
Eetwalt cc96348
fix tierpill nil error
Eetwalt e87da33
fix badges
Eetwalt 9598bf9
implement chips
Eetwalt ff51b23
add neg margin to chip
Eetwalt 72f42d7
implement collapsible variant
Eetwalt f75bdf8
test with aoe
Eetwalt 7d874fc
make collapse work with header click
Eetwalt f860f41
doesnt need the exclude
Eetwalt 8fefb64
add compact mode and placeholder icon
Eetwalt 54a3d0d
update wikis with correct variants
Eetwalt 9d9e026
lose top padding from 2nd and 3rd PhaseCollapsibles
Eetwalt 45b378d
update lol mainpage
Eetwalt 94bdd40
remove padding
Eetwalt 563c2ac
prop annos
Eetwalt abe7822
css cleanup
Eetwalt df1a59a
collapsible css fixes
Eetwalt c163097
single return tierpill approach
Eetwalt c95ccc9
css fixes
Eetwalt fe7daa9
move Data out of Widget dir
Eetwalt f7a9a1a
use WidgetUtil for badgeChildren
Eetwalt 3e87d41
Data improvements
Eetwalt 2e5e9e3
use general collapsible
Eetwalt 88e4065
lint
Eetwalt fcb42b2
refactor TierPill
Eetwalt 522ca1d
force border color
Eetwalt 1a7b839
refactor List / Sublist to minimize repeated code
Eetwalt e829ec3
chore: update visual snapshots
Eetwalt 0d41b51
Merge branch 'main' into new-tournament-list
Eetwalt 4c8da08
chore: update visual snapshots
Eetwalt 4e16b11
remove redundant logic check
Eetwalt da898ca
mobile-first css
Eetwalt 5dea231
replace FILLER with icon test
Eetwalt 02d6a88
add font-sizes for proper icon sizing
Eetwalt dbd9f52
remove wrapper div from game icon
Eetwalt 1db238d
css fixes
Eetwalt f3d3e01
update test with new filler
Eetwalt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eetwalt marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| --- | ||
| -- @Liquipedia | ||
| -- page=Module:TournamentsTicker/Data | ||
| -- | ||
| -- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
| -- | ||
|
|
||
| local Lua = require('Module:Lua') | ||
|
|
||
| local Array = Lua.import('Module:Array') | ||
| local Condition = Lua.import('Module:Condition') | ||
| local DateExt = Lua.import('Module:Date/Ext') | ||
| local Operator = Lua.import('Module:Operator') | ||
|
|
||
| local Tournament = Lua.import('Module:Tournament') | ||
|
|
||
| local TournamentsTickerData = {} | ||
|
|
||
| ---@class TournamentsTickerDataProps | ||
| ---@field upcomingDays number | ||
| ---@field completedDays number | ||
| ---@field modifierTier1 number? | ||
| ---@field modifierTier2 number? | ||
| ---@field modifierTier3 number? | ||
| ---@field modifierTier4 number? | ||
| ---@field modifierTier5 number? | ||
| ---@field modifierTierMisc number? | ||
| ---@field modifierTypeQualifier number? | ||
|
|
||
| ---@class TournamentsTickerDataResult | ||
| ---@field upcoming StandardTournament[] | ||
| ---@field ongoing StandardTournament[] | ||
| ---@field completed StandardTournament[] | ||
|
|
||
| ---@param props TournamentsTickerDataProps | ||
| ---@return TournamentsTickerDataResult | ||
| function TournamentsTickerData.get(props) | ||
| local upcomingDays = props.upcomingDays or 5 | ||
| local completedDays = props.completedDays or 5 | ||
|
|
||
| local tierThresholdModifiers = { | ||
| [1] = props.modifierTier1, | ||
| [2] = props.modifierTier2, | ||
| [3] = props.modifierTier3, | ||
| [4] = props.modifierTier4, | ||
| [5] = props.modifierTier5, | ||
| [-1] = props.modifierTierMisc, | ||
| } | ||
|
|
||
| --- The Tier Type thresholds only affect completed tournaments. | ||
| local tierTypeThresholdModifiers = { | ||
| ['qualifier'] = props.modifierTypeQualifier, | ||
| } | ||
|
|
||
| local currentTimestamp = DateExt.getCurrentTimestamp() | ||
|
|
||
| ---@param tournament StandardTournament | ||
| ---@return boolean | ||
| local function isWithinDateRange(tournament) | ||
| local modifiedThreshold = tierThresholdModifiers[tournament.liquipediaTier] or 0 | ||
| local modifiedCompletedThreshold = tierTypeThresholdModifiers[tournament.liquipediaTierType] or modifiedThreshold | ||
|
|
||
| if not tournament.startDate then | ||
| return false | ||
| end | ||
|
|
||
| local startDateThreshold = currentTimestamp + DateExt.daysToSeconds(upcomingDays + modifiedThreshold) | ||
| local endDateThreshold = currentTimestamp - DateExt.daysToSeconds(completedDays + modifiedCompletedThreshold) | ||
|
|
||
| if tournament.phase == 'ONGOING' then | ||
| return true | ||
| elseif tournament.phase == 'UPCOMING' then | ||
| return tournament.startDate.timestamp < startDateThreshold | ||
| elseif tournament.phase == 'FINISHED' then | ||
| assert(tournament.endDate, 'Tournament without end date: ' .. tournament.pageName) | ||
| return tournament.endDate.timestamp > endDateThreshold | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| local lpdbFilter = Condition.Tree(Condition.BooleanOperator.all):add{ | ||
| Condition.Util.anyOf(Condition.ColumnName('status'), {'', 'finished'}), | ||
| Condition.Node(Condition.ColumnName('liquipediatiertype'), Condition.Comparator.neq, 'Points') | ||
| } | ||
|
|
||
| local allTournaments = Tournament.getAllTournaments(lpdbFilter, function(tournament) | ||
| return isWithinDateRange(tournament) | ||
| end) | ||
|
|
||
| ---@param a StandardTournament | ||
| ---@param b StandardTournament | ||
| ---@param dateProperty 'endDate'|'startDate' | ||
| ---@param operator fun(a: integer, b: integer): boolean | ||
| ---@return boolean? | ||
| local function sortByDateProperty(a, b, dateProperty, operator) | ||
| if not a[dateProperty] and not b[dateProperty] then return nil end | ||
| if not a[dateProperty] then return true end | ||
| if not b[dateProperty] then return false end | ||
| if a[dateProperty].timestamp ~= b[dateProperty].timestamp then | ||
| return operator(a[dateProperty].timestamp, b[dateProperty].timestamp) | ||
| end | ||
| return nil | ||
| end | ||
|
|
||
| ---@param a StandardTournament | ||
| ---@param b StandardTournament | ||
| ---@return boolean | ||
| local function sortByDate(a, b) | ||
| local endDateSort = sortByDateProperty(a, b, 'endDate', Operator.gt) | ||
| if endDateSort ~= nil then return endDateSort end | ||
| local startDateSort = sortByDateProperty(a, b, 'startDate', Operator.gt) | ||
| if startDateSort ~= nil then return startDateSort end | ||
| return a.pageName < b.pageName | ||
| end | ||
|
|
||
| ---@param a StandardTournament | ||
| ---@param b StandardTournament | ||
| ---@return boolean | ||
| local function sortByDateUpcoming(a, b) | ||
| local startDateSort = sortByDateProperty(a, b, 'startDate', Operator.gt) | ||
| if startDateSort ~= nil then return startDateSort end | ||
| local endDateSort = sortByDateProperty(a, b, 'endDate', Operator.gt) | ||
| if endDateSort ~= nil then return endDateSort end | ||
| return a.pageName < b.pageName | ||
| end | ||
|
|
||
| ---@param phase TournamentPhase | ||
| ---@return fun(tournament: StandardTournament): boolean | ||
| local function filterByPhase(phase) | ||
| return function(tournament) | ||
| return tournament.phase == phase | ||
| end | ||
| end | ||
|
|
||
| local upcomingTournaments = Array.filter(allTournaments, filterByPhase('UPCOMING')) | ||
| local ongoingTournaments = Array.filter(allTournaments, filterByPhase('ONGOING')) | ||
| local completedTournaments = Array.filter(allTournaments, filterByPhase('FINISHED')) | ||
| table.sort(upcomingTournaments, sortByDateUpcoming) | ||
| table.sort(ongoingTournaments, sortByDate) | ||
| table.sort(completedTournaments, sortByDate) | ||
|
|
||
| return { | ||
| upcoming = upcomingTournaments, | ||
| ongoing = ongoingTournaments, | ||
| completed = completedTournaments, | ||
| } | ||
| end | ||
|
|
||
| return TournamentsTickerData |
2 changes: 1 addition & 1 deletion
2
...idget/Participants/Team/ChevronToggle.lua → ...dget/GeneralCollapsible/ChevronToggle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.