From 8af3618793952a0e26669f86ea0a1ad3cbf6e63d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 20 Dec 2025 19:12:18 -0600 Subject: [PATCH] Improve loading of Project Details dialog --- src/components/ProjectDetailsDialog.tsx | 62 ++++++++++++++++--------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/src/components/ProjectDetailsDialog.tsx b/src/components/ProjectDetailsDialog.tsx index c728f898..ab8fc36a 100644 --- a/src/components/ProjectDetailsDialog.tsx +++ b/src/components/ProjectDetailsDialog.tsx @@ -39,8 +39,10 @@ import { } from 'lucide-react'; import JSZip from 'jszip'; import { Separator } from './ui/separator'; +import { Skeleton } from './ui/skeleton'; import { DotAI } from '@/lib/DotAI'; import { LabelSelector } from '@/components/labels/LabelSelector'; +import { cn } from '@/lib/utils'; interface ProjectDetailsDialogProps { project: Project; @@ -55,6 +57,7 @@ export function ProjectDetailsDialog({ project, open, onOpenChange, onProjectDel const [isRenaming, setIsRenaming] = useState(false); const [newProjectName, setNewProjectName] = useState(project.id); const [totalCost, setTotalCost] = useState(null); + const [isLoading, setIsLoading] = useState(false); const [templateInfo, setTemplateInfo] = useState<{ name: string; description: string; url: string } | null>(null); const { toast } = useToast(); const { fs } = useFS(); @@ -72,6 +75,7 @@ export function ProjectDetailsDialog({ project, open, onOpenChange, onProjectDel // Load total project cost and template info useEffect(() => { const loadProjectData = async () => { + setIsLoading(true); try { const dotAI = new DotAI(fs, `${projectsPath}/${project.id}`); @@ -86,6 +90,8 @@ export function ProjectDetailsDialog({ project, open, onOpenChange, onProjectDel console.warn('Failed to load project data:', error); setTotalCost(null); setTemplateInfo(null); + } finally { + setIsLoading(false); } }; @@ -259,30 +265,44 @@ export function ProjectDetailsDialog({ project, open, onOpenChange, onProjectDel {/* Total Cost */} - {totalCost !== null && totalCost > 0 && ( -
- - Total Cost: +
+ + Total Cost: + {typeof totalCost === 'number' ? ( ${totalCost.toFixed(2)} -
- )} + ) : ( + isLoading ? ( + + ) : ( + N/A + ) + )} +
{/* Template Info */} - {templateInfo && ( -
- - Template: - - {templateInfo.name} - - -
- )} +
+ + Template: + + {templateInfo ? ( + <> + {templateInfo.name} + + + ) : ( + isLoading ? ( + + ) : ( + N/A + ) + )} + +
{/* Project Name */}