From 6ce3548dfeec817355afc3c02bd4ed8b3c47cdca Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Thu, 25 Dec 2025 13:11:49 -0500 Subject: [PATCH] refactor RepoCard component layout and interaction Simplify card layout with consistent button styling, proper event handling for card clicks, and improved visual feedback with hover states. Consolidate branch and status indicators in a cleaner layout structure. --- frontend/src/components/repo/RepoCard.tsx | 161 ++++++++++------------ 1 file changed, 75 insertions(+), 86 deletions(-) diff --git a/frontend/src/components/repo/RepoCard.tsx b/frontend/src/components/repo/RepoCard.tsx index c52d033a..55147062 100644 --- a/frontend/src/components/repo/RepoCard.tsx +++ b/frontend/src/components/repo/RepoCard.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Checkbox } from "@/components/ui/checkbox"; -import { Loader2, Trash2, ExternalLink, Download } from "lucide-react"; +import { Loader2, Trash2, Download, GitBranch, FolderOpen } from "lucide-react"; import { useNavigate } from "react-router-dom"; import { downloadRepo } from "@/api/repos"; import { showToast } from "@/lib/toast"; @@ -41,85 +41,81 @@ export function RepoCard({ : repo.localPath || "Local Repo"; const branchToDisplay = repo.currentBranch || repo.branch; const isReady = repo.cloneStatus === "ready"; + const isCloning = repo.cloneStatus === "cloning"; + + const handleCardClick = () => { + if (isReady) { + navigate(`/repos/${repo.id}`); + } + }; + + const handleActionClick = (e: React.MouseEvent, action: () => void) => { + e.stopPropagation(); + action(); + }; return (
-
-
-
-{onSelect && ( - { - onSelect(repo.id, checked === true); - }} - onClick={(e) => { - e.stopPropagation(); - }} - className="w-5 h-5" - /> - )} -

{ - e.stopPropagation(); - if (onSelect) { - onSelect(repo.id, !isSelected); - } - }} - className={`font-semibold text-lg text-foreground truncate group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors ${ - onSelect ? "cursor-pointer" : "cursor-not-allowed opacity-60" - }`} - > - {repoName} -

- {repo.isWorktree && ( - - {branchToDisplay || "main"} - - )} - {repo.cloneStatus === "cloning" && ( - - cloning - - )} -
- -
- - - -
- {repo.cloneStatus === "cloning" && ( -
- - Cloning repository... +
+
+ {onSelect && ( +
handleActionClick(e, () => onSelect(repo.id, !isSelected))} + > + onSelect(repo.id, checked === true)} + className="w-5 h-5" + />
)} -
- + +
+
+

+ {repoName} +

+ {repo.isWorktree && ( + + worktree + + )} +
+ +
+ {isCloning ? ( + + + Cloning... + + ) : ( + <> + + + {branchToDisplay || "main"} + + {repo.isLocal && ( + + + Local + + )} + + )} +
+
+
e.stopPropagation()}>
- -
); }