import { Button } from '@renderer/components/ui/button'; import { FolderGit2, FolderOpen, Search } from 'lucide-react'; import { useRecentProjectsSection } from '../hooks/useRecentProjectsSection'; import { RecentProjectCard } from './RecentProjectCard'; interface RecentProjectsSectionProps { searchQuery: string; } const titleWidths = [60, 66, 50, 55, 75, 45, 40, 65]; const pathWidths = [80, 75, 85, 66, 70, 80, 60, 72]; function SelectProjectFolderCard({ onClick, }: Readonly<{ onClick: () => void; }>): React.JSX.Element { return ( Select Folder ); } export const RecentProjectsSection = ({ searchQuery, }: Readonly): React.JSX.Element => { const { cards, loading, error, canLoadMore, isElectron, loadMore, reload, openRecentProject, openProjectPath, selectProjectFolder, } = useRecentProjectsSection(searchQuery); if (loading) { return ( {Array.from({ length: 8 }).map((_, index) => ( ))} ); } if (error && cards.length === 0) { return ( Failed to load projects {error} void reload()} className="rounded-sm border border-border bg-surface-raised px-3 py-1.5 text-xs text-text-secondary transition-colors hover:border-border-emphasis hover:text-text" > Retry ); } if (cards.length === 0 && searchQuery.trim()) { return ( No projects found No matches for "{searchQuery}" ); } if (cards.length === 0) { return ( No recent projects found Recent Claude and Codex activity will appear here. ); } const hasSelectFolderCard = !searchQuery.trim() && isElectron; return ( {hasSelectFolderCard && ( void selectProjectFolder()} /> )} {cards.map((card) => ( void openRecentProject(card.project)} onOpenPath={() => void openProjectPath(card.project.primaryPath)} /> ))} {canLoadMore && ( Load more )} ); };
Failed to load projects
{error}
No projects found
No matches for "{searchQuery}"
No recent projects found
Recent Claude and Codex activity will appear here.