2026-02-16 13:32:04 -06:00
|
|
|
import { useCallback } from "react";
|
|
|
|
|
import { goalsApi } from "../api/goals";
|
|
|
|
|
import { useApi } from "../hooks/useApi";
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
import { StatusBadge } from "../components/StatusBadge";
|
|
|
|
|
import { useCompany } from "../context/CompanyContext";
|
|
|
|
|
import { Card, CardContent } from "@/components/ui/card";
|
2026-02-16 13:32:04 -06:00
|
|
|
|
|
|
|
|
export function Goals() {
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
const { selectedCompanyId } = useCompany();
|
|
|
|
|
|
|
|
|
|
const fetcher = useCallback(() => {
|
|
|
|
|
if (!selectedCompanyId) return Promise.resolve([]);
|
|
|
|
|
return goalsApi.list(selectedCompanyId);
|
|
|
|
|
}, [selectedCompanyId]);
|
|
|
|
|
|
2026-02-16 13:32:04 -06:00
|
|
|
const { data: goals, loading, error } = useApi(fetcher);
|
|
|
|
|
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
if (!selectedCompanyId) {
|
|
|
|
|
return <p className="text-muted-foreground">Select a company first.</p>;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-16 13:32:04 -06:00
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<h2 className="text-2xl font-bold mb-4">Goals</h2>
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
{loading && <p className="text-muted-foreground">Loading...</p>}
|
|
|
|
|
{error && <p className="text-destructive">{error.message}</p>}
|
|
|
|
|
{goals && goals.length === 0 && <p className="text-muted-foreground">No goals yet.</p>}
|
2026-02-16 13:32:04 -06:00
|
|
|
{goals && goals.length > 0 && (
|
|
|
|
|
<div className="grid gap-4">
|
|
|
|
|
{goals.map((goal) => (
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
<Card key={goal.id}>
|
|
|
|
|
<CardContent className="p-4">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="font-semibold">{goal.title}</h3>
|
|
|
|
|
{goal.description && <p className="text-sm text-muted-foreground mt-1">{goal.description}</p>}
|
|
|
|
|
<p className="text-xs text-muted-foreground mt-2">Level: {goal.level}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<StatusBadge status={goal.status} />
|
2026-02-16 13:32:04 -06:00
|
|
|
</div>
|
Overhaul UI with shadcn components and new pages
Add shadcn/ui components (badge, button, card, input, select,
separator). Add company context provider. New pages: Activity,
Approvals, Companies, Costs, Org chart. Restyle existing pages
(Dashboard, Agents, Issues, Goals, Projects) with shadcn components
and dark theme. Update layout, sidebar navigation, and routing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:32 -06:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
2026-02-16 13:32:04 -06:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|