Skip to content

Commit

Permalink
Merge pull request #64 from Favo02/favo02-unimi-organization
Browse files Browse the repository at this point in the history
Add `favo02-unimi` organization repositories
  • Loading branch information
Favo02 authored Jul 24, 2023
2 parents d1ed1ca + cef93bb commit 1beb23e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/components/Interests/InterestProjectExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import Loading from "../Common/Loading"
import FetchRepositoryDetails from "../Projects/FetchRepositoryDetails"
import ProjectCard from "../Projects/ProjectCard"

const InterestProjectExample : FC<{ name : string }> = ({ name }) => {
const InterestProjectExample : FC<{ name : string, user : string }> = ({ name, user }) => {

const [loading, setLoading] = useState<boolean>(true)
const [repo, setRepo] = useState<Repository>()

useEffect(() => {
const fetch = async () => {
setLoading(true)
const repo = await repositoriesService.get(name)
const repo = await repositoriesService.get(name, user)

setRepo(repo)

setLoading(false)
}

fetch()
}, [name])
}, [name, user])

if (loading || !repo) {
return (
Expand Down
14 changes: 4 additions & 10 deletions src/components/Interests/InterestSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ import React, { useEffect, useRef,useState } from "react"
import { BsArrowsCollapse, BsArrowsExpand } from "react-icons/bs"
import { Link } from "react-router-dom"

import type Interest from "../../interfaces/Interest"

import InterestProjectExample from "./InterestProjectExample"
import LateralIcons from "./LateralIcons"

interface props {
title : string,
description : string,
languages : string,
icons : React.ReactNode[],
projects : string[]
}

const InterestSection : FC<{interest : props}> = ({ interest }) => {
const InterestSection : FC<{interest : Interest}> = ({ interest }) => {

const [isOpen, setOpen] = useState(false)

Expand Down Expand Up @@ -44,7 +38,7 @@ const InterestSection : FC<{interest : props}> = ({ interest }) => {

<div className={`${isOpen ? "h-[22rem] opacity-100" : "h-0 opacity-0"} transition-all duration-700`}>
<div className="flex justify-center">
{interest.projects.map(p => <InterestProjectExample key={p} name={p} />)}
{interest.projects.map(p => <InterestProjectExample key={p.name} name={p.name} user={p.owner} />)}
</div>
<p className="italic text-gray-600">
And more... Visit
Expand Down
2 changes: 1 addition & 1 deletion src/components/Projects/ProjectsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Projects : FC = () => {

const fetch = async () => {
setLoading(true)
const allRepos = await repositoriesService.getAll()
const allRepos = [...await repositoriesService.getAll("Favo02"), ...await repositoriesService.getAll("Favo02-unimi")]

const nrepos = allRepos
.filter((r : Repository) => !ignoredRepos.includes(r.name))
Expand Down
12 changes: 12 additions & 0 deletions src/interfaces/Interest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface Interest {
title : string,
description : string,
languages : string,
icons : React.ReactNode[],
projects : {
name : string,
owner : string
}[]
}

export default Interest
17 changes: 5 additions & 12 deletions src/pages/Interests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ import { SiC, SiExpress, SiGnubash, SiMongodb, SiPostgresql,SiReact, SiTailwindc
import { TbBrandGolang, TbBrandJavascript,TbBrandTypescript } from "react-icons/tb"

import InterestSection from "../components/Interests/InterestSection"
import type Interest from "../interfaces/Interest"

import "../assets/styles/animations.css"

interface Interest {
title : string,
description : string,
languages : string,
icons : React.ReactNode[],
projects : string[]
}

const Interests : FC = () => {

const interests : Interest[] = [
Expand All @@ -28,7 +21,7 @@ const Interests : FC = () => {
<TbBrandGolang key="Go" />,
<FaPython key="Python" />
],
"projects": ["advent-of-code", "cloudflight-coding-contest-2023"]
"projects": [{ name: "advent-of-code", owner: "Favo02" }, { name: "cloudflight-coding-contest-2023", owner: "Favo02" }]
},
{
"title": "Full stack web development",
Expand All @@ -43,7 +36,7 @@ const Interests : FC = () => {
<SiMongodb key="Mongo" />,
<SiPostgresql key="Postgres" />
],
"projects": ["favo02.dev", "social-network-for-music"]
"projects": [{ name: "favo02.dev", owner: "Favo02" }, { name: "social-network-for-music", owner: "Favo02-unimi" }]
},
{
"title": "Open source software",
Expand All @@ -53,7 +46,7 @@ const Interests : FC = () => {
<FaJava key="Java" />,
<TbBrandJavascript key="Javascript" />
],
"projects": ["workspaces-by-open-apps", "java-algorithms-and-structures"]
"projects": [{ name: "workspaces-by-open-apps", owner: "Favo02" }, { name: "java-algorithms-and-structures", owner: "Favo02" }]
},
{
"title": "Learning...",
Expand All @@ -65,7 +58,7 @@ const Interests : FC = () => {
<IoMdFlag key="ctf" />,
<SiC key="c" />
],
"projects": ["docker-compose"]
"projects": [{ name: "docker-compose", owner: "Favo02" }]
}
]

Expand Down
8 changes: 4 additions & 4 deletions src/services/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import axios from "axios"
// backend needed to proxy requests
const baseUrl = "https://api.github.com"

const getAll = async () => {
const res = await axios.get(`${baseUrl}/users/Favo02/repos`)
const getAll = async (user : string) => {
const res = await axios.get(`${baseUrl}/users/${user}/repos`)
return res.data
}

const get = async (name : string) => {
const res = await axios.get(`${baseUrl}/repos/Favo02/${name}`)
const get = async (name : string, user : string) => {
const res = await axios.get(`${baseUrl}/repos/${user}/${name}`)
return res.data
}

Expand Down

0 comments on commit 1beb23e

Please sign in to comment.