fix: Replace sign out button with prompt button for better user confirmation [INS-5877] (#8841)

* refactor: replace sign out button with prompt button for better user confirmation

* refactor: replace sign out button with prompt button for improved user experience
This commit is contained in:
Pavlos Koutoglou
2025-07-09 14:51:57 +02:00
committed by GitHub
parent 503acfaa78
commit 2e46c9afa4
2 changed files with 13 additions and 30 deletions

View File

@@ -4,7 +4,7 @@ import { useFetcher } from 'react-router';
import type { GitCredentials } from '../../../models/git-credentials';
import type { GitRepository } from '../../../models/git-repository';
import { showAlert } from '../modals';
import { PromptButton } from '../base/prompt-button';
import { GitHubRepositorySelect } from './github-repository-select';
interface Props {
@@ -100,22 +100,14 @@ const GitHubRepositoryForm = ({ uri, credentials, onSubmit }: GitHubRepositoryFo
<span className="text-sm text-[--hl]">{credentials.author.email || 'Signed in'}</span>
</div>
</div>
<Button
type="button"
onPress={() => {
showAlert({
title: 'Sign out of GitHub',
message:
'Are you sure you want to sign out? You will need to re-authenticate with GitHub to use this feature.',
okLabel: 'Sign out',
onConfirm: () => {
signOutFetcher.submit({}, { action: '/git-credentials/github/sign-out', method: 'POST' });
},
});
<PromptButton
confirmMessage="Confirm"
onClick={() => {
signOutFetcher.submit({}, { action: '/git-credentials/github/sign-out', method: 'POST' });
}}
>
Sign out
</Button>
Disconnect
</PromptButton>
</div>
<GitHubRepositorySelect uri={uri} token={credentials.token} />
{error && (

View File

@@ -4,8 +4,8 @@ import { useFetcher } from 'react-router';
import type { GitCredentials } from '../../../models/git-credentials';
import type { GitRepository } from '../../../models/git-repository';
import { PromptButton } from '../base/prompt-button';
import { Icon } from '../icon';
import { showAlert } from '../modals';
interface Props {
uri?: string;
@@ -98,22 +98,13 @@ const GitLabRepositoryForm = ({ uri, credentials, onSubmit }: GitLabRepositoryFo
<span className="text-sm text-[--hl]">{credentials.author.email || 'Signed in'}</span>
</div>
</div>
<Button
type="button"
onPress={() => {
showAlert({
title: 'Sign out of GitLab',
message:
'Are you sure you want to sign out? You will need to re-authenticate with GitLab to use this feature.',
okLabel: 'Sign out',
onConfirm: () => {
signOutFetcher.submit({}, { action: '/git-credentials/gitlab/sign-out', method: 'POST' });
},
});
<PromptButton
onClick={() => {
signOutFetcher.submit({}, { action: '/git-credentials/gitlab/sign-out', method: 'POST' });
}}
>
Sign out
</Button>
Disconnect
</PromptButton>
</div>
<TextField autoFocus name="uri" className="flex w-full flex-col gap-1 px-0.5" isRequired>
<Label className="text-start text-sm font-semibold">Git URI (https, including .git suffix)</Label>