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" && ( {section.name === "speakers" && (
<div class="middle-pane-medium mt-16"> <div class="middle-pane-medium mt-16">
<h1 class="my-6 glitch-text ">Speakers</h1> <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> </div>
)} )}
{section.name === "core contributors" && ( {section.name === "core contributors" && (
<div class="middle-pane-medium mt-16"> <div class="middle-pane-medium mt-16">
<h1 class="my-6 glitch-text">Core Contributors</h1> <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> </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 // Filter based on the `core` parameter
const filteredPeople = people const members = core
.filter((p) => !team.includes(p.id)) ? people.filter((p) => team.includes(p.id)) // If `core` is true, filter for team members
.filter((p) => p.imageUrl) : people.filter((p) => !team.includes(p.id)); // If `core` is false or undefined, filter for non-team members
.slice(0, 12); // Limit to the first 12 people
const filteredPeople = members.filter((p) => p.imageUrl).slice(0, 12);
function personLink(person) { function personLink(person) {
if (person.refs?.twitter) { if (person.refs?.twitter) {
@ -24,15 +25,6 @@ function personLink(person) {
return "#"; return "#";
} }
} }
function truncateCaption(caption) {
if (!caption) return "";
const words = caption.split(" ");
if (words.length > 10) {
return words.slice(0, 20).join(" ") + "...";
}
return caption;
}
--- ---
<div <div
@ -40,7 +32,7 @@ function truncateCaption(caption) {
> >
{ {
filteredPeople.map((person) => ( 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)}> <a href={personLink(person)}>
<img <img
src={person.imageUrl} src={person.imageUrl}