"use client"; import { useEffect, useRef, useState } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { DataTable } from "@/components/data-table"; import { DataChart } from "@/components/data-chart"; import { Button } from "@/components/ui/button"; import { BarChart3, Table2, Filter } from "lucide-react"; import { getPRDataService } from "@/app/Services/service"; import { PRData } from "@/app/Interfaces/interface"; import { useSharedContext } from "@/lib/shared-context"; import { useCopilotAction, useCopilotReadable } from "@copilotkit/react-core"; import { PieChart, Pie, Cell, Tooltip } from "recharts"; import { PRPieData } from "./pr-pie-all-data"; import { PRReviewBarData } from "./pr-review-bar-data"; import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, } from "@/components/ui/select"; import { PRPieFilterData } from "./pr-pie-filter-data"; import { PRLineChartData } from "./pr-line-chart-data"; import { Loader } from "./ui/loader"; // Sample data for the developer dashboard const tableColumns = [ { accessorKey: "id", header: "ID", }, { accessorKey: "title", header: "TITLE", }, { accessorKey: "author", header: "AUTHOR", }, { accessorKey: "repository", header: "REPOSITORY", }, { accessorKey: "status", header: "STATUS", }, ]; const chartData = [ { name: "Mon", "Build Time": 45, "Test Coverage": 78, }, { name: "Tue", "Build Time": 52, "Test Coverage": 82, }, { name: "Wed", "Build Time": 48, "Test Coverage": 85, }, { name: "Thu", "Build Time": 61, "Test Coverage": 79, }, { name: "Fri", "Build Time": 55, "Test Coverage": 83, }, { name: "Sat", "Build Time": 42, "Test Coverage": 86, }, { name: "Sun", "Build Time": 38, "Test Coverage": 90, }, ]; const status = [ { name: "approved", color: "bg-green-300", value: "rgb(134 239 172)", }, { name: "needs_revision", color: "bg-yellow-300", value: "rgb(253 224 71)", }, { name: "merged", color: "bg-purple-300", value: "rgb(216 180 254)", }, { name: "in_review", color: "bg-blue-300", value: "rgb(147 197 253)", }, ]; export function DeveloperDashboard() { const { prData, setPrData } = useSharedContext(); const [filteredData, setFilteredData] = useState([]); const [filterParams, setFilterParams] = useState<{ status: string; author: string; }>({ status: "a", author: "b" }); const [viewMode, setViewMode] = useState<"table" | "chart">("table"); const [isLoading, setIsLoading] = useState(true); const ref1 = useRef(null); const ref2 = useRef(null); useEffect(() => { getPRData(); }, []); useCopilotReadable({ description: "A list of all the PR Data", value: JSON.stringify(prData), }); useCopilotAction({ name: "GenerateChartBasedOnUserPRData", description: `Generate a pie-chart based on the PR data for a user`, parameters: [ { name: "userId", type: "number", description: "The id of the user for whom the PR data is to be fetched", }, ], render: ({ args }: any) => { return ; }, }); useCopilotAction({ name: "GenerateChartBasedOnPRReviewStatus", description: `Generate a bar-chart based on the PR data which are only in needs_revision or in_review status for specific user`, parameters: [ { name: "userId", type: "number", description: "The id of the user for whom the PR data is to be fetched", }, ], render: ({ args }: any) => { return ; }, }); useCopilotAction({ name: "GenerateChartBasedOnFilteredDateAndTime", description: `Generate a Pie-chart based on the PR data which lies between the given date and time`, parameters: [ { name: "userId", type: "number", description: "The id of the user for whom the PR data is to be fetched", }, { name: "dayCount", type: "number", description: "The number of days to be considered for the PR data", }, ], render: ({ args }: any) => { return ; }, }); useCopilotAction({ name: "GenerateLineChartToShowPRCreationTrend", description: `Generate a Line-chart based on the PR data which shows the trend of PR creation over time`, parameters: [ { name: "userId", type: "number", description: "The id of the user for whom the PR data is to be fetched", }, ], render: ({ args }: any) => { return ; }, }); async function getPRData() { try { const res = await getPRDataService(); setPrData(res); setFilteredData(res); setIsLoading(false); } catch (error) { console.log(error); } } return (
{isLoading && }

Developer Dashboard

Repositories Total active repositories
12

+2 from last month

Build Success Rate Last 7 days
94.3%

+1.2% from last week

Code Quality Average score
A+

Improved from A

Repository Performance Monitor build times and test coverage across repositories
Filters:
{viewMode === "table" && ( )}
{viewMode === "table" ? ( ) : ( )}
); }