From 76468685774f0e5da0d4d6c2a88d5d9d70861391 Mon Sep 17 00:00:00 2001 From: SahilDahekar Date: Thu, 12 Dec 2024 17:16:55 +0530 Subject: [PATCH 1/3] Fixed calender button render issue --- components/CommunityEvents.tsx | 45 ++++++++++++++++++++++++++++++++ components/Meeting.tsx | 11 +++++++- pages/community/events/index.tsx | 39 +++++---------------------- utils/getStatic.ts | 2 +- 4 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 components/CommunityEvents.tsx diff --git a/components/CommunityEvents.tsx b/components/CommunityEvents.tsx new file mode 100644 index 000000000000..8782e91fbde0 --- /dev/null +++ b/components/CommunityEvents.tsx @@ -0,0 +1,45 @@ +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'; + +const CommunityEvents = () => { + const [events, setEvents] = useState(getEvents(meetings)); + + return ( +
+
+ + All Events + +
+ +
+
+
+ {!events || events.length === 0 ? ( +
+ + No Events. Check back later! + +
+ ) : ( +
    + {events.map((event: Event, index: number) => { + return ; + })} +
+ )} +
+
+ ); +}; + +export default CommunityEvents; \ No newline at end of file diff --git a/components/Meeting.tsx b/components/Meeting.tsx index 41bb90dd0fb4..998e0e817cde 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,15 @@ 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)) }; From 7233788545bf6a1fca41ac1a0cb5dbfb10b4532b Mon Sep 17 00:00:00 2001 From: SahilDahekar Date: Thu, 12 Dec 2024 17:18:14 +0530 Subject: [PATCH 2/3] Fixed lint issues --- components/CommunityEvents.tsx | 2 +- components/Meeting.tsx | 1 - pages/community/events/index.tsx | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/CommunityEvents.tsx b/components/CommunityEvents.tsx index 8782e91fbde0..868360265b21 100644 --- a/components/CommunityEvents.tsx +++ b/components/CommunityEvents.tsx @@ -42,4 +42,4 @@ const CommunityEvents = () => { ); }; -export default CommunityEvents; \ No newline at end of file +export default CommunityEvents; diff --git a/components/Meeting.tsx b/components/Meeting.tsx index 998e0e817cde..537c154c50d6 100644 --- a/components/Meeting.tsx +++ b/components/Meeting.tsx @@ -34,7 +34,6 @@ export default function Meeting({ youtube = '', bg = '' }: MeetingProps) { - const [isClient, setIsClient] = useState(false); useEffect(() => { diff --git a/pages/community/events/index.tsx b/pages/community/events/index.tsx index 01718a2aca6b..f0314cb69a6d 100644 --- a/pages/community/events/index.tsx +++ b/pages/community/events/index.tsx @@ -1,11 +1,11 @@ /* eslint-disable react/no-unescaped-entities */ import { ArrowRightIcon } from '@heroicons/react/outline'; +import CommunityEvents from '@/components/CommunityEvents'; import { HeadingLevel, HeadingTypeStyle } from '@/types/typography/Heading'; import { ParagraphTypeStyle } from '@/types/typography/Paragraph'; import { makeStaticProps } from '@/utils/getStatic'; -import CommunityEvents from '@/components/CommunityEvents'; import GoogleCalendarButton from '../../../components/buttons/GoogleCalendarButton'; import ICSFileButton from '../../../components/buttons/ICSFileButton'; import GenericLayout from '../../../components/layout/GenericLayout'; From 1d1a3e29559200d7c282dec36ec6da5f99e7b096 Mon Sep 17 00:00:00 2001 From: Ansh Goyal Date: Sat, 21 Dec 2024 20:40:51 +0530 Subject: [PATCH 3/3] add comment --- components/CommunityEvents.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/CommunityEvents.tsx b/components/CommunityEvents.tsx index 868360265b21..8c802d3278ed 100644 --- a/components/CommunityEvents.tsx +++ b/components/CommunityEvents.tsx @@ -10,6 +10,9 @@ 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));