Skip to content

Commit

Permalink
Merge branch 'asyncapi:master' into issue#2205
Browse files Browse the repository at this point in the history
  • Loading branch information
J0SAL authored Nov 12, 2023
2 parents 27d09c1 + b91f537 commit e566cc1
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 105 deletions.
137 changes: 116 additions & 21 deletions components/campaigns/AnnoucementHero.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { useState, useEffect } from 'react'
import Paragraph from '../typography/Paragraph'
import Button from '../buttons/Button'
import Heading from '../typography/Heading'
import Container from '../layout/Container'
import AnnouncementRemainingDays from './AnnouncementRamainingDays'
import AnnouncementRemainingDays from './AnnouncementRemainingDays'
import ArrowLeft from '../icons/ArrowLeft'
import ArrowRight from '../icons/ArrowRight'

function shouldShowBanner(cfpDeadline) {
const currentDate = new Date(); // G et the current date
Expand All @@ -15,48 +18,140 @@ function shouldShowBanner(cfpDeadline) {

return true;
}

export default function AnnouncementHero({ className = '', small = false, hideVideo = false }) {
//return null;

const [activeIndex, setActiveIndex] = useState(0);

const cfpDeadline = '2023-11-30T06:00:00Z'
const showBanner = shouldShowBanner(cfpDeadline);
if (!showBanner) return null;
const cfpDeadlineIndia = '2023-11-30T06:00:00Z'
const cfpDeadlineFrance = '2023-12-06T06:00:00Z'
const showBannerIndia = shouldShowBanner(cfpDeadlineIndia);
const showBannerFrance = shouldShowBanner(cfpDeadlineFrance);


return (
<Container wide as="section" padding='' className='text-center'>
const Banner = ({ title, dateLocation, cfaText, eventName, cfpDeadline, link, city, activeBanner }) => {
return (
<div
className={`bg-gray-50 border border-gray-200 py-6 rounded ${className} ${
small ? 'mb-4' : 'mx-3 mt-3 p-3 mb-6'
}`} data-testid = "AnnouncementHero-main-div"
className={`bg-gray-50 w-full h-full border border-gray-200 absolute py-6 rounded transform transition-transform ${className} ${small ? 'mb-4' : 'mx-3 mt-3 p-3 mb-6'
} ${activeBanner ? 'opacity-100 scale-100' : 'opacity-0 scale-90'}`} data-testid="AnnouncementHero-main-div"
>
<Heading
className="countdown-text-gradient"
level="h2"
typeStyle="heading-lg" >
AsyncAPI Conf on Tour 2023
{title}
</Heading>

<Heading
className="countdown-text-gradient"
level="h3"
typeStyle="heading-sm"
>
Bangalore Edition
level="h2"
typeStyle="heading-md" >
{city}
</Heading>
<Paragraph typeStyle="body-lg">
30th of November, 2023 | Bangalore, India
{dateLocation}
</Paragraph>
<AnnouncementRemainingDays dateTime={cfpDeadline} eventName="AACoT'23 Bangalore Edition" />
<AnnouncementRemainingDays dateTime={cfpDeadline} eventName={eventName} />
<div className="mt-6 pb-2 space-x-2">
<Button
href="https://opencollective.com/asyncapi/events/asyncapi-conference-on-tour-6b3c0aa1/contribute/aacot-london-edition-66187"
href={link}
target="_blank"
text="Get Your Tickets"
text={cfaText}
data-testid="AnnouncementHero-submit-session"
/>
</div>
</div>
)
}

const banners = [
{
title: "AsyncAPI Conf",
city: "Bengaluru",
dateLocation: "30th of November, 2023 | Bengaluru, India",
cfaText: "Grab Free Tickets",
eventName: "AACoT'23 Bengaluru Edition",
cfpDeadline: cfpDeadlineIndia,
link: "https://opencollective.com/asyncapi/events/asyncapi-conference-on-tour-6b3c0aa1/contribute/aacot-london-edition-66187",
show: showBannerIndia
},
{
title: "AsyncAPI Conf",
city: "Paris",
dateLocation: "8th of December, 2023 | Paris, France",
cfaText: "Get Free Tickets",
eventName: "AACoT'23 Paris Edition",
cfpDeadline: cfpDeadlineFrance,
link: "https://ticket.apidays.global/event/apidays-paris-2023/8a1f3904-e2be-4c69-a880-37d2ddf1027d/cart?coupon=ASYNCAPICONF23",
show: showBannerFrance
}
];

// Calculate the number of banners that should be displayed
const numberOfVisibleBanners = banners.filter(banner => banner.show).length;
const len = banners.length;

const goToPrevious = () => {
setActiveIndex((prevIndex) => (prevIndex === 0 ? len - 1 : prevIndex - 1));
};

const goToNext = () => {
setActiveIndex((prevIndex) => (prevIndex === len - 1 ? 0 : prevIndex + 1));
};

const goToIndex = (index) => {
setActiveIndex(index);
};

useEffect(() => {
const interval = setInterval(() => setActiveIndex(index => index + 1), 5000);
return () => {
clearInterval(interval);
};
}, [activeIndex]);

return (
<Container as="section" padding='' className={`text-center`}>
<div className="relative flex flex-row justify-center items-center md:gap-4 overflow-x-hidden">
<div className="h-8 w-8 rounded-full bg-primary-500 hover:bg-primary-600 cursor-pointer mb-2 absolute left-0 z-10 top-1/2 transform -translate-y-1/2 opacity-50 md:opacity-100 flex justify-center items-center" onClick={goToPrevious}>
<ArrowLeft className='w-4 text-white' />
</div>
<div className='relative w-5/6 flex flex-col gap-2 justify-center items-center'>
<div className='relative w-full h-[18rem] lg:w-[38rem] lg:h-[17rem] overflow-hidden'>
{banners.map((banner, index) => (
banner.show && (
<Banner
key={index}
title={banner.title}
dateLocation={banner.dateLocation}
cfaText={banner.cfaText}
eventName={banner.eventName}
cfpDeadline={banner.cfpDeadline}
link={banner.link}
city={banner.city}
activeBanner={index === activeIndex % len}
/>
)
))}
</div>
<div className="flex justify-center m-auto">
{banners.map((banner, index) => (
<div
key={index}
className={`h-2 w-2 rounded-full mx-1 cursor-pointer ${
activeIndex % len === index ? 'bg-primary-500' : 'bg-gray-300'
}`}
onClick={() => goToIndex(index)}
/>
))}
</div>
</div>
<div
className="h-8 w-8 rounded-full bg-primary-500 hover:bg-primary-600 cursor-pointer mb-2 z-10 absolute right-0 top-1/2 transform -translate-y-1/2 opacity-50 md:opacity-100"
onClick={goToNext}
>
<ArrowRight className='text-white' />
</div>
</div>
</Container>
);
}
}
7 changes: 0 additions & 7 deletions config/meetings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
"banner": "https://user-images.githubusercontent.com/40604284/256949583-958c34c8-4256-4ac5-852b-e00ec094fad0.png",
"date": "2023-08-08T16:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=NG9lc2RwN3A2djFmNmRxaHZoaWRjMnRhaDAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/823",
"banner": "",
"date": "2023-08-02T16:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=Z3YzNDRwamprYzMwNTluYTdtNG1iaHA5NjggY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ describe('AnnouncementHero Component', () => {
// Assert the event details
cy.get('[data-testid="Paragraph-test"]').should('exist');
cy.get('h2').should('exist');
cy.get('h3').should('exist');

});
it('should have a link and text for the button', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import moment from 'moment';
import { mount } from '@cypress/react';
import AnnouncementRemainingDays from '../../../../components/campaigns/AnnouncementRamainingDays';
import AnnouncementRemainingDays from '../../../../components/campaigns/AnnouncementRemainingDays';

describe('AnnouncementRemainingDays', () => {
it('displays correct countdown text', () => {
Expand Down
96 changes: 34 additions & 62 deletions dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"resourcePath": "/asyncapi/website/pull/2038",
"repo": "asyncapi/website",
"labels": [],
"score": 39.34291865864845
"score": 39.63009324739771
},
{
"id": "PR_kwDOFLhIt85Vmgtj",
Expand All @@ -52,7 +52,39 @@
"resourcePath": "/asyncapi/community/pull/805",
"repo": "asyncapi/community",
"labels": [],
"score": 30.440506407421427
"score": 30.727680996170687
},
{
"id": "I_kwDOBGu-184_rP6l",
"isPR": false,
"isAssigned": false,
"title": "Let channels be identified by an ID rather than their address.",
"author": "smoya",
"resourcePath": "/asyncapi/spec/issues/663",
"repo": "asyncapi/spec",
"labels": [
{
"name": "πŸ’­ Strawman (RFC 0)",
"color": "C2E0C6"
}
],
"score": 21.538094156194408
},
{
"id": "I_kwDOGJ23c85V9C3c",
"isPR": false,
"isAssigned": false,
"title": "Support `referenceIntoComponents` for other components than `message`",
"author": "thake",
"resourcePath": "/asyncapi/bundler/issues/97",
"repo": "asyncapi/bundler",
"labels": [
{
"name": "enhancement",
"color": "a2eeef"
}
],
"score": 20.102221212448114
},
{
"id": "I_kwDOBW5R_c5BIl5P",
Expand Down Expand Up @@ -146,41 +178,6 @@
"repo": "asyncapi/community",
"labels": [],
"score": 14.645904026212197
},
{
"id": "PR_kwDOBW5R_c5VmsTR",
"isPR": true,
"isAssigned": true,
"title": "docs: tags in a AsyncAPI document",
"author": "TRohit20",
"resourcePath": "/asyncapi/website/pull/1957",
"repo": "asyncapi/website",
"labels": [
{
"name": "πŸ“‘ docs",
"color": "E50E99"
},
{
"name": "area/docs",
"color": "e50e99"
},
{
"name": "gsod",
"color": "7B5DB8"
}
],
"score": 14.07155484871368
},
{
"id": "PR_kwDOCoBobc42aMuI",
"isPR": true,
"isAssigned": false,
"title": "feat: release for version 3.0.0 of the spec",
"author": "jonaslagoni",
"resourcePath": "/asyncapi/parser-js/pull/526",
"repo": "asyncapi/parser-js",
"labels": [],
"score": 13.497205671215161
}
],
"goodFirstIssues": [
Expand Down Expand Up @@ -738,21 +735,6 @@
}
]
},
{
"id": "I_kwDOBW5R_c5qCIUD",
"title": "[πŸ“‘ Docs]: Remove v2 spec links for v3",
"isAssigned": true,
"resourcePath": "/asyncapi/website/issues/1855",
"repo": "asyncapi/website",
"author": "jonaslagoni",
"area": "docs",
"labels": [
{
"name": "πŸ“‘ docs",
"color": "E50E99"
}
]
},
{
"id": "I_kwDOBW5R_c5qCG1z",
"title": "[πŸ“‘ Docs]: Adapt github action tooling page for v3",
Expand All @@ -763,16 +745,6 @@
"area": "Unknown",
"labels": []
},
{
"id": "I_kwDOBW5R_c5qCC_7",
"title": "[πŸ“‘ Docs]: Adapt frontpage animation for v3",
"isAssigned": true,
"resourcePath": "/asyncapi/website/issues/1853",
"repo": "asyncapi/website",
"author": "jonaslagoni",
"area": "Unknown",
"labels": []
},
{
"id": "I_kwDOFLhIt85o9dDJ",
"title": "Add 2023 mentorship directory",
Expand Down
Loading

0 comments on commit e566cc1

Please sign in to comment.