diff --git a/src/components/events/EventCard.tsx b/src/components/events/EventCard.tsx index c5a0e4f..4e73c25 100644 --- a/src/components/events/EventCard.tsx +++ b/src/components/events/EventCard.tsx @@ -1,38 +1,159 @@ 'use server'; - -import EventCard from '@src/components/events/EventCard'; -import { api } from '@src/trpc/server'; +import { format, isSameDay } from 'date-fns'; +import Image from 'next/image'; import Link from 'next/link'; +import { MoreIcon } from '@src/icons/Icons'; +import { type RouterOutputs } from '@src/trpc/shared'; +import EventLikeButton from './EventLikeButton'; +import { getServerAuthSession } from '@src/server/auth'; +import dynamic from 'next/dynamic'; + +const EventTimeAlert = dynamic(() => import('./EventTimeAlert'), { + ssr: false, +}); + +type EventCardProps = { + event: RouterOutputs['event']['findByFilters']['events'][number]; +}; -const CommunityEvents = async () => { - const events = await api.userMetadata.getEvents(); - if (events.length === 0) { - return ( -
-
You haven't added any community events yet 😭
-
- You can check out new events{' '} +const HorizontalCard = async ({ + event, +}: { + event: RouterOutputs['event']['findByFilters']['events'][number]; +}) => { + const session = await getServerAuthSession(); + return ( +
+
+
+ event image +
+
+ +
+
+
+
+

{event.name}

+

+ + {event.club.name} + {' '} + • + + {format(event.startTime, 'E, MMM d, p')} + {isSameDay(event.startTime, event.endTime) ? ( + <> - {format(event.endTime, 'p')} + ) : ( + <> - {format(event.endTime, 'E, MMM d, p')} + )} + +

+

+ {event.description} +

+
+
+ {session && ( + + )} - here +
- ); - } +
+ ); +}; + +const VerticalCard = async ({ + event, +}: { + event: RouterOutputs['event']['findByFilters']['events'][number]; +}) => { + const session = await getServerAuthSession(); return ( -
- {events.map((event) => ( -
- +
+
+
+ event image +
+ +
- ))} +
+
+
+

{event.name}

+

+ + {event.club.name} + +
+ + {format(event.startTime, 'E, MMM d, p')} + {isSameDay(event.startTime, event.endTime) ? ( + <> - {format(event.endTime, 'p')} + ) : ( + <> + {' '} + -
+ {format(event.endTime, 'E, MMM d, p')} + + )} +
+
+

+
+
+ + + + {session && ( + + )} +
+
+
+ ); +}; + +const EventCard = ({ event }: EventCardProps) => { + return ( +
+
+ +
+
+ +
); }; -export default CommunityEvents; +export default EventCard;