diff --git a/components/HeroContainer.tsx b/components/HeroContainer.tsx index 48c27111..552582fb 100644 --- a/components/HeroContainer.tsx +++ b/components/HeroContainer.tsx @@ -2,7 +2,12 @@ import { GitHubIcon } from "./GitHubIcon"; import { HappyCommitsInfo } from "./HappyCommitsInfo"; import { BinaryCode } from "./BinaryCode"; -export const HeroContainer = ({filter, setFilter}) => { +type FilterProps = { + filter: string; + setFilter: (filter: string) => void; +}; + +export const HeroContainer = ({filter, setFilter}: FilterProps) => { return ( <>
{ -// return ( -//
-// {numIssues} -// -//
-// ); -// }; - export const IssueItem = ({ issue }: IssueItemProps) => { return (
  • @@ -35,7 +19,6 @@ export const IssueItem = ({ issue }: IssueItemProps) => { > {issue.title} - {/* {issue.comments_count > 0 && } */}
  • ); diff --git a/components/RepositoryMetadata.tsx b/components/RepositoryMetadata.tsx index 2f4d4699..d03bd9b7 100644 --- a/components/RepositoryMetadata.tsx +++ b/components/RepositoryMetadata.tsx @@ -43,7 +43,7 @@ export const RepositoryMetadata = ({
    - SDG-1 + {repositoryTopics && repositoryTopics.map(topic => topic.display).join(', ')}
    diff --git a/pages/index.tsx b/pages/index.tsx index 77b2637b..e2d46014 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -16,7 +16,7 @@ export default function Home() { Happy Commits | Make your next open-source contribution matter. - + ); diff --git a/pages/language/[tag].tsx b/pages/language/[tag].tsx deleted file mode 100644 index b5446f1b..00000000 --- a/pages/language/[tag].tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { GetStaticPaths, GetStaticProps } from "next"; -import Head from "next/head"; -import { ParsedUrlQuery } from "querystring"; - -import { RepositoryList } from "../../components/RepositoryList"; -import data from "../../generated.json"; -import { useAppData } from "../../hooks/useAppData"; - -interface Params extends ParsedUrlQuery { - tag: string; -} - -type LanguageProps = { - tag: Params["tag"]; -}; - -export const getStaticPaths: GetStaticPaths = async () => { - return { - paths: data.languages.map((language) => ({ - params: { tag: language.id } - })), - fallback: false - }; -}; - -export const getStaticProps: GetStaticProps = async ({ - params = {} as Params -}) => { - return { - props: { tag: params.tag } - }; -}; - -export default function Language({ tag }: LanguageProps) { - const { repositories, languages } = useAppData(); - - const language = languages.find((language) => language.id === tag); - const pageTitle = `First Issue | ${language?.display} Language`; - - return ( - <> - - {pageTitle} - - repository.language.id === tag)} - /> - - ); -} diff --git a/pages/search/[tag].tsx b/pages/search/[tag].tsx deleted file mode 100644 index 13d7e097..00000000 --- a/pages/search/[tag].tsx +++ /dev/null @@ -1,42 +0,0 @@ -import Head from "next/head"; -import { useRouter } from "next/router"; - -import { RepositoryList } from "../../components/RepositoryList"; -import { useAppData } from "../../hooks/useAppData"; -import { CountableTag } from "../../types"; - -export default function Language() { - const { repositories, languages, topics } = useAppData(); - - const router = useRouter(); - const { query } = router.query; - - const pageTitle = `First Issue | Search ${query}`; - - const queriedLanguages = languages.filter((language: CountableTag) => - language.display?.toLowerCase().includes(query as string) - ); - const queriedTopics = topics.filter((topic: CountableTag) => - topic.display?.toLowerCase().includes(query as string) - ); - const queriedRepositories = repositories.filter( - (repository) => - repository.owner.toLowerCase().includes(query as string) || - repository.name.toLowerCase().includes(query as string) || - repository.language.display?.toLowerCase().includes(query as string) || - repository.topics?.some((topic) => topic.display?.toLowerCase().includes(query as string)) || - repository.issues?.some((issue) => issue.title.toLowerCase().includes(query as string)) - ); - - // show repositories that have the tag in either title, description, language or topics or issues - return ( - <> - - {pageTitle} - - - {queriedLanguages} - {queriedTopics} - - ); -} diff --git a/pages/topic/[tag].tsx b/pages/topic/[tag].tsx deleted file mode 100644 index 75b69596..00000000 --- a/pages/topic/[tag].tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { GetStaticPaths, GetStaticProps } from "next"; -import Head from "next/head"; -import { ParsedUrlQuery } from "querystring"; - -import { RepositoryList } from "../../components/RepositoryList"; -import data from "../../generated.json"; -import { useAppData } from "../../hooks/useAppData"; - -interface Params extends ParsedUrlQuery { - tag: string; -} - -type TopicProps = { - tag: Params["tag"]; -}; - -export const getStaticPaths: GetStaticPaths = async () => { - return { - paths: data.topics.map((topic) => ({ - params: { tag: topic.id } - })), - fallback: false - }; -}; - -export const getStaticProps: GetStaticProps = async ({ - params = {} as Params -}) => { - return { - props: { tag: params.tag } - }; -}; - -export default function Topic({ tag }: TopicProps) { - const { repositories, topics } = useAppData(); - - const topic = topics.find((topic) => topic.id === tag); - const pageTitle = `First Issue | Topic ${topic?.display}`; - - return ( - <> - - {pageTitle} - - - repository.topics?.some((topic) => topic.id === tag) - )} - /> - - ); -}