Fixed the speakers and core contributors difference.

This commit is contained in:
NoobDeveloper412 2024-09-16 20:10:46 +05:00
parent ce2663e1a2
commit 29dcb9d346
2 changed files with 18 additions and 18 deletions

View file

@ -89,14 +89,22 @@ const sortedSections = sectionsConfig
{section.name === "speakers" && (
<div class="middle-pane-medium mt-16">
<h1 class="my-6 glitch-text ">Speakers</h1>
<SpeakerGrid people={core.people} team={core.teams["core-team"]} />
<SpeakerGrid
people={core.people}
team={core.teams["core-team"]}
core={false}
/>
</div>
)}
{section.name === "core contributors" && (
<div class="middle-pane-medium mt-16">
<h1 class="my-6 glitch-text">Core Contributors</h1>
<SpeakerGrid people={core.people} team={core.teams["core-team"]} />
<SpeakerGrid
people={core.people}
team={core.teams["core-team"]}
core={true}
/>
</div>
)}

View file

@ -1,11 +1,12 @@
---
const { people, team } = Astro.props;
const { people, team, core } = Astro.props;
// Filter the people and limit the results to 12
const filteredPeople = people
.filter((p) => !team.includes(p.id))
.filter((p) => p.imageUrl)
.slice(0, 12); // Limit to the first 12 people
// Filter based on the `core` parameter
const members = core
? people.filter((p) => team.includes(p.id)) // If `core` is true, filter for team members
: people.filter((p) => !team.includes(p.id)); // If `core` is false or undefined, filter for non-team members
const filteredPeople = members.filter((p) => p.imageUrl).slice(0, 12);
function personLink(person) {
if (person.refs?.twitter) {
@ -24,15 +25,6 @@ function personLink(person) {
return "#";
}
}
function truncateCaption(caption) {
if (!caption) return "";
const words = caption.split(" ");
if (words.length > 10) {
return words.slice(0, 20).join(" ") + "...";
}
return caption;
}
---
<div
@ -40,7 +32,7 @@ function truncateCaption(caption) {
>
{
filteredPeople.map((person) => (
<div class="max-w-xs w-full h-[340px] bg-transparent overflow-hidden p-1 space-y-1 mb-2">
<div class="max-w-xs w-full max-h-[340px] bg-transparent overflow-hidden p-1 space-y-1 mb-2">
<a href={personLink(person)}>
<img
src={person.imageUrl}