From 79b2b065c4f3ceaaf448611f41722c129ac4f018 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 10 Oct 2024 15:27:33 +0200 Subject: [PATCH 1/3] feat(site): add team to contentful --- site/src/lib/contentful/types.ts | 10 +++ site/src/pages/team.astro | 111 +++++++++++++++++++++---------- 2 files changed, 85 insertions(+), 36 deletions(-) diff --git a/site/src/lib/contentful/types.ts b/site/src/lib/contentful/types.ts index b82825ab3f..ff2bdeea72 100644 --- a/site/src/lib/contentful/types.ts +++ b/site/src/lib/contentful/types.ts @@ -34,6 +34,16 @@ export interface LearningPageFields { nineText: EntryFields.RichText } +export interface TeamPageFields { + name: EntryFields.Text + title: EntryFields.Text + twitterHandle: EntryFields.Text + profilePicture: EntryFields.AssetLink + position: EntryFields.Number +} + +export interface TeamPageSkeleton extends EntrySkeletonType {} + export interface LandingPageSkeleton extends EntrySkeletonType {} export interface LearningPageFields extends EntrySkeletonType {} diff --git a/site/src/pages/team.astro b/site/src/pages/team.astro index f71836f5e3..29772fc98d 100644 --- a/site/src/pages/team.astro +++ b/site/src/pages/team.astro @@ -1,4 +1,8 @@ + --- +import type { TeamPageFields, TeamPageSkeleton } from "../lib/contentful/types" +import { contentfulClient } from "../lib/contentful/client" + import SectionsLayout from "#/layouts/SectionsLayout.astro" import Card from "#/components/Card.astro" import TopSection from "../components/sections/TopSection.astro" @@ -156,46 +160,81 @@ const teams = [ clazz: "h-[38px]" } ] ---- - +let teamData: TeamPageFields[] | null = null +let error: string | null = null - -
-

Our team is a global network of - professionals, working to build - the interoperability future.

-
-
-
+try { + const teamEntries = await contentfulClient.getEntries({ + content_type: "team" + }) - -
- { - profiles.map(person => ( - - -
- union worker -
-
-

{person.name}

-
{person.title}
-
@{person.x_name}
-
-
-
- )) - } -
-
+ if (teamEntries.items.length > 0) { + teamData = teamEntries.items + .map(item => item.fields) + .sort((a, b) => { + const posA = typeof a.position === "number" ? a.position : Number.POSITIVE_INFINITY + const posB = typeof b.position === "number" ? b.position : Number.POSITIVE_INFINITY + return posA - posB + }) + } else { + error = "No team data found." + } +} catch (err) { + console.error("Error fetching Contentful data:", err) + error = "Failed to load content. Please try again later." +} +--- + + {error ? ( +
+

Error

+

{error}

+
+ ) : teamData ? ( + <> + +
+

Our team is a global network of + professionals, working to build + the interoperability future.

+
+
+
+ + + + + ) : ( +
+

Loading content...

+
+ )}
From b12ce7af218c2e6ad4ed2c1c91154495c1d5deae Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 10 Oct 2024 15:28:46 +0200 Subject: [PATCH 2/3] fix(site): remove old stuff --- site/src/pages/team.astro | 82 --------------------------------------- 1 file changed, 82 deletions(-) diff --git a/site/src/pages/team.astro b/site/src/pages/team.astro index 29772fc98d..bdce211945 100644 --- a/site/src/pages/team.astro +++ b/site/src/pages/team.astro @@ -1,4 +1,3 @@ - --- import type { TeamPageFields, TeamPageSkeleton } from "../lib/contentful/types" import { contentfulClient } from "../lib/contentful/client" @@ -7,18 +6,6 @@ import SectionsLayout from "#/layouts/SectionsLayout.astro" import Card from "#/components/Card.astro" import TopSection from "../components/sections/TopSection.astro" -import headshot_karel from "#/assets/images/headshots/karel.jpg" -import headshot_cor from "#/assets/images/headshots/cor.jpg" -import headshot_ben from "#/assets/images/headshots/ben.jpeg" -import headshot_emir from "#/assets/images/headshots/emir.jpeg" -import headshot_sarah from "#/assets/images/headshots/sarah.jpg" -import headshot_abdullah from "#/assets/images/headshots/abdullah.jpeg" -import headshot_connor from "#/assets/images/headshots/connor.jpg" -import headshot_omar from "#/assets/images/headshots/omar.jpeg" -import headshot_hussein from "#/assets/images/headshots/hussein.jpeg" -import headshot_valentin from "#/assets/images/headshots/valentin.jpeg" -import headshot_boris from "#/assets/images/headshots/boris.jpeg" - import vc_galileo from "#/assets/images/investors/galileo.svg" import vc_nascent from "#/assets/images/investors/nascent.svg" import vc_tioga from "#/assets/images/investors/tioga.png" @@ -32,75 +19,6 @@ import team_groomlake from "#/assets/images/partners/groomlake.png" import team_horizons from "#/assets/images/partners/horizons.svg" import ContainedSection from "../components/ContainedSection.astro" -const profiles = [ - { - name: "Karel", - title: "CEO", - x_name: "0xkaiserkarel", - profile_pic: headshot_karel - }, - { - name: "Cor", - title: "CTO", - x_name: "corcoder", - profile_pic: headshot_cor - }, - { - name: "Emir", - title: "Head of BD", - x_name: "EBeriker", - profile_pic: headshot_emir - }, - { - name: "Sarah", - title: "Head of Operations", - x_name: "sarahkc07", - profile_pic: headshot_sarah - }, - { - name: "Hussein", - title: "Principal Engineer", - x_name: "0xc0dejug", - profile_pic: headshot_hussein - }, - { - name: "Abdullah", - title: "Founding Engineer", - x_name: "aeryz2", - profile_pic: headshot_abdullah - }, - { - name: "Ben", - title: "Founding Engineer", - x_name: "0xbonlulu", - profile_pic: headshot_ben - }, - { - name: "Connor", - title: "Founding Engineer", - x_name: "PoisonPhang", - profile_pic: headshot_connor - }, - { - name: "Omar", - title: "Full Stack Engineer", - x_name: "awkroot", - profile_pic: headshot_omar - }, - { - name: "Valentin", - title: "Advisor", - x_name: "valeyo777", - profile_pic: headshot_valentin - }, - { - name: "Boris", - title: "Advisor", - x_name: "sprembo", - profile_pic: headshot_boris - } -] - const teams = [ { name: "Spearbit", From 4e4afb874775b0f4acfde2a892d9a9382a4d5248 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 10 Oct 2024 15:33:12 +0200 Subject: [PATCH 3/3] chore(site): lint --- site/src/pages/team.astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/src/pages/team.astro b/site/src/pages/team.astro index bdce211945..fa168229b7 100644 --- a/site/src/pages/team.astro +++ b/site/src/pages/team.astro @@ -1,6 +1,6 @@ --- -import type { TeamPageFields, TeamPageSkeleton } from "../lib/contentful/types" -import { contentfulClient } from "../lib/contentful/client" +import type { TeamPageFields, TeamPageSkeleton } from "../lib/contentful/types.ts" +import { contentfulClient } from "../lib/contentful/client.ts" import SectionsLayout from "#/layouts/SectionsLayout.astro" import Card from "#/components/Card.astro" @@ -79,7 +79,7 @@ const teams = [ } ] -let teamData: TeamPageFields[] | null = null +let teamData: Array | null = null let error: string | null = null try {