import React, { useContext } from "react" import BoxFull from "../base/BoxFull" import ContextUser from "../../contexts/ContextUser" import useData from "../../hooks/useData" import RepositorySummaryBase from "./RepositorySummaryBase" import Loading from "../base/Loading" import BoxAlert from "../base/BoxAlert" /** * A {@link BoxFull} listing all the user's active repositories. * * @param props - Additional props to pass to the box. * @returns {JSX.Element} * @constructor */ export default function BoxRepositoriesActive({ ...props }) { const {fetchDataAuth} = useContext(ContextUser) const {data, started, loading, error} = useData(fetchDataAuth, "GET", "/api/v1/repositories/", { "onlyAlive": true, }) let contents; if(!started || loading) { contents = } else if(error) { contents = {error.toString()} } else { let repositories = [...data["owner"], ...data["spectator"]] if(repositories.length > 0) { contents = repositories.map(repo => ) } else { contents = There's nothing here. } } return ( {contents} ) }