diff --git a/components/CommunityEvents.tsx b/components/CommunityEvents.tsx new file mode 100644 index 000000000000..8c802d3278ed --- /dev/null +++ b/components/CommunityEvents.tsx @@ -0,0 +1,48 @@ +import React, { useState } from 'react'; + +import EventFilter from '@/components/navigation/EventFilter'; +import EventPostItem from '@/components/navigation/EventPostItem'; +import Heading from '@/components/typography/Heading'; +import Paragraph from '@/components/typography/Paragraph'; +import meetings from '@/config/meetings.json'; +import type { Event } from '@/types/pages/community/Community'; +import { HeadingLevel, HeadingTypeStyle } from '@/types/typography/Heading'; +import { ParagraphTypeStyle } from '@/types/typography/Paragraph'; +import { getEvents } from '@/utils/staticHelpers'; + +/** + * CommunityEvents component for displaying all events + */ +const CommunityEvents = () => { + const [events, setEvents] = useState(getEvents(meetings)); + + return ( +
+
+ + All Events + +
+ +
+
+
+ {!events || events.length === 0 ? ( +
+ + No Events. Check back later! + +
+ ) : ( + + )} +
+
+ ); +}; + +export default CommunityEvents; diff --git a/components/Meeting.tsx b/components/Meeting.tsx index 41bb90dd0fb4..537c154c50d6 100644 --- a/components/Meeting.tsx +++ b/components/Meeting.tsx @@ -1,5 +1,5 @@ import { ArrowRightIcon } from '@heroicons/react/outline'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { ParagraphTypeStyle } from '@/types/typography/Paragraph'; @@ -34,6 +34,14 @@ export default function Meeting({ youtube = '', bg = '' }: MeetingProps) { + const [isClient, setIsClient] = useState(false); + + useEffect(() => { + setIsClient(true); + }, []); + + if (!isClient) return null; + return (
@@ -89,31 +88,7 @@ export default function EventIndex() {
-
-
- - All Events - -
- -
-
-
- {!events || events.length === 0 ? ( -
- - No Events. Check back later! - -
- ) : ( -
    - {events.map((event: Event, index: number) => { - return ; - })} -
- )} -
-
+
diff --git a/utils/getStatic.ts b/utils/getStatic.ts index 56af2cf6b1ca..974ff691920f 100644 --- a/utils/getStatic.ts +++ b/utils/getStatic.ts @@ -29,7 +29,7 @@ export const getStaticPaths = () => ({ * @returns An object containing the internationalization props. */ export async function getI18nProps(ctx: any, ns = ['common']) { - const locale = ctx?.params?.lang; + const locale = ctx?.params?.lang ? ctx.params.lang : 'en'; const props = { ...(await serverSideTranslations(locale, ns)) };