diff --git a/src/Components/PullReqAnalysis/PullReqProgress.tsx b/src/Components/PullReqAnalysis/PullReqProgress.tsx new file mode 100644 index 0000000..7c78e98 --- /dev/null +++ b/src/Components/PullReqAnalysis/PullReqProgress.tsx @@ -0,0 +1,45 @@ +import React, { useState } from "react"; +import { DonutChart, Card, Title } from "@tremor/react"; +import { PullRequestAnalysis } from "@/Interface/api.interface"; +import { RoughNotation } from "react-rough-notation"; + +const PullRequestProgress: React.FC = ({ + OpenCount, + ClosedCount, +}) => { + const valueFormatter = (value: number) => `${value}%`; + const [show, setShow] = useState(true); + + const openCount = typeof OpenCount === "number" ? OpenCount : 0; + const closedCount = typeof ClosedCount === "number" ? ClosedCount : 0; + + const chartData = [ + { name: "Open Count", value: openCount }, + { name: "Closed Count", value: closedCount }, + ]; + + return ( +
+
+ + + {" "} + + Pull Request Analysis + + + + + +
+ ); +}; + +export default PullRequestProgress; diff --git a/src/Interface/api.interface.ts b/src/Interface/api.interface.ts index d14ee43..5207f7c 100644 --- a/src/Interface/api.interface.ts +++ b/src/Interface/api.interface.ts @@ -24,4 +24,9 @@ export interface FollowerFollowingRatio { export interface RepoCountAnalysis{ RepoCount: number; increaseOrDecrease:string +} + +export interface PullRequestAnalysis{ + OpenCount: number; + ClosedCount: number; } \ No newline at end of file diff --git a/src/Styles/Dashboard/followerProgress.css b/src/Styles/Dashboard/followerProgress.css index cf3b038..d8b1e02 100644 --- a/src/Styles/Dashboard/followerProgress.css +++ b/src/Styles/Dashboard/followerProgress.css @@ -42,7 +42,22 @@ margin-left: 10%; border-radius: 30px; } - +.pullRequestCard{ + background-color: black; + border-radius: 55px; + text-align: center; + max-width: 250px; + height: 200px; +} +.pullReqGradientBack{ + height: 210px; + border-radius: 30px; +} +.pullRequestTitle{ + color: white; + font-size: 15px; + font-weight: bolder; +} diff --git a/src/app/Dashboard/page.tsx b/src/app/Dashboard/page.tsx index 94ff85f..68d61d1 100644 --- a/src/app/Dashboard/page.tsx +++ b/src/app/Dashboard/page.tsx @@ -17,17 +17,21 @@ import { getFollowingAnalysis, getLanguageCountAnalysis, getRepoCountAnalysis, + getOpenCount, + getClosedCount } from "@/Services/analysis.service"; import { FollowerAnalysis, FollowingAnalysis, LanguageCountAnalysis, RepoCountAnalysis, + PullRequestAnalysis } from "@/Interface/api.interface"; import FollowerProgress from "@/Components/FollowerAnalysis/FollowerProgress"; import FollowingProgress from "@/Components/FollowerAnalysis/FollowingProgress"; import LanguageCount from "@/Components/LanguageAnalysis/LanguageCount"; import RepoProgress from "@/Components/Repository/RepoProgress"; +import PullRequestProgress from "@/Components/PullReqAnalysis/PullReqProgress"; const VersionDashboard: React.FC = () => { @@ -48,6 +52,9 @@ const VersionDashboard: React.FC = () => { increaseOrDecrease: "", }); + const [issueCount,setIssueCount] = useState({OpenCount:0,ClosedCount:0}); + + const getFollowerAnalysisData = async () => { try { const response: any = await getFollowerAnalysis( @@ -95,12 +102,35 @@ const VersionDashboard: React.FC = () => { console.error("Error fetching language count analysis:", error); } }; + const getIssueCounts = async () => { + try { + const [openResponse, closedResponse]:[any,any] = await Promise.all([ + getOpenCount("64b2e27fd3b241f53c4b4c55"), + getClosedCount("64b2e27fd3b241f53c4b4c55") + ]); + + const openCountData: { OpenCount: number } = await openResponse.json(); + const closedCountData: { ClosedCount: number } = await closedResponse.json(); + + console.log("here is the main data") + console.log(openCountData) + + setIssueCount({ OpenCount: openCountData.OpenCount, ClosedCount: closedCountData.ClosedCount }); + } catch (err) { + console.error("Error fetching issue counts:", err); + } + }; + + + + useEffect(() => { getFollowerAnalysisData(); getFollowingAnalysisData(); getLanguageCountAnalysisData(); getRepoCountAnalysisData(); + getIssueCounts() }, []); return followerAnlData.followerCount !== 0 && @@ -159,6 +189,7 @@ const VersionDashboard: React.FC = () => {
+ ) : ( diff --git a/src/app/page.tsx b/src/app/page.tsx index d434b9b..eeb2a19 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,12 +1,12 @@ import Image from "next/image"; -import VersionDashboard from "./Dashboard/page"; + import "../Styles/Dashboard/followerProgress.css" export default function Home() { return ( +

nkn

- ); }