Skip to content

Commit

Permalink
Merge pull request #473 from hifrontendcafe/randomize-mentors
Browse files Browse the repository at this point in the history
feat(mentors): randomize mentors
  • Loading branch information
Santiago-j-s authored Oct 2, 2023
2 parents 6606d50 + 69b5fed commit 8870e0b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/app/mentorias/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@/lib/api.server';
import { getAllDiscordEvents } from '@/lib/discord';
import { getPageMetadata } from '@/lib/seo';
import { shuffle } from '@/lib/shuffle';
import { Suspense } from 'react';

export const generateMetadata = () => getPageMetadata('Mentorías');
Expand All @@ -22,12 +23,28 @@ export default async function MentorshipsPage() {
const response = await getAllDiscordEvents();
const events = await response.json();

const availableMentors = mentors.filter(
(mentor) => mentor.status === 'ACTIVE',
);

const notAvailableMentors = mentors.filter(
(mentor) => mentor.status !== 'ACTIVE',
);

// randomize mentors order
shuffle(availableMentors);
shuffle(notAvailableMentors);

return (
<>
<PageComponents components={page.components} />

<Suspense fallback={<MentorListSkeleton />}>
<MentorList topics={topics} mentors={mentors} events={events} />
<MentorList
topics={topics}
mentors={[...availableMentors, ...notAvailableMentors]}
events={events}
/>
</Suspense>
</>
);
Expand Down

1 comment on commit 8870e0b

@vercel
Copy link

@vercel vercel bot commented on 8870e0b Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.