feat: add GitHub deployment functionality (#1904)
- Add GitHubDeploy component to handle build and file preparation - Create GitHubDeploymentDialog for repository selection and creation - Update DeployButton to include GitHub deployment option - Support both new and existing GitHub repositories - Allow choosing between public and private repositories
This commit is contained in:
@@ -10,23 +10,30 @@ import { NetlifyDeploymentLink } from '~/components/chat/NetlifyDeploymentLink.c
|
|||||||
import { VercelDeploymentLink } from '~/components/chat/VercelDeploymentLink.client';
|
import { VercelDeploymentLink } from '~/components/chat/VercelDeploymentLink.client';
|
||||||
import { useVercelDeploy } from '~/components/deploy/VercelDeploy.client';
|
import { useVercelDeploy } from '~/components/deploy/VercelDeploy.client';
|
||||||
import { useNetlifyDeploy } from '~/components/deploy/NetlifyDeploy.client';
|
import { useNetlifyDeploy } from '~/components/deploy/NetlifyDeploy.client';
|
||||||
|
import { useGitHubDeploy } from '~/components/deploy/GitHubDeploy.client';
|
||||||
|
import { GitHubDeploymentDialog } from '~/components/deploy/GitHubDeploymentDialog';
|
||||||
|
|
||||||
interface DeployButtonProps {
|
interface DeployButtonProps {
|
||||||
onVercelDeploy?: () => Promise<void>;
|
onVercelDeploy?: () => Promise<void>;
|
||||||
onNetlifyDeploy?: () => Promise<void>;
|
onNetlifyDeploy?: () => Promise<void>;
|
||||||
|
onGitHubDeploy?: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy }: DeployButtonProps) => {
|
export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy, onGitHubDeploy }: DeployButtonProps) => {
|
||||||
const netlifyConn = useStore(netlifyConnection);
|
const netlifyConn = useStore(netlifyConnection);
|
||||||
const vercelConn = useStore(vercelConnection);
|
const vercelConn = useStore(vercelConnection);
|
||||||
const [activePreviewIndex] = useState(0);
|
const [activePreviewIndex] = useState(0);
|
||||||
const previews = useStore(workbenchStore.previews);
|
const previews = useStore(workbenchStore.previews);
|
||||||
const activePreview = previews[activePreviewIndex];
|
const activePreview = previews[activePreviewIndex];
|
||||||
const [isDeploying, setIsDeploying] = useState(false);
|
const [isDeploying, setIsDeploying] = useState(false);
|
||||||
const [deployingTo, setDeployingTo] = useState<'netlify' | 'vercel' | null>(null);
|
const [deployingTo, setDeployingTo] = useState<'netlify' | 'vercel' | 'github' | null>(null);
|
||||||
const isStreaming = useStore(streamingState);
|
const isStreaming = useStore(streamingState);
|
||||||
const { handleVercelDeploy } = useVercelDeploy();
|
const { handleVercelDeploy } = useVercelDeploy();
|
||||||
const { handleNetlifyDeploy } = useNetlifyDeploy();
|
const { handleNetlifyDeploy } = useNetlifyDeploy();
|
||||||
|
const { handleGitHubDeploy } = useGitHubDeploy();
|
||||||
|
const [showGitHubDeploymentDialog, setShowGitHubDeploymentDialog] = useState(false);
|
||||||
|
const [githubDeploymentFiles, setGithubDeploymentFiles] = useState<Record<string, string> | null>(null);
|
||||||
|
const [githubProjectName, setGithubProjectName] = useState('');
|
||||||
|
|
||||||
const handleVercelDeployClick = async () => {
|
const handleVercelDeployClick = async () => {
|
||||||
setIsDeploying(true);
|
setIsDeploying(true);
|
||||||
@@ -60,87 +67,142 @@ export const DeployButton = ({ onVercelDeploy, onNetlifyDeploy }: DeployButtonPr
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleGitHubDeployClick = async () => {
|
||||||
|
setIsDeploying(true);
|
||||||
|
setDeployingTo('github');
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (onGitHubDeploy) {
|
||||||
|
await onGitHubDeploy();
|
||||||
|
} else {
|
||||||
|
const result = await handleGitHubDeploy();
|
||||||
|
|
||||||
|
if (result && result.success && result.files) {
|
||||||
|
setGithubDeploymentFiles(result.files);
|
||||||
|
setGithubProjectName(result.projectName);
|
||||||
|
setShowGitHubDeploymentDialog(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setIsDeploying(false);
|
||||||
|
setDeployingTo(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex border border-bolt-elements-borderColor rounded-md overflow-hidden text-sm">
|
<>
|
||||||
<DropdownMenu.Root>
|
<div className="flex border border-bolt-elements-borderColor rounded-md overflow-hidden text-sm">
|
||||||
<DropdownMenu.Trigger
|
<DropdownMenu.Root>
|
||||||
disabled={isDeploying || !activePreview || isStreaming}
|
<DropdownMenu.Trigger
|
||||||
className="rounded-md items-center justify-center [&:is(:disabled,.disabled)]:cursor-not-allowed [&:is(:disabled,.disabled)]:opacity-60 px-3 py-1.5 text-xs bg-accent-500 text-white hover:text-bolt-elements-item-contentAccent [&:not(:disabled,.disabled)]:hover:bg-bolt-elements-button-primary-backgroundHover outline-accent-500 flex gap-1.7"
|
disabled={isDeploying || !activePreview || isStreaming}
|
||||||
>
|
className="rounded-md items-center justify-center [&:is(:disabled,.disabled)]:cursor-not-allowed [&:is(:disabled,.disabled)]:opacity-60 px-3 py-1.5 text-xs bg-accent-500 text-white hover:text-bolt-elements-item-contentAccent [&:not(:disabled,.disabled)]:hover:bg-bolt-elements-button-primary-backgroundHover outline-accent-500 flex gap-1.7"
|
||||||
{isDeploying ? `Deploying to ${deployingTo}...` : 'Deploy'}
|
>
|
||||||
<span className={classNames('i-ph:caret-down transition-transform')} />
|
{isDeploying ? `Deploying to ${deployingTo}...` : 'Deploy'}
|
||||||
</DropdownMenu.Trigger>
|
<span className={classNames('i-ph:caret-down transition-transform')} />
|
||||||
<DropdownMenu.Content
|
</DropdownMenu.Trigger>
|
||||||
className={classNames(
|
<DropdownMenu.Content
|
||||||
'z-[250]',
|
|
||||||
'bg-bolt-elements-background-depth-2',
|
|
||||||
'rounded-lg shadow-lg',
|
|
||||||
'border border-bolt-elements-borderColor',
|
|
||||||
'animate-in fade-in-0 zoom-in-95',
|
|
||||||
'py-1',
|
|
||||||
)}
|
|
||||||
sideOffset={5}
|
|
||||||
align="end"
|
|
||||||
>
|
|
||||||
<DropdownMenu.Item
|
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'cursor-pointer flex items-center w-full px-4 py-2 text-sm text-bolt-elements-textPrimary hover:bg-bolt-elements-item-backgroundActive gap-2 rounded-md group relative',
|
'z-[250]',
|
||||||
{
|
'bg-bolt-elements-background-depth-2',
|
||||||
'opacity-60 cursor-not-allowed': isDeploying || !activePreview || !netlifyConn.user,
|
'rounded-lg shadow-lg',
|
||||||
},
|
'border border-bolt-elements-borderColor',
|
||||||
|
'animate-in fade-in-0 zoom-in-95',
|
||||||
|
'py-1',
|
||||||
)}
|
)}
|
||||||
disabled={isDeploying || !activePreview || !netlifyConn.user}
|
sideOffset={5}
|
||||||
onClick={handleNetlifyDeployClick}
|
align="end"
|
||||||
>
|
>
|
||||||
<img
|
<DropdownMenu.Item
|
||||||
className="w-5 h-5"
|
className={classNames(
|
||||||
height="24"
|
'cursor-pointer flex items-center w-full px-4 py-2 text-sm text-bolt-elements-textPrimary hover:bg-bolt-elements-item-backgroundActive gap-2 rounded-md group relative',
|
||||||
width="24"
|
{
|
||||||
crossOrigin="anonymous"
|
'opacity-60 cursor-not-allowed': isDeploying || !activePreview || !netlifyConn.user,
|
||||||
src="https://cdn.simpleicons.org/netlify"
|
},
|
||||||
/>
|
)}
|
||||||
<span className="mx-auto">{!netlifyConn.user ? 'No Netlify Account Connected' : 'Deploy to Netlify'}</span>
|
disabled={isDeploying || !activePreview || !netlifyConn.user}
|
||||||
{netlifyConn.user && <NetlifyDeploymentLink />}
|
onClick={handleNetlifyDeployClick}
|
||||||
</DropdownMenu.Item>
|
>
|
||||||
|
<img
|
||||||
|
className="w-5 h-5"
|
||||||
|
height="24"
|
||||||
|
width="24"
|
||||||
|
crossOrigin="anonymous"
|
||||||
|
src="https://cdn.simpleicons.org/netlify"
|
||||||
|
/>
|
||||||
|
<span className="mx-auto">{!netlifyConn.user ? 'No Netlify Account Connected' : 'Deploy to Netlify'}</span>
|
||||||
|
{netlifyConn.user && <NetlifyDeploymentLink />}
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'cursor-pointer flex items-center w-full px-4 py-2 text-sm text-bolt-elements-textPrimary hover:bg-bolt-elements-item-backgroundActive gap-2 rounded-md group relative',
|
'cursor-pointer flex items-center w-full px-4 py-2 text-sm text-bolt-elements-textPrimary hover:bg-bolt-elements-item-backgroundActive gap-2 rounded-md group relative',
|
||||||
{
|
{
|
||||||
'opacity-60 cursor-not-allowed': isDeploying || !activePreview || !vercelConn.user,
|
'opacity-60 cursor-not-allowed': isDeploying || !activePreview || !vercelConn.user,
|
||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
disabled={isDeploying || !activePreview || !vercelConn.user}
|
disabled={isDeploying || !activePreview || !vercelConn.user}
|
||||||
onClick={handleVercelDeployClick}
|
onClick={handleVercelDeployClick}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="w-5 h-5 bg-black p-1 rounded"
|
className="w-5 h-5 bg-black p-1 rounded"
|
||||||
height="24"
|
height="24"
|
||||||
width="24"
|
width="24"
|
||||||
crossOrigin="anonymous"
|
crossOrigin="anonymous"
|
||||||
src="https://cdn.simpleicons.org/vercel/white"
|
src="https://cdn.simpleicons.org/vercel/white"
|
||||||
alt="vercel"
|
alt="vercel"
|
||||||
/>
|
/>
|
||||||
<span className="mx-auto">{!vercelConn.user ? 'No Vercel Account Connected' : 'Deploy to Vercel'}</span>
|
<span className="mx-auto">{!vercelConn.user ? 'No Vercel Account Connected' : 'Deploy to Vercel'}</span>
|
||||||
{vercelConn.user && <VercelDeploymentLink />}
|
{vercelConn.user && <VercelDeploymentLink />}
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
|
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
disabled
|
className={classNames(
|
||||||
className="flex items-center w-full rounded-md px-4 py-2 text-sm text-bolt-elements-textTertiary gap-2 opacity-60 cursor-not-allowed"
|
'cursor-pointer flex items-center w-full px-4 py-2 text-sm text-bolt-elements-textPrimary hover:bg-bolt-elements-item-backgroundActive gap-2 rounded-md group relative',
|
||||||
>
|
{
|
||||||
<img
|
'opacity-60 cursor-not-allowed': isDeploying || !activePreview,
|
||||||
className="w-5 h-5"
|
},
|
||||||
height="24"
|
)}
|
||||||
width="24"
|
disabled={isDeploying || !activePreview}
|
||||||
crossOrigin="anonymous"
|
onClick={handleGitHubDeployClick}
|
||||||
src="https://cdn.simpleicons.org/cloudflare"
|
>
|
||||||
alt="cloudflare"
|
<img
|
||||||
/>
|
className="w-5 h-5"
|
||||||
<span className="mx-auto">Deploy to Cloudflare (Coming Soon)</span>
|
height="24"
|
||||||
</DropdownMenu.Item>
|
width="24"
|
||||||
</DropdownMenu.Content>
|
crossOrigin="anonymous"
|
||||||
</DropdownMenu.Root>
|
src="https://cdn.simpleicons.org/github"
|
||||||
</div>
|
alt="github"
|
||||||
|
/>
|
||||||
|
<span className="mx-auto">Deploy to GitHub</span>
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
|
||||||
|
<DropdownMenu.Item
|
||||||
|
disabled
|
||||||
|
className="flex items-center w-full rounded-md px-4 py-2 text-sm text-bolt-elements-textTertiary gap-2 opacity-60 cursor-not-allowed"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="w-5 h-5"
|
||||||
|
height="24"
|
||||||
|
width="24"
|
||||||
|
crossOrigin="anonymous"
|
||||||
|
src="https://cdn.simpleicons.org/cloudflare"
|
||||||
|
alt="cloudflare"
|
||||||
|
/>
|
||||||
|
<span className="mx-auto">Deploy to Cloudflare (Coming Soon)</span>
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
</DropdownMenu.Content>
|
||||||
|
</DropdownMenu.Root>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* GitHub Deployment Dialog */}
|
||||||
|
{showGitHubDeploymentDialog && githubDeploymentFiles && (
|
||||||
|
<GitHubDeploymentDialog
|
||||||
|
isOpen={showGitHubDeploymentDialog}
|
||||||
|
onClose={() => setShowGitHubDeploymentDialog(false)}
|
||||||
|
projectName={githubProjectName}
|
||||||
|
files={githubDeploymentFiles}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
162
app/components/deploy/GitHubDeploy.client.tsx
Normal file
162
app/components/deploy/GitHubDeploy.client.tsx
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import { useStore } from '@nanostores/react';
|
||||||
|
import { workbenchStore } from '~/lib/stores/workbench';
|
||||||
|
import { webcontainer } from '~/lib/webcontainer';
|
||||||
|
import { path } from '~/utils/path';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import type { ActionCallbackData } from '~/lib/runtime/message-parser';
|
||||||
|
import { chatId } from '~/lib/persistence/useChatHistory';
|
||||||
|
import { getLocalStorage } from '~/lib/persistence/localStorage';
|
||||||
|
|
||||||
|
export function useGitHubDeploy() {
|
||||||
|
const [isDeploying, setIsDeploying] = useState(false);
|
||||||
|
const currentChatId = useStore(chatId);
|
||||||
|
|
||||||
|
const handleGitHubDeploy = async () => {
|
||||||
|
const connection = getLocalStorage('github_connection');
|
||||||
|
|
||||||
|
if (!connection?.token || !connection?.user) {
|
||||||
|
toast.error('Please connect your GitHub account in Settings > Connections first');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentChatId) {
|
||||||
|
toast.error('No active chat found');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setIsDeploying(true);
|
||||||
|
|
||||||
|
const artifact = workbenchStore.firstArtifact;
|
||||||
|
|
||||||
|
if (!artifact) {
|
||||||
|
throw new Error('No active project found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a deployment artifact for visual feedback
|
||||||
|
const deploymentId = `deploy-github-project`;
|
||||||
|
workbenchStore.addArtifact({
|
||||||
|
id: deploymentId,
|
||||||
|
messageId: deploymentId,
|
||||||
|
title: 'GitHub Deployment',
|
||||||
|
type: 'standalone',
|
||||||
|
});
|
||||||
|
|
||||||
|
const deployArtifact = workbenchStore.artifacts.get()[deploymentId];
|
||||||
|
|
||||||
|
// Notify that build is starting
|
||||||
|
deployArtifact.runner.handleDeployAction('building', 'running', { source: 'github' });
|
||||||
|
|
||||||
|
const actionId = 'build-' + Date.now();
|
||||||
|
const actionData: ActionCallbackData = {
|
||||||
|
messageId: 'github build',
|
||||||
|
artifactId: artifact.id,
|
||||||
|
actionId,
|
||||||
|
action: {
|
||||||
|
type: 'build' as const,
|
||||||
|
content: 'npm run build',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add the action first
|
||||||
|
artifact.runner.addAction(actionData);
|
||||||
|
|
||||||
|
// Then run it
|
||||||
|
await artifact.runner.runAction(actionData);
|
||||||
|
|
||||||
|
if (!artifact.runner.buildOutput) {
|
||||||
|
// Notify that build failed
|
||||||
|
deployArtifact.runner.handleDeployAction('building', 'failed', {
|
||||||
|
error: 'Build failed. Check the terminal for details.',
|
||||||
|
source: 'github',
|
||||||
|
});
|
||||||
|
throw new Error('Build failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify that build succeeded and deployment preparation is starting
|
||||||
|
deployArtifact.runner.handleDeployAction('deploying', 'running', {
|
||||||
|
source: 'github'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get all project files instead of just the build directory since we're deploying to a repository
|
||||||
|
const container = await webcontainer;
|
||||||
|
|
||||||
|
// Get all files recursively - we'll deploy the entire project, not just the build directory
|
||||||
|
async function getAllFiles(dirPath: string, basePath: string = ''): Promise<Record<string, string>> {
|
||||||
|
const files: Record<string, string> = {};
|
||||||
|
const entries = await container.fs.readdir(dirPath, { withFileTypes: true });
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullPath = path.join(dirPath, entry.name);
|
||||||
|
// Create a relative path without the leading slash for GitHub
|
||||||
|
const relativePath = basePath ? `${basePath}/${entry.name}` : entry.name;
|
||||||
|
|
||||||
|
// Skip node_modules, .git directories and other common excludes
|
||||||
|
if (entry.isDirectory() && (
|
||||||
|
entry.name === 'node_modules' ||
|
||||||
|
entry.name === '.git' ||
|
||||||
|
entry.name === 'dist' ||
|
||||||
|
entry.name === 'build' ||
|
||||||
|
entry.name === '.cache' ||
|
||||||
|
entry.name === '.next'
|
||||||
|
)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.isFile()) {
|
||||||
|
// Skip binary files, large files and other common excludes
|
||||||
|
if (entry.name.endsWith('.DS_Store') ||
|
||||||
|
entry.name.endsWith('.log') ||
|
||||||
|
entry.name.startsWith('.env')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const content = await container.fs.readFile(fullPath, 'utf-8');
|
||||||
|
// Store the file with its relative path, not the full system path
|
||||||
|
files[relativePath] = content;
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Could not read file ${fullPath}:`, error);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (entry.isDirectory()) {
|
||||||
|
const subFiles = await getAllFiles(fullPath, relativePath);
|
||||||
|
Object.assign(files, subFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileContents = await getAllFiles('/');
|
||||||
|
|
||||||
|
// Show GitHub deployment dialog here - it will handle the actual deployment
|
||||||
|
// and will receive these files to deploy
|
||||||
|
|
||||||
|
// For now, we'll just complete the deployment with a success message
|
||||||
|
// Notify that deployment preparation is complete
|
||||||
|
deployArtifact.runner.handleDeployAction('deploying', 'complete', {
|
||||||
|
source: 'github'
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
files: fileContents,
|
||||||
|
projectName: artifact.title || 'bolt-project'
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
console.error('GitHub deploy error:', err);
|
||||||
|
toast.error(err instanceof Error ? err.message : 'GitHub deployment preparation failed');
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
setIsDeploying(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
isDeploying,
|
||||||
|
handleGitHubDeploy,
|
||||||
|
isConnected: !!getLocalStorage('github_connection')?.user,
|
||||||
|
};
|
||||||
|
}
|
||||||
914
app/components/deploy/GitHubDeploymentDialog.tsx
Normal file
914
app/components/deploy/GitHubDeploymentDialog.tsx
Normal file
@@ -0,0 +1,914 @@
|
|||||||
|
import * as Dialog from '@radix-ui/react-dialog';
|
||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import { motion } from 'framer-motion';
|
||||||
|
import { Octokit } from '@octokit/rest';
|
||||||
|
import { classNames } from '~/utils/classNames';
|
||||||
|
import { getLocalStorage } from '~/lib/persistence/localStorage';
|
||||||
|
import type { GitHubUserResponse, GitHubRepoInfo } from '~/types/GitHub';
|
||||||
|
import { logStore } from '~/lib/stores/logs';
|
||||||
|
import { chatId } from '~/lib/persistence/useChatHistory';
|
||||||
|
import { useStore } from '@nanostores/react';
|
||||||
|
import { GitHubAuthDialog } from '~/components/@settings/tabs/connections/components/GitHubAuthDialog';
|
||||||
|
import { SearchInput, EmptyState, StatusIndicator, Badge } from '~/components/ui';
|
||||||
|
|
||||||
|
interface GitHubDeploymentDialogProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
projectName: string;
|
||||||
|
files: Record<string, string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GitHubDeploymentDialog({ isOpen, onClose, projectName, files }: GitHubDeploymentDialogProps) {
|
||||||
|
const [repoName, setRepoName] = useState('');
|
||||||
|
const [isPrivate, setIsPrivate] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [user, setUser] = useState<GitHubUserResponse | null>(null);
|
||||||
|
const [recentRepos, setRecentRepos] = useState<GitHubRepoInfo[]>([]);
|
||||||
|
const [filteredRepos, setFilteredRepos] = useState<GitHubRepoInfo[]>([]);
|
||||||
|
const [repoSearchQuery, setRepoSearchQuery] = useState('');
|
||||||
|
const [isFetchingRepos, setIsFetchingRepos] = useState(false);
|
||||||
|
const [showSuccessDialog, setShowSuccessDialog] = useState(false);
|
||||||
|
const [createdRepoUrl, setCreatedRepoUrl] = useState('');
|
||||||
|
const [pushedFiles, setPushedFiles] = useState<{ path: string; size: number }[]>([]);
|
||||||
|
const [showAuthDialog, setShowAuthDialog] = useState(false);
|
||||||
|
const currentChatId = useStore(chatId);
|
||||||
|
|
||||||
|
// Load GitHub connection on mount
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen) {
|
||||||
|
const connection = getLocalStorage('github_connection');
|
||||||
|
|
||||||
|
// Set a default repository name based on the project name
|
||||||
|
setRepoName(projectName.replace(/\s+/g, '-').toLowerCase());
|
||||||
|
|
||||||
|
if (connection?.user && connection?.token) {
|
||||||
|
setUser(connection.user);
|
||||||
|
|
||||||
|
// Only fetch if we have both user and token
|
||||||
|
if (connection.token.trim()) {
|
||||||
|
fetchRecentRepos(connection.token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [isOpen, projectName]);
|
||||||
|
|
||||||
|
// Filter repositories based on search query
|
||||||
|
useEffect(() => {
|
||||||
|
if (recentRepos.length === 0) {
|
||||||
|
setFilteredRepos([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!repoSearchQuery.trim()) {
|
||||||
|
setFilteredRepos(recentRepos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = repoSearchQuery.toLowerCase().trim();
|
||||||
|
const filtered = recentRepos.filter(
|
||||||
|
(repo) =>
|
||||||
|
repo.name.toLowerCase().includes(query) ||
|
||||||
|
(repo.description && repo.description.toLowerCase().includes(query)) ||
|
||||||
|
(repo.language && repo.language.toLowerCase().includes(query)),
|
||||||
|
);
|
||||||
|
|
||||||
|
setFilteredRepos(filtered);
|
||||||
|
}, [recentRepos, repoSearchQuery]);
|
||||||
|
|
||||||
|
const fetchRecentRepos = async (token: string) => {
|
||||||
|
if (!token) {
|
||||||
|
logStore.logError('No GitHub token available');
|
||||||
|
toast.error('GitHub authentication required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setIsFetchingRepos(true);
|
||||||
|
|
||||||
|
// Fetch ALL repos by paginating through all pages
|
||||||
|
let allRepos: GitHubRepoInfo[] = [];
|
||||||
|
let page = 1;
|
||||||
|
let hasMore = true;
|
||||||
|
|
||||||
|
while (hasMore) {
|
||||||
|
const requestUrl = `https://api.github.com/user/repos?sort=updated&per_page=100&page=${page}&affiliation=owner,organization_member`;
|
||||||
|
const response = await fetch(requestUrl, {
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/vnd.github.v3+json',
|
||||||
|
Authorization: `Bearer ${token.trim()}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
let errorData: { message?: string } = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
errorData = await response.json();
|
||||||
|
} catch (e) {
|
||||||
|
errorData = { message: 'Could not parse error response' };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.status === 401) {
|
||||||
|
toast.error('GitHub token expired. Please reconnect your account.');
|
||||||
|
|
||||||
|
// Clear invalid token
|
||||||
|
const connection = getLocalStorage('github_connection');
|
||||||
|
|
||||||
|
if (connection) {
|
||||||
|
localStorage.removeItem('github_connection');
|
||||||
|
setUser(null);
|
||||||
|
}
|
||||||
|
} else if (response.status === 403 && response.headers.get('x-ratelimit-remaining') === '0') {
|
||||||
|
// Rate limit exceeded
|
||||||
|
const resetTime = response.headers.get('x-ratelimit-reset');
|
||||||
|
const resetDate = resetTime ? new Date(parseInt(resetTime) * 1000).toLocaleTimeString() : 'soon';
|
||||||
|
toast.error(`GitHub API rate limit exceeded. Limit resets at ${resetDate}`);
|
||||||
|
} else {
|
||||||
|
logStore.logError('Failed to fetch GitHub repositories', {
|
||||||
|
status: response.status,
|
||||||
|
statusText: response.statusText,
|
||||||
|
error: errorData,
|
||||||
|
});
|
||||||
|
toast.error(`Failed to fetch repositories: ${errorData.message || response.statusText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const repos = (await response.json()) as GitHubRepoInfo[];
|
||||||
|
allRepos = allRepos.concat(repos);
|
||||||
|
|
||||||
|
if (repos.length < 100) {
|
||||||
|
hasMore = false;
|
||||||
|
} else {
|
||||||
|
page += 1;
|
||||||
|
}
|
||||||
|
} catch (parseError) {
|
||||||
|
logStore.logError('Failed to parse GitHub repositories response', { parseError });
|
||||||
|
toast.error('Failed to parse repository data');
|
||||||
|
setRecentRepos([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setRecentRepos(allRepos);
|
||||||
|
} catch (error) {
|
||||||
|
logStore.logError('Failed to fetch GitHub repositories', { error });
|
||||||
|
toast.error('Failed to fetch recent repositories');
|
||||||
|
} finally {
|
||||||
|
setIsFetchingRepos(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to create a new repository or push to an existing one
|
||||||
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const connection = getLocalStorage('github_connection');
|
||||||
|
|
||||||
|
if (!connection?.token || !connection?.user) {
|
||||||
|
toast.error('Please connect your GitHub account in Settings > Connections first');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!repoName.trim()) {
|
||||||
|
toast.error('Repository name is required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initialize Octokit with the GitHub token
|
||||||
|
const octokit = new Octokit({ auth: connection.token });
|
||||||
|
let repoExists = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Check if the repository already exists
|
||||||
|
const { data: existingRepo } = await octokit.repos.get({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
});
|
||||||
|
|
||||||
|
repoExists = true;
|
||||||
|
|
||||||
|
// If we get here, the repo exists - confirm overwrite
|
||||||
|
let confirmMessage = `Repository "${repoName}" already exists. Do you want to update it? This will add or modify files in the repository.`;
|
||||||
|
|
||||||
|
// Add visibility change warning if needed
|
||||||
|
if (existingRepo.private !== isPrivate) {
|
||||||
|
const visibilityChange = isPrivate
|
||||||
|
? 'This will also change the repository from public to private.'
|
||||||
|
: 'This will also change the repository from private to public.';
|
||||||
|
|
||||||
|
confirmMessage += `\n\n${visibilityChange}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmOverwrite = window.confirm(confirmMessage);
|
||||||
|
|
||||||
|
if (!confirmOverwrite) {
|
||||||
|
setIsLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If visibility needs to be updated
|
||||||
|
if (existingRepo.private !== isPrivate) {
|
||||||
|
await octokit.repos.update({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
private: isPrivate
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error: any) {
|
||||||
|
// 404 means repo doesn't exist, which is what we want for new repos
|
||||||
|
if (error.status !== 404) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create repository if it doesn't exist
|
||||||
|
if (!repoExists) {
|
||||||
|
const { data: newRepo } = await octokit.repos.createForAuthenticatedUser({
|
||||||
|
name: repoName,
|
||||||
|
private: isPrivate,
|
||||||
|
// Initialize with a README to avoid empty repository issues
|
||||||
|
auto_init: true,
|
||||||
|
// Create a .gitignore file for the project
|
||||||
|
gitignore_template: "Node",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the URL for success dialog
|
||||||
|
setCreatedRepoUrl(newRepo.html_url);
|
||||||
|
|
||||||
|
// Since we created the repo with auto_init, we need to wait for GitHub to initialize it
|
||||||
|
console.log('Created new repository with auto_init, waiting for GitHub to initialize it...');
|
||||||
|
|
||||||
|
// Wait a moment for GitHub to set up the initial commit
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
|
} else {
|
||||||
|
// Set URL for existing repo
|
||||||
|
setCreatedRepoUrl(`https://github.com/${connection.user.login}/${repoName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process files to upload
|
||||||
|
const fileEntries = Object.entries(files);
|
||||||
|
|
||||||
|
// Filter out files and format them for display
|
||||||
|
const fileList = fileEntries.map(([filePath, content]) => {
|
||||||
|
// The paths are already properly formatted in the GitHubDeploy component
|
||||||
|
return {
|
||||||
|
path: filePath,
|
||||||
|
size: new TextEncoder().encode(content).length,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
setPushedFiles(fileList);
|
||||||
|
|
||||||
|
// Now we need to handle the repository, whether it's new or existing
|
||||||
|
// Get the default branch for the repository
|
||||||
|
let defaultBranch: string;
|
||||||
|
let baseSha: string | null = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// For both new and existing repos, get the repository info
|
||||||
|
const { data: repo } = await octokit.repos.get({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
});
|
||||||
|
defaultBranch = repo.default_branch || 'main';
|
||||||
|
console.log(`Repository default branch: ${defaultBranch}`);
|
||||||
|
|
||||||
|
// For a newly created repo (or existing one), get the reference to the default branch
|
||||||
|
try {
|
||||||
|
const { data: refData } = await octokit.git.getRef({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
ref: `heads/${defaultBranch}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
baseSha = refData.object.sha;
|
||||||
|
console.log(`Found existing reference with SHA: ${baseSha}`);
|
||||||
|
|
||||||
|
// Get the latest commit to use as a base for our tree
|
||||||
|
const { data: commitData } = await octokit.git.getCommit({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
commit_sha: baseSha,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Store the base tree SHA for tree creation
|
||||||
|
baseSha = commitData.tree.sha;
|
||||||
|
console.log(`Using base tree SHA: ${baseSha}`);
|
||||||
|
} catch (refError) {
|
||||||
|
console.error('Error getting reference:', refError);
|
||||||
|
baseSha = null;
|
||||||
|
}
|
||||||
|
} catch (repoError) {
|
||||||
|
console.error('Error getting repository info:', repoError);
|
||||||
|
defaultBranch = 'main';
|
||||||
|
baseSha = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log('Creating tree for repository');
|
||||||
|
|
||||||
|
// Create a tree with all files
|
||||||
|
const tree = fileEntries.map(([filePath, content]) => ({
|
||||||
|
path: filePath, // We've already formatted the paths correctly
|
||||||
|
mode: '100644' as const, // Regular file
|
||||||
|
type: 'blob' as const,
|
||||||
|
content,
|
||||||
|
}));
|
||||||
|
|
||||||
|
console.log(`Creating tree with ${tree.length} files using base: ${baseSha || 'none'}`);
|
||||||
|
|
||||||
|
// Create a tree with all the files, using the base tree if available
|
||||||
|
const { data: treeData } = await octokit.git.createTree({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
tree,
|
||||||
|
base_tree: baseSha || undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Tree created successfully', treeData.sha);
|
||||||
|
|
||||||
|
// Get the current reference to use as parent for our commit
|
||||||
|
let parentCommitSha: string | null = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data: refData } = await octokit.git.getRef({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
ref: `heads/${defaultBranch}`,
|
||||||
|
});
|
||||||
|
parentCommitSha = refData.object.sha;
|
||||||
|
console.log(`Found parent commit: ${parentCommitSha}`);
|
||||||
|
} catch (refError) {
|
||||||
|
console.log('No reference found, this is a brand new repo', refError);
|
||||||
|
parentCommitSha = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a commit with the tree
|
||||||
|
console.log('Creating commit');
|
||||||
|
const { data: commitData } = await octokit.git.createCommit({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
message: !repoExists ? 'Initial commit from Bolt.diy' : 'Update from Bolt.diy',
|
||||||
|
tree: treeData.sha,
|
||||||
|
parents: parentCommitSha ? [parentCommitSha] : [], // Use parent if available
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Commit created successfully', commitData.sha);
|
||||||
|
|
||||||
|
// Update the reference to point to the new commit
|
||||||
|
try {
|
||||||
|
console.log(`Updating reference: heads/${defaultBranch} to ${commitData.sha}`);
|
||||||
|
await octokit.git.updateRef({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
ref: `heads/${defaultBranch}`,
|
||||||
|
sha: commitData.sha,
|
||||||
|
force: true, // Use force to ensure the update works
|
||||||
|
});
|
||||||
|
console.log('Reference updated successfully');
|
||||||
|
} catch (refError) {
|
||||||
|
console.log('Failed to update reference, attempting to create it', refError);
|
||||||
|
|
||||||
|
// If the reference doesn't exist, create it (shouldn't happen with auto_init, but just in case)
|
||||||
|
try {
|
||||||
|
await octokit.git.createRef({
|
||||||
|
owner: connection.user.login,
|
||||||
|
repo: repoName,
|
||||||
|
ref: `refs/heads/${defaultBranch}`,
|
||||||
|
sha: commitData.sha,
|
||||||
|
});
|
||||||
|
console.log('Reference created successfully');
|
||||||
|
} catch (createRefError) {
|
||||||
|
console.error('Error creating reference:', createRefError);
|
||||||
|
const errorMsg = typeof createRefError === 'object' && createRefError !== null && 'message' in createRefError ? String(createRefError.message) : 'Unknown error';
|
||||||
|
throw new Error(`Failed to create Git reference: ${errorMsg}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (gitError) {
|
||||||
|
console.error('Error with git operations:', gitError);
|
||||||
|
const gitErrorMsg = typeof gitError === 'object' && gitError !== null && 'message' in gitError ? String(gitError.message) : 'Unknown error';
|
||||||
|
throw new Error(`Failed during git operations: ${gitErrorMsg}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the repository information for this chat
|
||||||
|
localStorage.setItem(`github-repo-${currentChatId}`, JSON.stringify({
|
||||||
|
owner: connection.user.login,
|
||||||
|
name: repoName,
|
||||||
|
url: `https://github.com/${connection.user.login}/${repoName}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Show success dialog
|
||||||
|
setShowSuccessDialog(true);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error pushing to GitHub:', error);
|
||||||
|
|
||||||
|
// Attempt to extract more specific error information
|
||||||
|
let errorMessage = 'Failed to push to GitHub.';
|
||||||
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
errorMessage = error.message;
|
||||||
|
} else if (typeof error === 'object' && error !== null) {
|
||||||
|
// Octokit errors
|
||||||
|
if ('message' in error) {
|
||||||
|
errorMessage = error.message as string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GitHub API errors
|
||||||
|
if ('documentation_url' in error) {
|
||||||
|
console.log('GitHub API documentation:', error.documentation_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toast.error(`GitHub deployment failed: ${errorMessage}`);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setRepoName('');
|
||||||
|
setIsPrivate(false);
|
||||||
|
setShowSuccessDialog(false);
|
||||||
|
setCreatedRepoUrl('');
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAuthDialogClose = () => {
|
||||||
|
setShowAuthDialog(false);
|
||||||
|
|
||||||
|
// Refresh user data after auth
|
||||||
|
const connection = getLocalStorage('github_connection');
|
||||||
|
if (connection?.user && connection?.token) {
|
||||||
|
setUser(connection.user);
|
||||||
|
fetchRecentRepos(connection.token);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Success Dialog
|
||||||
|
if (showSuccessDialog) {
|
||||||
|
return (
|
||||||
|
<Dialog.Root open={isOpen} onOpenChange={(open) => !open && handleClose()}>
|
||||||
|
<Dialog.Portal>
|
||||||
|
<Dialog.Overlay className="fixed inset-0 bg-black/50 backdrop-blur-sm z-[9999]" />
|
||||||
|
<div className="fixed inset-0 flex items-center justify-center z-[9999]">
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
|
exit={{ opacity: 0, scale: 0.95 }}
|
||||||
|
transition={{ duration: 0.2 }}
|
||||||
|
className="w-[90vw] md:w-[600px] max-h-[85vh] overflow-y-auto"
|
||||||
|
>
|
||||||
|
<Dialog.Content
|
||||||
|
className="bg-white dark:bg-bolt-elements-background-depth-1 rounded-lg border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark shadow-xl"
|
||||||
|
aria-describedby="success-dialog-description"
|
||||||
|
>
|
||||||
|
<div className="p-6 space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="w-10 h-10 rounded-xl bg-green-500/10 flex items-center justify-center text-green-500">
|
||||||
|
<div className="i-ph:check-circle w-5 h-5" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 className="text-lg font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark">
|
||||||
|
Successfully pushed to GitHub
|
||||||
|
</h3>
|
||||||
|
<p
|
||||||
|
id="success-dialog-description"
|
||||||
|
className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark"
|
||||||
|
>
|
||||||
|
Your code is now available on GitHub
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Dialog.Close asChild>
|
||||||
|
<button
|
||||||
|
onClick={handleClose}
|
||||||
|
className="p-2 rounded-lg transition-all duration-200 ease-in-out bg-transparent text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary dark:text-bolt-elements-textTertiary-dark dark:hover:text-bolt-elements-textPrimary-dark hover:bg-bolt-elements-background-depth-2 dark:hover:bg-bolt-elements-background-depth-3 focus:outline-none focus:ring-2 focus:ring-bolt-elements-borderColor dark:focus:ring-bolt-elements-borderColor-dark"
|
||||||
|
>
|
||||||
|
<span className="i-ph:x block w-5 h-5" aria-hidden="true" />
|
||||||
|
<span className="sr-only">Close dialog</span>
|
||||||
|
</button>
|
||||||
|
</Dialog.Close>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 rounded-lg p-4 text-left border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark">
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark mb-2 flex items-center gap-2">
|
||||||
|
<span className="i-ph:github-logo w-4 h-4 text-purple-500" />
|
||||||
|
Repository URL
|
||||||
|
</p>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<code className="flex-1 text-sm bg-bolt-elements-background-depth-1 dark:bg-bolt-elements-background-depth-4 px-3 py-2 rounded border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark font-mono">
|
||||||
|
{createdRepoUrl}
|
||||||
|
</code>
|
||||||
|
<motion.button
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(createdRepoUrl);
|
||||||
|
toast.success('URL copied to clipboard');
|
||||||
|
}}
|
||||||
|
className="p-2 text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary dark:text-bolt-elements-textSecondary-dark dark:hover:text-bolt-elements-textPrimary-dark bg-bolt-elements-background-depth-1 dark:bg-bolt-elements-background-depth-4 rounded-lg border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark"
|
||||||
|
whileHover={{ scale: 1.05 }}
|
||||||
|
whileTap={{ scale: 0.95 }}
|
||||||
|
>
|
||||||
|
<div className="i-ph:copy w-4 h-4" />
|
||||||
|
</motion.button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 rounded-lg p-4 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark">
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark mb-2 flex items-center gap-2">
|
||||||
|
<span className="i-ph:files w-4 h-4 text-purple-500" />
|
||||||
|
Pushed Files ({pushedFiles.length})
|
||||||
|
</p>
|
||||||
|
<div className="max-h-[200px] overflow-y-auto custom-scrollbar pr-2">
|
||||||
|
{pushedFiles.slice(0, 100).map((file) => (
|
||||||
|
<div
|
||||||
|
key={file.path}
|
||||||
|
className="flex items-center justify-between py-1.5 text-sm text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark border-b border-bolt-elements-borderColor/30 dark:border-bolt-elements-borderColor-dark/30 last:border-0"
|
||||||
|
>
|
||||||
|
<span className="font-mono truncate flex-1 text-xs">{file.path}</span>
|
||||||
|
<span className="text-xs px-2 py-0.5 rounded-full bg-bolt-elements-background-depth-3 dark:bg-bolt-elements-background-depth-4 text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark ml-2">
|
||||||
|
{(file.size / 1024).toFixed(1)} KB
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{pushedFiles.length > 100 && (
|
||||||
|
<div className="py-2 text-center text-xs text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark">
|
||||||
|
+{pushedFiles.length - 100} more files
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-end gap-2 pt-2">
|
||||||
|
<motion.a
|
||||||
|
href={createdRepoUrl}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="px-4 py-2 rounded-lg bg-purple-500 text-white hover:bg-purple-600 text-sm inline-flex items-center gap-2"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
>
|
||||||
|
<div className="i-ph:github-logo w-4 h-4" />
|
||||||
|
View Repository
|
||||||
|
</motion.a>
|
||||||
|
<motion.button
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(createdRepoUrl);
|
||||||
|
toast.success('URL copied to clipboard');
|
||||||
|
}}
|
||||||
|
className="px-4 py-2 rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark hover:bg-bolt-elements-background-depth-3 dark:hover:bg-bolt-elements-background-depth-4 text-sm inline-flex items-center gap-2 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
>
|
||||||
|
<div className="i-ph:copy w-4 h-4" />
|
||||||
|
Copy URL
|
||||||
|
</motion.button>
|
||||||
|
<motion.button
|
||||||
|
onClick={handleClose}
|
||||||
|
className="px-4 py-2 rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark hover:bg-bolt-elements-background-depth-3 dark:hover:bg-bolt-elements-background-depth-4 text-sm border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</motion.button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Dialog.Content>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
</Dialog.Portal>
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return (
|
||||||
|
<Dialog.Root open={isOpen} onOpenChange={(open) => !open && handleClose()}>
|
||||||
|
<Dialog.Portal>
|
||||||
|
<Dialog.Overlay className="fixed inset-0 bg-black/50 backdrop-blur-sm z-[9999]" />
|
||||||
|
<div className="fixed inset-0 flex items-center justify-center z-[9999]">
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
|
exit={{ opacity: 0, scale: 0.95 }}
|
||||||
|
transition={{ duration: 0.2 }}
|
||||||
|
className="w-[90vw] md:w-[500px]"
|
||||||
|
>
|
||||||
|
<Dialog.Content
|
||||||
|
className="bg-white dark:bg-bolt-elements-background-depth-1 rounded-lg p-6 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark shadow-xl"
|
||||||
|
aria-describedby="connection-required-description"
|
||||||
|
>
|
||||||
|
<div className="relative text-center space-y-4">
|
||||||
|
<Dialog.Close asChild>
|
||||||
|
<button
|
||||||
|
onClick={handleClose}
|
||||||
|
className="absolute right-0 top-0 p-2 rounded-lg transition-all duration-200 ease-in-out bg-transparent text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary dark:text-bolt-elements-textTertiary-dark dark:hover:text-bolt-elements-textPrimary-dark hover:bg-bolt-elements-background-depth-2 dark:hover:bg-bolt-elements-background-depth-3 focus:outline-none focus:ring-2 focus:ring-bolt-elements-borderColor dark:focus:ring-bolt-elements-borderColor-dark"
|
||||||
|
>
|
||||||
|
<span className="i-ph:x block w-5 h-5" aria-hidden="true" />
|
||||||
|
<span className="sr-only">Close dialog</span>
|
||||||
|
</button>
|
||||||
|
</Dialog.Close>
|
||||||
|
<motion.div
|
||||||
|
initial={{ scale: 0.8 }}
|
||||||
|
animate={{ scale: 1 }}
|
||||||
|
transition={{ delay: 0.1 }}
|
||||||
|
className="mx-auto w-16 h-16 rounded-xl bg-bolt-elements-background-depth-3 flex items-center justify-center text-purple-500"
|
||||||
|
>
|
||||||
|
<div className="i-ph:github-logo w-8 h-8" />
|
||||||
|
</motion.div>
|
||||||
|
<h3 className="text-lg font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark">
|
||||||
|
GitHub Connection Required
|
||||||
|
</h3>
|
||||||
|
<p
|
||||||
|
id="connection-required-description"
|
||||||
|
className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark max-w-md mx-auto"
|
||||||
|
>
|
||||||
|
To deploy your code to GitHub, you need to connect your GitHub account first.
|
||||||
|
</p>
|
||||||
|
<div className="pt-2 flex justify-center gap-3">
|
||||||
|
<motion.button
|
||||||
|
className="px-4 py-2 rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark text-sm hover:bg-bolt-elements-background-depth-3 dark:hover:bg-bolt-elements-background-depth-4 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
onClick={handleClose}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</motion.button>
|
||||||
|
<motion.button
|
||||||
|
onClick={() => setShowAuthDialog(true)}
|
||||||
|
className="px-4 py-2 rounded-lg bg-purple-500 text-white text-sm hover:bg-purple-600 inline-flex items-center gap-2"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
>
|
||||||
|
<div className="i-ph:github-logo w-4 h-4" />
|
||||||
|
Connect GitHub Account
|
||||||
|
</motion.button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Dialog.Content>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
</Dialog.Portal>
|
||||||
|
|
||||||
|
{/* GitHub Auth Dialog */}
|
||||||
|
<GitHubAuthDialog isOpen={showAuthDialog} onClose={handleAuthDialogClose} />
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog.Root open={isOpen} onOpenChange={(open) => !open && handleClose()}>
|
||||||
|
<Dialog.Portal>
|
||||||
|
<Dialog.Overlay className="fixed inset-0 bg-black/50 backdrop-blur-sm z-[9999]" />
|
||||||
|
<div className="fixed inset-0 flex items-center justify-center z-[9999]">
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
|
exit={{ opacity: 0, scale: 0.95 }}
|
||||||
|
transition={{ duration: 0.2 }}
|
||||||
|
className="w-[90vw] md:w-[500px]"
|
||||||
|
>
|
||||||
|
<Dialog.Content
|
||||||
|
className="bg-white dark:bg-bolt-elements-background-depth-1 rounded-lg border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark shadow-xl"
|
||||||
|
aria-describedby="push-dialog-description"
|
||||||
|
>
|
||||||
|
<div className="p-6">
|
||||||
|
<div className="flex items-center gap-4 mb-6">
|
||||||
|
<motion.div
|
||||||
|
initial={{ scale: 0.8 }}
|
||||||
|
animate={{ scale: 1 }}
|
||||||
|
transition={{ delay: 0.1 }}
|
||||||
|
className="w-10 h-10 rounded-xl bg-bolt-elements-background-depth-3 flex items-center justify-center text-purple-500"
|
||||||
|
>
|
||||||
|
<div className="i-ph:github-logo w-5 h-5" />
|
||||||
|
</motion.div>
|
||||||
|
<div>
|
||||||
|
<Dialog.Title className="text-lg font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark">
|
||||||
|
Deploy to GitHub
|
||||||
|
</Dialog.Title>
|
||||||
|
<p
|
||||||
|
id="push-dialog-description"
|
||||||
|
className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark"
|
||||||
|
>
|
||||||
|
Deploy your code to a new or existing GitHub repository
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Dialog.Close asChild>
|
||||||
|
<button
|
||||||
|
onClick={handleClose}
|
||||||
|
className="ml-auto p-2 rounded-lg transition-all duration-200 ease-in-out bg-transparent text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary dark:text-bolt-elements-textTertiary-dark dark:hover:text-bolt-elements-textPrimary-dark hover:bg-bolt-elements-background-depth-2 dark:hover:bg-bolt-elements-background-depth-3 focus:outline-none focus:ring-2 focus:ring-bolt-elements-borderColor dark:focus:ring-bolt-elements-borderColor-dark"
|
||||||
|
>
|
||||||
|
<span className="i-ph:x block w-5 h-5" aria-hidden="true" />
|
||||||
|
<span className="sr-only">Close dialog</span>
|
||||||
|
</button>
|
||||||
|
</Dialog.Close>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-3 mb-6 p-4 bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 rounded-lg border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark">
|
||||||
|
<div className="relative">
|
||||||
|
<img src={user.avatar_url} alt={user.login} className="w-10 h-10 rounded-full" />
|
||||||
|
<div className="absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-purple-500 flex items-center justify-center text-white">
|
||||||
|
<div className="i-ph:github-logo w-3 h-3" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark">
|
||||||
|
{user.name || user.login}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark">
|
||||||
|
@{user.login}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<label
|
||||||
|
htmlFor="repoName"
|
||||||
|
className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark"
|
||||||
|
>
|
||||||
|
Repository Name
|
||||||
|
</label>
|
||||||
|
<div className="relative">
|
||||||
|
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-bolt-elements-textTertiary dark:text-bolt-elements-textTertiary-dark">
|
||||||
|
<span className="i-ph:git-branch w-4 h-4" />
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
id="repoName"
|
||||||
|
type="text"
|
||||||
|
value={repoName}
|
||||||
|
onChange={(e) => setRepoName(e.target.value)}
|
||||||
|
placeholder="my-awesome-project"
|
||||||
|
className="w-full pl-10 px-4 py-2 rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark placeholder-bolt-elements-textTertiary dark:placeholder-bolt-elements-textTertiary-dark focus:outline-none focus:ring-2 focus:ring-purple-500"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="flex items-center justify-between mb-2">
|
||||||
|
<label className="text-sm text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark">
|
||||||
|
Recent Repositories
|
||||||
|
</label>
|
||||||
|
<span className="text-xs text-bolt-elements-textTertiary dark:text-bolt-elements-textTertiary-dark">
|
||||||
|
{filteredRepos.length} of {recentRepos.length}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-2">
|
||||||
|
<SearchInput
|
||||||
|
placeholder="Search repositories..."
|
||||||
|
value={repoSearchQuery}
|
||||||
|
onChange={(e) => setRepoSearchQuery(e.target.value)}
|
||||||
|
onClear={() => setRepoSearchQuery('')}
|
||||||
|
className="bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{recentRepos.length === 0 && !isFetchingRepos ? (
|
||||||
|
<EmptyState
|
||||||
|
icon="i-ph:github-logo"
|
||||||
|
title="No repositories found"
|
||||||
|
description="We couldn't find any repositories in your GitHub account."
|
||||||
|
variant="compact"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2 max-h-[200px] overflow-y-auto pr-2 custom-scrollbar">
|
||||||
|
{filteredRepos.length === 0 && repoSearchQuery.trim() !== '' ? (
|
||||||
|
<EmptyState
|
||||||
|
icon="i-ph:magnifying-glass"
|
||||||
|
title="No matching repositories"
|
||||||
|
description="Try a different search term"
|
||||||
|
variant="compact"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
filteredRepos.map((repo) => (
|
||||||
|
<motion.button
|
||||||
|
key={repo.full_name}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setRepoName(repo.name)}
|
||||||
|
className="w-full p-3 text-left rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 hover:bg-bolt-elements-background-depth-3 dark:hover:bg-bolt-elements-background-depth-4 transition-colors group border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark hover:border-purple-500/30"
|
||||||
|
whileHover={{ scale: 1.01 }}
|
||||||
|
whileTap={{ scale: 0.99 }}
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="i-ph:git-branch w-4 h-4 text-purple-500" />
|
||||||
|
<span className="text-sm font-medium text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark group-hover:text-purple-500">
|
||||||
|
{repo.name}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{repo.private && (
|
||||||
|
<Badge variant="primary" size="sm" icon="i-ph:lock w-3 h-3">
|
||||||
|
Private
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{repo.description && (
|
||||||
|
<p className="mt-1 text-xs text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark line-clamp-2">
|
||||||
|
{repo.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<div className="mt-2 flex items-center gap-2 flex-wrap">
|
||||||
|
{repo.language && (
|
||||||
|
<Badge variant="subtle" size="sm" icon="i-ph:code w-3 h-3">
|
||||||
|
{repo.language}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
<Badge variant="subtle" size="sm" icon="i-ph:star w-3 h-3">
|
||||||
|
{repo.stargazers_count.toLocaleString()}
|
||||||
|
</Badge>
|
||||||
|
<Badge variant="subtle" size="sm" icon="i-ph:git-fork w-3 h-3">
|
||||||
|
{repo.forks_count.toLocaleString()}
|
||||||
|
</Badge>
|
||||||
|
<Badge variant="subtle" size="sm" icon="i-ph:clock w-3 h-3">
|
||||||
|
{new Date(repo.updated_at).toLocaleDateString()}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</motion.button>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isFetchingRepos && (
|
||||||
|
<div className="flex items-center justify-center py-4">
|
||||||
|
<StatusIndicator status="loading" pulse={true} label="Loading repositories..." />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="p-3 bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 rounded-lg border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
id="private"
|
||||||
|
checked={isPrivate}
|
||||||
|
onChange={(e) => setIsPrivate(e.target.checked)}
|
||||||
|
className="rounded border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark text-purple-500 focus:ring-purple-500 dark:bg-bolt-elements-background-depth-3"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="private"
|
||||||
|
className="text-sm text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary-dark"
|
||||||
|
>
|
||||||
|
Make repository private
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-bolt-elements-textTertiary dark:text-bolt-elements-textTertiary-dark mt-2 ml-6">
|
||||||
|
Private repositories are only visible to you and people you share them with
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="pt-4 flex gap-2">
|
||||||
|
<motion.button
|
||||||
|
type="button"
|
||||||
|
onClick={handleClose}
|
||||||
|
className="px-4 py-2 rounded-lg bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3 text-bolt-elements-textSecondary dark:text-bolt-elements-textSecondary-dark hover:bg-bolt-elements-background-depth-3 dark:hover:bg-bolt-elements-background-depth-4 text-sm border border-bolt-elements-borderColor dark:border-bolt-elements-borderColor-dark"
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
whileTap={{ scale: 0.98 }}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</motion.button>
|
||||||
|
<motion.button
|
||||||
|
type="submit"
|
||||||
|
disabled={isLoading}
|
||||||
|
className={classNames(
|
||||||
|
'flex-1 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 text-sm inline-flex items-center justify-center gap-2',
|
||||||
|
isLoading ? 'opacity-50 cursor-not-allowed' : '',
|
||||||
|
)}
|
||||||
|
whileHover={!isLoading ? { scale: 1.02 } : {}}
|
||||||
|
whileTap={!isLoading ? { scale: 0.98 } : {}}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<div className="i-ph:spinner-gap animate-spin w-4 h-4" />
|
||||||
|
Deploying...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<div className="i-ph:github-logo w-4 h-4" />
|
||||||
|
Deploy to GitHub
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</motion.button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</Dialog.Content>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
</Dialog.Portal>
|
||||||
|
|
||||||
|
{/* GitHub Auth Dialog */}
|
||||||
|
<GitHubAuthDialog isOpen={showAuthDialog} onClose={handleAuthDialogClose} />
|
||||||
|
</Dialog.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user