diff --git a/src/components/GitDialog.tsx b/src/components/GitDialog.tsx index 6461358a..9d4f02a8 100644 --- a/src/components/GitDialog.tsx +++ b/src/components/GitDialog.tsx @@ -682,8 +682,8 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog <> {children && {children}} - e.preventDefault()}> - + e.preventDefault()}> +
@@ -706,123 +706,122 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
- {/* URL Configuration */} - {gitStatus?.isGitRepo && ( - - - Git URL - - -
-
- - setOriginUrl(e.target.value)} - disabled={isSavingOrigin} - /> -
- +
+ + {/* Credentials Warning */} + {gitStatus.remotes.length > 0 && ( + (() => { + const remoteWithoutCredentials = gitStatus.remotes.find((remote) => !findCredentialsForRepo(remote.url, settings.credentials)); + if (!remoteWithoutCredentials) return null; + + let protocol = ''; + let hostname = 'the remote host'; + try { + const url = new URL(remoteWithoutCredentials.url); + protocol = url.protocol; + hostname = url.hostname; + } catch { + // Invalid URL + return ( + + + + Invalid URL format. Enter an https URL. + + + ); + } + + // Check for unsupported protocols + if (protocol !== 'https:' && protocol !== 'nostr:') { + return ( + + + + The {protocol.replace(':', '')} URL type is not supported. Enter an https URL. + + + ); + } + + // For nostr protocol, only show warning if user is not logged in + if (protocol === 'nostr:' && !user) { + return ( + + + + You are not logged into Nostr. Push & pull might not work unless you{' '} + . + + + ); + } + + // For https protocol, show warning if no credentials + if (protocol === 'https:') { + return ( + + + + You are not logged into {hostname}. Push & pull might not work unless you{' '} + . + + + ); + } + + return null; + })() )} - {isSavingOrigin ? 'Saving...' : 'Save'} - - - - {/* Credentials Warning */} - {gitStatus.remotes.length > 0 && ( - (() => { - const remoteWithoutCredentials = gitStatus.remotes.find((remote) => !findCredentialsForRepo(remote.url, settings.credentials)); - if (!remoteWithoutCredentials) return null; - - let protocol = ''; - let hostname = 'the remote host'; - try { - const url = new URL(remoteWithoutCredentials.url); - protocol = url.protocol; - hostname = url.hostname; - } catch { - // Invalid URL - return ( - - - - Invalid URL format. Enter an https URL. - - - ); - } - - // Check for unsupported protocols - if (protocol !== 'https:' && protocol !== 'nostr:') { - return ( - - - - The {protocol.replace(':', '')} URL type is not supported. Enter an https URL. - - - ); - } - - // For nostr protocol, only show warning if user is not logged in - if (protocol === 'nostr:' && !user) { - return ( - - - - You are not logged into Nostr. Push & pull might not work unless you{' '} - . - - - ); - } - - // For https protocol, show warning if no credentials - if (protocol === 'https:') { - return ( - - - - You are not logged into {hostname}. Push & pull might not work unless you{' '} - . - - - ); - } - - return null; - })() - )} -
-
- )} - - -
+ + + )} {/* Branch Selector */} {gitStatus?.isGitRepo && gitStatus.currentBranch && ( @@ -1021,8 +1020,8 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog )}
-
-
+ + {/* Advanced Git Management Dialog */}