1- import { faCalendar , faFolderOpen , faCircleExclamation } from '@fortawesome/free-solid-svg-icons'
1+ import { faCircleExclamation } from '@fortawesome/free-solid-svg-icons'
22import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3- import { useRouter } from 'next/navigation'
43import React from 'react'
54import type { Issue } from 'types/issue'
6- import { formatDate } from 'utils/dateFormatter'
75import AnchorTitle from 'components/AnchorTitle'
86import ItemCardList from 'components/ItemCardList'
9- import { TruncatedText } from 'components/TruncatedText'
7+ import { IssueMetadata } from 'components/IssueMetadata' // ← new reusable component
108
119interface RecentIssuesProps {
1210 data : Issue [ ]
1311 showAvatar ?: boolean
1412}
1513
1614const RecentIssues : React . FC < RecentIssuesProps > = ( { data, showAvatar = true } ) => {
17- const router = useRouter ( )
18-
1915 return (
2016 < ItemCardList
2117 title = {
2218 < div className = "flex items-center gap-2" >
2319 < AnchorTitle title = "Recent Issues" className = "flex items-center leading-none" />
20+ < FontAwesomeIcon icon = { faCircleExclamation } className = "h-5 w-5 text-red-500" />
2421 </ div >
2522 }
2623 data = { data }
2724 showAvatar = { showAvatar }
2825 icon = { faCircleExclamation }
29- renderDetails = { ( item ) => (
30- < div className = "mt-2 flex flex-wrap items-center text-sm text-gray-600 dark:text-gray-400" >
31- < div className = "mr-4 flex items-center" >
32- < FontAwesomeIcon icon = { faCalendar } className = "mr-2 h-4 w-4" />
33- < span > { formatDate ( item . createdAt ) } </ span >
34- </ div >
35- { item ?. repositoryName && (
36- < div className = "flex flex-1 items-center overflow-hidden" >
37- < FontAwesomeIcon icon = { faFolderOpen } className = "mr-2 h-5 w-4" />
38- < button
39- className = "cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-gray-600 hover:underline dark:text-gray-400"
40- onClick = { ( ) =>
41- router . push (
42- `/organizations/${ item . organizationName } /repositories/${ item . repositoryName } `
43- )
44- }
45- >
46- < TruncatedText text = { item . repositoryName } />
47- </ button >
48- </ div >
49- ) }
50- </ div >
51- ) }
26+ renderDetails = { ( item ) => < IssueMetadata issue = { item } /> }
5227 />
5328 )
5429}
5530
56- export default RecentIssues
31+ export default RecentIssues
0 commit comments