onSelect(row)}
- onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- e.preventDefault();
- onSelect(row);
- }
- }}
- data-testid={`mobile-repo-row-${row.repositoryId}`}
- className={`flex items-center gap-2 border px-2 py-2 rounded-md cursor-pointer select-none ${
- isActive ? "border-primary/50 bg-card" : "border-transparent hover:bg-muted"
- }`}
- >
-
-
-
{row.name}
-
-
-
- {row.checkoutBranch || row.baseBranch}
-
- {row.sessionCount > 0 && (
-
- {row.sessionCount} session{row.sessionCount === 1 ? "" : "s"}
-
- )}
-
-
- {isActive &&
}
-
- );
-}
-
-export const MobileReposSection = memo(function MobileReposSection({
- taskId,
- workspaceId,
- onClose,
-}: {
- taskId: string | null;
- workspaceId: string | null;
- onClose: () => void;
-}) {
- const setActiveSession = useAppStore((s) => s.setActiveSession);
- const activeSessionId = useAppStore((s) => s.tasks.activeSessionId);
- const activeRepoId = useAppStore((s) =>
- activeSessionId ? (s.taskSessions.items[activeSessionId]?.repository_id ?? null) : null,
- );
- const rows = useTaskRepoRows(taskId, workspaceId);
- const { toast } = useToast();
-
- const handleSelect = useCallback(
- (row: RepoRow) => {
- if (!taskId) return;
- if (row.switchToSessionId) {
- setActiveSession(taskId, row.switchToSessionId);
- onClose();
- return;
- }
- // We don't auto-launch from a repo tap — that would create a side effect
- // for what looks like navigation. Surface a hint so the tap doesn't
- // appear silently broken.
- toast({
- title: "No session on this repo yet",
- description: "Open the session picker to launch one.",
- });
- },
- [taskId, setActiveSession, onClose, toast],
- );
-
- if (!taskId) {
- return (
-