diff --git a/frontend/components/DatasetsPage.tsx b/frontend/components/DatasetsPage.tsx new file mode 100644 index 0000000..9ed1d82 --- /dev/null +++ b/frontend/components/DatasetsPage.tsx @@ -0,0 +1,111 @@ +"use client"; +import { useState, useEffect } from "react"; +import { + Box, + Button, + Container, + Flex, + Heading, + Icon, + Stack, + Text, + useColorModeValue, +} from "@chakra-ui/react"; +import { ReactElement } from "react"; +import { + FcAbout, + FcAssistant, + FcCollaboration, + FcDonate, + FcManager, +} from "react-icons/fc"; + +import Link from "next/link"; + +import { datasets } from "@/app/datasets/config"; + +import axios from "axios"; +import { useQuery } from "react-query"; +import { API_URL } from "@/app/config"; + +const fetchDatasets = async () => { + try { + const response = await axios.get(`${API_URL}/datasets/`, {}); + return response.data; + } catch (error) { + console.error("Error fetching datasets:", error); + return []; + } +}; + +interface CardProps { + heading: string; + href: string; +} + +function capitalizeFirstLetter(word: string) { + if (!word) return word; + return word.charAt(0).toUpperCase() + word.slice(1); +} + +const Card = ({ heading, href }: CardProps) => { + return ( + + + + {heading} + + + + + + + ); +}; + +export default function DatasetsList() { + const [datasets, setDatasets] = useState([]); + const { isLoading, error, data } = useQuery("fetchDatasets", fetchDatasets); + + useEffect(() => { + if (error || isLoading) { + setDatasets([]); + } else { + setDatasets(data); + } + }, [error, data, isLoading]); + return ( + + + + Datasets + + + Browse through the different datasets that we have built at AI4Bharat + + + + + + {datasets.map((dataset: any) => ( + + ))} + + + + ); +} diff --git a/frontend/components/Hero.tsx b/frontend/components/Hero.tsx index bba7472..aafacbd 100644 --- a/frontend/components/Hero.tsx +++ b/frontend/components/Hero.tsx @@ -37,7 +37,11 @@ export default function Hero() { > - + ; +} diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 1e0fdf1..0598fba 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -6,6 +6,9 @@ export const metadata: Metadata = { title: "AI4Bharat", description: "AI4Bharat is a research lab at IIT Madras which works on developing open-source datasets, tools, models and applications for Indian languages.", + openGraph: { + images: "/assets/logos/ai4bclogo.png", + }, }; export default function RootLayout({