diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14b7efa7..4cc9481a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,8 @@ stages: test: stage: test script: + - npm run typecheck + - npm run build - npm run test pages: diff --git a/package-lock.json b/package-lock.json index 73908c5f..2d331915 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,6 +80,7 @@ "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "turndown": "^7.2.1", + "uri-templates": "^0.2.0", "use-stick-to-bottom": "^1.1.1", "vaul": "^0.9.3", "webln": "^0.3.2", @@ -100,6 +101,7 @@ "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", "@types/turndown": "^5.0.5", + "@types/uri-templates": "^0.1.34", "@vitejs/plugin-react-swc": "^3.5.0", "autoprefixer": "^10.4.20", "eslint": "^9.9.0", @@ -3849,6 +3851,13 @@ "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", "license": "MIT" }, + "node_modules/@types/uri-templates": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@types/uri-templates/-/uri-templates-0.1.34.tgz", + "integrity": "sha512-13v4r/Op3iEO1y6FvEHQjrUNnrNyO67SigdFC9n80sVfsrM2AWJRNYbE1pBs4/p87I7z1J979JGeLAo3rM1L/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.31.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.1.tgz", @@ -10627,6 +10636,12 @@ "punycode": "^2.1.0" } }, + "node_modules/uri-templates": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/uri-templates/-/uri-templates-0.2.0.tgz", + "integrity": "sha512-EWkjYEN0L6KOfEoOH6Wj4ghQqU7eBZMJqRHQnxQAq+dSEzRPClkWjf8557HkWQXF6BrAUoLSAyy9i3RVTliaNg==", + "license": "http://geraintluff.github.io/tv4/LICENSE.txt" + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", diff --git a/package.json b/package.json index 07ecc7ed..8761be75 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "turndown": "^7.2.1", + "uri-templates": "^0.2.0", "use-stick-to-bottom": "^1.1.1", "vaul": "^0.9.3", "webln": "^0.3.2", @@ -103,6 +104,7 @@ "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", "@types/turndown": "^5.0.5", + "@types/uri-templates": "^0.1.34", "@vitejs/plugin-react-swc": "^3.5.0", "autoprefixer": "^10.4.20", "eslint": "^9.9.0", diff --git a/proxy.ts b/proxy.ts new file mode 100644 index 00000000..209de288 --- /dev/null +++ b/proxy.ts @@ -0,0 +1,22 @@ +export default { + async fetch(request: Request): Promise { + const url = new URL(request.url); + const target = url.searchParams.get("url"); + + if (!target) { + return new Response("Include a `url` query parameter", { status: 400 }); + } + + const headers = new Headers(request.headers); + headers.set('User-Agent', 'Shakespeare Proxy '); + + const targetResponse = await fetch(target, request); + const response = new Response(targetResponse.body, targetResponse); + + response.headers.set("Access-Control-Allow-Origin", "*"); + response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS"); + response.headers.set("Access-Control-Allow-Headers", "Content-Type"); + + return response; + } +}; diff --git a/src/components/ActionsMenu.tsx b/src/components/ActionsMenu.tsx index cb69af3b..ff0bde1e 100644 --- a/src/components/ActionsMenu.tsx +++ b/src/components/ActionsMenu.tsx @@ -4,193 +4,45 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, - DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from '@/components/ui/alert-dialog'; -import { + GitBranch, MoreHorizontal, MessageSquarePlus, - Play, CloudUpload, - Loader2, - GitBranch, - Download, - Trash2, - Settings, - GitMerge, + History, } from 'lucide-react'; import { GitHistoryDialog } from '@/components/ai/GitHistoryDialog'; import { GitDialog } from '@/components/GitDialog'; -import { AppSettingsDialog } from '@/components/AppSettingsDialog'; -import { useNavigate } from 'react-router-dom'; -import { useProjectsManager } from '@/hooks/useProjectsManager'; -import { useToast } from '@/hooks/useToast'; -import { useGit } from '@/hooks/useGit'; -import { useFS } from '@/hooks/useFS'; -import JSZip from 'jszip'; +import { DeployDialog } from '@/components/DeployDialog'; interface ActionsMenuProps { projectId: string; projectName: string; onNewChat: () => void; - onBuild: () => void; - onDeploy: () => void; isLoading?: boolean; isBuildLoading?: boolean; - isDeployLoading?: boolean; disabled?: boolean; onFirstInteraction?: () => void; - onProjectDeleted?: () => void; } export function ActionsMenu({ projectId, projectName, onNewChat, - onBuild, - onDeploy, isLoading = false, isBuildLoading = false, - isDeployLoading = false, disabled = false, onFirstInteraction, - onProjectDeleted }: ActionsMenuProps) { const [gitHistoryOpen, setGitHistoryOpen] = useState(false); const [gitDialogOpen, setGitDialogOpen] = useState(false); - const [isDeleting, setIsDeleting] = useState(false); - const [isExporting, setIsExporting] = useState(false); + const [deployDialogOpen, setDeployDialogOpen] = useState(false); - const navigate = useNavigate(); - const projectsManager = useProjectsManager(); - const { toast } = useToast(); - const { fs } = useFS(); - const { git } = useGit(); + const isAnyLoading = isLoading || isBuildLoading; - const isAnyLoading = isLoading || isBuildLoading || isDeployLoading || isDeleting || isExporting; - const handleDeleteProject = async () => { - setIsDeleting(true); - try { - await projectsManager.deleteProject(projectId); - - toast({ - title: "Project deleted", - description: `"${projectName}" has been permanently deleted.`, - }); - - // Navigate back to home and notify parent - navigate('/'); - if (onProjectDeleted) { - onProjectDeleted(); - } - } catch (error) { - toast({ - title: "Failed to delete project", - description: error instanceof Error ? error.message : "An unexpected error occurred", - variant: "destructive", - }); - } finally { - setIsDeleting(false); - } - }; - - const handleExportProject = async () => { - setIsExporting(true); - try { - const zip = new JSZip(); - const projectPath = `/projects/${projectId}`; - - // Recursive function to add files and directories to zip from a specific project - const addProjectToZip = async (dirPath: string, zipFolder: JSZip) => { - try { - const entries = await fs.readdir(dirPath, { withFileTypes: true }); - - for (const entry of entries) { - const fullPath = `${dirPath}/${entry.name}`; - - if (entry.isDirectory()) { - // Create folder in zip and recursively add its contents - const folder = zipFolder.folder(entry.name); - if (folder) { - await addProjectToZip(fullPath, folder); - } - } else if (entry.isFile()) { - // Add file to zip - try { - const fileContent = await fs.readFile(fullPath); - zipFolder.file(entry.name, fileContent); - } catch (error) { - console.warn(`Failed to read file ${fullPath}:`, error); - } - } - } - } catch (error) { - console.warn(`Failed to read directory ${dirPath}:`, error); - } - }; - - // Start from the project directory - await addProjectToZip(projectPath, zip); - - // Generate zip file - const content = await zip.generateAsync({ type: 'blob' }); - - // Create download link - const url = URL.createObjectURL(content); - const link = document.createElement('a'); - link.href = url; - - // Generate filename with commit hash - let filename = `${projectName}.zip`; - try { - // Get the current commit hash - const commits = await git.log({ - dir: projectPath, - depth: 1, - }); - - if (commits.length > 0) { - const commitHash = commits[0].oid.substring(0, 7); // Truncate to 7 characters - filename = `${projectName}-${commitHash}.zip`; - } - } catch (error) { - console.warn('Failed to get commit hash, using project name only:', error); - } - - link.download = filename; - - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - URL.revokeObjectURL(url); - - toast({ - title: "Project exported successfully", - description: `"${projectName}" has been downloaded as a zip file.`, - }); - } catch (error) { - console.error('Failed to export project:', error); - toast({ - title: "Failed to export project", - description: error instanceof Error ? error.message : "An unexpected error occurred", - variant: "destructive", - }); - } finally { - setIsExporting(false); - } - }; return ( <> @@ -221,8 +73,8 @@ export function ActionsMenu({ disabled={isAnyLoading} className="gap-2" > - - Git Status + + Repository - - Git History - - - - e.preventDefault()} - > - - Settings - - - - - {isExporting ? ( - - ) : ( - - )} - {isExporting ? 'Exporting...' : 'Export Project'} + + Rollback { - if (onFirstInteraction) onFirstInteraction(); - onBuild(); - }} + onClick={() => setDeployDialogOpen(true)} disabled={isAnyLoading} className="gap-2" > - {isBuildLoading ? ( - - ) : ( - - )} - {isBuildLoading ? 'Building...' : 'Build'} + + Deploy - - { - if (onFirstInteraction) onFirstInteraction(); - onDeploy(); - }} - disabled={isAnyLoading} - className="gap-2" - > - {isDeployLoading ? ( - - ) : ( - - )} - {isDeployLoading ? 'Deploying...' : 'Deploy'} - - - - - - - e.preventDefault()} - > - - Delete Project - - - - - Delete Project - - Are you sure you want to delete "{projectName}"? This action cannot be undone and will permanently delete all project data including files. - - - - Cancel - - {isDeleting ? ( - <> - - Deleting... - - ) : ( - 'Delete Project' - )} - - - - @@ -343,6 +109,14 @@ export function ActionsMenu({ open={gitHistoryOpen} onOpenChange={setGitHistoryOpen} /> + + ); } \ No newline at end of file diff --git a/src/components/AppSettingsDialog.tsx b/src/components/AppSettingsDialog.tsx deleted file mode 100644 index 3960d34f..00000000 --- a/src/components/AppSettingsDialog.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import { useState } from 'react'; -import { Settings, Save } from 'lucide-react'; -import { Button } from '@/components/ui/button'; -import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { useAppContext } from '@/hooks/useAppContext'; -import { useToast } from '@/hooks/useToast'; - -interface AppSettingsDialogProps { - children?: React.ReactNode; -} - -export function AppSettingsDialog({ children }: AppSettingsDialogProps) { - const { config, updateConfig } = useAppContext(); - const { toast } = useToast(); - const [open, setOpen] = useState(false); - const [deployServer, setDeployServer] = useState(config.deployServer); - - const handleSave = () => { - // Validate deploy server - if (!deployServer.trim()) { - toast({ - title: "Invalid deploy server", - description: "Deploy server cannot be empty.", - variant: "destructive", - }); - return; - } - - // Remove protocol if present - const cleanDeployServer = deployServer.replace(/^https?:\/\//, ''); - - updateConfig((current) => ({ - ...current, - deployServer: cleanDeployServer, - })); - - toast({ - title: "Settings saved", - description: "Your deployment settings have been updated.", - }); - - setOpen(false); - }; - - const handleCancel = () => { - // Reset to current config - setDeployServer(config.deployServer); - setOpen(false); - }; - - return ( - - - {children || ( - - )} - - - - App Settings - - Configure your application preferences and deployment settings. - - - -
- - - Deployment - - -
- - setDeployServer(e.target.value)} - placeholder="shakespeare.wtf" - className="font-mono" - /> -

- Your projects will be deployed to subdomains of this server. - Example: yourproject.{deployServer || 'shakespeare.wtf'} -

-
-
-
-
- -
- - -
-
-
- ); -} \ No newline at end of file diff --git a/src/components/DeployDialog.tsx b/src/components/DeployDialog.tsx new file mode 100644 index 00000000..87d1f94f --- /dev/null +++ b/src/components/DeployDialog.tsx @@ -0,0 +1,182 @@ +import { useState, useEffect } from 'react'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogFooter, +} from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { useToast } from '@/hooks/useToast'; +import { useAppContext } from '@/hooks/useAppContext'; +import { useCurrentUser } from '@/hooks/useCurrentUser'; +import { useMutation } from '@tanstack/react-query'; +import { deployProject } from '@/lib/deploy'; +import { useFS } from '@/hooks/useFS'; +import { + CloudUpload, + Loader2, +} from 'lucide-react'; + +interface DeployDialogProps { + projectId: string; + projectName: string; + open: boolean; + onOpenChange: (open: boolean) => void; + onFirstInteraction?: () => void; +} + +export function DeployDialog({ + projectId, + projectName, + open, + onOpenChange, + onFirstInteraction +}: DeployDialogProps) { + const { config } = useAppContext(); + const { user } = useCurrentUser(); + const { fs } = useFS(); + const { toast } = useToast(); + + // State for the deploy URL input + const [deployUrl, setDeployUrl] = useState(''); + + // Initialize deploy URL when dialog opens + useEffect(() => { + if (open) { + setDeployUrl(`${projectId}.${config.deployServer}`); + } + }, [open, projectId, config.deployServer]); + + const deployMutation = useMutation({ + mutationFn: async () => { + if (!user) { + throw new Error("You must be logged into Nostr to deploy a project"); + } + + // Parse the deploy URL to extract hostname and server + const hostname = deployUrl.trim(); + const parts = hostname.split('.'); + + if (parts.length < 2) { + throw new Error("Invalid deploy URL format. Please use format: subdomain.domain.com"); + } + + // Extract the deploy server (everything after the first dot) + const deployServer = parts.slice(1).join('.'); + + return await deployProject({ + fs, + projectId, // Keep the original projectId for file path + deployServer, + projectPath: `/projects/${projectId}`, + signer: user.signer, + customHostname: hostname, // Pass the custom hostname + }); + }, + onSuccess: (result) => { + toast({ + title: "Deployment successful!", + description: `Your project is now live at ${result.hostname}`, + }); + + // Open the deployed site in a new tab + window.open(result.url, '_blank'); + + // Close the dialog + onOpenChange(false); + }, + onError: (error) => { + toast({ + title: "Deployment failed", + description: error instanceof Error ? error.message : "An unexpected error occurred", + variant: "destructive", + }); + }, + }); + + const handleDeploy = () => { + if (onFirstInteraction) { + onFirstInteraction(); + } + deployMutation.mutate(); + }; + + const handleUrlChange = (value: string) => { + // Remove protocol if user enters it + const cleanValue = value.replace(/^https?:\/\//, ''); + setDeployUrl(cleanValue); + }; + + const isValidUrl = () => { + const trimmed = deployUrl.trim(); + return trimmed.length > 0 && trimmed.includes('.') && !trimmed.startsWith('.') && !trimmed.endsWith('.'); + }; + + return ( + + + + + + Deploy "{projectName}" + + + +
+
+ +
+ + https:// + + handleUrlChange(e.target.value)} + placeholder={`${projectId}.${config.deployServer}`} + className="pl-16" + disabled={deployMutation.isPending} + /> +
+

+ Your project will be deployed to this URL. You can customize the subdomain. +

+
+ + {!user && ( +
+

+ You must be logged into Nostr to deploy projects. +

+
+ )} +
+ + + + + +
+
+ ); +} \ No newline at end of file diff --git a/src/components/GitDialog.test.tsx b/src/components/GitDialog.test.tsx index faf4e17b..ab2a5081 100644 --- a/src/components/GitDialog.test.tsx +++ b/src/components/GitDialog.test.tsx @@ -43,17 +43,10 @@ vi.mock('@/hooks/useToast', () => ({ })), })); +const mockUseGitSettings = vi.fn(); + vi.mock('@/hooks/useGitSettings', () => ({ - useGitSettings: vi.fn(() => ({ - settings: { - credentials: { - 'https://github.com': { - username: 'git', - password: 'github-token', - }, - }, - }, - })), + useGitSettings: () => mockUseGitSettings(), })); describe('GitDialog', () => { @@ -62,9 +55,20 @@ describe('GitDialog', () => { data: baseGitStatus, refetch: mockRefetch, }); + + mockUseGitSettings.mockReturnValue({ + settings: { + credentials: { + 'https://github.com': { + username: 'git', + password: 'github-token', + }, + }, + }, + }); }); - it('renders git repository information', () => { + it('renders git dialog without repository information section', () => { render( {}}> @@ -73,11 +77,9 @@ describe('GitDialog', () => { ); - expect(screen.getByText('Git Repository Status')).toBeInTheDocument(); - expect(screen.getByText('Repository Information')).toBeInTheDocument(); - expect(screen.getByText('main')).toBeInTheDocument(); - expect(screen.getByText('5')).toBeInTheDocument(); - expect(screen.getAllByText('origin')).toHaveLength(2); // Appears in remotes and credentials sections + expect(screen.getByText('Repository')).toBeInTheDocument(); + expect(screen.queryByText('Repository Information')).not.toBeInTheDocument(); + expect(screen.queryByText('Authentication')).not.toBeInTheDocument(); // Authentication section is removed }); it('shows sync status', () => { @@ -145,7 +147,7 @@ describe('GitDialog', () => { expect(pushButton.closest('button')).toBeDisabled(); }); - it('shows configured credentials status', () => { + it('does not show credentials warning when credentials are configured', () => { render( {}}> @@ -154,8 +156,38 @@ describe('GitDialog', () => { ); - expect(screen.getByText('Authentication')).toBeInTheDocument(); - expect(screen.getByText('github.com')).toBeInTheDocument(); - expect(screen.getByText('Configured')).toBeInTheDocument(); + // Should not show warning when credentials are configured + expect(screen.queryByText(/No credentials configured/)).not.toBeInTheDocument(); + expect(screen.queryByText('Authentication')).not.toBeInTheDocument(); // Authentication section is removed + }); + + it('shows credentials warning when no credentials are configured', () => { + // Mock git settings with no credentials and mock git status with an https remote + mockUseGitSettings.mockReturnValue({ + settings: { + credentials: {}, + }, + }); + + mockUseGitStatus.mockReturnValue({ + data: { + ...baseGitStatus, + remotes: [{ name: 'origin', url: 'https://github.com/example/repo.git' }], + }, + refetch: mockRefetch, + }); + + render( + + {}}> + + + + ); + + // Should show warning when credentials are missing + expect(screen.getByText(/You are not logged into github.com/)).toBeInTheDocument(); + expect(screen.getByText('log in')).toBeInTheDocument(); + expect(screen.queryByText('Authentication')).not.toBeInTheDocument(); // Authentication section is removed }); }); \ No newline at end of file diff --git a/src/components/GitDialog.tsx b/src/components/GitDialog.tsx index 56ef8f13..1aa22072 100644 --- a/src/components/GitDialog.tsx +++ b/src/components/GitDialog.tsx @@ -1,10 +1,9 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, - DialogDescription, DialogHeader, DialogTitle, DialogTrigger, @@ -19,6 +18,8 @@ import { import { Badge } from '@/components/ui/badge'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Alert, AlertDescription } from '@/components/ui/alert'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; import { GitBranch, Upload, @@ -31,10 +32,9 @@ import { Plus, Minus, Edit, - RefreshCw, - Settings, AlertTriangle, Zap, + Save, } from 'lucide-react'; import { useGitStatus } from '@/hooks/useGitStatus'; import { useGitSettings } from '@/hooks/useGitSettings'; @@ -44,7 +44,7 @@ import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useNostr } from '@nostrify/react'; import { useNostrPublish } from '@/hooks/useNostrPublish'; import { cn } from '@/lib/utils'; -import { findCredentialsForRepo, getOriginDisplayName } from '@/lib/gitCredentials'; +import { findCredentialsForRepo } from '@/lib/gitCredentials'; import { nip19 } from 'nostr-tools'; const GRASP_SERVERS = ["git.shakespeare.diy", "relay.ngit.dev", "gitnostr.com"]; @@ -60,8 +60,8 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog const [isPushing, setIsPushing] = useState(false); const [isPulling, setIsPulling] = useState(false); const [isPushingToNostr, setIsPushingToNostr] = useState(false); - const [pushResult, setPushResult] = useState(null); - const [pullResult, setPullResult] = useState(null); + const [originUrl, setOriginUrl] = useState(''); + const [isSavingOrigin, setIsSavingOrigin] = useState(false); const navigate = useNavigate(); const { data: gitStatus, refetch: refetchGitStatus } = useGitStatus(projectId); @@ -74,6 +74,70 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog const projectPath = `/projects/${projectId}`; + // Initialize origin URL from git status + useEffect(() => { + if (gitStatus?.remotes) { + const originRemote = gitStatus.remotes.find(remote => remote.name === 'origin'); + setOriginUrl(originRemote?.url || ''); + } + }, [gitStatus?.remotes]); + + const handleSaveOrigin = async () => { + if (!gitStatus?.isGitRepo) { + toast({ + title: "Cannot configure origin", + description: "Not a git repository", + variant: "destructive", + }); + return; + } + + setIsSavingOrigin(true); + + try { + // Remove existing origin if it exists + try { + await git.deleteRemote({ + dir: projectPath, + remote: 'origin', + }); + } catch { + // Ignore if origin doesn't exist + } + + // Add new origin if URL is provided + if (originUrl.trim()) { + await git.addRemote({ + dir: projectPath, + remote: 'origin', + url: originUrl.trim(), + }); + + toast({ + title: "Origin configured", + description: `Origin remote set to ${originUrl.trim()}`, + }); + } else { + toast({ + title: "Origin removed", + description: "Origin remote has been removed", + }); + } + + // Refresh git status after changing origin + await refetchGitStatus(); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; + toast({ + title: "Failed to configure origin", + description: errorMessage, + variant: "destructive", + }); + } finally { + setIsSavingOrigin(false); + } + }; + const handlePushToNostr = async () => { if (!user) { toast({ @@ -94,7 +158,6 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog } setIsPushingToNostr(true); - setPushResult(null); try { // Check if repo announcement already exists @@ -265,10 +328,8 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog description: "Waiting for GRASP servers to update...", }); - setPushResult(`✅ Successfully published repository to Nostr`); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; - setPushResult(`❌ Push to Nostr failed: ${errorMessage}`); toast({ title: "Push to Nostr failed", description: errorMessage, @@ -308,7 +369,6 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog } setIsPushing(true); - setPushResult(null); try { const remote = gitStatus.remotes[0]; // Use first remote (usually 'origin') @@ -321,7 +381,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog signer: user?.signer, // For signing if pushing to Nostr }); - setPushResult(`✅ Successfully pushed ${gitStatus.ahead} commit${gitStatus.ahead !== 1 ? 's' : ''} to ${remote.name}/${gitStatus.currentBranch}`); + toast({ title: "Push successful", description: `${gitStatus.ahead} commit${gitStatus.ahead !== 1 ? 's' : ''} pushed to ${remote.name}/${gitStatus.currentBranch}`, @@ -331,7 +391,6 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog await refetchGitStatus(); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; - setPushResult(`❌ Push failed: ${errorMessage}`); toast({ title: "Push failed", description: errorMessage, @@ -362,7 +421,6 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog } setIsPulling(true); - setPullResult(null); try { const remote = gitStatus.remotes[0]; // Use first remote (usually 'origin') @@ -378,7 +436,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog onAuth: (url) => findCredentialsForRepo(url, settings.credentials), }); - setPullResult(`✅ Successfully pulled from ${remote.name}/${gitStatus.currentBranch}`); + toast({ title: "Pull successful", description: `Latest changes pulled from ${remote.name}/${gitStatus.currentBranch}`, @@ -388,7 +446,6 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog await refetchGitStatus(); } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; - setPullResult(`❌ Pull failed: ${errorMessage}`); toast({ title: "Pull failed", description: errorMessage, @@ -399,11 +456,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog } }; - const handleRefresh = async () => { - await refetchGitStatus(); - setPushResult(null); - setPullResult(null); - }; + const getFileStatusIcon = (status: string) => { switch (status) { @@ -473,158 +526,131 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog return ( {children && {children}} - + e.preventDefault()}> - Git Repository Status + Repository - - View repository status and sync with remote repositories - + {/* URL Configuration */} + {gitStatus?.isGitRepo && ( + + + Git URL + + +
+
+ + setOriginUrl(e.target.value)} + disabled={isSavingOrigin} + /> +
+ +
+ + {/* Credentials Warning */} + {gitStatus.remotes.length > 0 && ( + (() => { + const remoteWithoutCredentials = gitStatus.remotes.find((remote) => !findCredentialsForRepo(remote.url, settings.credentials)); + if (!remoteWithoutCredentials) return null; + + let protocol = ''; + let hostname = 'the remote host'; + try { + const url = new URL(remoteWithoutCredentials.url); + protocol = url.protocol; + hostname = url.hostname; + } catch { + // Invalid URL + return ( + + + + Invalid URL format. Enter an https URL. + + + ); + } + + // Check for unsupported protocols + if (protocol !== 'https:' && protocol !== 'nostr:') { + return ( + + + + The {protocol.replace(':', '')} URL type is not supported. Enter an https URL. + + + ); + } + + // For nostr protocol, only show warning if user is not logged in + if (protocol === 'nostr:' && !user) { + return ( + + + + You are not logged into Nostr. Push & pull might not work unless you{' '} + . + + + ); + } + + // For https protocol, show warning if no credentials + if (protocol === 'https:') { + return ( + + + + You are not logged into {hostname}. Push & pull might not work unless you{' '} + . + + + ); + } + + return null; + })() + )} +
+
+ )} +
- {/* Repository Info */} - - - - Repository Information - - - - - {gitStatus?.isGitRepo ? ( - <> -
- Current Branch: - - {gitStatus.currentBranch || 'unknown'} - -
- -
- Total Commits: - {gitStatus.totalCommits} -
- - {gitStatus.latestCommit && ( -
- Latest Commit: -
-
- {gitStatus.latestCommit.oid.substring(0, 7)} -
-
{gitStatus.latestCommit.message}
-
- - {new Date(gitStatus.latestCommit.author.timestamp * 1000).toLocaleString()} -
-
-
- )} - - {gitStatus.remotes.length > 0 && ( -
- Remotes: - {gitStatus.remotes.map((remote) => ( -
-
- {remote.name} - - {remote.url} - -
-
- ))} -
- )} - - ) : ( -
- -

Not a Git repository

-
- )} -
-
- - {/* Credentials Status */} - {gitStatus?.isGitRepo && gitStatus.remotes.length > 0 && ( - - - - Authentication - - - - Credentials for push/pull operations - - - - {gitStatus.remotes.map((remote) => { - const credentials = findCredentialsForRepo(remote.url, settings.credentials); - const originDisplayName = getOriginDisplayName(remote.url); - - return ( -
-
-
- {remote.name} - - {originDisplayName} - -
- {credentials ? ( -
- - Configured -
- ) : ( -
- - No credentials -
- )} -
- - {!credentials && ( - - - - No credentials configured for {originDisplayName}. - Push/pull operations may fail for private repositories.{' '} - - - - )} -
- ); - })} -
-
- )} {/* Sync Status */} {gitStatus?.isGitRepo && ( @@ -694,21 +720,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
)} - {/* Operation Results */} - {(pushResult || pullResult) && ( -
- {pushResult && ( -
- {pushResult} -
- )} - {pullResult && ( -
- {pullResult} -
- )} -
- )} + )} diff --git a/src/components/GitSettingsProvider.test.tsx b/src/components/GitSettingsProvider.test.tsx index 96a201f3..2192aa12 100644 --- a/src/components/GitSettingsProvider.test.tsx +++ b/src/components/GitSettingsProvider.test.tsx @@ -179,7 +179,7 @@ describe('GitSettingsProvider', () => { password: 'test-token', } }, - corsProxy: 'https://cors.isomorphic-git.org' + corsProxy: 'https://proxy.shakespeare.diy/?url={href}' }) ); }); @@ -220,7 +220,7 @@ describe('GitSettingsProvider', () => { ); await waitFor(() => { - expect(screen.getByTestId('cors-proxy')).toHaveTextContent('https://cors.isomorphic-git.org'); + expect(screen.getByTestId('cors-proxy')).toHaveTextContent('https://proxy.shakespeare.diy/?url={href}'); }); }); @@ -232,7 +232,7 @@ describe('GitSettingsProvider', () => { ); await waitFor(() => { - expect(screen.getByTestId('cors-proxy')).toHaveTextContent('https://cors.isomorphic-git.org'); + expect(screen.getByTestId('cors-proxy')).toHaveTextContent('https://proxy.shakespeare.diy/?url={href}'); }); fireEvent.click(screen.getByText('Update CORS Proxy')); diff --git a/src/components/GitSettingsProvider.tsx b/src/components/GitSettingsProvider.tsx index 3f49fbf3..275a805f 100644 --- a/src/components/GitSettingsProvider.tsx +++ b/src/components/GitSettingsProvider.tsx @@ -9,7 +9,7 @@ interface GitSettingsProviderProps { const DEFAULT_SETTINGS: GitSettings = { credentials: {}, - corsProxy: 'https://cors.isomorphic-git.org', + corsProxy: 'https://proxy.shakespeare.diy/?url={href}', }; export function GitSettingsProvider({ children }: GitSettingsProviderProps) { @@ -22,6 +22,10 @@ export function GitSettingsProvider({ children }: GitSettingsProviderProps) { const initializeSettings = async () => { try { const settings = await readGitSettings(fs); + // Migrate old CORS proxy format + if (settings.corsProxy === 'https://cors.isomorphic-git.org') { + settings.corsProxy = DEFAULT_SETTINGS.corsProxy; + } setSettings(settings); } catch (error) { console.error('Failed to initialize Git settings:', error); diff --git a/src/components/LanguagePicker.tsx b/src/components/LanguagePicker.tsx index 6838115e..3ea6fdad 100644 --- a/src/components/LanguagePicker.tsx +++ b/src/components/LanguagePicker.tsx @@ -47,6 +47,24 @@ export function LanguagePicker({ className }: LanguagePickerProps) { {t('chinese')} + +
+ 🇳🇬 + {t('hausa')} +
+
+ +
+ 🇳🇬 + {t('yoruba')} +
+
+ +
+ 🇳🇬 + {t('igbo')} +
+
); diff --git a/src/components/OnboardingDialog.tsx b/src/components/OnboardingDialog.tsx index ba6edb95..361746f2 100644 --- a/src/components/OnboardingDialog.tsx +++ b/src/components/OnboardingDialog.tsx @@ -243,9 +243,16 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps) >
- - {model.name ?? model.id} - +
+ + {model.description || model.name || model.id} + + {model.description && ( +

+ {model.name || model.id} +

+ )} +
{isFree && ( @@ -261,11 +268,6 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
- {model.description && ( -

- {model.description} -

- )}
{model.pricing && ( <> diff --git a/src/components/ProjectInfoDialog.tsx b/src/components/ProjectInfoDialog.tsx index 33fdf923..8460951a 100644 --- a/src/components/ProjectInfoDialog.tsx +++ b/src/components/ProjectInfoDialog.tsx @@ -1,112 +1,50 @@ -import { useState, useEffect } from 'react'; +import { useState } from 'react'; import { type Project } from '@/lib/ProjectsManager'; -import { useProjectsManager } from '@/hooks/useProjectsManager'; -import { useGitStatus } from '@/hooks/useGitStatus'; import { Dialog, DialogContent, - DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; -import { Badge } from '@/components/ui/badge'; -import { Separator } from '@/components/ui/separator'; -import { Skeleton } from '@/components/ui/skeleton'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from '@/components/ui/alert-dialog'; +import { Button } from '@/components/ui/button'; +import { useToast } from '@/hooks/useToast'; +import { useFS } from '@/hooks/useFS'; +import { useProjectsManager } from '@/hooks/useProjectsManager'; +import { useNavigate } from 'react-router-dom'; import { Calendar, Folder, - GitBranch, - Package, - FileText, - GitCommit, - GitMerge, - Globe, - Clock, - User, - Hash, - AlertCircle, - CheckCircle, - Plus, - Minus, - Edit, - Eye + Download, + Loader2, + Trash2, } from 'lucide-react'; +import JSZip from 'jszip'; interface ProjectInfoDialogProps { project: Project; open: boolean; onOpenChange: (open: boolean) => void; + onProjectDeleted?: () => void; } -interface ProjectMetadata { - description?: string; - version?: string; - nostrRepoAddress?: string; - fileCount?: number; -} - -export function ProjectInfoDialog({ project, open, onOpenChange }: ProjectInfoDialogProps) { - const [metadata, setMetadata] = useState({}); - const [isLoading, setIsLoading] = useState(false); +export function ProjectInfoDialog({ project, open, onOpenChange, onProjectDeleted }: ProjectInfoDialogProps) { + const [isExporting, setIsExporting] = useState(false); + const [isDeleting, setIsDeleting] = useState(false); + const { toast } = useToast(); + const { fs } = useFS(); const projectsManager = useProjectsManager(); - const gitStatus = useGitStatus(project.id); - - useEffect(() => { - if (!open) return; - - const loadProjectMetadata = async () => { - setIsLoading(true); - try { - const meta: ProjectMetadata = {}; - - // Try to read package.json - try { - const packageJsonContent = await projectsManager.readFile(project.id, 'package.json'); - const packageJson = JSON.parse(packageJsonContent); - meta.description = packageJson.description; - meta.version = packageJson.version; - } catch { - // package.json doesn't exist or is invalid - } - - // Get Nostr repo address - try { - const repoAddress = await projectsManager.getNostrRepoAddress(project.id); - if (repoAddress) { - meta.nostrRepoAddress = repoAddress; - } - } catch { - // No Nostr repo configured - } - - // Calculate file count and size (simplified) - try { - const files = await projectsManager.listFiles(project.id); - meta.fileCount = files.length; - } catch { - // Can't read directory - } - - setMetadata(meta); - } catch (error) { - console.error('Failed to load project metadata:', error); - } finally { - setIsLoading(false); - } - }; - - loadProjectMetadata(); - }, [open, project.id, projectsManager]); - - const formatDate = (date: Date) => { - return new Intl.DateTimeFormat('en-US', { - year: 'numeric', - month: 'long', - day: 'numeric', - hour: '2-digit', - minute: '2-digit', - }).format(date); - }; + const navigate = useNavigate(); const formatDistanceToNow = (date: Date) => { const now = new Date(); @@ -120,239 +58,174 @@ export function ProjectInfoDialog({ project, open, onOpenChange }: ProjectInfoDi return `${Math.floor(diffInSeconds / 31536000)} years ago`; }; + const handleDeleteProject = async () => { + setIsDeleting(true); + try { + await projectsManager.deleteProject(project.id); + + toast({ + title: "Project deleted", + description: `"${project.name}" has been permanently deleted.`, + }); + + // Close the dialog first + onOpenChange(false); + + // Navigate back to home and notify parent + navigate('/'); + if (onProjectDeleted) { + onProjectDeleted(); + } + } catch (error) { + toast({ + title: "Failed to delete project", + description: error instanceof Error ? error.message : "An unexpected error occurred", + variant: "destructive", + }); + } finally { + setIsDeleting(false); + } + }; + + const handleExportProject = async () => { + setIsExporting(true); + try { + const zip = new JSZip(); + const projectPath = `/projects/${project.id}`; + + // Recursive function to add files and directories to zip from a specific project + const addFolderToZip = async (dirPath: string, zipFolder: JSZip) => { + try { + const entries = await fs.readdir(dirPath, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = `${dirPath}/${entry.name}`; + + if (entry.isDirectory()) { + // Create folder in zip and recursively add its contents + const folder = zipFolder.folder(entry.name); + if (folder) { + await addFolderToZip(fullPath, folder); + } + } else if (entry.isFile()) { + // Add file to zip + try { + const fileContent = await fs.readFile(fullPath); + zipFolder.file(entry.name, fileContent); + } catch (error) { + console.warn(`Failed to read file ${fullPath}:`, error); + } + } + } + } catch (error) { + console.warn(`Failed to read directory ${dirPath}:`, error); + } + }; + + // Start from the project directory + await addFolderToZip(projectPath, zip); + + // Generate zip file + const content = await zip.generateAsync({ type: 'blob' }); + + // Create download link + const url = URL.createObjectURL(content); + const link = document.createElement('a'); + link.href = url; + link.download = `${project.id}.zip`; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + URL.revokeObjectURL(url); + + toast({ + title: "Project exported successfully", + description: `"${project.name}" has been downloaded as a zip file.`, + }); + } catch (error) { + console.error('Failed to export project:', error); + toast({ + title: "Failed to export project", + description: error instanceof Error ? error.message : "An unexpected error occurred", + variant: "destructive", + }); + } finally { + setIsExporting(false); + } + }; + return ( - + {project.name} - - Project information and metadata - - {isLoading ? ( -
-
-
-
-
+
+ {/* Last Modified */} +
+ + Last Modified: + {formatDistanceToNow(project.lastModified)}
- ) : ( -
- {/* Basic Information */} -
-

- Basic Information -

-
-
- - Project ID: - {project.id} -
-
- - Last Modified: - {formatDistanceToNow(project.lastModified)} -
- {metadata.version && ( -
- - Version: - {metadata.version} -
- )} - {metadata.fileCount !== undefined && ( -
- - Files: - {metadata.fileCount} -
- )} -
-
- Created: - {formatDate(project.lastModified)} -
- {metadata.description && ( -
- Description: -

{metadata.description}

-
- )} -
- {/* Nostr Information */} - {metadata.nostrRepoAddress && ( - <> - -
-

- - Nostr Repository -

-
- Repository Address: - - {metadata.nostrRepoAddress} - -
-
- + {/* Export Project Button */} + - {/* Git Status Information */} - -
-

- - Git Repository -

- - {gitStatus.isLoading ? ( -
- - - -
- ) : !gitStatus.data?.isGitRepo ? ( -
- - This project is not a Git repository -
- ) : ( -
- {/* Repository Status */} -
- {/* Current Branch */} -
- - Branch: - - {gitStatus.data?.currentBranch || 'unknown'} - -
- - {/* Uncommitted Changes */} -
- {gitStatus.data?.hasUncommittedChanges ? ( - <> - - Status: - - {gitStatus.data.changedFiles.length} uncommitted changes - - - ) : ( - <> - - Status: - - Clean working tree - - - )} -
- - {/* Total Commits */} -
- - Commits: - {gitStatus.data?.totalCommits || 0} -
- - {/* All Branches */} -
- - Branches: - {gitStatus.data?.branches.length || 0} -
-
- - {/* Latest Commit */} - {gitStatus.data?.latestCommit && ( -
-

- Latest Commit -

-
-
- -
-
- {gitStatus.data.latestCommit.message.split('\n')[0]} -
-
- {gitStatus.data.latestCommit.oid.substring(0, 7)} -
-
-
-
-
- - {gitStatus.data.latestCommit.author.name} -
-
- - {new Date(gitStatus.data.latestCommit.author.timestamp * 1000).toLocaleDateString()} -
-
-
-
+ {/* Delete Project Button */} + + + + + + + Delete Project + + Are you sure you want to delete "{project.name}"? This action cannot be undone and will permanently delete all project data including files. + + + + Cancel + + {isDeleting ? ( + <> + + Deleting... + + ) : ( + 'Delete Project' )} - - {/* Changed Files */} - {gitStatus.data?.hasUncommittedChanges && gitStatus.data.changedFiles.length > 0 && ( -
-

- Uncommitted Changes -

-
- {gitStatus.data.changedFiles.map((file, index) => ( -
- {file.status === 'added' && } - {file.status === 'modified' && } - {file.status === 'deleted' && } - {file.status === 'untracked' && } - {file.status === 'staged' && } - {file.status}: - - {file.filepath} - -
- ))} -
-
- )} - - {/* Remotes */} - {gitStatus.data?.remotes && gitStatus.data.remotes.length > 0 && ( -
-

- Remote Repositories -

-
- {gitStatus.data.remotes.map((remote, index) => ( -
- - {remote.name}: - - {remote.url} - -
- ))} -
-
- )} -
- )} -
- -
- )} + + + + +
); diff --git a/src/components/Shakespeare/ChatPane.tsx b/src/components/Shakespeare/ChatPane.tsx index 032120ca..f9af956c 100644 --- a/src/components/Shakespeare/ChatPane.tsx +++ b/src/components/Shakespeare/ChatPane.tsx @@ -117,12 +117,10 @@ interface ChatPaneProps { projectId: string; onNewChat?: () => void; onBuild?: () => void; - onDeploy?: () => void; onFirstInteraction?: () => void; onLoadingChange?: (isLoading: boolean) => void; isLoading?: boolean; isBuildLoading?: boolean; - isDeployLoading?: boolean; } export interface ChatPaneRef { @@ -133,12 +131,10 @@ export const ChatPane = forwardRef(({ projectId, onNewChat: _onNewChat, onBuild: _onBuild, - onDeploy: _onDeploy, onFirstInteraction, onLoadingChange, isLoading: externalIsLoading, isBuildLoading: externalIsBuildLoading, - isDeployLoading: externalIsDeployLoading }, ref) => { const { t } = useTranslation(); const [input, setInput] = useState(''); @@ -150,7 +146,6 @@ export const ChatPane = forwardRef(({ // Use external state if provided, otherwise default to false const isBuildLoading = externalIsBuildLoading || false; - const isDeployLoading = externalIsDeployLoading || false; const scrollAreaRef = useRef(null); const { isConfigured, settings, addRecentlyUsedModel } = useAISettings(); const [providerModel, setProviderModel] = useState(() => { @@ -216,7 +211,7 @@ export const ChatPane = forwardRef(({ // Keep-alive functionality to prevent tab throttling during AI processing const { updateMetadata } = useKeepAlive({ - enabled: externalIsLoading || isBuildLoading || isDeployLoading, + enabled: externalIsLoading || isBuildLoading, title: 'Shakespeare', artist: `Working on ${projectId}...`, artwork: [ diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index a5424484..befc11ee 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -4,16 +4,18 @@ import { useTranslation } from 'react-i18next'; import { useProjectsManager } from '@/hooks/useProjectsManager'; import { useFS } from '@/hooks/useFS'; import { useConsoleMessages, addConsoleMessage, clearConsoleMessages, type ConsoleMessage } from '@/hooks/useConsoleMessages'; +import { useBuildProject } from '@/hooks/useBuildProject'; import { Tabs, TabsContent } from '@/components/ui/tabs'; import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'; import { Button } from '@/components/ui/button'; -import { FolderOpen, ArrowLeft, X, Bug, Copy, Check } from 'lucide-react'; +import { FolderOpen, ArrowLeft, X, Bug, Copy, Check, Play, Loader2, MenuIcon, Code } from 'lucide-react'; import { useIsMobile } from '@/hooks/useIsMobile'; import { GitStatusIndicator } from '@/components/GitStatusIndicator'; import { BrowserAddressBar } from '@/components/ui/browser-address-bar'; import { DropdownMenu, DropdownMenuContent, + DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; @@ -26,6 +28,7 @@ const IFRAME_DOMAIN = import.meta.env.VITE_IFRAME_DOMAIN || 'local-shakespeare.d interface PreviewPaneProps { projectId: string; activeTab: 'preview' | 'code'; + onToggleView?: () => void; } interface JSONRPCRequest { @@ -59,7 +62,7 @@ interface JSONRPCResponse { } -export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) { +export function PreviewPane({ projectId, activeTab, onToggleView }: PreviewPaneProps) { const { t } = useTranslation(); const [selectedFile, setSelectedFile] = useState(null); const [fileContent, setFileContent] = useState(''); @@ -75,6 +78,15 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) { const { fs } = useFS(); const projectsManager = useProjectsManager(); const { messages: consoleMessages } = useConsoleMessages(); + const { mutate: buildProject, isPending: isBuildLoading } = useBuildProject(projectId); + + const handleBuildProject = () => { + buildProject(undefined, { + onError: (error) => { + console.error('Build failed:', error); + } + }); + }; const loadFileContent = useCallback(async (filePath: string) => { setIsLoading(true); @@ -128,16 +140,15 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) { const refreshIframe = useCallback(() => { if (iframeRef.current) { // Force reload the iframe by updating its src - const currentSrc = iframeRef.current.src; - iframeRef.current.src = ''; + iframeRef.current.src = '/'; // Use a small timeout to ensure the src is cleared before setting it back setTimeout(() => { if (iframeRef.current) { - iframeRef.current.src = currentSrc; + iframeRef.current.src = `https://${projectId}.${IFRAME_DOMAIN}${currentPath}`; } }, 10); } - }, []); + }, [currentPath, projectId]); const navigateToPath = useCallback((path: string) => { if (iframeRef.current) { @@ -485,66 +496,136 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) { ); }; + const Menu = () => { + return ( + + + + + + {(!isMobile && onToggleView) && ( + + + View Code + + )} + + {isBuildLoading ? ( + + ) : ( + + )} + {isBuildLoading ? 'Building...' : 'Build'} + + + + ); + }; + return (
- {hasBuiltProject ? ( -
-
- 0} - canGoForward={historyIndex < navigationHistory.length - 1} - extraContent={} - /> -
-