"use client";
import { Badge } from "@kandev/ui/badge";
import { IconAlertTriangle, IconFileText, IconUsersGroup } from "@tabler/icons-react";
import type { TaskContextDTO, TaskRefDTO } from "@/lib/api/domains/office-task-context-api";
type Props = {
/**
* The task context envelope from GET /api/v1/tasks/:id/context.
* Pass null when the backend's HandoffService is not configured or the
* fetch failed; the panel renders nothing in that case so the page
* falls back to its pre-handoffs layout.
*/
context: TaskContextDTO | null;
};
/**
* Office task-handoffs phase 8.2 — task detail panel.
*
* Surfaces the cross-task relations + document references + workspace
* group state introduced by the handoffs feature. Document bodies are
* never rendered here; the panel only shows references that the user
* can click through to fetch full content.
*/
export function TaskDetailContextPanel({ context }: Props) {
if (!context) return null;
const showRelations =
!!context.parent ||
context.children.length > 0 ||
context.siblings.length > 0 ||
context.blockers.length > 0 ||
context.blocked_by.length > 0;
const showDocs = context.available_documents.length > 0;
const showWorkspace = !!context.workspace_group;
if (!showRelations && !showDocs && !showWorkspace) return null;
return (