mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
AddProviderDialog -> AddDeployProviderDialog, refactor GitHub OAuth to be less hardcoded
This commit is contained in:
3 files changed
+11
-11
No files matched your search
@@ -28,7 +28,7 @@ interface OAuthHook {
|
||||
initiateOAuth: () => void;
|
||||
}
|
||||
|
||||
interface AddProviderDialogProps {
|
||||
interface AddDeployProviderDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
preset: PresetDeployProvider;
|
||||
@@ -39,7 +39,7 @@ interface AddProviderDialogProps {
|
||||
onAdd: (apiKey: string, accountId?: string, organizationId?: string) => void;
|
||||
}
|
||||
|
||||
export function AddProviderDialog({
|
||||
export function AddDeployProviderDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
preset,
|
||||
@@ -48,7 +48,7 @@ export function AddProviderDialog({
|
||||
forceManualEntry,
|
||||
onSetForceManualEntry,
|
||||
onAdd,
|
||||
}: AddProviderDialogProps) {
|
||||
}: AddDeployProviderDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const [apiKey, setApiKey] = useState('');
|
||||
const [accountId, setAccountId] = useState('');
|
||||
@@ -84,8 +84,8 @@ export function AddGitCredentialDialog({
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4 py-4">
|
||||
{preset.id === 'github' && isOAuthConfigured && !forceManualEntry ? (
|
||||
// Special rendering for GitHub OAuth
|
||||
{isOAuthConfigured && !forceManualEntry ? (
|
||||
// Show OAuth button if OAuth is configured and not forced to manual
|
||||
<div className="space-y-3">
|
||||
<div className="flex gap-0">
|
||||
<Button
|
||||
@@ -101,7 +101,7 @@ export function AddGitCredentialDialog({
|
||||
</>
|
||||
) : (
|
||||
<span className="truncate text-ellipsis overflow-hidden">
|
||||
Connect to GitHub
|
||||
Connect to {preset.name}
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
@@ -117,7 +117,7 @@ export function AddGitCredentialDialog({
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => onSetForceManualEntry(true)}>
|
||||
Enter API key
|
||||
Enter token manually
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@@ -129,7 +129,7 @@ export function AddGitCredentialDialog({
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
// Standard token input
|
||||
// Show manual token input
|
||||
<ExternalInput
|
||||
type="password"
|
||||
placeholder={t('enterToken')}
|
||||
@@ -146,7 +146,7 @@ export function AddGitCredentialDialog({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!(preset.id === 'github' && isOAuthConfigured && !forceManualEntry) && (
|
||||
{!(isOAuthConfigured && !forceManualEntry) && (
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
{t('cancel')}
|
||||
|
||||
Reference in new issue
Block a user