Skip to content

Commit

Permalink
use same names as action creating issue creating meetup-mdx (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
JorgeX committed Sep 7, 2023
1 parent 20b25e3 commit cbb8d2f
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 54 deletions.
8 changes: 5 additions & 3 deletions packages/site/src/components/MeetupCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {
time,
organizer,
organizerLink,
meetupLink,
signupLink,
slug,
} = Astro.props;
---
Expand Down Expand Up @@ -90,13 +90,15 @@ const {
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-900">Sign up link</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
<a href={meetupLink} target="_blank">{meetupLink}</a>
<a href={signupLink} target="_blank">{signupLink}</a>
</dd>
</div>
<div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-900">Description</dt>
<dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
{description}
<a href={`${import.meta.env.BASE_URL}meetups/${slug}`}>
{description}
</a>
</dd>
</div>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/components/MeetupPageCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
time,
organizer,
organizerLink,
meetupLink,
signupLink,
image,
} = meetupProps.meetup.data;
const heroImage = image ? image : 'images/heroimages/1-meetup-image.jpg';
Expand Down Expand Up @@ -113,7 +113,7 @@ const { Content } = await meetupProps.meetup.render();
<dd
class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"
>
<a href={meetupLink} target="_blank">{meetupLink}</a>
<a href={signupLink} target="_blank">{signupLink}</a>
</dd>
</div>
</dl>
Expand Down
14 changes: 6 additions & 8 deletions packages/site/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@ import { defineCollection, z } from 'astro:content';
const meetups = defineCollection({
type: 'content',
schema: z.object({
name: z.string(),
description: z.string(),
title: z.string(),
// Transform string to Date object
time: z.string(),
date: z.string(),
location: z.string(),
locationLink: z.string().optional(),
organizer: z.string(),
organizerLink: z.string().optional(),
meetupLink: z.string(),
signupLink: z.string(),
image: z.string().optional(),
}),
});

const testmeetups = defineCollection({
type: 'content',
schema: z.object({
name: z.string(),
description: z.string(),
title: z.string(),
// Transform string to Date object
time: z.string(),
date: z.string(),
location: z.string(),
locationLink: z.string().optional(),
organizer: z.string(),
organizerLink: z.string().optional(),
meetupLink: z.string(),
signupLink: z.string(),
image: z.string().optional(),
}),
});
Expand Down
7 changes: 3 additions & 4 deletions packages/site/src/content/meetups/25-8-2023-cloudamite.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: 'Great AI Meetup'
title: 'Great AI Meetup'
location: 'Oulu Elektroniikkatie'
locationLink: 'https://goo.gl/maps/GvuboievRSW5VfZf6'
time: '2023-08-25 17:00'
date: '2023-08-25 17:00'
organizer: 'Cloudamite'
organizerLink: 'https://cloudamite.com'
description: 'Join us for an evening of AI talks and discussions.'
meetupLink: 'https://meetup.com/great-ai-meetup'
signupLink: 'https://meetup.com/great-ai-meetup'
image: 'images/heroimages/1-meetup-image.jpg'
---

Expand Down
7 changes: 3 additions & 4 deletions packages/site/src/content/testmeetups/11-22-3333-company.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: 'Reactive coding Meetup'
title: 'Reactive coding Meetup'
location: 'Oulu Elektroniikkatie'
locationLink: 'https://goo.gl/maps/GvuboievRSW5VfZf6'
time: '2023-09-25 17:00'
date: '2023-09-25 17:00'
organizer: 'The Company'
organizerLink: 'https://google.com'
description: 'Join us for an evening of reacitve programming talks and discussions.'
meetupLink: 'https://meetup.com/great-reactive-meetup'
signupLink: 'https://meetup.com/great-reactive-meetup'
image: 'images/heroimages/5-meetup-image.jpg'
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: 'Local AWS group Meetup'
title: 'Local AWS group Meetup'
location: 'Oulu Elektroniikkatie'
locationLink: 'https://goo.gl/maps/GvuboievRSW5VfZf6'
time: '2023-10-03 17:00'
date: '2023-10-03 17:00'
organizer: 'Cloudinary'
organizerLink: 'https://google.com'
description: 'Join us for an evening of cloud optimizing talks and discussions.'
meetupLink: 'https://meetup.com/local-aws-meetup'
signupLink: 'https://meetup.com/local-aws-meetup'
image: 'images/heroimages/4-meetup-image.jpg'
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: 'Great AI Meetup'
title: 'Great AI Meetup'
location: 'Oulu Elektroniikkatie'
locationLink: 'https://goo.gl/maps/GvuboievRSW5VfZf6'
time: '2023-08-25 17:00'
date: '2023-08-25 17:00'
organizer: 'Cloudamite'
organizerLink: 'https://cloudamite.com'
description: 'Join us for an evening of AI talks and discussions.'
meetupLink: 'https://meetup.com/great-ai-meetup'
signupLink: 'https://meetup.com/great-ai-meetup'
image: 'images/heroimages/1-meetup-image.jpg'
---

Expand Down
17 changes: 17 additions & 0 deletions packages/site/src/content/testmeetups/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: The great JS Bundle maximizing event
location: Eletie 3
locationLink: https://planbee-dev.github.io/oulu-dev-meetups/submit/
organizer: Pentagon
organizerLink: https://www.google.com
signupLink: https://planbee-dev.github.io/oulu-dev-meetups/submit/
date: Wed, 13 Sep 2023 16:30:00 GMT
---

## Bundle sizes should be great again!

Feeling like your miserable kilobytes are not enough? No worries, just install rxjs, react and bootstrap.

## NEVER TREE SHAKE ANYTHING

you hear? no small boy stuff, JUST MEGABUNDLES!!
2 changes: 1 addition & 1 deletion packages/site/src/layouts/Meetup.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { meetup } = Astro.props;
</head>
<body class="h-full">
<div class="min-h-full">
<Header headerText={meetup.data.name} />
<Header headerText={meetup.data.title} />
<main>
<div class="mx-auto max-w-7xl px-4 py-4 sm:px-6 lg:px-8">
<MeetupPageCard meetup={meetup} />
Expand Down
14 changes: 10 additions & 4 deletions packages/site/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ const meetups: any = await getCollection(collectionName);
const nextMeetup = getNextMeetup(meetups);
const createDescription = (meetup) => {
if (meetup.body.length > 100) {
return meetup.body.substring(0, 100) + '...';
} else return meetup.body;
};
const meetupDetails = nextMeetup
? {
name: nextMeetup.data.name,
name: nextMeetup.data.title,
location: nextMeetup.data.location,
locationLink: nextMeetup.data.locationLink,
time: nextMeetup.data.time,
time: nextMeetup.data.date,
organizer: nextMeetup.data.organizer,
organizerLink: nextMeetup.data.organizerLink,
description: nextMeetup.data.description,
meetupLink: nextMeetup.data.meetupLink,
signupLink: nextMeetup.data.signupLink,
slug: nextMeetup.slug,
description: createDescription(nextMeetup),
}
: null;
---
Expand Down
6 changes: 3 additions & 3 deletions packages/site/src/pages/meetups/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { parseMeetupDate } from '../../utils';
const collectionName = getMeetupsCollectionName();
const meetups: any = await getCollection(collectionName);
meetups.sort((a: any, b: any) => {
return parseMeetupDate(b.data.time) - parseMeetupDate(a.data.time);
return parseMeetupDate(b.data.date) - parseMeetupDate(a.data.date);
});
---

Expand All @@ -33,9 +33,9 @@ meetups.sort((a: any, b: any) => {
{
meetups.map((meetup: any) => (
<MeetupListItem
name={meetup.data.name}
name={meetup.data.title}
location={meetup.data.location}
time={meetup.data.time}
time={meetup.data.date}
organizer={meetup.data.organizer}
slug={meetup.slug}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/pages/rss.xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
export async function get(context) {
const meetups = await getCollection('meetups');
const rssItems = meetups.map((meetup) => ({
title: meetup.data.name,
title: meetup.data.title,
link: `${import.meta.env.BASE_URL}meetups/${meetup.slug}`,
pubDate: meetup.data.time,
pubDate: meetup.data.date,
}));
return rss({
title: SITE_TITLE,
Expand Down
10 changes: 5 additions & 5 deletions packages/site/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// place any helper functions here
export type Meetup = {
data: {
name: string;
title: string;
description: string;
time: string;
date: string;
location: string;
locationLink: string | null;
organizer: string;
organizerLink: string | null;
meetupLink: string;
signupLink: string;
image: string | null;
};
};
Expand Down Expand Up @@ -40,13 +40,13 @@ export const getNextMeetup = (meetups: Meetup[]) => {

const currentDate = new Date();
const futureMeetups = meetups.filter((meetup: Meetup) => {
return parseMeetupDate(meetup.data.time) > currentDate.getTime();
return parseMeetupDate(meetup.data.date) > currentDate.getTime();
});

if (futureMeetups.length === 0) return null;

futureMeetups.sort((a: Meetup, b: Meetup) => {
return parseMeetupDate(a.data.time) - parseMeetupDate(b.data.time);
return parseMeetupDate(a.data.date) - parseMeetupDate(b.data.date);
});
return futureMeetups[0];
};
20 changes: 10 additions & 10 deletions packages/site/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@ afterEach(() => {
const meetups: Meetup[] = [];
meetups.push({
data: {
name: 'React coding Meetup',
title: 'React coding Meetup',
description: 'Monthly meetup for coders',
location: 'Oulu Library',
locationLink: null,
time: '2023-09-25 17:00',
date: '2023-09-25 17:00',
organizer: 'React Community',
organizerLink: null,
meetupLink: 'https://www.meetup.com/react',
signupLink: 'https://www.meetup.com/react',
image: 'react-meetup.jpg',
},
});
meetups.push({
data: {
name: 'Vitest Meetup',
title: 'Vitest Meetup',
description: 'Monthly meetup for Vitest users',
location: 'Oulu University',
locationLink: null,
time: '2023-08-25 18:00',
date: '2023-08-25 18:00',
organizer: 'Vitest Community',
organizerLink: null,
meetupLink: 'https://www.meetup.com/vitest',
signupLink: 'https://www.meetup.com/vitest',
image: 'vitest-meetup.jpg',
},
});
meetups.push({
data: {
name: 'Local AWS group Meetup',
title: 'Local AWS group Meetup',
location: 'Oulu Elektroniikkatie',
locationLink: 'https://goo.gl/maps/GvuboievRSW5VfZf6',
time: '2023-10-03 17:00',
date: '2023-10-03 17:00',
organizer: 'Cloudinary',
organizerLink: 'https://google.com',
description:
'Join us for an evening of cloud optimizing talks and discussions.',
meetupLink: 'https://meetup.com/local-aws-meetup',
signupLink: 'https://meetup.com/local-aws-meetup',
image: 'images/heroimages/4-meetup-image.jpg',
},
});
Expand Down Expand Up @@ -90,5 +90,5 @@ test('get next meetup from today', () => {
const date = new Date(2023, 8, 4, 10, 0);
vi.setSystemTime(date);
const nextMeetup = getNextMeetup(meetups);
expect(nextMeetup?.data.name).toBe('React coding Meetup');
expect(nextMeetup?.data.title).toBe('React coding Meetup');
});

0 comments on commit cbb8d2f

Please sign in to comment.