import { useQuery } from '@tanstack/react-query'
import { issuesApi } from '../services/api'
import { Link } from 'react-router-dom'
export default function Dashboard() {
const { data: stats } = useQuery({
queryKey: ['stats'],
queryFn: issuesApi.getStats,
refetchInterval: 10000,
})
const { data: issues } = useQuery({
queryKey: ['issues'],
queryFn: () => issuesApi.list(),
refetchInterval: 10000,
})
const recentIssues = issues?.slice(0, 5) || []
return (
Dashboard
{/* Stats Grid */}
{/* Recent Issues */}
Recent Issues
View all →
{recentIssues.length === 0 ? (
No issues yet
) : (
recentIssues.map(issue => (
{issue.external_key || `#${issue.id}`}
{issue.title}
{issue.confidence && (
{Math.round(issue.confidence * 100)}%
)}
))
)}
)
}
function StatCard({ title, value, icon, color }: {
title: string
value: number | string
icon: string
color: 'blue' | 'green' | 'purple' | 'yellow'
}) {
const colors = {
blue: 'bg-blue-500/20 text-blue-400',
green: 'bg-green-500/20 text-green-400',
purple: 'bg-purple-500/20 text-purple-400',
yellow: 'bg-yellow-500/20 text-yellow-400',
}
return (
)
}
function StatusBadge({ status }: { status: string }) {
const styles = {
analyzed: 'bg-green-500/20 text-green-400',
pending: 'bg-yellow-500/20 text-yellow-400',
error: 'bg-red-500/20 text-red-400',
}
return (
{status}
)
}