import { useCallback } from "react"; import { issuesApi } from "../api/issues"; import { useApi } from "../hooks/useApi"; import { StatusBadge } from "../components/StatusBadge"; import { cn } from "../lib/utils"; import { useCompany } from "../context/CompanyContext"; import { Card, CardContent } from "@/components/ui/card"; const priorityColors: Record = { critical: "text-red-300 bg-red-900/50", high: "text-orange-300 bg-orange-900/50", medium: "text-yellow-300 bg-yellow-900/50", low: "text-neutral-400 bg-neutral-800", }; export function Issues() { const { selectedCompanyId } = useCompany(); const fetcher = useCallback(() => { if (!selectedCompanyId) return Promise.resolve([]); return issuesApi.list(selectedCompanyId); }, [selectedCompanyId]); const { data: issues, loading, error } = useApi(fetcher); if (!selectedCompanyId) { return

Select a company first.

; } return (

Tasks

{loading &&

Loading...

} {error &&

{error.message}

} {issues && issues.length === 0 &&

No tasks yet.

} {issues && issues.length > 0 && (
{issues.map((issue) => (

{issue.title}

{issue.description && (

{issue.description}

)}
{issue.priority}
))}
)}
); }