Skip to content

Commit

Permalink
Merge pull request #19 from jatimdevday/feat/dynamic-parallel-speaker
Browse files Browse the repository at this point in the history
Feat : Add dynamic content parallel speaker
  • Loading branch information
fahmisyaifudin authored Sep 30, 2024
2 parents 9aade9d + 26e56e6 commit 68aa9ff
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 39 deletions.
15 changes: 15 additions & 0 deletions src/lib/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Content,
Events,
Galleries,
ParallelSpeakers,
Speakers,
ThrowbackEvent,
} from "./schema";
Expand Down Expand Up @@ -59,6 +60,20 @@ export async function getSpeakers(): Promise<Speakers | Error> {
}
}

export async function getParallelSpeakers(): Promise<ParallelSpeakers | Error> {
try {
const dbRef = ref(getDatabase());
const data = await get(child(dbRef, "parallel"));
if (data.exists()) {
return data.val() as Speakers;
} else {
throw new Error("Speaker data not found");
}
} catch (error) {
return Error(undefined);
}
}

export async function getGalleries(): Promise<Galleries | Error> {
try {
const dbRef = ref(getDatabase());
Expand Down
6 changes: 6 additions & 0 deletions src/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export type Content = {

export type Galleries = string[];

export type ParallelSpeakers = {
name: string;
photo: string;
title: string;
}[];

export type Speakers = {
name: string;
photo: string;
Expand Down
42 changes: 3 additions & 39 deletions src/screens/landing/sections/Parallel.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,10 @@
import Image from "next/image";
import PrimaryStar from "@/assets/svgs/PrimaryStar";
import { getParallelSpeakers } from "@/lib/firebase";
import { ParallelSpeakers } from "@/lib/schema";

const Parallel = async () => {
// TODO: need to change into real data
const speakers = [
{
linkedin: "https://www.linkedin.com/in/rubiagatra",
name: "Doni Rubiagtra",
photo:
"https://firebasestorage.googleapis.com/v0/b/jdd2024-b625b.appspot.com/o/speaker%2Fdoni_rubiagatra.jpg?alt=media&token=fc1134b9-bba0-4cce-bb61-84b3177cafec",
title: "Partner & VP of Engineering at Zero One Group",
twitter: "https://x.com/rubiagatra",
youtube: "",
},
{
linkedin: "https://www.linkedin.com/in/rubiagatra",
name: "Doni Rubiagtra",
photo:
"https://firebasestorage.googleapis.com/v0/b/jdd2024-b625b.appspot.com/o/speaker%2Fdoni_rubiagatra.jpg?alt=media&token=fc1134b9-bba0-4cce-bb61-84b3177cafec",
title: "Partner & VP of Engineering at Zero One Group",
twitter: "https://x.com/rubiagatra",
youtube: "",
},
{
linkedin: "https://www.linkedin.com/in/rubiagatra",
name: "Doni Rubiagtra",
photo:
"https://firebasestorage.googleapis.com/v0/b/jdd2024-b625b.appspot.com/o/speaker%2Fdoni_rubiagatra.jpg?alt=media&token=fc1134b9-bba0-4cce-bb61-84b3177cafec",
title: "Partner & VP of Engineering at Zero One Group",
twitter: "https://x.com/rubiagatra",
youtube: "",
},
{
linkedin: "https://www.linkedin.com/in/rubiagatra",
name: "Doni Rubiagtra",
photo:
"https://firebasestorage.googleapis.com/v0/b/jdd2024-b625b.appspot.com/o/speaker%2Fdoni_rubiagatra.jpg?alt=media&token=fc1134b9-bba0-4cce-bb61-84b3177cafec",
title: "Partner & VP of Engineering at Zero One Group",
twitter: "https://x.com/rubiagatra",
youtube: "",
},
];
const speakers = (await getParallelSpeakers()) as ParallelSpeakers;

return (
<div className="bg-darkBg py-12 md:py-24" id="speakers">
Expand Down

0 comments on commit 68aa9ff

Please sign in to comment.