diff --git a/CHANGELOG.md b/CHANGELOG.md index a5feadfd3a..909db5e4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,47 @@ > All notable changes to this project will be documented in this file +## [1.51.0-beta.2](https://github.com/open-sauced/insights/compare/v1.51.0-beta.1...v1.51.0-beta.2) (2023-06-06) + + +### πŸ• Features + +* add share tracking ([#1250](https://github.com/open-sauced/insights/issues/1250)) ([5b7d331](https://github.com/open-sauced/insights/commit/5b7d3317d4670d46611ed6bb1439e24974f7ddc4)) + + +### πŸ› Bug Fixes + +* update hook for Posthog ([cd4f32c](https://github.com/open-sauced/insights/commit/cd4f32c506dc370a88fa2fa451995704f4818994)) +* update medium activity threshold for repositories ([#1251](https://github.com/open-sauced/insights/issues/1251)) ([4730533](https://github.com/open-sauced/insights/commit/4730533c2426a58f39bbc4d6b06cd7291d96652f)), closes [#1224](https://github.com/open-sauced/insights/issues/1224) + +## [1.51.0-beta.1](https://github.com/open-sauced/insights/compare/v1.50.1-beta.3...v1.51.0-beta.1) (2023-06-06) + + +### πŸ• Features + +* implement dynamic redirect on auth ([#1240](https://github.com/open-sauced/insights/issues/1240)) ([548cc4d](https://github.com/open-sauced/insights/commit/548cc4df7c4758c9fbe45054ab4b889b7180f011)) + +### [1.50.1-beta.3](https://github.com/open-sauced/insights/compare/v1.50.1-beta.2...v1.50.1-beta.3) (2023-06-06) + + +### πŸ› Bug Fixes + +* reports select issue ([#1239](https://github.com/open-sauced/insights/issues/1239)) ([a48bc87](https://github.com/open-sauced/insights/commit/a48bc879b23bf9bfe43164b4377a607741a58d2a)) + +### [1.50.1-beta.2](https://github.com/open-sauced/insights/compare/v1.50.1-beta.1...v1.50.1-beta.2) (2023-06-05) + + +### πŸ› Bug Fixes + +* Footer Location on Smaller Screens ([#1242](https://github.com/open-sauced/insights/issues/1242)) ([8b2356a](https://github.com/open-sauced/insights/commit/8b2356ab0b28a3582c32a28985356110e405448e)) + +### [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/components/molecules/AuthSection/auth-section.tsx b/components/molecules/AuthSection/auth-section.tsx index 79b85c0ff7..b9e9c9f341 100644 --- a/components/molecules/AuthSection/auth-section.tsx +++ b/components/molecules/AuthSection/auth-section.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from "react"; import Image from "next/image"; +import { useRouter } from "next/router"; import Link from "next/link"; import { IoNotifications } from "react-icons/io5"; @@ -26,11 +27,20 @@ import { authSession } from "lib/hooks/authSession"; import { Spinner } from "components/atoms/SpinLoader/spin-loader"; const AuthSection: React.FC = ({}) => { + const router = useRouter(); + const currentPath = router.asPath; + const { signIn, signOut, user, sessionToken } = useSupabaseAuth(); const { onboarded } = useSession(); const [notifications, setNotifications] = useState([]); const [loading, setLoading] = useState(false); const [userInfo, setUserInfo] = useState(undefined); + const [host, setHost] = useState(""); + useEffect(() => { + if (typeof window !== "undefined") { + setHost(window.location.origin as string); + } + }, []); // Fetch user notifications const fetchNotifications = async () => { @@ -158,7 +168,12 @@ const AuthSection: React.FC = ({}) => { ) : ( - )} 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/molecules/ContributorProfileHeader/contributor-profile-header.tsx b/components/molecules/ContributorProfileHeader/contributor-profile-header.tsx index c6df0d8c9b..8501f76c95 100644 --- a/components/molecules/ContributorProfileHeader/contributor-profile-header.tsx +++ b/components/molecules/ContributorProfileHeader/contributor-profile-header.tsx @@ -8,6 +8,7 @@ import { MarkGithubIcon } from "@primer/octicons-react"; import { User } from "@supabase/supabase-js"; import { FiCopy } from "react-icons/fi"; import { useToast } from "lib/hooks/useToast"; +import { usePostHog } from "posthog-js/react"; interface ContributorProfileHeaderProps { avatarUrl?: string; @@ -31,8 +32,9 @@ const ContributorProfileHeader = ({ username, user, handleSignIn, - isOwner + isOwner, }: ContributorProfileHeaderProps) => { + const posthog = usePostHog(); const { toast } = useToast(); const [host, setHost] = useState(""); const handleFollowClick = () => { @@ -45,6 +47,10 @@ const ContributorProfileHeader = ({ const handleCopyToClipboard = async (content: string) => { const url = new URL(content).toString(); + posthog!.capture("clicked: profile copied", { + profile: user?.user_metadata.user_name, + }); + try { await navigator.clipboard.writeText(url); toast({ description: "Copied to clipboard", variant: "success" }); @@ -92,7 +98,11 @@ const ContributorProfileHeader = ({ {isConnected && (
- {user ? ( diff --git a/components/molecules/RepoRow/repo-row.tsx b/components/molecules/RepoRow/repo-row.tsx index 1380f024aa..0c7f6ba67c 100644 --- a/components/molecules/RepoRow/repo-row.tsx +++ b/components/molecules/RepoRow/repo-row.tsx @@ -43,7 +43,7 @@ export const getActivity = (total?: number, loading?: boolean) => { return } text="High" color="green" />; } - if (total >= 20 && total <= 80) { + if (total >= 5 && total <= 80) { return } text="Medium" color="yellow" />; } diff --git a/components/molecules/SelectReportsFilter/select-reports-filter.tsx b/components/molecules/SelectReportsFilter/select-reports-filter.tsx index a91482b41c..a13bfaf196 100644 --- a/components/molecules/SelectReportsFilter/select-reports-filter.tsx +++ b/components/molecules/SelectReportsFilter/select-reports-filter.tsx @@ -6,7 +6,7 @@ import { FilterOptions } from "interfaces/filter-object-types"; import { useState } from "react"; interface SelectReportsFilterProps { - filterList?: FilterOptions[]; + filterList: FilterOptions[]; callback: (selectedValue: string) => any; } @@ -23,13 +23,15 @@ const SelectReportsFilter = ({ filterList, callback }: SelectReportsFilterProps) return (
Select a Filter - - Download the filtered pull requests from the filtered repositories for the last 30 days as a CSV. - + Download the filtered pull requests from the filtered repositories for the last 30 days as a CSV.
- setSelectedValue(value)}> - {selectedValue ? selectedValue : "Select a Filter"} + + {selectedValue + ? filterList.find((filter) => filter.filterValue === selectedValue)?.filterName + : "Select a Filter"} + {filterList?.map(({ filterName, filterValue }, index) => ( 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} /> { return ( -