Skip to content

Commit 725f782

Browse files
Add iconOnly prop to BranchSwitcher for compact display
1 parent 992cb83 commit 725f782

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

frontend/src/components/repo/BranchSwitcher.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ interface BranchSwitcherProps {
2121
repoUrl?: string | null;
2222
repoLocalPath?: string;
2323
className?: string;
24+
iconOnly?: boolean;
2425
}
2526

26-
export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, repoLocalPath, className }: BranchSwitcherProps) {
27+
export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, repoLocalPath, className, iconOnly }: BranchSwitcherProps) {
2728
const [addBranchOpen, setAddBranchOpen] = useState(false);
2829
const [gitChangesOpen, setGitChangesOpen] = useState(false);
2930
const queryClient = useQueryClient();
@@ -63,14 +64,14 @@ export function BranchSwitcher({ repoId, currentBranch, isWorktree, repoUrl, rep
6364
variant="ghost"
6465
size="sm"
6566
disabled={switchBranchMutation.isPending}
66-
className={`h-6 px-1 sm:px-2 text-[10px] sm:text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-accent gap-1 border border-blue-500/20 ${className || ""}`}
67+
className={`h-6 px-1 sm:px-2 text-[10px] sm:text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-accent gap-1 border border-blue-500/20 ${iconOnly ? 'w-6' : ''} ${className || ""}`}
6768
>
6869
{switchBranchMutation.isPending ? (
6970
<Loader2 className="w-3 h-3 animate-spin" />
7071
) : (
7172
<GitBranch className="w-3 h-3" />
7273
)}
73-
<span className="truncate">{currentBranch}</span>
74+
{!iconOnly && <span className="truncate">{currentBranch}</span>}
7475
</Button>
7576
</DropdownMenuTrigger>
7677
<DropdownMenuContent sideOffset={0} align="end" className="bg-card border-border min-w-[200px]">

frontend/src/components/session/SessionDetailHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export function SessionDetailHeader({
159159
repoUrl={repo.repoUrl}
160160
repoLocalPath={repo.localPath}
161161
className="max-w-[80px] sm:w-[140px] sm:max-w-[140px]"
162+
iconOnly
162163
/>
163164
<div className="flex items-center gap-1 sm:gap-2">
164165
<div

frontend/src/pages/RepoDetail.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ export function RepoDetail() {
123123
currentBranch={currentBranch}
124124
isWorktree={repo.isWorktree}
125125
repoUrl={repo.repoUrl}
126-
className="w-[140px] max-w-[140px]"
126+
className="sm:w-[140px] sm:max-w-[140px]"
127+
iconOnly
127128
/>
128129
) : branchToDisplay ? (
129130
<Badge

0 commit comments

Comments
 (0)