Skip to content

Commit

Permalink
Sync main branch from pricefx-eds-qa, excluding fstab.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 19, 2024
2 parents 09c2ae5 + a9b3aa6 commit 0df1574
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions blocks/events/events.css
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@

.filter-category {
margin-bottom: 27px;
border-top: 1px solid var(--c-gray-border);
}

.filter-category-item {
Expand Down
18 changes: 12 additions & 6 deletions blocks/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ export default async function decorate(block) {
eventsContent.append(paginationContainer);

const defaultSortedArticle = noFeaturedEventData.sort((a, b) => new Date(b.eventDate) - new Date(a.eventDate));

noFeaturedEventData = defaultSortedArticle;
currentEvenData = defaultSortedArticle;
const queryStr = 'page=1&sortBy=desc-date';
const searchParams = new URLSearchParams(queryStr);

Expand Down Expand Up @@ -461,6 +462,7 @@ ${
const appendEvents = (articleJsonData) => {
EventsContainer.innerHTML = renderArticleCard(articleJsonData);
};
noFeaturedEventData = noFeaturedEventData.sort((a, b) => new Date(b.eventDate) - new Date(a.eventDate));
appendEvents(noFeaturedEventData);

// Render pagination pages
Expand Down Expand Up @@ -796,39 +798,43 @@ ${

const handleFilterEvents = (filters, articleList) => {
let articleJson = articleList;
if (filters['filter-program'].length > 0) {
if (filters['filter-program'] && filters['filter-program'].length > 0) {
articleJson = articleJson.filter((event) =>
filters['filter-program'].some((searchTag) =>
event.eventTags.some((tag) => tag.toLowerCase().includes(searchTag.toLowerCase())),
),
);
}

if (filters['filter-type'].length > 0 && Array.isArray(filters['filter-type'])) {
if (filters['filter-type'] && filters['filter-type'].length > 0 && Array.isArray(filters['filter-type'])) {
articleJson = articleJson.filter((event) =>
filters['filter-type'].some((searchTag) =>
event.eventTags.some((tag) => tag.toLowerCase().includes(searchTag.toLowerCase())),
),
);
}

if (filters['filter-industry'].length > 0 && Array.isArray(filters['filter-industry'])) {
if (
filters['filter-industry'] &&
filters['filter-industry'].length > 0 &&
Array.isArray(filters['filter-industry'])
) {
articleJson = articleJson.filter((event) =>
filters['filter-industry'].some((searchTag) =>
event.eventTags.some((tag) => tag.toLowerCase().includes(searchTag.toLowerCase())),
),
);
}

if (filters['filter-capability'].length > 0) {
if (filters['filter-capability'] && filters['filter-capability'].length > 0) {
articleJson = articleJson.filter((event) =>
filters['filter-capability'].some((searchTag) =>
event.eventTags.some((tag) => tag.toLowerCase().includes(searchTag.toLowerCase())),
),
);
}

if (filters['filter-topic'].length > 0 && Array.isArray(filters['filter-topic'])) {
if (filters['filter-topic'] && filters['filter-topic'].length > 0 && Array.isArray(filters['filter-topic'])) {
articleJson = articleJson.filter((event) =>
filters['filter-topic'].some((searchTag) =>
event.eventTags.some((tag) => tag.toLowerCase().includes(searchTag.toLowerCase())),
Expand Down

0 comments on commit 0df1574

Please sign in to comment.