import { ChevronDown, GitBranch, UploadCloud } from "lucide-react";
import { Button } from "@/shared/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuTrigger,
} from "@/shared/ui/dropdown-menu";
/** Branch picker shared by the readme and files panel headers. */
export function RepositoryBranchDropdown({
branch,
branchOptions,
compact,
onBranchChange,
}: {
branch: string;
branchOptions: string[];
/** Smaller trigger for inline headers. */
compact?: boolean;
onBranchChange: (branch: string) => void;
}) {
const selectableBranches =
branchOptions.length > 0 ? branchOptions : [branch];
if (!branch) {
return (
—
);
}
return (
{selectableBranches.map((option) => (
{option}
))}
);
}
/** Props for the compact branch + remote/local controls in panel headers. */
export type RepoSourceHeaderControls = {
branch: string;
branchOptions: string[];
onBranchChange: (branch: string) => void;
source: "remote" | "local";
onSourceChange: (source: "remote" | "local") => void;
localDisabled: boolean;
localLabel: string;
remoteLabel: string;
/** Push of local commits, shown only when the local source can push. */
canPush?: boolean;
onPush?: () => void;
pushDisabled?: boolean;
pushPending?: boolean;
pushTitle?: string;
};
/** Small pill toggle between the remote and local repository source. */
export function RepoSourceToggle({
controls,
}: {
controls: RepoSourceHeaderControls;
}) {
const showPush =
controls.source === "local" && controls.canPush && controls.onPush;
return (
{showPush ? (
) : null}
);
}