import { useCallback } from "react"; import { goalsApi } from "../api/goals"; import { useApi } from "../hooks/useApi"; import { StatusBadge } from "../components/StatusBadge"; import { useCompany } from "../context/CompanyContext"; import { Card, CardContent } from "@/components/ui/card"; export function Goals() { const { selectedCompanyId } = useCompany(); const fetcher = useCallback(() => { if (!selectedCompanyId) return Promise.resolve([]); return goalsApi.list(selectedCompanyId); }, [selectedCompanyId]); const { data: goals, loading, error } = useApi(fetcher); if (!selectedCompanyId) { return
Select a company first.
; } return (Loading...
} {error &&{error.message}
} {goals && goals.length === 0 &&No goals yet.
} {goals && goals.length > 0 && ({goal.description}
}Level: {goal.level}