From 9996f5c52bea387c56520ab719625b4bcb23cfc1 Mon Sep 17 00:00:00 2001 From: lankabelgezogen Date: Sun, 23 Jun 2024 18:49:19 +0200 Subject: [PATCH 1/6] added data path --- tsconfig.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index 86430dd..3f72709 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -28,6 +28,9 @@ "@components/*": [ "./components/*" ], + "@data/*": [ + "./data/*" + ], "@ui/*": [ "./components/ui/*" ], From 9cee5a296762980acfa4f9e94b9f0b32062250cd Mon Sep 17 00:00:00 2001 From: lankabelgezogen Date: Sun, 23 Jun 2024 18:49:31 +0200 Subject: [PATCH 2/6] added startup data --- data/e-lab-startups.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 data/e-lab-startups.json diff --git a/data/e-lab-startups.json b/data/e-lab-startups.json new file mode 100644 index 0000000..ebfa8b9 --- /dev/null +++ b/data/e-lab-startups.json @@ -0,0 +1,30 @@ +[ + { + "id": "airbnb", + "name": "Airbnb", + "description": "Airbnb is an online marketplace for short-term homestays and experiences.", + "founders": [ + { + "name": "Brian Chesky", + "role": "CEO, Co-founder" + }, + { + "name": "Joe Gebbia", + "role": "Co-founder" + }, + { + "name": "Nathan Blecharczyk", + "role": "Chief Strategy Officer, Co-founder" + } + ], + "metrics": { + "Year Founded": "2008", + "Valuation": "$113 billion", + "Funding Raised": "$6.4 billion", + "Employees": "6,132" + }, + "about": "Airbnb has revolutionized the travel industry by allowing homeowners to rent out their spaces to travelers. Founded in 2008, the company has grown from a small startup to a global phenomenon, operating in over 220 countries and regions. Airbnb's platform not only provides unique accommodation options for travelers but also empowers hosts to earn extra income. The company's success lies in its ability to create a trusted community marketplace and its continuous innovation in the travel and hospitality sector.", + "website": "https://www.airbnb.com", + "logo": "/assets/e-lab/startups/airbnb-logo.png" + } +] \ No newline at end of file From 48db4f94493c0bcc6acda9bc37758761017bd2dc Mon Sep 17 00:00:00 2001 From: lankabelgezogen Date: Sun, 23 Jun 2024 18:49:53 +0200 Subject: [PATCH 3/6] added startup-details component --- components/StartupDetails.tsx | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 components/StartupDetails.tsx diff --git a/components/StartupDetails.tsx b/components/StartupDetails.tsx new file mode 100644 index 0000000..997f7af --- /dev/null +++ b/components/StartupDetails.tsx @@ -0,0 +1,55 @@ +import Image from 'next/image'; +import Link from 'next/link'; + +const StartupDetails = ({ startup }: { startup: any }) => { + return ( +
+
+
+ {`${startup.name} +

{startup.name}

+
+ +

{startup.description}

+ +

Founders

+
    + {startup.founders.map((founder: any) => ( +
  • + {founder.name} - {founder.role} +
  • + ))} +
+ +

Metrics

+
    + {Object.entries(startup.metrics).map(([key, value]) => ( +
  • + {key}: {String(value)} +
  • + ))} +
+ +

About {startup.name}

+

{startup.about}

+ + + Visit Website + +
+
+ ); +}; + +export default StartupDetails; \ No newline at end of file From 59224abe3ca68962f67d920d9d9bb5cac84ef404 Mon Sep 17 00:00:00 2001 From: lankabelgezogen Date: Sun, 23 Jun 2024 18:51:10 +0200 Subject: [PATCH 4/6] added dynamic route for startup pages --- app/e-lab/startups/[id]/page.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/e-lab/startups/[id]/page.tsx diff --git a/app/e-lab/startups/[id]/page.tsx b/app/e-lab/startups/[id]/page.tsx new file mode 100644 index 0000000..0c6094c --- /dev/null +++ b/app/e-lab/startups/[id]/page.tsx @@ -0,0 +1,18 @@ +import startups from '@data/e-lab-startups.json'; +import StartupDetails from '@components/StartupDetails'; + +export async function generateStaticParams() { + return startups.map((startup) => ({ + id: startup.id, + })); +} + +export default function StartupPage({ params }: { params: { id: string } }) { + const startup = startups.find((s) => s.id === params.id); + + if (!startup) { + return
Startup not found
; + } + + return ; +} \ No newline at end of file From a30b0adf928cdd7588a7d00402e216b2bf511b87 Mon Sep 17 00:00:00 2001 From: lankabelgezogen Date: Mon, 24 Jun 2024 10:27:28 +0200 Subject: [PATCH 5/6] fixed lint issues --- app/e-lab/startups/[id]/page.tsx | 4 ++-- components/StartupDetails.tsx | 5 +++-- data/e-lab.tsx | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/e-lab/startups/[id]/page.tsx b/app/e-lab/startups/[id]/page.tsx index 0c6094c..2481adb 100644 --- a/app/e-lab/startups/[id]/page.tsx +++ b/app/e-lab/startups/[id]/page.tsx @@ -2,9 +2,9 @@ import startups from '@data/e-lab-startups.json'; import StartupDetails from '@components/StartupDetails'; export async function generateStaticParams() { - return startups.map((startup) => ({ + return await Promise.resolve(startups.map((startup) => ({ id: startup.id, - })); + }))); } export default function StartupPage({ params }: { params: { id: string } }) { diff --git a/components/StartupDetails.tsx b/components/StartupDetails.tsx index 997f7af..1ec09ed 100644 --- a/components/StartupDetails.tsx +++ b/components/StartupDetails.tsx @@ -1,7 +1,8 @@ import Image from 'next/image'; import Link from 'next/link'; +import { Startup } from '@data/e-lab'; -const StartupDetails = ({ startup }: { startup: any }) => { +const StartupDetails = ({ startup }: { startup: Startup }) => { return (
@@ -20,7 +21,7 @@ const StartupDetails = ({ startup }: { startup: any }) => {

Founders

    - {startup.founders.map((founder: any) => ( + {startup.founders.map((founder) => (
  • {founder.name} - {founder.role}
  • diff --git a/data/e-lab.tsx b/data/e-lab.tsx index b038b6b..4bd9364 100644 --- a/data/e-lab.tsx +++ b/data/e-lab.tsx @@ -145,3 +145,21 @@ export const faq = [ "The AI E-Lab is a part-time program. Keep in mind that the more you commit, the more you get out of this program.", }, ]; + +export interface Founder { + name: string; + role: string; +} + +export type Metrics = Record; + +export interface Startup { + id: string; + name: string; + description: string; + founders: Founder[]; + metrics: Metrics; + website: string; + logo: string; + about?: string; +} \ No newline at end of file From b204c3d6ac4443d1b5924993c5dc16756e456b09 Mon Sep 17 00:00:00 2001 From: Cyro292 Date: Fri, 28 Jun 2024 17:06:49 +0200 Subject: [PATCH 6/6] fixed linting issues and fixed structure added types and added Padding --- app/e-lab/startups/[id]/page.tsx | 18 ++++---- app/hero.tsx | 2 +- components/StartupDetails.tsx | 44 +++++++++++-------- ...e-lab-startups.json => e-lab-startups.tsx} | 22 +++++++++- 4 files changed, 56 insertions(+), 30 deletions(-) rename data/{e-lab-startups.json => e-lab-startups.tsx} (79%) diff --git a/app/e-lab/startups/[id]/page.tsx b/app/e-lab/startups/[id]/page.tsx index 2481adb..f55f9ab 100644 --- a/app/e-lab/startups/[id]/page.tsx +++ b/app/e-lab/startups/[id]/page.tsx @@ -1,17 +1,17 @@ -import startups from '@data/e-lab-startups.json'; +import { startups, Startup} from '@data/e-lab-startups'; import StartupDetails from '@components/StartupDetails'; -export async function generateStaticParams() { - return await Promise.resolve(startups.map((startup) => ({ - id: startup.id, - }))); -} - export default function StartupPage({ params }: { params: { id: string } }) { - const startup = startups.find((s) => s.id === params.id); + + const startup: Startup | undefined = startups.find((startup: Startup) => { + if (startup && startup.id === params.id) { + return startup; + } + return undefined; + }); if (!startup) { - return
    Startup not found
    ; + return
    Startup Not Found
    ; } return ; diff --git a/app/hero.tsx b/app/hero.tsx index 3d3fd55..fc162c0 100644 --- a/app/hero.tsx +++ b/app/hero.tsx @@ -27,7 +27,7 @@ export const Hero = () => { distort={0.3} wireframe={true} wireframeLinewidth={5} - color={fullConfig.theme.colors.purple["600"]} + color={(fullConfig.theme?.colors?.purple?.["600"] as string) ?? "#000000"} transparent opacity={0.4} blending={THREE.AdditiveBlending} diff --git a/components/StartupDetails.tsx b/components/StartupDetails.tsx index 1ec09ed..cf7a658 100644 --- a/components/StartupDetails.tsx +++ b/components/StartupDetails.tsx @@ -1,33 +1,32 @@ +"use client"; + import Image from 'next/image'; import Link from 'next/link'; import { Startup } from '@data/e-lab'; +import { useState } from 'react'; const StartupDetails = ({ startup }: { startup: Startup }) => { + const [imageError, setImageError] = useState(false); + return ( -
    +
    -
    - {`${startup.name} + +

    {startup.name}

    + {!imageError && ( + {`${startup.name} setImageError(true)} + /> + )}

    {startup.description}

    -

    Founders

    -
      - {startup.founders.map((founder) => ( -
    • - {founder.name} - {founder.role} -
    • - ))} -
    -

    Metrics

      {Object.entries(startup.metrics).map(([key, value]) => ( @@ -40,6 +39,15 @@ const StartupDetails = ({ startup }: { startup: Startup }) => {

      About {startup.name}

      {startup.about}

      +

      Founders

      +
        + {startup.founders.map((founder) => ( +
      • + {founder.name} - {founder.role} +
      • + ))} +
      + ; + +export const startups: Startup[] = [ { "id": "airbnb", "name": "Airbnb", @@ -27,4 +45,4 @@ "website": "https://www.airbnb.com", "logo": "/assets/e-lab/startups/airbnb-logo.png" } -] \ No newline at end of file +]; \ No newline at end of file