2026-02-17 20:16:57 -06:00
|
|
|
import { Link } from "react-router-dom";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import type { Issue } from "@paperclip/shared";
|
2026-02-17 12:24:48 -06:00
|
|
|
import { useQuery } from "@tanstack/react-query";
|
|
|
|
|
import { agentsApi } from "../api/agents";
|
2026-02-17 20:16:57 -06:00
|
|
|
import { projectsApi } from "../api/projects";
|
2026-02-17 10:53:20 -06:00
|
|
|
import { useCompany } from "../context/CompanyContext";
|
2026-02-17 12:24:48 -06:00
|
|
|
import { queryKeys } from "../lib/queryKeys";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { StatusIcon } from "./StatusIcon";
|
|
|
|
|
import { PriorityIcon } from "./PriorityIcon";
|
|
|
|
|
import { formatDate } from "../lib/utils";
|
2026-02-17 10:53:20 -06:00
|
|
|
import { timeAgo } from "../lib/timeAgo";
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
import { Separator } from "@/components/ui/separator";
|
|
|
|
|
|
|
|
|
|
interface IssuePropertiesProps {
|
|
|
|
|
issue: Issue;
|
|
|
|
|
onUpdate: (data: Record<string, unknown>) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function PropertyRow({ label, children }: { label: string; children: React.ReactNode }) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-between py-1.5">
|
|
|
|
|
<span className="text-xs text-muted-foreground">{label}</span>
|
|
|
|
|
<div className="flex items-center gap-1.5">{children}</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function statusLabel(status: string): string {
|
|
|
|
|
return status.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function priorityLabel(priority: string): string {
|
|
|
|
|
return priority.charAt(0).toUpperCase() + priority.slice(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function IssueProperties({ issue, onUpdate }: IssuePropertiesProps) {
|
2026-02-17 10:53:20 -06:00
|
|
|
const { selectedCompanyId } = useCompany();
|
2026-02-17 20:16:57 -06:00
|
|
|
|
2026-02-17 12:24:48 -06:00
|
|
|
const { data: agents } = useQuery({
|
|
|
|
|
queryKey: queryKeys.agents.list(selectedCompanyId!),
|
|
|
|
|
queryFn: () => agentsApi.list(selectedCompanyId!),
|
|
|
|
|
enabled: !!selectedCompanyId,
|
|
|
|
|
});
|
2026-02-17 10:53:20 -06:00
|
|
|
|
2026-02-17 20:16:57 -06:00
|
|
|
const { data: projects } = useQuery({
|
|
|
|
|
queryKey: queryKeys.projects.list(selectedCompanyId!),
|
|
|
|
|
queryFn: () => projectsApi.list(selectedCompanyId!),
|
|
|
|
|
enabled: !!selectedCompanyId && !!issue.projectId,
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-17 10:53:20 -06:00
|
|
|
const agentName = (id: string | null) => {
|
|
|
|
|
if (!id || !agents) return null;
|
|
|
|
|
const agent = agents.find((a) => a.id === id);
|
|
|
|
|
return agent?.name ?? id.slice(0, 8);
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-17 20:16:57 -06:00
|
|
|
const projectName = (id: string | null) => {
|
|
|
|
|
if (!id || !projects) return id?.slice(0, 8) ?? "None";
|
|
|
|
|
const project = projects.find((p) => p.id === id);
|
|
|
|
|
return project?.name ?? id.slice(0, 8);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const assignee = issue.assigneeAgentId
|
|
|
|
|
? agents?.find((a) => a.id === issue.assigneeAgentId)
|
|
|
|
|
: null;
|
|
|
|
|
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
return (
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<PropertyRow label="Status">
|
|
|
|
|
<StatusIcon
|
|
|
|
|
status={issue.status}
|
|
|
|
|
onChange={(status) => onUpdate({ status })}
|
|
|
|
|
/>
|
|
|
|
|
<span className="text-sm">{statusLabel(issue.status)}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
|
|
|
|
|
<PropertyRow label="Priority">
|
|
|
|
|
<PriorityIcon
|
|
|
|
|
priority={issue.priority}
|
|
|
|
|
onChange={(priority) => onUpdate({ priority })}
|
|
|
|
|
/>
|
|
|
|
|
<span className="text-sm">{priorityLabel(issue.priority)}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
|
2026-02-17 10:53:20 -06:00
|
|
|
<PropertyRow label="Assignee">
|
2026-02-17 20:16:57 -06:00
|
|
|
{assignee ? (
|
|
|
|
|
<Link
|
|
|
|
|
to={`/agents/${assignee.id}`}
|
|
|
|
|
className="text-sm hover:underline"
|
|
|
|
|
>
|
|
|
|
|
{assignee.name}
|
|
|
|
|
</Link>
|
|
|
|
|
) : (
|
|
|
|
|
<span className="text-sm text-muted-foreground">Unassigned</span>
|
|
|
|
|
)}
|
2026-02-17 10:53:20 -06:00
|
|
|
</PropertyRow>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
|
2026-02-17 20:16:57 -06:00
|
|
|
{issue.projectId && (
|
|
|
|
|
<PropertyRow label="Project">
|
|
|
|
|
<Link
|
|
|
|
|
to={`/projects/${issue.projectId}`}
|
|
|
|
|
className="text-sm hover:underline"
|
|
|
|
|
>
|
|
|
|
|
{projectName(issue.projectId)}
|
|
|
|
|
</Link>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{issue.parentId && (
|
|
|
|
|
<PropertyRow label="Parent">
|
|
|
|
|
<Link
|
|
|
|
|
to={`/issues/${issue.parentId}`}
|
|
|
|
|
className="text-sm hover:underline"
|
|
|
|
|
>
|
|
|
|
|
{issue.ancestors?.[0]?.title ?? issue.parentId.slice(0, 8)}
|
|
|
|
|
</Link>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{issue.requestDepth > 0 && (
|
|
|
|
|
<PropertyRow label="Depth">
|
|
|
|
|
<span className="text-sm font-mono">{issue.requestDepth}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
)}
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Separator />
|
|
|
|
|
|
|
|
|
|
<div className="space-y-1">
|
2026-02-17 10:53:20 -06:00
|
|
|
{issue.startedAt && (
|
|
|
|
|
<PropertyRow label="Started">
|
|
|
|
|
<span className="text-sm">{formatDate(issue.startedAt)}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
)}
|
|
|
|
|
{issue.completedAt && (
|
|
|
|
|
<PropertyRow label="Completed">
|
|
|
|
|
<span className="text-sm">{formatDate(issue.completedAt)}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
)}
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
<PropertyRow label="Created">
|
|
|
|
|
<span className="text-sm">{formatDate(issue.createdAt)}</span>
|
|
|
|
|
</PropertyRow>
|
|
|
|
|
<PropertyRow label="Updated">
|
2026-02-17 10:53:20 -06:00
|
|
|
<span className="text-sm">{timeAgo(issue.updatedAt)}</span>
|
Add detail pages, property panels, and restyle list pages
New pages: AgentDetail, GoalDetail, IssueDetail, ProjectDetail, Inbox,
MyIssues. New feature components: AgentProperties, GoalProperties,
IssueProperties, ProjectProperties, GoalTree, NewIssueDialog. Add
heartbeats API client. Restyle all list pages (Agents, Issues, Goals,
Projects, Dashboard, Costs, Activity, Org) with EntityRow, FilterBar,
and improved layouts. Add routing for detail views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:57:06 -06:00
|
|
|
</PropertyRow>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|