From eff01c0f88c05f57925a0ec021e78676ba9d915f Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 1 Jun 2023 17:41:19 -0500 Subject: [PATCH 01/12] fix: update contributors hook to use contributor API endpoint (#1238) --- .../contributor-list-table-row.tsx | 4 ++-- .../organisms/Contributors/contributors.tsx | 4 +--- .../ContributorsTable/contributors-table.tsx | 2 +- components/organisms/Dashboard/dashboard.tsx | 14 +++++++------- lib/hooks/api/useContributors.ts | 17 ++++++++--------- next-types.d.ts | 5 +++++ 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/components/molecules/ContributorListTableRow/contributor-list-table-row.tsx b/components/molecules/ContributorListTableRow/contributor-list-table-row.tsx index 39ee43ee55..c879e9e32f 100644 --- a/components/molecules/ContributorListTableRow/contributor-list-table-row.tsx +++ b/components/molecules/ContributorListTableRow/contributor-list-table-row.tsx @@ -14,7 +14,7 @@ import useRepoList from "lib/hooks/useRepoList"; import { useFetchUser } from "lib/hooks/useFetchUser"; interface ContributorListTableRow { - contributor: DbRepoPR; + contributor: DbPRContributor; topic: string; } @@ -50,7 +50,7 @@ const ContributorListTableRow = ({ contributor, topic }: ContributorListTableRow const totalPrs = data.length; const last30days = [ { - id: `last30-${contributor.repo_id}`, + id: `last30-${contributor.author_login}`, color: "hsl(63, 70%, 50%)", data: days, }, diff --git a/components/organisms/Contributors/contributors.tsx b/components/organisms/Contributors/contributors.tsx index f2e020818b..5c1bc8b0d6 100644 --- a/components/organisms/Contributors/contributors.tsx +++ b/components/organisms/Contributors/contributors.tsx @@ -34,7 +34,7 @@ const Contributors = ({ repositories }: ContributorProps): JSX.Element => { const contributors = data.map((pr) => { return { host_login: pr.author_login, - first_commit_time: pr.created_at, + first_commit_time: pr.updated_at, }; }); @@ -52,8 +52,6 @@ const Contributors = ({ repositories }: ContributorProps): JSX.Element => { }; }); - // console.log(data); - return ( <> {/* Table section */} diff --git a/components/organisms/ContributorsTable/contributors-table.tsx b/components/organisms/ContributorsTable/contributors-table.tsx index 0904765f86..e0da776e0f 100644 --- a/components/organisms/ContributorsTable/contributors-table.tsx +++ b/components/organisms/ContributorsTable/contributors-table.tsx @@ -3,7 +3,7 @@ import ContributorListTableRow from "components/molecules/ContributorListTableRo import React from "react"; export interface ContributorTableProps { - contributors: DbRepoPR[]; + contributors: DbPRContributor[]; topic: string; loading?: boolean; } diff --git a/components/organisms/Dashboard/dashboard.tsx b/components/organisms/Dashboard/dashboard.tsx index 891b138995..eb608c6608 100644 --- a/components/organisms/Dashboard/dashboard.tsx +++ b/components/organisms/Dashboard/dashboard.tsx @@ -12,7 +12,7 @@ import { getInsights, useInsights } from "lib/hooks/api/useInsights"; import { calcDaysFromToday } from "lib/utils/date-utils"; import roundedImage from "lib/utils/roundedImages"; import usePullRequests from "lib/hooks/api/usePullRequests"; -import getPullRequestsContributors from "lib/utils/get-pr-contributors"; +import useContributors from "lib/hooks/api/useContributors"; type ContributorPrMap = { [contributor: string]: DbRepoPR }; export type PrStatusFilter = "open" | "closed" | "all"; @@ -23,11 +23,11 @@ interface DashboardProps { const Dashboard = ({ repositories }: DashboardProps): JSX.Element => { const { data: insightsData, isLoading } = useInsights(repositories); - const { data: prData, meta: prMeta, isError: prError } = usePullRequests(undefined, repositories); + const { data: prData, isError: prError } = usePullRequests(undefined, repositories); + const { data: contributorData, meta: contributorMeta } = useContributors(undefined, repositories); const [showBots, setShowBots] = useState(false); const isMobile = useMediaQuery("(max-width:720px)"); const [prStateFilter, setPrStateFilter] = useState("all"); - const contributorData = getPullRequestsContributors(prData); const handleSetPrFilter = (state: PrStatusFilter) => { setPrStateFilter(state); @@ -37,7 +37,7 @@ const Dashboard = ({ repositories }: DashboardProps): JSX.Element => { let metadata: ScatterChartMetadata = { allPrs: prData.length, openPrs: prData.filter((pr) => pr.state.toLowerCase() === "open").length, - closedPrs: prData.filter((pr) => pr.state.toLowerCase() === "closed" || pr.state.toLowerCase() === "merged").length + closedPrs: prData.filter((pr) => pr.state.toLowerCase() === "closed" || pr.state.toLowerCase() === "merged").length, }; const uniqueContributors: ContributorPrMap = prData.reduce((prs, curr) => { @@ -73,7 +73,7 @@ const Dashboard = ({ repositories }: DashboardProps): JSX.Element => { x: calcDaysFromToday(new Date(updated_at)), y: linesCount, contributor: author_login, - image: roundedImage(`https://www.github.com/${author_image}.png?size=60`, process.env.NEXT_PUBLIC_CLOUD_NAME) + image: roundedImage(`https://www.github.com/${author_image}.png?size=60`, process.env.NEXT_PUBLIC_CLOUD_NAME), }; return data; }); @@ -99,8 +99,8 @@ const Dashboard = ({ repositories }: DashboardProps): JSX.Element => { metricIncreases={compare1.allPrsTotal - compare2.allPrsTotal >= 0} increased={compare1.allPrsTotal - compare2.allPrsTotal >= 0} numChanged={humanizeNumber(Math.abs(compare1.allPrsTotal - compare2.allPrsTotal), "abbreviation")} - value={humanizeNumber(prMeta.itemCount, "comma")} - contributors={contributorData} + value={humanizeNumber(contributorMeta.itemCount, "comma")} + contributors={contributorData.map((contributor) => ({ host_login: contributor.author_login }))} isLoading={isLoading} /> { const router = useRouter(); @@ -51,7 +50,7 @@ const useContributors = (intialLimit = 10, repoIds: number[] = [], range = 30) = query.set("range", `${range}`); - const baseEndpoint = "prs/search"; + const baseEndpoint = "contributors/search"; const endpointString = `${baseEndpoint}?${query.toString()}`; const { data, error, mutate } = useSWR( @@ -67,7 +66,7 @@ const useContributors = (intialLimit = 10, repoIds: number[] = [], range = 30) = mutate, page, setPage, - setLimit + setLimit, }; }; diff --git a/next-types.d.ts b/next-types.d.ts index 5f44f1a40d..7978f44671 100644 --- a/next-types.d.ts +++ b/next-types.d.ts @@ -41,6 +41,11 @@ interface DbRepoPR { readonly last_updated_at: string; } +interface DbPRContributor { + readonly author_login: string; + readonly updated_at: string; +} + interface DbFollowUser { readonly id: number; readonly user_id: number; From 5afb38f806d3b4c25866a34beceaba552bb7c7e9 Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 1 Jun 2023 22:46:25 +0000 Subject: [PATCH 02/12] chore(patch): release 1.50.1-beta.1 on beta channel [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### [1.50.1-beta.1](https://github.com/open-sauced/insights/compare/v1.50.0...v1.50.1-beta.1) (2023-06-01) ### πŸ› Bug Fixes * update contributors hook to use contributor API endpoint ([#1238](https://github.com/open-sauced/insights/issues/1238)) ([eff01c0](https://github.com/open-sauced/insights/commit/eff01c0f88c05f57925a0ec021e78676ba9d915f)) --- CHANGELOG.md | 7 +++++++ npm-shrinkwrap.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5feadfd3a..eb5c708642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ > All notable changes to this project will be documented in this file +### [1.50.1-beta.1](https://github.com/open-sauced/insights/compare/v1.50.0...v1.50.1-beta.1) (2023-06-01) + + +### πŸ› Bug Fixes + +* update contributors hook to use contributor API endpoint ([#1238](https://github.com/open-sauced/insights/issues/1238)) ([eff01c0](https://github.com/open-sauced/insights/commit/eff01c0f88c05f57925a0ec021e78676ba9d915f)) + ## [1.50.0](https://github.com/open-sauced/insights/compare/v1.49.0...v1.50.0) (2023-06-01) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 1533391206..b7a4c42dbd 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@open-sauced/insights", - "version": "1.50.0", + "version": "1.50.1-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@open-sauced/insights", - "version": "1.50.0", + "version": "1.50.1-beta.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 932fb688a1..5a9262a48d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@open-sauced/insights", "description": "πŸ•The dashboard for open source discovery.", "keywords": [], - "version": "1.50.0", + "version": "1.50.1-beta.1", "author": "TED Vortex ", "private": true, "license": "MIT", From 8b2356ab0b28a3582c32a28985356110e405448e Mon Sep 17 00:00:00 2001 From: Brandon Pirrocco <84143468+bpirrocco@users.noreply.github.com> Date: Mon, 5 Jun 2023 09:44:21 -0400 Subject: [PATCH 03/12] fix: Footer Location on Smaller Screens (#1242) update body background color and remove background on footer --- components/organisms/Footer/footer.tsx | 2 +- styles/globals.css | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/organisms/Footer/footer.tsx b/components/organisms/Footer/footer.tsx index 61c2f949c3..35e12e2d64 100644 --- a/components/organisms/Footer/footer.tsx +++ b/components/organisms/Footer/footer.tsx @@ -59,7 +59,7 @@ const footerContext = [ const Footer = (): JSX.Element => { return ( -