diff --git a/frontend/src/app/publications/page.tsx b/frontend/src/app/publications/page.tsx index 1bb1d17..9ff16a0 100644 --- a/frontend/src/app/publications/page.tsx +++ b/frontend/src/app/publications/page.tsx @@ -22,6 +22,14 @@ import { useCheckbox, useCheckboxGroup, UseCheckboxProps, + Modal, + ModalOverlay, + ModalContent, + ModalHeader, + ModalFooter, + ModalBody, + ModalCloseButton, + useDisclosure, } from "@chakra-ui/react"; import { FaPaperclip, FaGithub, FaCode } from "react-icons/fa"; import { useQuery } from "react-query"; @@ -111,7 +119,7 @@ const fetchPubFilters = async () => { const fetchPublications = async () => { try { - const response = await axios.get(`${API_URL}/publications/`); + const response = await axios.get(`${API_URL}/pubs/`); return response.data; } catch (error) { console.error("Error fetching publications:", error); @@ -125,185 +133,106 @@ interface Publication { area: string; conference: string; published_on: string; - colab_link: string; - hf_link: string; + dataset: any; + model: any; paper_link: string; - github_link: string; - type: string; } -// const Publications = () => { -// const isMobile = useBreakpointValue({ base: true, md: false }); -// const [filters, setFilters] = useState({ -// areas: [], -// conferences: [], -// years: [], -// }); - -// const [publications, setPublications] = useState>([]); -// const [filteredPublications, setFilteredPublications] = useState< -// Publication[] -// >([]); - -// const [selectedAreas, setSelectedAreas] = useState([]); -// const [selectedYears, setSelectedYears] = useState([]); -// const [selectedConferences, setSelectedConferences] = useState([]); - -// const { -// data: filterData, -// isLoading: filterLoading, -// error: filterError, -// } = useQuery("fetchFilters", fetchPubFilters); -// const { -// data: pubData, -// isLoading: pubLoading, -// error: pubError, -// } = useQuery("fetchPublications", fetchPublications); - -// useEffect(() => { -// if (!filterLoading && !filterError) { -// setFilters(filterData); -// } - -// if (!pubLoading && !pubError) { -// setPublications(pubData); -// setFilteredPublications(pubData); -// } -// }, [filterLoading, filterError, filterData, pubLoading, pubError, pubData]); - -// useEffect(() => { -// const filtered = publications.filter((pub) => { -// const matchesArea = -// selectedAreas.length === 0 || selectedAreas.includes(pub.area); -// const matchesConference = -// selectedConferences.length === 0 || -// selectedConferences.includes(pub.conference); -// const matchesYear = -// selectedYears.length === 0 || -// selectedYears.includes( -// new Date(pub.published_on).getFullYear().toString() -// ); -// return matchesArea && matchesConference && matchesYear; -// }); - -// setFilteredPublications(filtered); -// }, [selectedAreas, selectedConferences, selectedYears, publications]); - -// const handleSelect = (setter: any) => (value: any) => { -// setter((prev: any) => -// prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value] -// ); -// }; - -// return ( -// -// -// Publications -// -// -// -// -// Area:{" "} -// -// -// -// {filters.areas.map((value) => ( -// handleSelect(setSelectedAreas)(value)} -// > -// {value} -// -// ))} -// -// -// -// -// -// Year:{" "} -// -// -// -// {filters.years.map((value) => ( -// handleSelect(setSelectedYears)(value)} -// > -// {value} -// -// ))} -// -// -// -// -// -// Conference:{" "} -// -// -// -// {filters.conferences.map((value) => ( -// handleSelect(setSelectedConferences)(value)} -// > -// {value} -// -// ))} -// -// -// -// -// -// -//
-// -// {filteredPublications.map((pub, index) => -// pub.paper_link ? ( -// -// -// -// -// ) : ( -// <> -// ) -// )} -// -//
-// ); -// }; - interface CheckboxButtonProps extends UseCheckboxProps { children: ReactNode; } +const EntryModal = ({ + title, + description, + paper_link, + website_link, + github_link, + hf_link, + colab_link, +}: { + title: string; + description: string; + paper_link: string; + website_link: string; + github_link: string; + hf_link: string; + colab_link: string; +}) => { + const { isOpen, onOpen, onClose } = useDisclosure(); + return ( + <> + + + + + + + {title} + + + + + {github_link ? ( + + + + ) : ( + <> + )} + {colab_link ? ( + + + + ) : ( + <> + )} + {paper_link ? ( + + + + ) : ( + <> + )} + {hf_link ? ( + + Hugging Face + + ) : ( + <> + )} + +
+ {description} +
+ + + + +
+
+ + ); +}; + const CheckboxButton = (props: CheckboxButtonProps) => { const { getInputProps, getCheckboxProps } = useCheckbox(props); @@ -471,27 +400,24 @@ const Publications = () => {
- - {filteredPublications.map((pub, index) => - pub.paper_link ? ( - - - - - ) : ( - <> - ) - )} + + {filteredPublications.map((pub, index) => ( + + + + + ))} ); @@ -499,26 +425,20 @@ const Publications = () => { interface CardProps { title: string; + paper_link: string; categories: string[]; - description: string; date: Date; - hf_link: string; - paper_link: string; - github_link: string; - colab_link: string; - type: string; + model: any; + dataset: any; } const Card = ({ title, categories, - description, - date, - hf_link, paper_link, - github_link, - colab_link, - type, + date, + model, + dataset, }: CardProps) => { return ( {title} - - - {github_link ? ( - - - - ) : ( - <> - )} - {colab_link ? ( - - - - ) : ( - <> - )} - {paper_link ? ( - - - + + {model.length !== 0 ? ( + + + Models + + + {model.map((entry: any, index: number) => ( + + ))} + + ) : ( <> )} - {hf_link ? ( - - Hugging Face - + {dataset.length !== 0 ? ( + + + Datasets + + + {dataset.map((entry: any, index: number) => ( + + ))} + + ) : ( <> )} + {/* {model.length !== 0 ? ( + + {model.map((idx, entry) => ( + + ))} + + ) : ( + <> + )} */} + {/* */}