Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/mobile/src/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import { DevicePreviewRouteScreen } from "./features/devices/DevicePreviewRouteS
import { BrowserPreviewRouteScreen } from "./features/browser/BrowserPreviewRouteScreen";
import { LocalPreviewRouteScreen } from "./features/browser/LocalPreviewRouteScreen";
import { GitBranchesSheet } from "./features/threads/git/GitBranchesSheet";
import { GitRemoteSheet } from "./features/threads/git/GitRemoteSheet";
import { GitCommitSheet } from "./features/threads/git/GitCommitSheet";
import { GitConfirmSheet } from "./features/threads/git/GitConfirmSheet";
import { GitOverviewSheet } from "./features/threads/git/GitOverviewSheet";
Expand Down Expand Up @@ -825,6 +826,11 @@ const RootStackConfig = createWorkspaceStackNavigator({
linking: `${THREAD_LINKING_PREFIX}/git/branches`,
options: sheetRoute({ detent: 0.55, androidFit: true }),
}),
GitRemote: createNativeStackScreen({
screen: GitRemoteSheet,
linking: `${THREAD_LINKING_PREFIX}/git/remote`,
options: sheetRoute({ detent: 0.55, androidFit: true }),
}),
GitConfirm: createNativeStackScreen({
screen: GitConfirmSheet,
linking: `${THREAD_LINKING_PREFIX}/git-confirm`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const LISTED_OVERLAY_ROUTES: ReadonlySet<string> = new Set([
"GitBranches",
"GitCommit",
"GitConfirm",
"GitRemote",
"GitOverview",
"NewTaskProject",
"NewTaskFiles",
Expand Down
16 changes: 16 additions & 0 deletions apps/mobile/src/features/threads/git/GitOverviewSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,22 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
)
}
/>
{gitStatus.data?.remotes && gitStatus.data.refName ? (
<ListRow
icon="cloud"
label={gt("Push remote")}
description={gitStatus.data.pushRemote ?? gt("Not chosen")}
disabled={busy}
onPress={() =>
presentRoute(() =>
navigation.navigate("GitRemote", {
environmentId: String(environmentId),
threadId: String(threadId),
}),
)
}
/>
) : null}
{linkedPrActions.canLink ? (
<ListRow
icon="link"
Expand Down
118 changes: 118 additions & 0 deletions apps/mobile/src/features/threads/git/GitRemoteSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import { useRef, useState } from "react";
import { useGT } from "gt-react-native";
import type { GitStackedAction } from "@t3tools/contracts";
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { Platform, ScrollView, useWindowDimensions, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

import { ListChoiceRow } from "../../../components/ui/ListChoiceRow";
import { ListSection } from "../../../components/ui/ListSection";
import { ScreenContent } from "../../../components/ui/ScreenContent";
import { SheetHeader } from "../../../components/ui/SheetHeader";
import { useEnvironmentQuery } from "../../../state/query";
import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-git-actions";
import { useSelectedThreadWorktree } from "../../../state/use-selected-thread-worktree";
import { useThreadSelection } from "../../../state/use-thread-selection";
import { vcsEnvironment } from "../../../state/vcs";

type GitRemoteSheetProps = StaticScreenProps<{
readonly environmentId: string;
readonly threadId: string;
/** Set when a git action is waiting on the choice; it runs once a remote is picked. */
readonly action?: GitStackedAction;
readonly commitMessage?: string;
readonly featureBranch?: string;
readonly filePaths?: string;
}>;

export function GitRemoteSheet(props: GitRemoteSheetProps) {
const { environmentId, threadId, action, commitMessage, featureBranch, filePaths } =
props.route.params;
const gt = useGT();
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const { height: windowHeight } = useWindowDimensions();
const { selectedThread } = useThreadSelection();
const { selectedThreadCwd } = useSelectedThreadWorktree();
const gitActions = useSelectedThreadGitActions();
const gitStatus = useEnvironmentQuery(
selectedThread !== null && selectedThreadCwd !== null
? vcsEnvironment.status({
environmentId: selectedThread.environmentId,
input: { cwd: selectedThreadCwd },
})
: null,
);
const selecting = useRef(false);
const [isSelecting, setIsSelecting] = useState(false);
const remotes = gitStatus.data?.remotes ?? [];
const pushRemote = gitStatus.data?.pushRemote;

const runSelection = async (remoteName: string) => {
if (action) {
navigation.dispatch(StackActions.replace("Thread", { environmentId, threadId }));
await gitActions.onRunSelectedThreadGitAction({
action,
pushRemote: remoteName,
...(commitMessage ? { commitMessage } : {}),
...(featureBranch === "true" ? { featureBranch: true } : {}),
...(filePaths ? { filePaths: JSON.parse(filePaths) as string[] } : {}),
});
return;
}
const result = await gitActions.onSetSelectedThreadPushRemote(remoteName);
if (result !== null && navigation.isFocused()) navigation.goBack();
};
const selectRemote = async (remoteName: string) => {
if (selecting.current) return;
selecting.current = true;
setIsSelecting(true);
await runSelection(remoteName).finally(() => {
selecting.current = false;
setIsSelecting(false);
});
};

return (
<View
collapsable={false}
className="bg-sheet ios:flex-1 android:flex-col-reverse"
style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
>
<ScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
className="android:shrink android:grow-0 ios:flex-1"
contentInsetAdjustmentBehavior="automatic"
showsVerticalScrollIndicator={false}
contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
contentContainerClassName="android:gap-2 android:p-2 ios:gap-4 ios:px-5 ios:pt-2"
>
<ListSection
{...(action
? {
footer: gt(
"This repository has several remotes and the branch has none chosen yet. It will track the one you pick.",
),
}
: {})}
>
{remotes.map((remoteName) => (
<ListChoiceRow
key={remoteName}
label={remoteName}
selected={remoteName === pushRemote}
disabled={isSelecting || !gitActions.canWriteSourceControl}
onPress={() => void selectRemote(remoteName)}
/>
))}
</ListSection>
</ScrollView>
</ScreenContent>
<SheetHeader
title={action ? gt("Push to which remote?") : gt("Push remote")}
onClose={() => navigation.goBack()}
/>
</View>
);
}
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "Neueste Änderungen werden gepullt",
"adb9c574404d1db8": "Bereits auf dem neuesten Stand",
"84964b49287ced17": "Neuester Stand auf {branch} gepullt",
"ea8ce1c79f81b25d": "Push-Remote wird geändert",
"439fbd498ad5aba1": "Anhänge sind nicht bereit",
"f928da494821aeb0": "Warte, bis die Uploads abgeschlossen sind, oder wiederhole fehlgeschlagene Uploads.",
"4c7966190fc234b4": "Zu viele Kontextelemente",
Expand Down Expand Up @@ -5412,6 +5413,8 @@
"5c72439f2a8e12bf": "Änderungen, nicht committete Bearbeitungen und Diffs der Runden untersuchen",
"466265a5e2628fb2": "Branch wechseln, Branch erstellen oder in einen Worktree wechseln",
"6ed8a3818ccfda2d": "Branches und Worktrees anzeigen",
"18cf05cd2cd7dd0e": "Push-Remote",
"8ba218cd9a65f767": "Nicht ausgewählt",
"b294ba924b8cd9c1": "{term, select, mr {Einen Merge Request per URL oder Nummer anhängen} cr {Eine Änderungsanfrage per URL oder Nummer anhängen} other {Einen Pull Request per URL oder Nummer anhängen}}",
"a7ae53d702ca2548": "Aus diesem Thread entfernen",
"ae76dd262f9f5a43": "Das Repository wird weiterhin vom Projekt verfolgt",
Expand All @@ -5431,6 +5434,8 @@
"0c45f037e0d332be": "Ein verfolgtes Repository zu diesem Thread hinzufügen",
"f512ff8e7b064163": "Einen Worktree eines verfolgten Repositorys hinzufügen",
"562eeedc0de805fe": "Keine weiteren Repositorys",
"00c1e5d0b43e70be": "Dieses Repository hat mehrere Remotes und für diesen Branch wurde noch keines ausgewählt. Er wird das ausgewählte Remote verfolgen.",
"db3369af717edbfb": "An welches Remote pushen?",
"cd49e17eaf69eee3": "Branch-Status wird geladen…",
"95be4cac9ca707c4": "Kein Git-Repository",
"d804d85750efb3b8": "{term, select, mr {MR #{number} offen} cr {Änderungsanfrage #{number} offen} other {PR #{number} offen}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "Pulling latest changes",
"adb9c574404d1db8": "Already up to date",
"84964b49287ced17": "Pulled latest on {branch}",
"ea8ce1c79f81b25d": "Changing push remote",
"439fbd498ad5aba1": "Attachments are not ready",
"f928da494821aeb0": "Wait for uploads to finish, or retry failed uploads.",
"4c7966190fc234b4": "Too many context items",
Expand Down Expand Up @@ -5414,6 +5415,8 @@
"5c72439f2a8e12bf": "Inspect changes, uncommitted edits, and turn diffs",
"466265a5e2628fb2": "Switch branch, create branch, or move to a worktree",
"6ed8a3818ccfda2d": "View branches and worktrees",
"18cf05cd2cd7dd0e": "Push remote",
"8ba218cd9a65f767": "Not chosen",
"b294ba924b8cd9c1": "{term, select, mr {Attach a merge request by URL or number} cr {Attach a change request by URL or number} other {Attach a pull request by URL or number}}",
"a7ae53d702ca2548": "Remove from this thread",
"ae76dd262f9f5a43": "The repository stays tracked by the project",
Expand All @@ -5433,6 +5436,8 @@
"0c45f037e0d332be": "Add a tracked repository to this thread",
"f512ff8e7b064163": "Add a worktree of a tracked repository",
"562eeedc0de805fe": "No other repositories",
"00c1e5d0b43e70be": "This repository has several remotes and the branch has none chosen yet. It will track the one you pick.",
"db3369af717edbfb": "Push to which remote?",
"cd49e17eaf69eee3": "Loading branch status…",
"95be4cac9ca707c4": "Not a git repository",
"d804d85750efb3b8": "{term, select, mr {MR #{number} open} cr {change request #{number} open} other {PR #{number} open}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "Haciendo pull de los últimos cambios",
"adb9c574404d1db8": "Ya está actualizado",
"84964b49287ced17": "Pull de los últimos cambios en {branch} completado",
"ea8ce1c79f81b25d": "Cambiando remoto de push",
"439fbd498ad5aba1": "Los adjuntos no están listos",
"f928da494821aeb0": "Espera a que terminen las subidas o reintenta las fallidas.",
"4c7966190fc234b4": "Demasiados elementos de contexto",
Expand Down Expand Up @@ -5406,6 +5407,8 @@
"5c72439f2a8e12bf": "Inspecciona los cambios, las ediciones sin commit y los diffs de turnos",
"466265a5e2628fb2": "Cambia de rama, crea una rama o pasa a un worktree",
"6ed8a3818ccfda2d": "Ver ramas y worktrees",
"18cf05cd2cd7dd0e": "Remoto de push",
"8ba218cd9a65f767": "Sin elegir",
"b294ba924b8cd9c1": "{term, select, mr {Adjuntar una merge request por URL o número} cr {Adjuntar una solicitud de cambios por URL o número} other {Adjuntar una pull request por URL o número}}",
"a7ae53d702ca2548": "Quitar de este hilo",
"ae76dd262f9f5a43": "El proyecto sigue haciendo seguimiento del repositorio",
Expand All @@ -5425,6 +5428,8 @@
"0c45f037e0d332be": "Añadir a este hilo un repositorio seguido",
"f512ff8e7b064163": "Añadir un worktree de un repositorio seguido",
"562eeedc0de805fe": "No hay otros repositorios",
"00c1e5d0b43e70be": "Este repositorio tiene varios remotos y la rama aún no tiene uno elegido. Seguirá al que elijas.",
"db3369af717edbfb": "¿A qué remoto enviar?",
"cd49e17eaf69eee3": "Cargando el estado de la rama…",
"95be4cac9ca707c4": "No es un repositorio git",
"d804d85750efb3b8": "{term, select, mr {MR #{number} abierta} cr {solicitud de cambios #{number} abierta} other {PR #{number} abierta}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "Récupération des dernières modifications",
"adb9c574404d1db8": "Déjà à jour",
"84964b49287ced17": "Dernières modifications récupérées sur {branch}",
"ea8ce1c79f81b25d": "Modification du dépôt distant de push",
"439fbd498ad5aba1": "Les pièces jointes ne sont pas prêtes",
"f928da494821aeb0": "Attendez la fin des envois, ou relancez les envois échoués.",
"4c7966190fc234b4": "Trop d’éléments de contexte",
Expand Down Expand Up @@ -5406,6 +5407,8 @@
"5c72439f2a8e12bf": "Inspecter les modifications, les changements non commités et les diffs des tours",
"466265a5e2628fb2": "Changer de branche, créer une branche ou passer à un worktree",
"6ed8a3818ccfda2d": "Voir les branches et worktrees",
"18cf05cd2cd7dd0e": "Dépôt distant de push",
"8ba218cd9a65f767": "Non choisi",
"b294ba924b8cd9c1": "{term, select, mr {Joindre une merge request par URL ou numéro} cr {Joindre une demande de modification par URL ou numéro} other {Joindre une pull request par URL ou numéro}}",
"a7ae53d702ca2548": "Retirer de ce fil",
"ae76dd262f9f5a43": "Le dépôt reste suivi par le projet",
Expand All @@ -5425,6 +5428,8 @@
"0c45f037e0d332be": "Ajouter un dépôt suivi à ce fil",
"f512ff8e7b064163": "Ajouter un worktree d’un dépôt suivi",
"562eeedc0de805fe": "Aucun autre dépôt",
"00c1e5d0b43e70be": "Ce dépôt a plusieurs dépôts distants et la branche n’en a pas encore choisi. Elle suivra celui que vous choisissez.",
"db3369af717edbfb": "Vers quel dépôt distant pousser ?",
"cd49e17eaf69eee3": "Chargement du statut de la branche…",
"95be4cac9ca707c4": "Pas un dépôt git",
"d804d85750efb3b8": "{term, select, mr {MR #{number} ouverte} cr {demande de modification #{number} ouverte} other {PR #{number} ouverte}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "最新の変更をプルしています",
"adb9c574404d1db8": "すでに最新です",
"84964b49287ced17": "{branch} で最新の変更をプルしました",
"ea8ce1c79f81b25d": "プッシュ先リモートを変更中",
"439fbd498ad5aba1": "添付ファイルの準備ができていません",
"f928da494821aeb0": "アップロードが完了するまで待つか、失敗したアップロードを再試行してください。",
"4c7966190fc234b4": "コンテキストの項目が多すぎます",
Expand Down Expand Up @@ -5387,6 +5388,8 @@
"5c72439f2a8e12bf": "変更、未コミットの編集、ターンの差分を確認",
"466265a5e2628fb2": "ブランチの切り替え・作成、またはワークツリーへの移動",
"6ed8a3818ccfda2d": "ブランチとワークツリーを表示",
"18cf05cd2cd7dd0e": "プッシュ先リモート",
"8ba218cd9a65f767": "未選択",
"b294ba924b8cd9c1": "{term, select, mr {URL または番号でマージリクエストを添付} cr {URL または番号で変更リクエストを添付} other {URL または番号でプルリクエストを添付}}",
"a7ae53d702ca2548": "このスレッドから削除",
"ae76dd262f9f5a43": "リポジトリは引き続きプロジェクトで追跡されます",
Expand All @@ -5406,6 +5409,8 @@
"0c45f037e0d332be": "追跡中のリポジトリをこのスレッドに追加",
"f512ff8e7b064163": "追跡中のリポジトリのワークツリーを追加",
"562eeedc0de805fe": "他のリポジトリはありません",
"00c1e5d0b43e70be": "このリポジトリには複数のリモートがあり、ブランチのリモートは未選択です。選択したリモートを追跡します。",
"db3369af717edbfb": "どのリモートにプッシュしますか?",
"cd49e17eaf69eee3": "ブランチのステータスを読み込んでいます…",
"95be4cac9ca707c4": "Git リポジトリではありません",
"d804d85750efb3b8": "{term, select, mr {MR #{number} オープン} cr {変更リクエスト #{number} オープン} other {PR #{number} オープン}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "최신 변경 사항 가져오는 중",
"adb9c574404d1db8": "이미 최신 상태",
"84964b49287ced17": "{branch}에서 최신 변경 사항을 가져왔습니다",
"ea8ce1c79f81b25d": "푸시 원격 저장소 변경 중",
"439fbd498ad5aba1": "첨부 파일이 준비되지 않았습니다",
"f928da494821aeb0": "업로드가 끝날 때까지 기다리거나 실패한 업로드를 다시 시도하세요.",
"4c7966190fc234b4": "컨텍스트 항목이 너무 많습니다",
Expand Down Expand Up @@ -5391,6 +5392,8 @@
"5c72439f2a8e12bf": "변경 사항, 커밋되지 않은 편집, 턴 변경 사항 검사",
"466265a5e2628fb2": "브랜치 전환, 브랜치 만들기 또는 워크트리로 이동",
"6ed8a3818ccfda2d": "브랜치 및 워크트리 보기",
"18cf05cd2cd7dd0e": "푸시 원격 저장소",
"8ba218cd9a65f767": "선택 안 함",
"b294ba924b8cd9c1": "{term, select, mr {URL이나 번호로 병합 요청 첨부} cr {URL이나 번호로 변경 요청 첨부} other {URL이나 번호로 풀 리퀘스트 첨부}}",
"a7ae53d702ca2548": "이 스레드에서 제거",
"ae76dd262f9f5a43": "저장소는 계속 프로젝트에서 추적됩니다",
Expand All @@ -5410,6 +5413,8 @@
"0c45f037e0d332be": "추적 중인 저장소를 이 스레드에 추가",
"f512ff8e7b064163": "추적 중인 저장소의 워크트리 추가",
"562eeedc0de805fe": "다른 저장소 없음",
"00c1e5d0b43e70be": "이 저장소에는 여러 원격 저장소가 있으며 브랜치에 아직 선택된 원격 저장소가 없습니다. 선택한 원격 저장소를 추적합니다.",
"db3369af717edbfb": "어느 원격 저장소에 푸시할까요?",
"cd49e17eaf69eee3": "브랜치 상태 불러오는 중…",
"95be4cac9ca707c4": "Git 저장소가 아님",
"d804d85750efb3b8": "{term, select, mr {MR #{number} 열림} cr {변경 요청 #{number} 열림} other {PR #{number} 열림}}",
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,7 @@
"5521de0732509b7c": "Fazendo pull das alterações mais recentes",
"adb9c574404d1db8": "Já está atualizado",
"84964b49287ced17": "Pull mais recente feito em {branch}",
"ea8ce1c79f81b25d": "Alterando remoto de push",
"439fbd498ad5aba1": "Os anexos não estão prontos",
"f928da494821aeb0": "Aguarde os envios terminarem ou tente novamente os que falharam.",
"4c7966190fc234b4": "Itens de contexto demais",
Expand Down Expand Up @@ -5406,6 +5407,8 @@
"5c72439f2a8e12bf": "Inspecione alterações, edições sem commit e diffs dos turnos",
"466265a5e2628fb2": "Troque de branch, crie um branch ou mude para um worktree",
"6ed8a3818ccfda2d": "Ver branches e worktrees",
"18cf05cd2cd7dd0e": "Remoto de push",
"8ba218cd9a65f767": "Não escolhido",
"b294ba924b8cd9c1": "{term, select, mr {Anexar um merge request por URL ou número} cr {Anexar uma solicitação de alteração por URL ou número} other {Anexar um pull request por URL ou número}}",
"a7ae53d702ca2548": "Remover desta thread",
"ae76dd262f9f5a43": "O repositório continua rastreado pelo projeto",
Expand All @@ -5425,6 +5428,8 @@
"0c45f037e0d332be": "Adicionar um repositório rastreado a esta thread",
"f512ff8e7b064163": "Adicionar um worktree de um repositório rastreado",
"562eeedc0de805fe": "Nenhum outro repositório",
"00c1e5d0b43e70be": "Este repositório tem vários remotos e a branch ainda não tem um escolhido. Ela rastreará o que você escolher.",
"db3369af717edbfb": "Para qual remoto enviar?",
"cd49e17eaf69eee3": "Carregando status do branch…",
"95be4cac9ca707c4": "Não é um repositório git",
"d804d85750efb3b8": "{term, select, mr {MR #{number} aberto} cr {solicitação de alteração #{number} aberta} other {PR #{number} aberto}}",
Expand Down
Loading
Loading