Skip to content
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

feat(mwpw-155425): ability to have multiple event sort options #197

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion dist/app.css

Large diffs are not rendered by default.

40 changes: 27 additions & 13 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Chimera UI Libraries - Build 0.22.4 (11/4/2024, 04:38:25)
* Chimera UI Libraries - Build 0.23.0 (11/11/2024, 10:52:20)
*
*/
/******/ (function(modules) { // webpackBootstrap
Expand Down Expand Up @@ -3592,7 +3592,6 @@ var loadLana = exports.loadLana = function loadLana() {
args[_key] = arguments[_key];
}

// eslint-disable-next-line no-console
(_console = console).log.apply(_console, ['Lana not yet loaded, logging to console:'].concat(args));
},
log: function () {
Expand Down Expand Up @@ -3624,7 +3623,6 @@ var loadLana = exports.loadLana = function loadLana() {
_context.prev = 9;
_context.t0 = _context['catch'](3);

// eslint-disable-next-line no-console
console.error('Failed to load Lana:', _context.t0);

case 12:
Expand Down Expand Up @@ -48962,6 +48960,17 @@ var defineIsUpcoming = function defineIsUpcoming(currentTime, startTimeMls) {
return false;
};

/**
* @func sanitizeEventFilter
* @desc Ensures backwards compatibility with both string and array values for the event filter
* @param {*} rawEventFilter
* @returns {Array} of the events that will be filtered
*/
function sanitizeEventFilter(rawEventFilter) {
if (Array.isArray(rawEventFilter)) return rawEventFilter;
return [rawEventFilter];
}

/**
* @func eventTiming
* @desc First Sorts sessions by startDate, and then partitions them by category
Expand All @@ -48972,8 +48981,9 @@ var defineIsUpcoming = function defineIsUpcoming(currentTime, startTimeMls) {
*/
function eventTiming() {
var sessions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var eventFilter = arguments[1];
var eventFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

var sanitizedEventFilter = sanitizeEventFilter(eventFilter);
if (!sessions.length) return [];

var overrideTime = timeOverride();
Expand Down Expand Up @@ -49096,15 +49106,19 @@ function eventTiming() {
// updateTimeOverride(curMs, nextTransitionMs);
}

var cards = [].concat(live, upComing, onDemand, notTimed);
if (eventFilter === 'live') {
cards = live;
} else if (eventFilter === 'upcoming') {
cards = upComing;
} else if (eventFilter === 'on-demand') {
cards = onDemand;
} else if (eventFilter === 'not-timed') {
cards = notTimed;
var cards = [];
if (sanitizedEventFilter.length === 0) {
cards = [].concat(live, upComing, onDemand, notTimed);
}if (sanitizedEventFilter.indexOf('live') > -1) {
cards = cards.concat(live);
}if (sanitizedEventFilter.indexOf('upcoming') > -1) {
cards = cards.concat(upComing);
}if (sanitizedEventFilter.indexOf('on-demand') > -1) {
cards = cards.concat(onDemand);
}if (sanitizedEventFilter.indexOf('not-timed') > -1) {
cards = cards.concat(notTimed);
} else {
cards = [].concat(live, upComing, onDemand, notTimed);
}

/*
Expand Down
Loading
Loading