mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Fix linter issues
This commit is contained in:
7 files changed
+520
-569
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -33,7 +33,6 @@ import {
|
||||
import { useGit } from '@/hooks/useGit';
|
||||
import { useGitSettings } from '@/hooks/useGitSettings';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { findCredentialsForRepo } from '@/lib/gitCredentials';
|
||||
|
||||
interface PullRequestDialogProps {
|
||||
@@ -80,12 +79,38 @@ export function PullRequestDialog({
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
const loadRemoteBranches = useCallback(async () => {
|
||||
setIsLoadingBranches(true);
|
||||
try {
|
||||
const branches = await git.listBranches({
|
||||
dir: projectPath,
|
||||
remote: 'origin',
|
||||
});
|
||||
setRemoteBranches(branches);
|
||||
|
||||
// Set default target branch
|
||||
if (branches.includes('main')) {
|
||||
setTargetBranch('main');
|
||||
} else if (branches.includes('master')) {
|
||||
setTargetBranch('master');
|
||||
} else if (branches.length > 0) {
|
||||
setTargetBranch(branches[0]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to load remote branches:', err);
|
||||
// Set default branches if we can't fetch
|
||||
setRemoteBranches(['main', 'master', 'develop']);
|
||||
} finally {
|
||||
setIsLoadingBranches(false);
|
||||
}
|
||||
}, [git, projectPath]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && remoteUrl) {
|
||||
parseRemoteUrl(remoteUrl);
|
||||
loadRemoteBranches();
|
||||
}
|
||||
}, [isOpen, remoteUrl]);
|
||||
}, [isOpen, remoteUrl, loadRemoteBranches]);
|
||||
|
||||
const parseRemoteUrl = (url: string) => {
|
||||
setError(null);
|
||||
@@ -161,32 +186,6 @@ export function PullRequestDialog({
|
||||
}
|
||||
};
|
||||
|
||||
const loadRemoteBranches = async () => {
|
||||
setIsLoadingBranches(true);
|
||||
try {
|
||||
const branches = await git.listBranches({
|
||||
dir: projectPath,
|
||||
remote: 'origin',
|
||||
});
|
||||
setRemoteBranches(branches);
|
||||
|
||||
// Set default target branch
|
||||
if (branches.includes('main')) {
|
||||
setTargetBranch('main');
|
||||
} else if (branches.includes('master')) {
|
||||
setTargetBranch('master');
|
||||
} else if (branches.length > 0) {
|
||||
setTargetBranch(branches[0]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to load remote branches:', err);
|
||||
// Set default branches if we can't fetch
|
||||
setRemoteBranches(['main', 'master', 'develop']);
|
||||
} finally {
|
||||
setIsLoadingBranches(false);
|
||||
}
|
||||
};
|
||||
|
||||
const createPullRequest = async () => {
|
||||
if (!remoteInfo || !currentBranch) return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user