Skip to content

Commit

Permalink
eventsChnages
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangi1422 committed May 3, 2024
1 parent 6443c26 commit d4f1544
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions blocks/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function createEventsDropdown(eventName, options) {
}

function createLink(text, currentPage) {
const linkHref = currentPage === 'events-calendar' ? '/drafts/archived-events' : '/drafts/events-calendar';
const linkHref = currentPage === 'events' ? '/about-us/archived-events' : '/about-us/events';
const link = p(a({ href: linkHref, title: text }, text));
return link;
}
Expand All @@ -210,7 +210,7 @@ async function buildSidePanel(currentPage, eventData) {
const regionDropdown = createEventsDropdown('Region', REGIONS);

// Append dropdowns to filter div
const linkText = currentPage === 'events-calendar' ? 'Archived Events' : 'Upcoming Events';
const linkText = currentPage === 'events' ? 'Archived Events' : 'Upcoming Events';
const link = createLink(linkText, currentPage);

// Append filter div to side panel
Expand Down Expand Up @@ -274,8 +274,8 @@ export default async function decorate(block) {
const outerBlock = document.querySelector('.section');
outerBlock.classList.add('outer');
const postData = await fetchPostData();
const page = window.location.pathname.includes('events-calendar');
const currentPage = page ? 'events-calendar' : 'archived-events';
const page = window.location.pathname.includes('/events');
const currentPage = page ? 'events' : 'archived-events';
const filteredResults = postData.filter((item) => /events\/.*$/.test(item.path.toLowerCase()));
const sortedEvents = sortEventsByDate(filteredResults);
const currentDate = new Date();
Expand All @@ -296,7 +296,7 @@ export default async function decorate(block) {
itemsContainer.appendChild(element);
});
} else {
const noEventMessage = currentPage === 'event-calendar' ? 'No Upcoming Events' : 'No Archived Events';
const noEventMessage = currentPage === 'events' ? 'No Upcoming Events' : 'No Archived Events';
const noResults = h3({ class: 'no-result' }, noEventMessage);
itemsContainer.appendChild(noResults);
block.appendChild(itemsContainer);
Expand Down

0 comments on commit d4f1544

Please sign in to comment.