diff --git a/libs/remix-ui/git/src/components/github/devicecode.tsx b/libs/remix-ui/git/src/components/github/devicecode.tsx index 5ba492e8e4..ad9a156545 100644 --- a/libs/remix-ui/git/src/components/github/devicecode.tsx +++ b/libs/remix-ui/git/src/components/github/devicecode.tsx @@ -71,10 +71,11 @@ export const GetDeviceCode = () => { return ( <> - {(context.gitHubUser && context.gitHubUser.login) ? null : + {(context.gitHubUser && context.gitHubUser.login) ? null : <> + + }}>Login in with github } {gitHubResponse && !authorized &&
@@ -109,15 +110,15 @@ export const GetDeviceCode = () => {
-
Connected as {context.gitHubUser.login}
+
Connected as {context.gitHubUser.login}


- - {context.gitHubUser.html_url} - {context.userEmails && context.userEmails.filter((email: any) => email.primary).map((email: any) => { - return

{email.email}
- })} + + {context.gitHubUser.html_url} + {context.userEmails && context.userEmails.filter((email: any) => email.primary).map((email: any) => { + return

{email.email}
+ })}
diff --git a/libs/remix-ui/git/src/components/github/repositoryselect.tsx b/libs/remix-ui/git/src/components/github/repositoryselect.tsx index c546d51e59..ec563a3f42 100644 --- a/libs/remix-ui/git/src/components/github/repositoryselect.tsx +++ b/libs/remix-ui/git/src/components/github/repositoryselect.tsx @@ -18,6 +18,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { const actions = React.useContext(gitActionsContext) const [loading, setLoading] = useState(false) const [show, setShow] = useState(false) + const [selected, setSelected] = useState(null) useEffect(() => { if (context.repositories && context.repositories.length > 0) { @@ -39,6 +40,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { const selectRepo = async (e: any) => { if (!e || !e.value) { props.select(null) + setSelected(null) return } const value = e && e.value @@ -49,6 +51,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { if (repo) { props.select(repo) + setSelected(repo) await actions.remoteBranches(repo.owner.login, repo.name) } } @@ -70,17 +73,20 @@ const RepositorySelect = (props: RepositorySelectProps) => { { show ? - selectRepo(e)} + theme={selectTheme} + styles={selectStyles} + isClearable={true} + placeholder="Type to search for a repository..." + isLoading={loading} + /> + { selected ? null : } + : null } ); }; diff --git a/libs/remix-ui/git/src/components/github/selectandclonerepositories.tsx b/libs/remix-ui/git/src/components/github/selectandclonerepositories.tsx index 0c85485f6e..5557c3f13b 100644 --- a/libs/remix-ui/git/src/components/github/selectandclonerepositories.tsx +++ b/libs/remix-ui/git/src/components/github/selectandclonerepositories.tsx @@ -18,7 +18,7 @@ export const SelectAndCloneRepositories = (props: RepositoriesProps) => { const [branch, setBranch] = useState({ name: "" }); const [repo, setRepo] = useState(null); - const selectRemoteBranch = async (branch:{ name: string }) => { + const selectRemoteBranch = async (branch: { name: string }) => { setBranch(branch) } @@ -46,12 +46,15 @@ export const SelectAndCloneRepositories = (props: RepositoriesProps) => { - { repo && } + {repo && } - { repo && branch && branch.name && branch.name !== '0' ? + {repo && branch && branch.name && branch.name !== '0' ? : null } + }}>clone {repo.full_name}:{branch.name} : null} + + {repo && (!branch || branch.name === '0') ? + : null} ) diff --git a/libs/remix-ui/git/src/components/panels/clone.tsx b/libs/remix-ui/git/src/components/panels/clone.tsx index 6a63948d52..e7719fe68e 100644 --- a/libs/remix-ui/git/src/components/panels/clone.tsx +++ b/libs/remix-ui/git/src/components/panels/clone.tsx @@ -8,7 +8,12 @@ import { SelectAndCloneRepositories } from "../github/selectandclonerepositories import { RemixUiCheckbox } from "@remix-ui/checkbox" import GitUIButton from "../buttons/gituibutton" -export const Clone = () => { +interface CloneProps { + hideLoadFromGitHub?: boolean +} + +export const Clone = (props: CloneProps) => { + const { hideLoadFromGitHub } = props const context = React.useContext(gitPluginContext) const actions = React.useContext(gitActionsContext) const [cloneUrl, setCloneUrl] = useLocalStorage( @@ -64,9 +69,10 @@ export const Clone = () => { return ( <>
- - -
+ {!hideLoadFromGitHub ? <> + + +
: null} onGitHubCloneUrlChange(e.target.value)} aria-describedby="urlprepend" /> diff --git a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx index 7e92bba35b..8fd33d7102 100644 --- a/libs/remix-ui/git/src/components/panels/githubcredentials.tsx +++ b/libs/remix-ui/git/src/components/panels/githubcredentials.tsx @@ -68,14 +68,19 @@ export const GitHubCredentials = () => { return ( <> +

+ + + handleChangeUserNameState(e.target.value)} value={githubUsername} className="form-control mb-3" placeholder="* Git username" type="text" id="githubUsername" /> + + handleChangeEmailState(e.target.value)} value={githubEmail} className="form-control mb-3" placeholder="* Git email" type="text" id="githubEmail" /> +
handleChangeTokenState(e.target.value)} />
- handleChangeUserNameState(e.target.value)} value={githubUsername} className="form-control mb-3" placeholder="* Git username" type="text" id="githubUsername" /> - handleChangeEmailState(e.target.value)} value={githubEmail} className="form-control mb-3" placeholder="* Git email" type="text" id="githubEmail" />
: null} + {repo && !remoteName ? + : null} + ) } diff --git a/libs/remix-ui/git/src/components/panels/setup.tsx b/libs/remix-ui/git/src/components/panels/setup.tsx index 42a68014ae..71b35f1499 100644 --- a/libs/remix-ui/git/src/components/panels/setup.tsx +++ b/libs/remix-ui/git/src/components/panels/setup.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' import { GetDeviceCode } from '../github/devicecode' import { GitHubCredentials } from './githubcredentials' +import { Clone } from './clone' export const Setup = () => { @@ -19,6 +20,8 @@ export const Setup = () => {
+
CLONE
+ ) } else if (screen === 1) { diff --git a/libs/remix-ui/git/src/components/panels/tokenWarning.tsx b/libs/remix-ui/git/src/components/panels/tokenWarning.tsx index e13b3c912e..1c818c716b 100644 --- a/libs/remix-ui/git/src/components/panels/tokenWarning.tsx +++ b/libs/remix-ui/git/src/components/panels/tokenWarning.tsx @@ -6,7 +6,7 @@ export const TokenWarning = () => { return (<> {(context.gitHubUser && context.gitHubUser.login) ? null : - Generate and add a Git token to use this plugin. Tokens are added in { + Generate and add a Git token or login with GitHub. Tokens are added in { }}>settings. } diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index 84b05f18e7..2982086113 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -322,6 +322,8 @@ export const clone = async (input: cloneInputType) => { message: `Cloned ${input.url} to ${repoNameWithTimestamp}` }) + plugin.call('notification', 'toast', `Cloned ${input.url} to ${repoNameWithTimestamp}`) + } catch (e: any) { await parseError(e) }