From 5a40ab879cb25f514eafef191b2b34fbcd760641 Mon Sep 17 00:00:00 2001 From: V Thulisile Sibanda <66913810+thulieblack@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:24:01 +0200 Subject: [PATCH 1/7] Update banners.ts --- components/campaigns/banners.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/campaigns/banners.ts b/components/campaigns/banners.ts index b6472dbf4a2..8ae0c93b9b0 100644 --- a/components/campaigns/banners.ts +++ b/components/campaigns/banners.ts @@ -15,18 +15,18 @@ function shouldShowBanner(cfpDeadline: string) { return true; } -const cfpDeadlineParis = '2024-10-12T06:00:00Z'; +const cfpDeadlineParis = '2024-10-30T06:00:00Z'; const showBannerParis = shouldShowBanner(cfpDeadlineParis); export const banners = [ { - title: "AsyncAPI Conf on Tour'24", - city: 'Paris', - dateLocation: '3rd - 5th of December, 2024 | France, Paris', - cfaText: 'Apply To Speak', - eventName: 'the end of Call for Speakers', + title: "AsyncAPI Online Conference 2024", + city: 'YouTube', + dateLocation: '30th of October, 2024 | YouTube & LinkedIn', + cfaText: 'Join us for the AsyncAPI Online Conference', + eventName: 'Live on YouTube & LinkedIn', cfpDeadline: cfpDeadlineParis, - link: 'https://conference.asyncapi.com/venue/Paris', + link: 'https://www.youtube.com/live/F9wHxd-v2f0?si=kPCqgUzqAKC0FaqJ', show: showBannerParis } ]; From 17b8b0d6e32b33f73c2f02eff3edd85749de673a Mon Sep 17 00:00:00 2001 From: thulieblack Date: Mon, 21 Oct 2024 16:32:14 +0200 Subject: [PATCH 2/7] correct-text --- components/campaigns/banners.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/campaigns/banners.ts b/components/campaigns/banners.ts index 8ae0c93b9b0..95f2f3ba88b 100644 --- a/components/campaigns/banners.ts +++ b/components/campaigns/banners.ts @@ -23,8 +23,8 @@ export const banners = [ title: "AsyncAPI Online Conference 2024", city: 'YouTube', dateLocation: '30th of October, 2024 | YouTube & LinkedIn', - cfaText: 'Join us for the AsyncAPI Online Conference', - eventName: 'Live on YouTube & LinkedIn', + cfaText: 'Join us Live', + eventName: 'the AsyncAPI Online Conference', cfpDeadline: cfpDeadlineParis, link: 'https://www.youtube.com/live/F9wHxd-v2f0?si=kPCqgUzqAKC0FaqJ', show: showBannerParis From 7639112ebb3ae182661f6eba407fca8f6b9bc12c Mon Sep 17 00:00:00 2001 From: thulieblack Date: Mon, 21 Oct 2024 16:35:18 +0200 Subject: [PATCH 3/7] correct-text --- components/campaigns/banners.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/campaigns/banners.ts b/components/campaigns/banners.ts index 95f2f3ba88b..56a95ebea46 100644 --- a/components/campaigns/banners.ts +++ b/components/campaigns/banners.ts @@ -20,7 +20,7 @@ const showBannerParis = shouldShowBanner(cfpDeadlineParis); export const banners = [ { - title: "AsyncAPI Online Conference 2024", + title: "AsyncAPI Online Conference'24", city: 'YouTube', dateLocation: '30th of October, 2024 | YouTube & LinkedIn', cfaText: 'Join us Live', From b50bdb7dd9d15806e73a418c5d5788111700895b Mon Sep 17 00:00:00 2001 From: akshatnema Date: Wed, 23 Oct 2024 13:07:50 +0530 Subject: [PATCH 4/7] updated banners conditional render --- components/campaigns/AnnouncementHero.tsx | 6 +++--- components/campaigns/banners.ts | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index 61ffb47b85e..f3668ff3c82 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -4,7 +4,7 @@ import ArrowLeft from '../icons/ArrowLeft'; import ArrowRight from '../icons/ArrowRight'; import Container from '../layout/Container'; import Banner from './AnnouncementBanner'; -import { banners } from './banners'; +import { banners, shouldShowBanner } from './banners'; interface IAnnouncementHeroProps { className?: string; @@ -22,7 +22,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn const [activeIndex, setActiveIndex] = useState(0); const len = banners.length; - const numberOfVisibleBanners = banners.filter((banner) => banner.show).length; + const numberOfVisibleBanners = banners.filter((banner) => shouldShowBanner(banner.cfpDeadline)).length; const goToPrevious = () => { setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1)); @@ -64,7 +64,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn
{banners.map( (banner, index) => - banner.show && ( + shouldShowBanner(banner.cfpDeadline) && ( Date: Wed, 23 Oct 2024 13:52:04 +0530 Subject: [PATCH 5/7] updated banners conditional render --- components/campaigns/AnnouncementHero.tsx | 38 +++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index f3668ff3c82..1faed9ddfea 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import ArrowLeft from '../icons/ArrowLeft'; import ArrowRight from '../icons/ArrowRight'; @@ -22,7 +22,8 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn const [activeIndex, setActiveIndex] = useState(0); const len = banners.length; - const numberOfVisibleBanners = banners.filter((banner) => shouldShowBanner(banner.cfpDeadline)).length; + const visibleBanners = useMemo(() => banners.filter((banner) => shouldShowBanner(banner.cfpDeadline)), [banners]); + const numberOfVisibleBanners = visibleBanners.length; const goToPrevious = () => { setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1)); @@ -62,24 +63,21 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn )}
- {banners.map( - (banner, index) => - shouldShowBanner(banner.cfpDeadline) && ( - - ) - )} + {visibleBanners.map((banner, index) => ( + + ))}
{banners.map((banner, index) => ( From 7ad3ff65d44e7d5588c04683799b423054aad896 Mon Sep 17 00:00:00 2001 From: akshatnema Date: Wed, 23 Oct 2024 16:40:45 +0530 Subject: [PATCH 6/7] fixed AnnouncementHero component --- components/campaigns/AnnouncementHero.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index 1faed9ddfea..95ee8f0c7bc 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -21,7 +21,6 @@ interface IAnnouncementHeroProps { export default function AnnouncementHero({ className = '', small = false }: IAnnouncementHeroProps) { const [activeIndex, setActiveIndex] = useState(0); - const len = banners.length; const visibleBanners = useMemo(() => banners.filter((banner) => shouldShowBanner(banner.cfpDeadline)), [banners]); const numberOfVisibleBanners = visibleBanners.length; @@ -80,11 +79,11 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn ))}
- {banners.map((banner, index) => ( + {visibleBanners.map((banner, index) => (
goToIndex(index)} /> From db4009bbe27c2dcc429d308ab72c8e0528c68a6a Mon Sep 17 00:00:00 2001 From: akshatnema Date: Wed, 23 Oct 2024 16:47:14 +0530 Subject: [PATCH 7/7] fixed AnnouncementHero component --- components/campaigns/AnnouncementHero.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/campaigns/AnnouncementHero.tsx b/components/campaigns/AnnouncementHero.tsx index 95ee8f0c7bc..bee864e495c 100644 --- a/components/campaigns/AnnouncementHero.tsx +++ b/components/campaigns/AnnouncementHero.tsx @@ -25,11 +25,11 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn const numberOfVisibleBanners = visibleBanners.length; const goToPrevious = () => { - setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1)); + setActiveIndex((prevIndex) => (prevIndex === 0 ? numberOfVisibleBanners - 1 : prevIndex - 1)); }; const goToNext = () => { - setActiveIndex((prevIndex) => (prevIndex === len - 1 ? 0 : prevIndex + 1)); + setActiveIndex((prevIndex) => (prevIndex === numberOfVisibleBanners - 1 ? 0 : prevIndex + 1)); }; const goToIndex = (index: number) => { @@ -72,7 +72,7 @@ export default function AnnouncementHero({ className = '', small = false }: IAnn cfpDeadline={banner.cfpDeadline} link={banner.link} city={banner.city} - activeBanner={index === activeIndex % len} + activeBanner={index === activeIndex % numberOfVisibleBanners} className={className} small={small} />