1- "use client" ;
2- import * as React from "react" ;
1+ 'use client' ;
32
4-
5- import { EnhancedTechPartnerData } from "@/types/dashboard" ;
3+ import { EnhancedTechPartnerData } from '@/types/dashboard' ;
4+ import { useMemo , useState } from 'react' ;
5+ import { ExternalLink } from 'lucide-react' ;
6+ import { Button } from '@/components/ui/button' ;
7+ import {
8+ Dialog ,
9+ DialogContent ,
10+ DialogDescription ,
11+ DialogFooter ,
12+ DialogHeader ,
13+ DialogTitle ,
14+ } from '@/components/ui/dialog' ;
615import {
716 Table ,
817 TableBody ,
918 TableCell ,
1019 TableHead ,
1120 TableHeader ,
1221 TableRow ,
13- } from "@/components/ui/table" ;
14-
15- import { ExternalLink , GitPullRequest } from "lucide-react" ;
22+ } from '@/components/ui/table' ;
1623import {
1724 Tooltip ,
1825 TooltipContent ,
1926 TooltipProvider ,
2027 TooltipTrigger ,
21- } from "@/components/ui/tooltip" ;
22- import { Button } from "@/components/ui/button" ;
23- import {
24- Dialog ,
25- DialogContent ,
26- DialogDescription ,
27- DialogFooter ,
28- DialogHeader ,
29- DialogTitle ,
30- DialogTrigger ,
31- } from "@/components/ui/dialog" ;
28+ } from '@/components/ui/tooltip' ;
3229
3330interface Contribution {
3431 title : string ;
@@ -50,14 +47,14 @@ interface ContributorViewProps {
5047}
5148
5249export function ContributorView ( { data } : ContributorViewProps ) {
53-
54- const [ selectedContributorContributions , setSelectedContributorContributions ] =
55- React . useState < Contribution [ ] > ( [ ] ) ;
56- const [ isDialogOpen , setIsDialogOpen ] = React . useState ( false ) ;
57- const [ dialogTitle , setDialogTitle ] = React . useState ( "" ) ;
58-
59- const contributors = React . useMemo ( ( ) => {
60-
50+ const [
51+ selectedContributorContributions ,
52+ setSelectedContributorContributions ,
53+ ] = useState < Contribution [ ] > ( [ ] ) ;
54+ const [ isDialogOpen , setIsDialogOpen ] = useState ( false ) ;
55+ const [ dialogTitle , setDialogTitle ] = useState ( '' ) ;
56+
57+ const contributors = useMemo ( ( ) => {
6158 if ( ! data ?. length ) return [ ] ;
6259 const contributorMap = new Map < string , ContributorDetails > ( ) ;
6360
@@ -159,29 +156,31 @@ export function ContributorView({ data }: ContributorViewProps) {
159156 < TableCell > { contributor . totalIssues } </ TableCell >
160157 < TableCell > { contributor . engagement . toFixed ( 1 ) } </ TableCell >
161158 < TableCell className = "text-right" >
162- { contributor . contributions . slice ( 0 , 3 ) . map ( ( contribution , idx ) => (
163- < Tooltip key = { idx } >
164- < TooltipTrigger className = "underline cursor-pointer text-blue-500" >
165- { contribution . title . length > 20
166- ? `${ contribution . title . slice ( 0 , 20 ) } ...`
167- : contribution . title }
168- </ TooltipTrigger >
169- < TooltipContent className = "bg-white border border-black" >
170- < p className = "text-black" > { contribution . title } </ p >
171- < p className = "text-xs text-muted-foreground" >
172- Week: { contribution . week }
173- </ p >
174- < a
175- href = { contribution . url }
176- target = "_blank"
177- rel = "noopener noreferrer"
178- className = "text-xs text-green-600 hover:text-green-800 flex items-center gap-1"
179- >
180- View on GitHub < ExternalLink className = "h-3 w-3" />
181- </ a >
182- </ TooltipContent >
183- </ Tooltip >
184- ) ) }
159+ { contributor . contributions
160+ . slice ( 0 , 3 )
161+ . map ( ( contribution , idx ) => (
162+ < Tooltip key = { idx } >
163+ < TooltipTrigger className = "underline cursor-pointer text-blue-500" >
164+ { contribution . title . length > 20
165+ ? `${ contribution . title . slice ( 0 , 20 ) } ...`
166+ : contribution . title }
167+ </ TooltipTrigger >
168+ < TooltipContent className = "bg-white border border-black" >
169+ < p className = "text-black" > { contribution . title } </ p >
170+ < p className = "text-xs text-muted-foreground" >
171+ Week: { contribution . week }
172+ </ p >
173+ < a
174+ href = { contribution . url }
175+ target = "_blank"
176+ rel = "noopener noreferrer"
177+ className = "text-xs text-green-600 hover:text-green-800 flex items-center gap-1"
178+ >
179+ View on GitHub < ExternalLink className = "h-3 w-3" />
180+ </ a >
181+ </ TooltipContent >
182+ </ Tooltip >
183+ ) ) }
185184 { contributor . contributions . length > 3 && (
186185 < Button
187186 size = "sm"
@@ -192,7 +191,9 @@ export function ContributorView({ data }: ContributorViewProps) {
192191 </ Button >
193192 ) }
194193 { contributor . contributions . length === 0 && (
195- < span className = "text-muted-foreground" > No recent contributions</ span >
194+ < span className = "text-muted-foreground" >
195+ No recent contributions
196+ </ span >
196197 ) }
197198 </ TableCell >
198199 </ TableRow >
@@ -204,15 +205,19 @@ export function ContributorView({ data }: ContributorViewProps) {
204205 < DialogContent className = "sm:max-w-[425px]" >
205206 < DialogHeader >
206207 < DialogTitle > { dialogTitle } </ DialogTitle >
207- < DialogDescription > All contributions from this contributor.</ DialogDescription >
208+ < DialogDescription >
209+ All contributions from this contributor.
210+ </ DialogDescription >
208211 </ DialogHeader >
209212 < div className = "max-h-[400px] overflow-y-auto" >
210213 { selectedContributorContributions . length > 0 ? (
211214 < ul className = "space-y-2" >
212215 { selectedContributorContributions . map ( ( contribution , index ) => (
213216 < li key = { index } className = "border rounded-md p-2" >
214217 < p className = "font-semibold" > { contribution . title } </ p >
215- < p className = "text-sm text-muted-foreground" > Week: { contribution . week } </ p >
218+ < p className = "text-sm text-muted-foreground" >
219+ Week: { contribution . week }
220+ </ p >
216221 < a
217222 href = { contribution . url }
218223 target = "_blank"
@@ -237,4 +242,4 @@ export function ContributorView({ data }: ContributorViewProps) {
237242 </ Dialog >
238243 </ TooltipProvider >
239244 ) ;
240- }
245+ }
0 commit comments