'use client'; import { ChevronRight, Folder, FileText, CheckSquare, Home } from 'lucide-react'; import { useEpic } from '@/lib/hooks/use-epics'; import { useStory } from '@/lib/hooks/use-stories'; import { Skeleton } from '@/components/ui/skeleton'; import Link from 'next/link'; import type { Epic, Story, Task } from '@/types/project'; interface WorkItemBreadcrumbProps { projectId: string; projectName?: string; epic?: Epic; story?: Story; task?: Task; epicId?: string; storyId?: string; } export function WorkItemBreadcrumb({ projectId, projectName, epic, story, task, epicId, storyId, }: WorkItemBreadcrumbProps) { // Fetch epic if only epicId provided const { data: fetchedEpic, isLoading: epicLoading } = useEpic( epicId && !epic ? epicId : '' ); const effectiveEpic = epic || fetchedEpic; // Fetch story if only storyId provided const { data: fetchedStory, isLoading: storyLoading } = useStory( storyId && !story ? storyId : '' ); const effectiveStory = story || fetchedStory; // If we need to fetch parent epic from story const { data: parentEpic, isLoading: parentEpicLoading } = useEpic( effectiveStory && !effectiveEpic ? effectiveStory.epicId : '' ); const finalEpic = effectiveEpic || parentEpic; const isLoading = epicLoading || storyLoading || parentEpicLoading; if (isLoading) { return (