Merge branch 'main' into fix/23-detect-inference-errors-and-show-something-useful-to-the-user

This commit is contained in:
sam committed 2025-09-22 20:57:11 +07:00
commit c3fc719e82
38 files changed
+2199 -1222

No files matched your search

+20 -246
View File
@@ -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"
>
<GitMerge className="h-4 w-4" />
Git Status
<GitBranch className="h-4 w-4" />
Repository
</DropdownMenuItem>
<DropdownMenuItem
@@ -230,104 +82,18 @@ export function ActionsMenu({
disabled={isAnyLoading}
className="gap-2"
>
<GitBranch className="h-4 w-4" />
Git History
</DropdownMenuItem>
<AppSettingsDialog>
<DropdownMenuItem
disabled={isAnyLoading}
className="gap-2"
onSelect={(e) => e.preventDefault()}
>
<Settings className="h-4 w-4" />
Settings
</DropdownMenuItem>
</AppSettingsDialog>
<DropdownMenuItem
onClick={handleExportProject}
disabled={isAnyLoading}
className="gap-2"
>
{isExporting ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Download className="h-4 w-4" />
)}
{isExporting ? 'Exporting...' : 'Export Project'}
<History className="h-4 w-4" />
Rollback
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => {
if (onFirstInteraction) onFirstInteraction();
onBuild();
}}
onClick={() => setDeployDialogOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
{isBuildLoading ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Play className="h-4 w-4" />
)}
{isBuildLoading ? 'Building...' : 'Build'}
<CloudUpload className="h-4 w-4" />
Deploy
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => {
if (onFirstInteraction) onFirstInteraction();
onDeploy();
}}
disabled={isAnyLoading}
className="gap-2"
>
{isDeployLoading ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<CloudUpload className="h-4 w-4" />
)}
{isDeployLoading ? 'Deploying...' : 'Deploy'}
</DropdownMenuItem>
<DropdownMenuSeparator />
<AlertDialog>
<AlertDialogTrigger asChild>
<DropdownMenuItem
className="text-destructive focus:text-destructive cursor-pointer gap-2"
onSelect={(e) => e.preventDefault()}
>
<Trash2 className="h-4 w-4" />
Delete Project
</DropdownMenuItem>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Project</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete "{projectName}"? This action cannot be undone and will permanently delete all project data including files.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={handleDeleteProject}
disabled={isDeleting}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{isDeleting ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
Deleting...
</>
) : (
'Delete Project'
)}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</DropdownMenuContent>
</DropdownMenu>
@@ -343,6 +109,14 @@ export function ActionsMenu({
open={gitHistoryOpen}
onOpenChange={setGitHistoryOpen}
/>
<DeployDialog
projectId={projectId}
projectName={projectName}
open={deployDialogOpen}
onOpenChange={setDeployDialogOpen}
onFirstInteraction={onFirstInteraction}
/>
</>
);
}
-108
View File
@@ -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 (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
{children || (
<Button variant="outline" size="sm">
<Settings className="h-4 w-4 mr-2" />
Settings
</Button>
)}
</DialogTrigger>
<DialogContent className="sm:max-w-[500px]">
<DialogHeader>
<DialogTitle>App Settings</DialogTitle>
<DialogDescription>
Configure your application preferences and deployment settings.
</DialogDescription>
</DialogHeader>
<div className="space-y-6">
<Card>
<CardHeader>
<CardTitle className="text-lg">Deployment</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-2">
<Label htmlFor="deployServer">Deploy Server</Label>
<Input
id="deployServer"
value={deployServer}
onChange={(e) => setDeployServer(e.target.value)}
placeholder="shakespeare.wtf"
className="font-mono"
/>
<p className="text-xs text-muted-foreground">
Your projects will be deployed to subdomains of this server.
Example: yourproject.{deployServer || 'shakespeare.wtf'}
</p>
</div>
</CardContent>
</Card>
</div>
<div className="flex justify-end space-x-2">
<Button variant="outline" onClick={handleCancel}>
Cancel
</Button>
<Button onClick={handleSave}>
<Save className="h-4 w-4 mr-2" />
Save Settings
</Button>
</div>
</DialogContent>
</Dialog>
);
}
+182
View File
@@ -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 (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<CloudUpload className="h-5 w-5" />
Deploy "{projectName}"
</DialogTitle>
</DialogHeader>
<div className="space-y-4">
<div className="space-y-2">
<Label htmlFor="deploy-url">Deploy URL</Label>
<div className="relative">
<span className="absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground">
https://
</span>
<Input
id="deploy-url"
value={deployUrl}
onChange={(e) => handleUrlChange(e.target.value)}
placeholder={`${projectId}.${config.deployServer}`}
className="pl-16"
disabled={deployMutation.isPending}
/>
</div>
<p className="text-xs text-muted-foreground">
Your project will be deployed to this URL. You can customize the subdomain.
</p>
</div>
{!user && (
<div className="p-3 bg-muted rounded-lg">
<p className="text-sm text-muted-foreground">
You must be logged into Nostr to deploy projects.
</p>
</div>
)}
</div>
<DialogFooter>
<Button
variant="outline"
onClick={() => onOpenChange(false)}
disabled={deployMutation.isPending}
>
Cancel
</Button>
<Button
onClick={handleDeploy}
disabled={!user || !isValidUrl() || deployMutation.isPending}
className="gap-2"
>
{deployMutation.isPending ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<CloudUpload className="h-4 w-4" />
)}
{deployMutation.isPending ? 'Deploying...' : 'Deploy'}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}
+52 -20
View File
@@ -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(
<TestApp>
<GitDialog projectId="test-project" open={true} onOpenChange={() => {}}>
@@ -73,11 +77,9 @@ describe('GitDialog', () => {
</TestApp>
);
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(
<TestApp>
<GitDialog projectId="test-project" open={true} onOpenChange={() => {}}>
@@ -154,8 +156,38 @@ describe('GitDialog', () => {
</TestApp>
);
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(
<TestApp>
<GitDialog projectId="test-project" open={true} onOpenChange={() => {}}>
<button>Open Git Dialog</button>
</GitDialog>
</TestApp>
);
// 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
});
});
+192 -180
View File
@@ -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<string | null>(null);
const [pullResult, setPullResult] = useState<string | null>(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 (
<Dialog open={open} onOpenChange={onOpenChange}>
{children && <DialogTrigger asChild>{children}</DialogTrigger>}
<DialogContent className="max-w-2xl max-h-[80vh]">
<DialogContent className="max-w-2xl max-h-[80vh]" onOpenAutoFocus={(e) => e.preventDefault()}>
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<GitBranch className="h-5 w-5" />
Git Repository Status
Repository
</DialogTitle>
<DialogDescription>
View repository status and sync with remote repositories
</DialogDescription>
</DialogHeader>
{/* URL Configuration */}
{gitStatus?.isGitRepo && (
<Card>
<CardHeader className="pb-3">
<CardTitle className="text-sm">Git URL</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
<div className="flex gap-2">
<div className="flex-1">
<Label htmlFor="origin-url" className="sr-only">
URL
</Label>
<Input
id="origin-url"
placeholder="https://github.com/username/repository.git"
value={originUrl}
onChange={(e) => setOriginUrl(e.target.value)}
disabled={isSavingOrigin}
/>
</div>
<Button
onClick={handleSaveOrigin}
disabled={isSavingOrigin}
variant="outline"
size="sm"
className="h-10 shrink-0"
>
{isSavingOrigin ? (
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
) : (
<Save className="h-4 w-4 mr-2" />
)}
{isSavingOrigin ? 'Saving...' : 'Save'}
</Button>
</div>
{/* 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 (
<Alert className="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50">
<AlertTriangle className="h-4 w-4" />
<AlertDescription className="text-sm">
Invalid URL format. Enter an https URL.
</AlertDescription>
</Alert>
);
}
// Check for unsupported protocols
if (protocol !== 'https:' && protocol !== 'nostr:') {
return (
<Alert className="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50">
<AlertTriangle className="h-4 w-4" />
<AlertDescription className="text-sm">
The {protocol.replace(':', '')} URL type is not supported. Enter an https URL.
</AlertDescription>
</Alert>
);
}
// For nostr protocol, only show warning if user is not logged in
if (protocol === 'nostr:' && !user) {
return (
<Alert className="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50">
<AlertTriangle className="h-4 w-4" />
<AlertDescription className="text-sm">
You are not logged into Nostr. Push & pull might not work unless you{' '}
<button
onClick={() => navigate('/settings/nostr')}
className="underline hover:no-underline font-medium text-amber-700 dark:text-amber-300"
>
log in
</button>.
</AlertDescription>
</Alert>
);
}
// For https protocol, show warning if no credentials
if (protocol === 'https:') {
return (
<Alert className="border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/50">
<AlertTriangle className="h-4 w-4" />
<AlertDescription className="text-sm">
You are not logged into {hostname}. Push & pull might not work unless you{' '}
<button
onClick={() => navigate('/settings/git')}
className="underline hover:no-underline font-medium text-amber-700 dark:text-amber-300"
>
log in
</button>.
</AlertDescription>
</Alert>
);
}
return null;
})()
)}
</CardContent>
</Card>
)}
<ScrollArea className="max-h-[60vh]">
<div className="space-y-4">
{/* Repository Info */}
<Card>
<CardHeader className="pb-3">
<CardTitle className="text-sm flex items-center justify-between">
Repository Information
<Button
variant="ghost"
size="sm"
onClick={handleRefresh}
className="h-7 w-7 p-0"
>
<RefreshCw className="h-3 w-3" />
</Button>
</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{gitStatus?.isGitRepo ? (
<>
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground">Current Branch:</span>
<Badge variant="outline" className="font-mono">
{gitStatus.currentBranch || 'unknown'}
</Badge>
</div>
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground">Total Commits:</span>
<Badge variant="secondary">{gitStatus.totalCommits}</Badge>
</div>
{gitStatus.latestCommit && (
<div className="space-y-2">
<span className="text-sm text-muted-foreground">Latest Commit:</span>
<div className="bg-muted/50 rounded-md p-2 space-y-1">
<div className="font-mono text-xs text-muted-foreground">
{gitStatus.latestCommit.oid.substring(0, 7)}
</div>
<div className="text-sm">{gitStatus.latestCommit.message}</div>
<div className="text-xs text-muted-foreground flex items-center gap-1">
<Clock className="h-3 w-3" />
{new Date(gitStatus.latestCommit.author.timestamp * 1000).toLocaleString()}
</div>
</div>
</div>
)}
{gitStatus.remotes.length > 0 && (
<div className="space-y-2">
<span className="text-sm text-muted-foreground">Remotes:</span>
{gitStatus.remotes.map((remote) => (
<div key={remote.name} className="bg-muted/50 rounded-md p-2">
<div className="flex items-center justify-between">
<Badge variant="outline">{remote.name}</Badge>
<span className="font-mono text-xs text-muted-foreground truncate ml-2">
{remote.url}
</span>
</div>
</div>
))}
</div>
)}
</>
) : (
<div className="text-center py-4 text-muted-foreground">
<AlertCircle className="h-8 w-8 mx-auto mb-2" />
<p>Not a Git repository</p>
</div>
)}
</CardContent>
</Card>
{/* Credentials Status */}
{gitStatus?.isGitRepo && gitStatus.remotes.length > 0 && (
<Card>
<CardHeader className="pb-3">
<CardTitle className="text-sm flex items-center justify-between">
Authentication
<Button
variant="ghost"
size="sm"
onClick={() => navigate('/settings/git')}
className="h-7 gap-1 text-xs"
>
<Settings className="h-3 w-3" />
Settings
</Button>
</CardTitle>
<CardDescription>
Credentials for push/pull operations
</CardDescription>
</CardHeader>
<CardContent className="space-y-3">
{gitStatus.remotes.map((remote) => {
const credentials = findCredentialsForRepo(remote.url, settings.credentials);
const originDisplayName = getOriginDisplayName(remote.url);
return (
<div key={remote.name} className="space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Badge variant="outline">{remote.name}</Badge>
<span className="text-sm text-muted-foreground">
{originDisplayName}
</span>
</div>
{credentials ? (
<div className="flex items-center gap-1 text-green-600">
<CheckCircle className="h-3 w-3" />
<span className="text-xs">Configured</span>
</div>
) : (
<div className="flex items-center gap-1 text-amber-600">
<AlertTriangle className="h-3 w-3" />
<span className="text-xs">No credentials</span>
</div>
)}
</div>
{!credentials && (
<Alert className="border-amber-200 bg-amber-50">
<AlertTriangle className="h-4 w-4" />
<AlertDescription className="text-sm">
No credentials configured for {originDisplayName}.
Push/pull operations may fail for private repositories.{' '}
<button
onClick={() => navigate('/settings/git')}
className="underline hover:no-underline font-medium"
>
Configure credentials
</button>
</AlertDescription>
</Alert>
)}
</div>
);
})}
</CardContent>
</Card>
)}
{/* Sync Status */}
{gitStatus?.isGitRepo && (
@@ -694,21 +720,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
</div>
)}
{/* Operation Results */}
{(pushResult || pullResult) && (
<div className="mt-3 space-y-2">
{pushResult && (
<div className="text-xs font-mono bg-muted/50 rounded p-2">
{pushResult}
</div>
)}
{pullResult && (
<div className="text-xs font-mono bg-muted/50 rounded p-2">
{pullResult}
</div>
)}
</div>
)}
</CardContent>
</Card>
)}
+3 -3
View File
@@ -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'));
+5 -1
View File
@@ -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);
+18
View File
@@ -47,6 +47,24 @@ export function LanguagePicker({ className }: LanguagePickerProps) {
{t('chinese')}
</div>
</SelectItem>
<SelectItem value="ha">
<div className="flex items-center gap-2">
<span className="text-lg">🇳🇬</span>
{t('hausa')}
</div>
</SelectItem>
<SelectItem value="yo">
<div className="flex items-center gap-2">
<span className="text-lg">🇳🇬</span>
{t('yoruba')}
</div>
</SelectItem>
<SelectItem value="ig">
<div className="flex items-center gap-2">
<span className="text-lg">🇳🇬</span>
{t('igbo')}
</div>
</SelectItem>
</SelectContent>
</Select>
);
+10 -8
View File
@@ -243,9 +243,16 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
>
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
<CardTitle className="text-base font-semibold">
{model.name ?? model.id}
</CardTitle>
<div className="flex-1">
<CardTitle className="text-base font-semibold">
{model.description || model.name || model.id}
</CardTitle>
{model.description && (
<p className="text-sm text-muted-foreground mt-1">
{model.name || model.id}
</p>
)}
</div>
<div className="flex items-center gap-2">
{isFree && (
<Badge variant="secondary" className="text-xs">
@@ -261,11 +268,6 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
</div>
</CardHeader>
<CardContent className="pt-0">
{model.description && (
<p className="text-sm text-muted-foreground mb-3">
{model.description}
</p>
)}
<div className="flex items-center gap-4 text-xs text-muted-foreground">
{model.pricing && (
<>
+182 -309
View File
@@ -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<ProjectMetadata>({});
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 (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Folder className="h-5 w-5" />
{project.name}
</DialogTitle>
<DialogDescription>
Project information and metadata
</DialogDescription>
</DialogHeader>
{isLoading ? (
<div className="space-y-4">
<div className="animate-pulse">
<div className="h-4 bg-muted rounded w-3/4 mb-2"></div>
<div className="h-4 bg-muted rounded w-1/2"></div>
</div>
<div className="space-y-4">
{/* Last Modified */}
<div className="flex items-center gap-2 text-sm">
<Calendar className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Last Modified:</span>
<span>{formatDistanceToNow(project.lastModified)}</span>
</div>
) : (
<div className="space-y-6">
{/* Basic Information */}
<div className="space-y-3">
<h3 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide">
Basic Information
</h3>
<div className="grid grid-cols-2 gap-4 text-sm">
<div className="flex items-center gap-2">
<Folder className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Project ID:</span>
<code className="bg-muted px-1.5 py-0.5 rounded text-xs">{project.id}</code>
</div>
<div className="flex items-center gap-2">
<Calendar className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Last Modified:</span>
<span>{formatDistanceToNow(project.lastModified)}</span>
</div>
{metadata.version && (
<div className="flex items-center gap-2">
<Package className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Version:</span>
<Badge variant="secondary">{metadata.version}</Badge>
</div>
)}
{metadata.fileCount !== undefined && (
<div className="flex items-center gap-2">
<FileText className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Files:</span>
<span>{metadata.fileCount}</span>
</div>
)}
</div>
<div className="text-sm">
<span className="text-muted-foreground">Created:</span>
<span className="ml-2">{formatDate(project.lastModified)}</span>
</div>
{metadata.description && (
<div className="text-sm">
<span className="text-muted-foreground">Description:</span>
<p className="mt-1 text-foreground">{metadata.description}</p>
</div>
)}
</div>
{/* Nostr Information */}
{metadata.nostrRepoAddress && (
<>
<Separator />
<div className="space-y-3">
<h3 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2">
<GitBranch className="h-4 w-4" />
Nostr Repository
</h3>
<div className="text-sm">
<span className="text-muted-foreground">Repository Address:</span>
<code className="ml-2 bg-muted px-1.5 py-0.5 rounded text-xs break-all">
{metadata.nostrRepoAddress}
</code>
</div>
</div>
</>
{/* Export Project Button */}
<Button
onClick={handleExportProject}
disabled={isExporting || isDeleting}
className="w-full gap-2"
variant="outline"
>
{isExporting ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Download className="h-4 w-4" />
)}
{isExporting ? 'Exporting...' : 'Export Project'}
</Button>
{/* Git Status Information */}
<Separator />
<div className="space-y-3">
<h3 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2">
<GitCommit className="h-4 w-4" />
Git Repository
</h3>
{gitStatus.isLoading ? (
<div className="space-y-2">
<Skeleton className="h-4 w-3/4" />
<Skeleton className="h-4 w-1/2" />
<Skeleton className="h-4 w-2/3" />
</div>
) : !gitStatus.data?.isGitRepo ? (
<div className="text-sm text-muted-foreground flex items-center gap-2">
<AlertCircle className="h-4 w-4" />
This project is not a Git repository
</div>
) : (
<div className="space-y-4">
{/* Repository Status */}
<div className="grid grid-cols-2 gap-4 text-sm">
{/* Current Branch */}
<div className="flex items-center gap-2">
<GitBranch className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Branch:</span>
<Badge variant="outline" className="text-xs">
{gitStatus.data?.currentBranch || 'unknown'}
</Badge>
</div>
{/* Uncommitted Changes */}
<div className="flex items-center gap-2">
{gitStatus.data?.hasUncommittedChanges ? (
<>
<AlertCircle className="h-4 w-4 text-orange-500" />
<span className="text-muted-foreground">Status:</span>
<Badge variant="destructive" className="text-xs">
{gitStatus.data.changedFiles.length} uncommitted changes
</Badge>
</>
) : (
<>
<CheckCircle className="h-4 w-4 text-green-500" />
<span className="text-muted-foreground">Status:</span>
<Badge variant="secondary" className="text-xs bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400">
Clean working tree
</Badge>
</>
)}
</div>
{/* Total Commits */}
<div className="flex items-center gap-2">
<Hash className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Commits:</span>
<span>{gitStatus.data?.totalCommits || 0}</span>
</div>
{/* All Branches */}
<div className="flex items-center gap-2">
<GitMerge className="h-4 w-4 text-muted-foreground" />
<span className="text-muted-foreground">Branches:</span>
<span>{gitStatus.data?.branches.length || 0}</span>
</div>
</div>
{/* Latest Commit */}
{gitStatus.data?.latestCommit && (
<div className="space-y-2">
<h4 className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
Latest Commit
</h4>
<div className="bg-muted/30 rounded-md p-3 space-y-2">
<div className="flex items-start gap-2">
<GitCommit className="h-4 w-4 text-muted-foreground mt-0.5" />
<div className="flex-1 min-w-0">
<div className="text-sm font-medium break-words">
{gitStatus.data.latestCommit.message.split('\n')[0]}
</div>
<div className="text-xs text-muted-foreground font-mono">
{gitStatus.data.latestCommit.oid.substring(0, 7)}
</div>
</div>
</div>
<div className="flex items-center gap-4 text-xs text-muted-foreground">
<div className="flex items-center gap-1">
<User className="h-3 w-3" />
{gitStatus.data.latestCommit.author.name}
</div>
<div className="flex items-center gap-1">
<Clock className="h-3 w-3" />
{new Date(gitStatus.data.latestCommit.author.timestamp * 1000).toLocaleDateString()}
</div>
</div>
</div>
</div>
{/* Delete Project Button */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="destructive"
className="w-full gap-2"
disabled={isExporting || isDeleting}
>
<Trash2 className="h-4 w-4" />
Delete Project
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Project</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete "{project.name}"? This action cannot be undone and will permanently delete all project data including files.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={handleDeleteProject}
disabled={isDeleting}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{isDeleting ? (
<>
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
Deleting...
</>
) : (
'Delete Project'
)}
{/* Changed Files */}
{gitStatus.data?.hasUncommittedChanges && gitStatus.data.changedFiles.length > 0 && (
<div className="space-y-2">
<h4 className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
Uncommitted Changes
</h4>
<div className="space-y-1 max-h-32 overflow-y-auto">
{gitStatus.data.changedFiles.map((file, index) => (
<div key={index} className="flex items-center gap-2 text-sm">
{file.status === 'added' && <Plus className="h-3 w-3 text-green-500" />}
{file.status === 'modified' && <Edit className="h-3 w-3 text-blue-500" />}
{file.status === 'deleted' && <Minus className="h-3 w-3 text-red-500" />}
{file.status === 'untracked' && <Eye className="h-3 w-3 text-orange-500" />}
{file.status === 'staged' && <CheckCircle className="h-3 w-3 text-purple-500" />}
<span className="text-muted-foreground capitalize">{file.status}:</span>
<code className="text-xs bg-muted px-1 py-0.5 rounded font-mono">
{file.filepath}
</code>
</div>
))}
</div>
</div>
)}
{/* Remotes */}
{gitStatus.data?.remotes && gitStatus.data.remotes.length > 0 && (
<div className="space-y-2">
<h4 className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
Remote Repositories
</h4>
<div className="space-y-1">
{gitStatus.data.remotes.map((remote, index) => (
<div key={index} className="flex items-center gap-2 text-sm">
<Globe className="h-3 w-3 text-muted-foreground" />
<span className="text-muted-foreground font-medium">{remote.name}:</span>
<code className="text-xs bg-muted px-1 py-0.5 rounded font-mono break-all">
{remote.url}
</code>
</div>
))}
</div>
</div>
)}
</div>
)}
</div>
</div>
)}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
</DialogContent>
</Dialog>
);
+1 -6
View File
@@ -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<ChatPaneRef, ChatPaneProps>(({
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<ChatPaneRef, ChatPaneProps>(({
// Use external state if provided, otherwise default to false
const isBuildLoading = externalIsBuildLoading || false;
const isDeployLoading = externalIsDeployLoading || false;
const scrollAreaRef = useRef<HTMLDivElement>(null);
const { isConfigured, settings, addRecentlyUsedModel } = useAISettings();
const [providerModel, setProviderModel] = useState(() => {
@@ -216,7 +211,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
// 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: [
+181 -87
View File
@@ -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<string | null>(null);
const [fileContent, setFileContent] = useState<string>('');
@@ -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 (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
size="sm"
className="h-8 w-8 p-0"
>
<MenuIcon className="h-4 w-4" />
<span className="sr-only">Open menu</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48">
{(!isMobile && onToggleView) && (
<DropdownMenuItem
onClick={onToggleView}
className="gap-2"
>
<Code className="h-4 w-4" />
View Code
</DropdownMenuItem>
)}
<DropdownMenuItem
onClick={handleBuildProject}
disabled={isBuildLoading}
className="gap-2"
>
{isBuildLoading ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Play className="h-4 w-4" />
)}
{isBuildLoading ? 'Building...' : 'Build'}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
};
return (
<div className="h-full">
<Tabs value={activeTab} className="h-full">
<TabsContent value="preview" className="h-full mt-0">
{hasBuiltProject ? (
<div className="h-full w-full flex flex-col">
<div className="flex items-center border-b w-full">
<BrowserAddressBar
currentPath={currentPath}
onNavigate={navigateToPath}
onRefresh={refreshIframe}
onBack={goBack}
onForward={goForward}
canGoBack={historyIndex > 0}
canGoForward={historyIndex < navigationHistory.length - 1}
extraContent={<ConsoleDropdown />}
/>
</div>
<iframe
ref={iframeRef}
src={`https://${projectId}.${IFRAME_DOMAIN}${currentPath}`}
className="w-full flex-1 border-0"
title="Project Preview"
sandbox="allow-scripts allow-same-origin"
<div className="h-full w-full flex flex-col relative">
{/* Always show browser address bar */}
<div className="h-12 flex items-center w-full">
<BrowserAddressBar
currentPath={currentPath}
onNavigate={hasBuiltProject ? navigateToPath : undefined}
onRefresh={hasBuiltProject ? refreshIframe : undefined}
onBack={hasBuiltProject ? goBack : undefined}
onForward={hasBuiltProject ? goForward : undefined}
canGoBack={hasBuiltProject && historyIndex > 0}
canGoForward={hasBuiltProject && historyIndex < navigationHistory.length - 1}
extraContent={(
<div className="flex items-center">
<ConsoleDropdown />
<Menu />
</div>
)}
/>
</div>
) : (
<div className="h-full flex items-center justify-center bg-muted">
<div className="text-center">
<h3 className="text-lg font-semibold mb-2">{t('projectPreview')}</h3>
<p className="text-muted-foreground mb-4">
{t('buildProjectToSeePreview')}
</p>
</div>
{/* Content area */}
<div className="flex-1">
{hasBuiltProject ? (
<iframe
ref={iframeRef}
src={`https://${projectId}.${IFRAME_DOMAIN}${currentPath}`}
className="w-full h-full border-0"
title="Project Preview"
sandbox="allow-scripts allow-same-origin"
/>
) : (
<div className="h-full flex items-center justify-center bg-muted">
<div className="text-center">
<h3 className="text-lg font-semibold mb-2">{t('projectPreview')}</h3>
<p className="text-muted-foreground mb-4">
{t('buildProjectToSeePreview')}
</p>
<Button
onClick={handleBuildProject}
disabled={isBuildLoading}
variant="outline"
className="gap-2"
>
{isBuildLoading ? (
<>
<Loader2 className="h-5 w-5 animate-spin" />
Building...
</>
) : (
<>
<Play className="h-5 w-5" />
Build Project
</>
)}
</Button>
</div>
</div>
)}
</div>
)}
{/* Build loading overlay */}
{isBuildLoading && (
<div className="absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10">
<div className="bg-background/90 border rounded-lg p-4 shadow-lg flex items-center gap-3">
<Loader2 className="h-5 w-5 animate-spin text-primary" />
<span className="text-sm font-medium">Building project...</span>
</div>
</div>
)}
</div>
</TabsContent>
<TabsContent value="code" className="h-full mt-0">
{isMobile ? (
<div className="h-full flex flex-col">
{mobileCodeView === 'explorer' ? (
<>
<div className="p-3 border-b bg-gradient-to-r from-primary/5 to-accent/5">
<div className="flex items-center justify-between">
<h3 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">{t('fileExplorer')}</h3>
<GitStatusIndicator projectId={projectId} />
</div>
<ScrollArea className="flex-1">
<ScrollBar orientation="horizontal" />
<div className="min-w-max">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</div>
<ScrollArea className="flex-1">
<ScrollBar orientation="horizontal" />
<div className="min-w-max">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</div>
</ScrollArea>
</>
</ScrollArea>
) : (
<>
<div className="p-3 border-b bg-gradient-to-r from-primary/5 to-accent/5 flex items-center gap-2">
@@ -593,44 +674,57 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {
)}
</div>
) : (
<div className="h-full flex">
<div className="w-1/3 border-r">
<div className="p-4 border-b bg-gradient-to-r from-primary/5 to-accent/5">
<div className="flex items-center justify-between">
<h3 className="font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">{t('fileExplorer')}</h3>
<GitStatusIndicator projectId={projectId} />
</div>
<div className="h-full flex flex-col">
{/* Code view header with back button */}
{!isMobile && onToggleView && (
<div className="h-12 px-4 border-b flex items-center bg-gradient-to-r from-muted/20 to-background">
<Button
variant="ghost"
size="sm"
onClick={onToggleView}
className="gap-2 text-muted-foreground hover:text-foreground"
>
<ArrowLeft className="h-4 w-4" />
{t('backToPreview')}
</Button>
<div className="flex-1" />
<GitStatusIndicator projectId={projectId} />
</div>
<ScrollArea className="h-[calc(100%-60px)]">
<ScrollBar orientation="horizontal" />
<div className="min-w-max">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</div>
</ScrollArea>
</div>
)}
<div className="flex-1">
{selectedFile ? (
<FileEditor
filePath={selectedFile}
content={fileContent}
onSave={handleFileSave}
isLoading={isLoading}
projectId={projectId}
/>
) : (
<div className="h-full flex items-center justify-center">
<div className="text-center">
<p className="text-muted-foreground">
{t('selectFileFromExplorer')}
</p>
<div className="flex-1 flex min-h-0">
<div className="w-1/3 border-r flex flex-col">
<ScrollArea className="flex-1">
<ScrollBar orientation="horizontal" />
<div className="min-w-max">
<FileTree
projectId={projectId}
onFileSelect={handleFileSelect}
selectedFile={selectedFile}
/>
</div>
</div>
)}
</ScrollArea>
</div>
<div className="flex-1">
{selectedFile ? (
<FileEditor
filePath={selectedFile}
content={fileContent}
onSave={handleFileSave}
isLoading={isLoading}
projectId={projectId}
/>
) : (
<div className="h-full flex items-center justify-center">
<div className="text-center">
<p className="text-muted-foreground">
{t('selectFileFromExplorer')}
</p>
</div>
</div>
)}
</div>
</div>
</div>
)}
+21 -15
View File
@@ -1,8 +1,7 @@
import { useState, useEffect, useCallback } from 'react';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Badge } from '@/components/ui/badge';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog';
import { History, GitCommit, RotateCcw, AlertTriangle, ChevronDown, ChevronUp } from 'lucide-react';
import { useGit } from '@/hooks/useGit';
@@ -289,18 +288,18 @@ ${commitsToRevert.map(c => {
</Button>
</DialogTrigger>
)}
<DialogContent className="max-w-4xl max-h-[80vh]">
<DialogContent className="max-w-4xl max-h-[80vh] overflow-hidden">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<GitCommit className="h-5 w-5" />
Git History
<History className="h-5 w-5" />
Rollback
</DialogTitle>
<DialogDescription>
View the commit history for this project
Revert to an older commit
</DialogDescription>
</DialogHeader>
<div className="flex-1 min-h-0">
<div className="flex-1 min-h-0 max-w-full overflow-hidden">
{isLoading ? (
<div className="flex items-center justify-center py-8">
<div className="flex items-center gap-2 text-muted-foreground">
@@ -329,7 +328,7 @@ ${commitsToRevert.map(c => {
</div>
</div>
) : (
<ScrollArea className="h-[60vh]">
<div className="h-[60vh] overflow-y-scroll">
<div className="space-y-1 pr-4">
{commits.map((commit, index) => {
const { firstLine, hasMoreLines, fullMessage } = getCommitMessageLines(commit.commit.message);
@@ -340,7 +339,7 @@ ${commitsToRevert.map(c => {
<div className="flex items-start justify-between gap-3">
<div className="flex-1 min-w-0 space-y-1">
<div className="flex items-center gap-2 mb-1">
<h3 className="font-medium text-sm text-foreground break-words">
<h3 className="font-medium text-sm text-foreground truncate">
{firstLine}
</h3>
{hasMoreLines && (
@@ -372,7 +371,18 @@ ${commitsToRevert.map(c => {
</div>
<div className="flex items-center gap-2 shrink-0">
{index > 0 && ( // Don't show rollback for the most recent commit
{index === 0 ? (
// Show "Current" for the most recent commit
<Button
variant="outline"
size="sm"
className="h-7 px-2 text-xs gap-1 cursor-default"
disabled
>
Current
</Button>
) : (
// Show rollback button for older commits
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
@@ -430,17 +440,13 @@ ${commitsToRevert.map(c => {
</AlertDialogContent>
</AlertDialog>
)}
<Badge variant="secondary" className="text-xs font-mono">
{commit.oid.substring(0, 7)}
</Badge>
</div>
</div>
</div>
);
})}
</div>
</ScrollArea>
</div>
)}
</div>
</DialogContent>
+35 -12
View File
@@ -5,7 +5,7 @@ import { BrowserAddressBar } from './browser-address-bar';
describe('BrowserAddressBar', () => {
it('renders navigation buttons and address input', () => {
render(<BrowserAddressBar />);
expect(screen.getByTitle('Go back')).toBeInTheDocument();
expect(screen.getByTitle('Go forward')).toBeInTheDocument();
expect(screen.getByTitle('Refresh')).toBeInTheDocument();
@@ -15,33 +15,56 @@ describe('BrowserAddressBar', () => {
it('calls onNavigate with proper path when form is submitted', () => {
const onNavigate = vi.fn();
render(<BrowserAddressBar onNavigate={onNavigate} />);
const input = screen.getByPlaceholderText('Enter path (e.g., /, /about)');
fireEvent.change(input, { target: { value: 'about' } });
fireEvent.submit(input.closest('form')!);
expect(onNavigate).toHaveBeenCalledWith('/about');
});
it('disables back/forward buttons based on canGoBack/canGoForward props', () => {
it('disables back/forward buttons based on canGoBack/canGoForward props and handlers', () => {
// Test with handlers provided
const onBack = vi.fn();
const onForward = vi.fn();
render(
<BrowserAddressBar
canGoBack={false}
<BrowserAddressBar
onBack={onBack}
onForward={onForward}
canGoBack={false}
canGoForward={true}
/>
);
expect(screen.getByTitle('Go back')).toBeDisabled(); // disabled because canGoBack=false
expect(screen.getByTitle('Go forward')).not.toBeDisabled(); // enabled because canGoForward=true and handler provided
});
it('disables buttons when no handlers are provided', () => {
render(
<BrowserAddressBar
canGoBack={true}
canGoForward={true}
/>
);
// All buttons should be disabled when no handlers are provided
expect(screen.getByTitle('Go back')).toBeDisabled();
expect(screen.getByTitle('Go forward')).not.toBeDisabled();
expect(screen.getByTitle('Go forward')).toBeDisabled();
expect(screen.getByTitle('Refresh')).toBeDisabled();
// Input should also be disabled when no onNavigate handler is provided
expect(screen.getByPlaceholderText('Enter path (e.g., /, /about)')).toBeDisabled();
});
it('calls navigation handlers when buttons are clicked', () => {
const onBack = vi.fn();
const onForward = vi.fn();
const onRefresh = vi.fn();
render(
<BrowserAddressBar
<BrowserAddressBar
onBack={onBack}
onForward={onForward}
onRefresh={onRefresh}
@@ -49,11 +72,11 @@ describe('BrowserAddressBar', () => {
canGoForward={true}
/>
);
fireEvent.click(screen.getByTitle('Go back'));
fireEvent.click(screen.getByTitle('Go forward'));
fireEvent.click(screen.getByTitle('Refresh'));
expect(onBack).toHaveBeenCalled();
expect(onForward).toHaveBeenCalled();
expect(onRefresh).toHaveBeenCalled();
+7 -3
View File
@@ -32,6 +32,8 @@ export function BrowserAddressBar({
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!onNavigate) return;
let path = inputValue.trim();
// Ensure path starts with /
@@ -39,7 +41,7 @@ export function BrowserAddressBar({
path = '/' + path;
}
onNavigate?.(path);
onNavigate(path);
};
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -57,7 +59,7 @@ export function BrowserAddressBar({
variant="ghost"
size="sm"
onClick={onBack}
disabled={!canGoBack}
disabled={!canGoBack || !onBack}
className="h-8 w-8 p-0"
title="Go back"
>
@@ -67,7 +69,7 @@ export function BrowserAddressBar({
variant="ghost"
size="sm"
onClick={onForward}
disabled={!canGoForward}
disabled={!canGoForward || !onForward}
className="h-8 w-8 p-0"
title="Go forward"
>
@@ -77,6 +79,7 @@ export function BrowserAddressBar({
variant="ghost"
size="sm"
onClick={onRefresh}
disabled={!onRefresh}
className="h-8 w-8 p-0"
title="Refresh"
>
@@ -92,6 +95,7 @@ export function BrowserAddressBar({
onChange={handleInputChange}
placeholder="Enter path (e.g., /, /about)"
className="h-8 bg-muted/50 border-muted-foreground/20 focus:bg-background"
disabled={!onNavigate}
/>
</form>
+1 -1
View File
@@ -29,7 +29,7 @@ const PasswordInput = React.forwardRef<HTMLInputElement, React.InputHTMLAttribut
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-sm disabled:cursor-not-allowed disabled:opacity-50"
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
disabled={props.disabled}
aria-label={showPassword ? "Hide password" : "Show password"}
>
+17
View File
@@ -0,0 +1,17 @@
import { useMutation } from "@tanstack/react-query";
import { buildProject } from "@/lib/build";
import { useFS } from "./useFS";
export function useBuildProject(projectId: string) {
const { fs } = useFS();
return useMutation({
mutationFn: async () => {
return await buildProject({
fs,
projectPath: `/projects/${projectId}`,
domParser: new DOMParser(),
});
},
});
}
+26
View File
@@ -0,0 +1,26 @@
import { useMutation } from "@tanstack/react-query";
import { deployProject } from "@/lib/deploy";
import { useFS } from "./useFS";
import { useAppContext } from "./useAppContext";
import { useCurrentUser } from "./useCurrentUser";
export function useDeployProject(projectId: string) {
const { fs } = useFS();
const { user } = useCurrentUser();
const { config } = useAppContext();
return useMutation({
mutationFn: async () => {
if (!user) {
throw new Error("You must be logged into Nostr to deploy a project");
}
return await deployProject({
fs,
projectId: projectId,
deployServer: config.deployServer,
projectPath: `/projects/${projectId}`,
signer: user.signer,
});
},
});
}
+2 -2
View File
@@ -61,7 +61,7 @@ describe('useGitHubOAuth PKCE', () => {
wrapper: TestApp,
});
// Mock fetch for token exchange and user info (using corsproxy.io URLs)
// Mock fetch for token exchange and user info (using proxy URLs)
const mockFetch = vi.fn()
.mockResolvedValueOnce({
ok: true,
@@ -147,7 +147,7 @@ describe('useGitHubOAuth PKCE', () => {
// Check that the token request includes the code verifier
expect(mockFetch).toHaveBeenCalledWith(
expect.stringContaining('corsproxy.io/?url=https://github.com/login/oauth/access_token'),
'https://proxy.shakespeare.diy/?url=https%3A%2F%2Fgithub.com%2Flogin%2Foauth%2Faccess_token',
expect.objectContaining({
method: 'POST',
body: expect.stringContaining('"code_verifier":"test-verifier"'),
+8 -4
View File
@@ -1,5 +1,6 @@
import { useState, useCallback } from 'react';
import { useGitSettings } from './useGitSettings';
import { proxyUrl } from '@/lib/proxyUrl';
interface GitHubOAuthState {
isLoading: boolean;
@@ -17,7 +18,8 @@ export function useGitHubOAuth() {
isLoading: false,
error: null,
});
const { addCredential } = useGitSettings();
const { settings, addCredential } = useGitSettings();
const { corsProxy } = settings;
// Check if OAuth is configured
const isOAuthConfigured = !!(
@@ -122,7 +124,8 @@ export function useGitHubOAuth() {
code_verifier: codeVerifier,
};
const tokenResponse = await fetch('https://corsproxy.io/?url=https://github.com/login/oauth/access_token', {
const tokenUrl = proxyUrl(corsProxy, 'https://github.com/login/oauth/access_token');
const tokenResponse = await fetch(tokenUrl, {
method: 'POST',
headers: {
'Accept': 'application/json',
@@ -142,7 +145,8 @@ export function useGitHubOAuth() {
}
// Get user info to verify the token works
const userResponse = await fetch('https://corsproxy.io/?url=https://api.github.com/user', {
const userUrl = proxyUrl(corsProxy, 'https://api.github.com/user');
const userResponse = await fetch(userUrl, {
headers: {
'Authorization': `Bearer ${tokenData.access_token}`,
'Accept': 'application/vnd.github.v3+json',
@@ -177,7 +181,7 @@ export function useGitHubOAuth() {
}));
return false;
}
}, [addCredential]);
}, [addCredential, corsProxy]);
return {
...state,
+12 -5
View File
@@ -263,7 +263,7 @@ export class SessionManager {
// Check if session was cancelled
if (!session.isLoading) break;
const delta = chunk.choices[0]?.delta;
const delta = chunk.choices[0]?.delta as OpenAI.Chat.Completions.ChatCompletionChunk.Choice.Delta | undefined;
if (delta?.content) {
accumulatedContent += delta.content;
@@ -274,11 +274,18 @@ export class SessionManager {
}
// Handle reasoning content if present (some providers may include this)
const deltaWithReasoning = delta as { reasoning_content?: string };
if (deltaWithReasoning?.reasoning_content) {
accumulatedReasoningContent += deltaWithReasoning.reasoning_content;
let reasoningContent: string | undefined;
// LiteLLM, Z.ai, etc. use 'reasoning_content'
if (delta && 'reasoning_content' in delta && typeof delta.reasoning_content === 'string') {
reasoningContent = delta.reasoning_content;
// ollama uses 'reasoning'
} else if (delta && 'reasoning' in delta && typeof delta.reasoning === 'string') {
reasoningContent = delta.reasoning;
}
if (reasoningContent) {
accumulatedReasoningContent += reasoningContent;
if (session.streamingMessage) {
session.streamingMessage.reasoning_content += deltaWithReasoning.reasoning_content;
session.streamingMessage.reasoning_content += reasoningContent;
this.emit('streamingUpdate', projectId, session.streamingMessage.content, session.streamingMessage.reasoning_content, session.streamingMessage.tool_calls);
}
}
+4 -4
View File
@@ -76,7 +76,7 @@ describe('CurlCommand', () => {
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe('Hello World');
expect(mockFetch).toHaveBeenCalledWith('https://corsproxy.io/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
expect(mockFetch).toHaveBeenCalledWith('https://proxy.shakespeare.diy/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
method: 'GET',
headers: expect.objectContaining({
'User-Agent': 'curl/8.0.0 (compatible; JavaScript fetch)'
@@ -103,7 +103,7 @@ describe('CurlCommand', () => {
expect(result.exitCode).toBe(0);
expect(result.stdout).toBe('{"success": true}');
expect(mockFetch).toHaveBeenCalledWith('https://corsproxy.io/?url=https%3A%2F%2Fexample.com%2Fapi', expect.objectContaining({
expect(mockFetch).toHaveBeenCalledWith('https://proxy.shakespeare.diy/?url=https%3A%2F%2Fexample.com%2Fapi', expect.objectContaining({
method: 'POST',
body: '{"name": "test"}',
headers: expect.objectContaining({
@@ -131,7 +131,7 @@ describe('CurlCommand', () => {
], '/test');
expect(result.exitCode).toBe(0);
expect(mockFetch).toHaveBeenCalledWith('https://corsproxy.io/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
expect(mockFetch).toHaveBeenCalledWith('https://proxy.shakespeare.diy/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
headers: expect.objectContaining({
'Authorization': 'Bearer token123',
'Content-Type': 'application/json',
@@ -245,7 +245,7 @@ describe('CurlCommand', () => {
], '/test');
expect(result.exitCode).toBe(0);
expect(mockFetch).toHaveBeenCalledWith('https://corsproxy.io/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
expect(mockFetch).toHaveBeenCalledWith('https://proxy.shakespeare.diy/?url=https%3A%2F%2Fexample.com%2F', expect.objectContaining({
method: 'DELETE',
headers: expect.objectContaining({
'User-Agent': 'curl/8.0.0 (compatible; JavaScript fetch)'
+1 -1
View File
@@ -62,7 +62,7 @@ export class CurlCommand implements ShellCommand {
// Proxy the URL through CorsProxy
const originalUrl = url.toString();
const proxiedUrl = `https://corsproxy.io/?url=${encodeURIComponent(originalUrl)}`;
const proxiedUrl = `https://proxy.shakespeare.diy/?url=${encodeURIComponent(originalUrl)}`;
// Prepare request
const requestInit: RequestInit = {
+1 -1
View File
@@ -185,7 +185,7 @@ describe('configUtils', () => {
expect(result).toEqual({
credentials: {},
corsProxy: 'https://cors.isomorphic-git.org',
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
});
});
+3 -3
View File
@@ -135,7 +135,7 @@ async function migrateGitSettingsFromLocalStorage(fs: JSRuntimeFS): Promise<GitS
if (parsed && typeof parsed === 'object' && 'credentials' in parsed) {
const settings: GitSettings = {
credentials: parsed.credentials || {},
corsProxy: parsed.corsProxy || 'https://cors.isomorphic-git.org',
corsProxy: parsed.corsProxy || 'https://proxy.shakespeare.diy/?url={href}',
};
// Write to VFS and remove from localStorage
@@ -158,7 +158,7 @@ async function migrateGitSettingsFromLocalStorage(fs: JSRuntimeFS): Promise<GitS
export async function readGitSettings(fs: JSRuntimeFS): Promise<GitSettings> {
const defaultSettings: GitSettings = {
credentials: {},
corsProxy: 'https://cors.isomorphic-git.org',
corsProxy: 'https://proxy.shakespeare.diy/?url={href}',
};
// Try to read from VFS first
@@ -169,7 +169,7 @@ export async function readGitSettings(fs: JSRuntimeFS): Promise<GitSettings> {
if (parsed && typeof parsed === 'object' && 'credentials' in parsed) {
return {
credentials: parsed.credentials || {},
corsProxy: parsed.corsProxy || 'https://cors.isomorphic-git.org',
corsProxy: parsed.corsProxy || 'https://proxy.shakespeare.diy/?url={href}',
};
}
} catch {
+92
View File
@@ -0,0 +1,92 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { deployProject } from './deploy';
import type { JSRuntimeFS } from './JSRuntime';
import type { NostrSigner } from '@nostrify/nostrify';
// Mock JSZip
vi.mock('jszip', () => {
return {
default: vi.fn().mockImplementation(() => ({
folder: vi.fn().mockReturnValue({
file: vi.fn(),
}),
file: vi.fn(),
generateAsync: vi.fn().mockResolvedValue(new Blob()),
})),
};
});
// Mock NIP98Client
vi.mock('@nostrify/nostrify', () => ({
NIP98Client: vi.fn().mockImplementation(() => ({
fetch: vi.fn().mockResolvedValue({
ok: true,
status: 200,
statusText: 'OK',
}),
})),
}));
describe('deployProject', () => {
let mockFS: JSRuntimeFS;
let mockSigner: NostrSigner;
beforeEach(() => {
mockFS = {
readFile: vi.fn().mockResolvedValue('mock file content'),
readdir: vi.fn().mockResolvedValue([]),
writeFile: vi.fn().mockResolvedValue(undefined),
mkdir: vi.fn().mockResolvedValue(undefined),
stat: vi.fn().mockResolvedValue({ isDirectory: () => false, isFile: () => true }),
lstat: vi.fn().mockResolvedValue({ isDirectory: () => false, isFile: () => true }),
unlink: vi.fn().mockResolvedValue(undefined),
rmdir: vi.fn().mockResolvedValue(undefined),
rename: vi.fn().mockResolvedValue(undefined),
readlink: vi.fn().mockResolvedValue(''),
symlink: vi.fn().mockResolvedValue(undefined),
} as JSRuntimeFS;
mockSigner = {} as NostrSigner;
});
it('should construct hostname from projectId and deployServer by default', async () => {
const result = await deployProject({
projectId: 'test-project',
deployServer: 'shakespeare.wtf',
fs: mockFS,
projectPath: '/projects/test-project',
signer: mockSigner,
});
expect(result.hostname).toBe('test-project.shakespeare.wtf');
expect(result.url).toBe('https://test-project.shakespeare.wtf');
});
it('should use customHostname when provided', async () => {
const result = await deployProject({
projectId: 'test-project',
deployServer: 'shakespeare.wtf',
fs: mockFS,
projectPath: '/projects/test-project',
signer: mockSigner,
customHostname: 'my-custom-domain.example.com',
});
expect(result.hostname).toBe('my-custom-domain.example.com');
expect(result.url).toBe('https://my-custom-domain.example.com');
});
it('should handle custom subdomain with same deploy server', async () => {
const result = await deployProject({
projectId: 'original-id',
deployServer: 'shakespeare.wtf',
fs: mockFS,
projectPath: '/projects/original-id',
signer: mockSigner,
customHostname: 'custom-name.shakespeare.wtf',
});
expect(result.hostname).toBe('custom-name.shakespeare.wtf');
expect(result.url).toBe('https://custom-name.shakespeare.wtf');
});
});
+5 -3
View File
@@ -14,6 +14,8 @@ export interface DeployOptions {
projectPath: string;
/** Nostr signer for NIP-98 authentication */
signer: NostrSigner;
/** Custom hostname to use instead of constructing from projectId.deployServer */
customHostname?: string;
}
export interface DeployResult {
@@ -28,10 +30,10 @@ export interface DeployResult {
* to the deployment server using NIP-98 authentication.
*/
export async function deployProject(options: DeployOptions): Promise<DeployResult> {
const { projectId, deployServer, fs, projectPath, signer } = options;
const { projectId, deployServer, fs, projectPath, signer, customHostname } = options;
// Construct hostname and URL
const hostname = `${projectId}.${deployServer}`;
// Use custom hostname if provided, otherwise construct from projectId.deployServer
const hostname = customHostname || `${projectId}.${deployServer}`;
const deployUrl = `https://${deployServer}/deploy`;
const siteUrl = `https://${hostname}`;
-9
View File
@@ -66,7 +66,6 @@ describe('Git', () => {
expect(mockGit.clone).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'https://github.com/user/repo.git',
});
@@ -81,7 +80,6 @@ describe('Git', () => {
expect(mockGit.clone).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'https://gitlab.com/user/repo.git',
});
@@ -96,7 +94,6 @@ describe('Git', () => {
expect(mockGit.clone).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'https://custom.example.com/user/repo.git',
});
@@ -111,7 +108,6 @@ describe('Git', () => {
expect(mockGit.clone).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'http://github.com/user/repo.git',
});
@@ -130,7 +126,6 @@ describe('Git', () => {
expect(mockGit.getRemoteInfo).toHaveBeenCalledWith({
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
url: 'https://github.com/user/repo.git',
});
});
@@ -142,7 +137,6 @@ describe('Git', () => {
expect(mockGit.getRemoteInfo).toHaveBeenCalledWith({
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
url: 'https://custom.example.com/user/repo.git',
});
});
@@ -165,7 +159,6 @@ describe('Git', () => {
expect(mockGit.fetch).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
remote: 'origin',
});
@@ -180,7 +173,6 @@ describe('Git', () => {
expect(mockGit.fetch).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'https://gitlab.com/user/repo.git',
});
@@ -232,7 +224,6 @@ describe('Git', () => {
expect(mockGit.clone).toHaveBeenCalledWith({
fs,
http: expect.any(Object),
corsProxy: 'https://cors.example.com',
dir: '/test',
url: 'https://github.com/user/repo.git',
});
+103 -33
View File
@@ -1,7 +1,7 @@
import git from 'isomorphic-git';
import http from 'isomorphic-git/http/web';
import git, { GitHttpRequest, GitHttpResponse, HttpClient } from 'isomorphic-git';
import { NIP05 } from '@nostrify/nostrify';
import { nip19 } from 'nostr-tools';
import { proxyUrl } from './proxyUrl';
import type { NostrEvent, NostrSigner, NPool } from '@nostrify/nostrify';
import type { JSRuntimeFS } from './JSRuntime';
@@ -25,13 +25,13 @@ interface NostrCloneURI {
*/
export class Git {
private fs: JSRuntimeFS;
private http: HttpClient;
private nostr: NPool;
private corsProxy?: string;
constructor(options: GitOptions) {
this.fs = options.fs;
this.http = new GitHttp(options.corsProxy);
this.nostr = options.nostr;
this.corsProxy = options.corsProxy;
}
// Repository initialization and configuration
@@ -56,8 +56,7 @@ export class Git {
// Regular Git URL
return git.clone({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -178,8 +177,7 @@ export class Git {
}
return git.getRemoteInfo({
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -197,8 +195,7 @@ export class Git {
// Regular Git fetch
return git.fetch({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -216,8 +213,7 @@ export class Git {
// Regular Git pull
return git.pull({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -237,8 +233,7 @@ export class Git {
return git.push({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -387,8 +382,7 @@ export class Git {
async getRemoteInfo2(options: Omit<Parameters<typeof git.getRemoteInfo2>[0], 'http' | 'corsProxy'>) {
return git.getRemoteInfo2({
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -513,8 +507,7 @@ export class Git {
async listServerRefs(options: Omit<Parameters<typeof git.listServerRefs>[0], 'http' | 'corsProxy'>) {
return git.listServerRefs({
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
});
}
@@ -618,8 +611,7 @@ export class Git {
// Try to get remote info from the first clone URL
try {
const gitRemoteInfo = await git.getRemoteInfo({
http,
corsProxy: this.corsProxy,
http: this.http,
url: cloneUrls[0],
});
@@ -1016,8 +1008,7 @@ export class Git {
// Get remote repository information to check if it has the expected commit
const remoteInfo = await Promise.race([
git.getRemoteInfo({
http,
corsProxy: this.corsProxy,
http: this.http,
url: cloneUrl,
}),
new Promise<never>((_, reject) =>
@@ -1035,8 +1026,7 @@ export class Git {
await Promise.race([
git.clone({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
url: cloneUrl,
}),
@@ -1093,8 +1083,7 @@ export class Git {
await Promise.race([
git.clone({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
...options,
url: cloneUrl,
}),
@@ -1456,8 +1445,7 @@ export class Git {
// Push to the temporary remote
await git.push({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
dir,
url: cloneUrl,
...gitPushOptions,
@@ -1510,8 +1498,7 @@ export class Git {
// Fetch from the clone URL
await git.fetch({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
dir,
url: cloneUrl,
});
@@ -1588,8 +1575,7 @@ export class Git {
// Fetch from the temporary remote
const fetchResult = await git.fetch({
fs: this.fs,
http,
corsProxy: this.corsProxy,
http: this.http,
dir,
remote: tempRemoteName,
});
@@ -1626,4 +1612,88 @@ export class Git {
throw lastError || new Error('All fetch attempts failed');
}
}
}
class GitHttp implements HttpClient {
private proxy?: string;
constructor(proxy?: string) {
this.proxy = proxy;
}
async request(request: GitHttpRequest): Promise<GitHttpResponse> {
const method = request.method ?? "GET";
const url = new URL(request.url);
const target = this.proxy
? proxyUrl(this.proxy, url)
: url.href;
const init: RequestInit = {
method,
headers: request.headers,
};
if (request.body) {
const buffered = await collectToUint8Array(request.body);
init.body = new Blob([new Uint8Array(buffered)]);
}
const response = await fetch(target, init);
const headers = Object.fromEntries(response.headers.entries());
const body = response.body ? readableStreamToAsyncIterator(response.body) : undefined;
return {
url: response.url,
method,
statusCode: response.status,
statusMessage: response.statusText,
body,
headers,
};
}
}
// Drain an async iterable of Uint8Array into one Uint8Array
async function collectToUint8Array(
src: AsyncIterable<Uint8Array> | AsyncIterableIterator<Uint8Array>
): Promise<Uint8Array> {
const chunks: Uint8Array[] = [];
let total = 0;
for await (const chunk of src) {
chunks.push(chunk);
total += chunk.byteLength;
}
const out = new Uint8Array(total);
let offset = 0;
for (const c of chunks) {
out.set(c, offset);
offset += c.byteLength;
}
return out;
}
// Portable async iterator over a ReadableStream (works even if
// ReadableStream doesn't implement [Symbol.asyncIterator])
function readableStreamToAsyncIterator(
stream: ReadableStream<Uint8Array>
): AsyncIterableIterator<Uint8Array> {
const reader = stream.getReader();
return {
async next() {
const { value, done } = await reader.read();
return done ? { value: undefined, done: true } : { value, done: false };
},
async return() {
try {
await reader.cancel();
} catch {
// Ignore cancel errors
}
return { value: undefined, done: true };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
+900 -3
View File
@@ -31,6 +31,9 @@ const resources = {
english: 'English',
portuguese: 'Portuguese',
chinese: 'Chinese',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: 'System',
// Theme Options
@@ -107,11 +110,11 @@ const resources = {
chat: 'Chat',
preview: 'Preview',
code: 'Code',
backToPreview: 'Back to Preview',
// Preview Pane
projectPreview: 'Project Preview',
buildProjectToSeePreview: 'Build your project to see the preview here',
fileExplorer: 'File Explorer',
fileEditor: 'File Editor',
selectFileFromExplorer: 'Select a file from the explorer to edit',
openFileExplorer: 'Open File Explorer',
@@ -324,6 +327,9 @@ const resources = {
english: 'Inglês',
portuguese: 'Português',
chinese: 'Chinês',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: 'Sistema',
// Theme Options
@@ -400,11 +406,11 @@ const resources = {
chat: 'Chat',
preview: 'Visualização',
code: 'Código',
backToPreview: 'Voltar à Visualização',
// Preview Pane
projectPreview: 'Visualização do Projeto',
buildProjectToSeePreview: 'Construa seu projeto para ver a visualização aqui',
fileExplorer: 'Explorador de Arquivos',
fileEditor: 'Editor de Arquivos',
selectFileFromExplorer: 'Selecione um arquivo do explorador para editar',
openFileExplorer: 'Abrir Explorador de Arquivos',
@@ -617,6 +623,9 @@ const resources = {
english: 'English',
portuguese: 'Português',
chinese: '中文',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: '系统',
// Theme Options
@@ -693,11 +702,11 @@ const resources = {
chat: '聊天',
preview: '预览',
code: '代码',
backToPreview: '返回预览',
// Preview Pane
projectPreview: '项目预览',
buildProjectToSeePreview: '构建您的项目以在此处查看预览',
fileExplorer: '文件浏览器',
fileEditor: '文件编辑器',
selectFileFromExplorer: '从浏览器中选择一个文件进行编辑',
openFileExplorer: '打开文件浏览器',
@@ -881,6 +890,894 @@ const resources = {
accessDenied: '访问被拒绝。仓库可能是私有的或需要身份验证。',
networkError: '网络错误。请检查您的连接并重试。',
}
},
ha: {
translation: {
// Navigation and Layout
preferences: 'Zaɓuɓɓuka',
settings: 'Saitunan',
backToSettings: 'Koma zuwa Saitunan',
help: 'Taimako',
anonymous: 'Maras Suna',
// Authentication
logIn: 'Shiga',
signUp: 'Yi Rajista',
// Preferences Page
preferencesDescription: 'Sarrafa zaɓuɓɓukan aikace-aikacenku da saitunan bayyanar.',
// Theme Section
theme: 'Jigogi',
themeDescription: 'Zaɓi tsakanin haske, duhu, ko zaɓin jigogi na tsarin.',
// Language Section
language: 'Harshe',
languageDescription: 'Zaɓi harshen da kuke so don dubawa.',
// Language Options
english: 'Turanci',
portuguese: 'Fotigis',
chinese: 'Sinanci',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: 'Tsarin',
// Theme Options
light: 'Haske',
dark: 'Duhu',
system: 'Tsarin',
// Common UI Elements
save: 'Ajiye',
cancel: 'Soke',
close: 'Rufe',
open: 'Buɗe',
edit: 'Gyara',
delete: 'Share',
create: 'Ƙirƙira',
update: 'Sabunta',
loading: 'Ana lodin...',
error: 'Kuskure',
success: 'Nasara',
warning: 'Gargaɗi',
info: 'Bayani',
add: 'Ƙara',
remove: 'Cire',
retry: 'Sake gwadawa',
// Shakespeare Main Page
buildNostrApps: 'Gina aikace-aikacen Nostr da AI',
whatToBuild: 'Me kuke son ginawa?',
createProject: 'Ƙirƙiri Aikin',
generating: 'Ana samarwa...',
creating: 'Ana ƙirƙirawa...',
chooseModel: 'Zaɓi samfuri...',
selectModelToDescribe: "Da fatan za a zaɓi samfuri a ƙasa, sannan a bayyana abin da kuke son ginawa...",
examplePrompt: "misali, Ƙirƙiri kasuwar kayan aikin noma don manoma na yankin su sayi da sayar da taraktoci, kayan aiki, da kayayyaki...",
// Settings Page
settingsDescription: 'Sarrafa saitunan aikace-aikacenku da zaɓuɓɓuka.',
aiSettings: 'Saitunan AI',
aiSettingsDescription: 'Saita masu samar da AI da maɓallan API',
gitSettings: 'Saitunan Git',
gitSettingsDescription: 'Saita bayanan shaidar Git don tabbatar da HTTP',
nostrSettings: 'Saitunan Nostr',
nostrSettingsDescription: 'Saita haɗin relay da zaɓuɓɓukan Nostr',
dataSettings: 'Bayanai',
dataSettingsDescription: 'Fitar da fayiloli da sarrafa bayanan gida',
aboutShakespeareSettings: 'Game da Shakespeare',
aboutShakespeareSettingsDescription: 'Bayani game da Shakespeare',
// Project Sidebar
newProject: 'Sabon Aikin',
importRepository: 'Shigo da Repository',
noProjectsYet: 'Babu ayyuka har yanzu',
createFirstProject: 'Ƙirƙiri aikin farko don farawa',
closeSidebar: 'Rufe gefen mashigi',
collapseSidebar: 'Rufe gefen mashigi',
// Chat Interface
welcomeToShakespeare: 'Maraba da Shakespeare',
aiAssistantReady: 'Mataimakin ci gaban ku na AI ya shirya don taimaka muku gina, gyara, da haɓaka aikinku.',
askMeFeatures: '💡 Roƙe ni in ƙara sabbin fasaloli',
requestEdits: '📝 Nemi gyare-gyaren fayil da haɓakawa',
getHelp: '🔧 Sami taimako da gyara kuskure da haɓakawa',
buildDeploy: '🚀 Gina da tura aikinku',
aiNotConfigured: 'Mataimakin AI Ba a Saita ba',
configureAI: 'Da fatan za a saita saitunan AI don farawa ginawa da taimakon AI.',
useMenuForAI: 'Yi amfani da menu a saman mashigi don shiga Saitunan AI.',
askToAddFeatures: 'Roƙe ni in ƙara fasaloli, gyara fayiloli, ko gina aikinku...',
selectModelFirst: 'Da fatan za a zaɓi samfuri don farawa hira...',
sendMessage: 'Aika saƙo',
stopGeneration: 'Tsayar da samarwa',
running: 'Ana gudana',
// Project View Navigation
chat: 'Hira',
preview: 'Duba',
code: 'Lambar',
backToPreview: 'Koma zuwa Duba',
// Preview Pane
projectPreview: 'Duban Aikin',
buildProjectToSeePreview: 'Gina aikinku don ganin duba a nan',
fileEditor: 'Editan Fayil',
selectFileFromExplorer: 'Zaɓi fayil daga mai bincike don gyarawa',
openFileExplorer: 'Buɗe Mai Binciken Fayil',
// File Editor
unsavedChanges: 'Canje-canjen da ba a ajiye ba',
saving: 'Ana ajiyewa...',
languageLabel: 'Harshe',
// File Tree
searchFiles: 'Neman fayiloli...',
noFilesFound: 'Babu fayilolin da aka samu',
noFilesFoundSearch: 'Babu fayilolin da suka dace da bincikenku',
// Git Dialog
gitRepositoryStatus: 'Matsayin Repository na Git',
repositoryStatusDescription: 'Duba matsayin repository da haɗawa da repositories na nesa',
repositoryInformation: 'Bayanan Repository',
currentBranch: 'Reshen Yanzu',
totalCommits: 'Jimlar Commits',
latestCommit: 'Commit na Baya-bayan nan',
remotes: 'Na Nesa',
notGitRepository: 'Ba repository na Git ba',
gitAuthentication: 'Tabbatarwa',
credentialsDescription: 'Bayanan shaidar don ayyukan tura/ja',
configured: 'An saita',
noCredentials: 'Babu bayanan shaidar',
noCredentialsWarning: 'Babu bayanan shaidar da aka saita don {{provider}}. Ayyukan tura/ja na iya gazawa don repositories masu sirri.',
configureCredentials: 'Saita bayanan shaidar',
syncStatus: 'Matsayin Haɗawa',
pull: 'Ja',
push: 'Tura',
pulling: 'Ana ja...',
pushing: 'Ana turawa...',
upToDate: 'An sabunta',
commitsAhead: 'Commit {{count}} a gaba | Commits {{count}} a gaba',
commitsBehind: 'Commit {{count}} a baya | Commits {{count}} a baya',
uncommittedChanges: 'Canji {{count}} da ba a commit ba | Canje-canje {{count}} da ba a commit ba',
noRemoteConfigured: 'Babu na nesa da aka saita',
workingDirectoryChanges: 'Canje-canjen Directory na Aiki',
filesWithChanges: 'Fayil {{count}} da canje-canje | Fayiloli {{count}} da canje-canje',
workingDirectoryClean: 'Directory na aiki tsabta ne',
noUncommittedChanges: 'Babu canje-canjen da ba a commit ba',
cannotPush: 'Ba za a iya turawa ba',
cannotPull: 'Ba za a iya ja ba',
notGitRepoOrBranch: 'Ba repository na git ba ko babu reshen yanzu',
noRemoteRepositories: 'Babu repositories na nesa da aka saita',
nothingToPush: 'Babu abin da za a tura',
noCommitsAhead: 'Babu commits a gaban na nesa. Fara commit canje-canjenku.',
pushSuccessful: 'Turawa ta yi nasara',
pushFailed: 'Turawa ta gaza',
pullSuccessful: 'Ja ya yi nasara',
pullFailed: 'Ja ya gaza',
// AI Settings
aiSettingsDescriptionLong: 'Saita masu samar da AI ta hanyar ƙara maɓallan API. Saitunan ana ajiye su kai tsaye kuma ana adana su a cikin burauzar ku.',
configuredProviders: 'Masu Samarwa da aka Saita',
addProvider: 'Ƙara Mai Samarwa',
getApiKey: 'Sami maɓallin API',
getToken: 'Sami alamar',
enterApiKey: 'Shigar da maɓallin API',
enterToken: 'Shigar da alamar ku',
enterCashuToken: 'Shigar da alamar Cashu',
addCustomProvider: 'Ƙara Mai Samarwa na Musamman',
providerName: 'Sunan Mai Samarwa',
baseUrl: 'URL na Tushe',
apiKey: 'Maɓallin API',
authentication: 'Tabbatarwa',
addCustomProviderButton: 'Ƙara Mai Samarwa na Musamman',
providerExists: 'Mai samarwa da wannan suna ya riga ya wanzu',
custom: 'Na Musamman',
connecting: 'Ana haɗawa...',
connectToGitHub: 'Haɗu da GitHub',
loginToNostrRequired: 'Shiga Nostr don amfani da wannan mai samarwa',
goToNostrSettings: 'Tafi zuwa Saitunan Nostr',
// Git Settings
gitSettingsDescriptionLong: 'Saita bayanan shaidar Git don tabbatar da HTTP. Saitunan ana ajiye su kai tsaye kuma ana adana su a cikin burauzar ku.',
configuredCredentials: 'Bayanan Shaidar da aka Saita',
origin: 'Asali',
username: 'Sunan mai amfani',
password: 'Kalmar sirri',
enterPassword: 'Shigar da kalmar sirri/alamar ku',
credentialsExist: 'Bayanan shaidar wannan asali sun riga sun wanzu',
corsProxy: 'CORS Proxy',
corsProxyDescription: 'Sabar proxy na CORS da ake amfani da ita don duk ayyukan Git da repositories na nesa. Ana bukata don ayyukan Git na burauzar.',
// Data Settings
dataSettingsDescriptionLong: 'Fitar da fayiloli da sarrafa bayanan gida.',
exportFiles: 'Fitar da Fayiloli',
exportFilesDescription: 'Sauke duk ayyukanku da fayiloli azaman ajiyar ZIP. Wannan ya haɗa da duk fayilolin aikin, saitunan, da bayanan da aka adana a gida.',
exportAllFiles: 'Fitar da Duk Fayiloli',
exporting: 'Ana fitarwa...',
clearAllData: 'Share Duk Bayanai',
clearAllDataDescription: 'Share duk bayanan gida har abada ciki har da ayyuka, saitunan, da bayanan cache. Wannan aikin ba za a iya sokewa ba.',
clearing: 'Ana sharewa...',
areYouSure: 'Kun tabbata sosai?',
clearDataWarning: 'Wannan aikin zai share duk bayanan gida daga wannan burauzar har abada, ciki har da:',
allProjects: 'Duk ayyuka da fayilolinsu',
aiSettingsAndKeys: 'Saitunan AI da maɓallan API',
gitCredentialsSettings: 'Bayanan shaidar Git da saitunan',
userPreferences: 'Zaɓuɓɓukan mai amfani da jigogi',
cachedData: 'Bayanan cache da bayanan zama',
actionCannotBeUndone: 'Wannan aikin ba za a iya sokewa ba. Yi la\'akari da fitar da fayilolinku da farko.',
yesClearAllData: 'Eh, share duk bayanai',
used: 'An yi amfani',
available: 'Akwai',
usagePercentage: 'An yi amfani da {{percentage}}%',
usageUnavailable: 'Adadin amfani ba ya samuwa',
loadingStorageInfo: 'Ana lodin bayanan ajiya...',
filesExportedSuccessfully: 'An fitar da fayiloli cikin nasara',
filesExportedDescription: 'An sauke fayilolin aikinku azaman fayil zip.',
failedToExportFiles: 'Ya gaza fitar da fayiloli',
dataClearedSuccessfully: 'An share bayanai cikin nasara',
dataClearedDescription: 'An cire duk bayanan gida. Ana turawa zuwa shafin gida...',
failedToClearData: 'Ya gaza share bayanai',
// About Settings
aboutShakespeare: 'Game da Shakespeare',
aboutShakespeareDescription: 'Bayani game da Shakespeare.',
sourceCode: 'Lambar Tushe',
viewOnGitLab: 'Duba akan GitLab',
description: 'Bayanin',
license: 'Lasisi',
loadingLicense: 'Ana lodin lasisi...',
failedToLoadLicense: 'Ya gaza lodin lasisi',
// 404 Page
pageNotFound: 'Kai! Ba a sami shafin ba',
returnToHome: 'Koma Gida',
// Model Selector
selectOrEnterModel: 'Zaɓi ko shigar da samfuri...',
searchModels: 'Neman samfura...',
enterCustomModel: 'Shigar da samfuri na musamman...',
manageProviders: 'Sarrafa masu samarwa...',
noModelsFound: 'Ba a sami samfura ba.',
tryCustomModel: 'Gwada amfani da samfuri na musamman.',
recentlyUsed: 'An yi amfani da su kwanan nan',
errorLoadingModels: 'Kuskure wajen Lodin Samfura',
// Context and Cost
contextUsage: 'Amfanin mahallin: {{tokens}} / {{total}} alamomi ({{percentage}}%)',
totalCostSession: 'Jimlar farashi don wannan zaman hira',
// File Status
added: 'an ƙara',
deleted: 'an share',
modified: 'an gyara',
staged: 'an shirya',
untracked: 'ba a bi ba',
// Settings Layout
toggleSidebar: 'Juya gefen mashigi',
openSidebar: 'Buɗe gefen mashigi',
// Nostr Settings
nostrSettingsDescriptionLong: 'Saita saitunan haɗin Nostr da zaɓuɓɓukan relay.',
nostrAccounts: 'Asusun Nostr',
noAccountsLoggedIn: 'Babu asusun da aka shiga. Ƙara asusu don farawa.',
createAccount: 'Ƙirƙiri Asusu',
addExistingAccount: 'Ƙara Asusu da ya wanzu',
addAccount: 'Ƙara Asusu',
relayConfiguration: 'Saitunan Relay',
selectedRelay: 'Relay da aka zaɓa',
// Clone Page
cloneGitRepository: 'Clone repository na Git zuwa wurin aikin Shakespeare',
pleaseEnterRepositoryUrl: 'Da fatan za a shigar da URL na repository',
pleaseEnterValidGitUrl: 'Da fatan za a shigar da ingantaccen URL na repository na Git ko URI na clone na Nostr (misali: nostr://npub.../sunan-repo)',
cloningRepository: 'Ana Clone Repository...',
nostrRepositoryImportedSuccessfully: 'An shigo da repository na Nostr cikin nasara',
repositoryClonedFromNostr: 'An clone "{{repoName}}" daga Nostr kuma ya shirya don ci gaba.',
repositoryImportedSuccessfully: 'An shigo da repository cikin nasara',
repositoryClonedReady: 'An clone "{{repoName}}" kuma ya shirya don ci gaba.',
failedToImportRepository: 'Ya gaza shigo da repository',
repositoryNotFoundOnNostr: 'Ba a sami repository akan hanyar sadarwar Nostr ba. Da fatan za a duba URI kuma a sake gwadawa.',
noCloneUrlsFound: 'An sami sanarwar repository amma babu URLs na clone da ke samuwa.',
allCloneAttemptsFailed: 'An sami repository amma duk URLs na clone sun gaza. Repository na iya zama ba ya samuwa.',
repositoryNotFound: 'Ba a sami repository ba. Da fatan za a duba URL kuma a sake gwadawa.',
accessDenied: 'An hana shiga. Repository na iya zama na sirri ko yana buƙatar tabbatarwa.',
networkError: 'Kuskuren hanyar sadarwa. Da fatan za a duba haɗinku kuma a sake gwadawa.',
}
},
yo: {
translation: {
// Navigation and Layout
preferences: 'Awọn ayanfẹ',
settings: 'Awọn eto',
backToSettings: 'Pada si Awọn eto',
help: 'Iranlọwọ',
anonymous: 'Alainidamọ',
// Authentication
logIn: 'Wọle',
signUp: 'Forukọsilẹ',
// Preferences Page
preferencesDescription: 'Ṣakoso awọn ayanfẹ ohun elo rẹ ati awọn eto iwoye.',
// Theme Section
theme: 'Akori',
themeDescription: 'Yan laarin imọlẹ, okunkun, tabi ayanfẹ akori eto.',
// Language Section
language: 'Ede',
languageDescription: 'Yan ede ti o fẹran fun wiwo.',
// Language Options
english: 'Gẹẹsi',
portuguese: 'Potogisi',
chinese: 'Kannada',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: 'Eto',
// Theme Options
light: 'Imọlẹ',
dark: 'Okunkun',
system: 'Eto',
// Common UI Elements
save: 'Fi pamọ',
cancel: 'Fagilee',
close: 'Ti',
open: 'Ṣi',
edit: 'Ṣatunkọ',
delete: 'Paarẹ',
create: 'Ṣẹda',
update: 'Imudojuiwọn',
loading: 'N gbe...',
error: 'Aṣiṣe',
success: 'Aṣeyọri',
warning: 'Ikilọ',
info: 'Alaye',
add: 'Fi kun',
remove: 'Yọ kuro',
retry: 'Tun gbiyanju',
// Shakespeare Main Page
buildNostrApps: 'Kọ awọn ohun elo Nostr pẹlu AI',
whatToBuild: 'Kini o fẹ kọ?',
createProject: 'Ṣẹda Iṣẹ akanṣe',
generating: 'N ṣẹda...',
creating: 'N ṣẹda...',
chooseModel: 'Yan awoṣe...',
selectModelToDescribe: "Jọwọ yan awoṣe ni isalẹ, lẹhinna ṣapejuwe ohun ti o fẹ kọ...",
examplePrompt: "apeere, Ṣẹda ọja ẹrọ ogbin fun awọn agbe agbegbe lati ra ati ta awọn traktọ, awọn irinṣẹ, ati awọn ipese...",
// Settings Page
settingsDescription: 'Ṣakoso awọn eto ohun elo rẹ ati awọn ayanfẹ.',
aiSettings: 'Awọn eto AI',
aiSettingsDescription: 'Tunto awọn olupese AI ati awọn bọtini API',
gitSettings: 'Awọn eto Git',
gitSettingsDescription: 'Tunto awọn ẹri Git fun ijẹrisi HTTP',
nostrSettings: 'Awọn eto Nostr',
nostrSettingsDescription: 'Tunto awọn asopọ relay ati awọn ayanfẹ Nostr',
dataSettings: 'Data',
dataSettingsDescription: 'Gbe awọn faili jade ati ṣakoso data agbegbe',
aboutShakespeareSettings: 'Nipa Shakespeare',
aboutShakespeareSettingsDescription: 'Alaye nipa Shakespeare',
// Project Sidebar
newProject: 'Iṣẹ akanṣe Tuntun',
importRepository: 'Gbe Repository wọle',
noProjectsYet: 'Ko si awọn iṣẹ akanṣe sibẹsibẹ',
createFirstProject: 'Ṣẹda iṣẹ akanṣe akọkọ rẹ lati bẹrẹ',
closeSidebar: 'Ti ẹgbẹ sidebar',
collapseSidebar: 'Subu sidebar',
// Chat Interface
welcomeToShakespeare: 'Kaabo si Shakespeare',
aiAssistantReady: 'Oluranlọwọ idagbasoke AI rẹ ti ṣetan lati ran ọ lọwọ lati kọ, ṣatunkọ, ati mu iṣẹ akanṣe rẹ dara si.',
askMeFeatures: '💡 Beere mi lati fi awọn ẹya tuntun kun',
requestEdits: '📝 Beere awọn atunkọ faili ati awọn ilọsiwaju',
getHelp: '🔧 Gba iranlọwọ pẹlu atunṣe ati imudara',
buildDeploy: '🚀 Kọ ati gbe iṣẹ akanṣe rẹ lọ',
aiNotConfigured: 'Oluranlọwọ AI Ko Tunto',
configureAI: 'Jọwọ tunto awọn eto AI rẹ lati bẹrẹ kikọ pẹlu iranlọwọ AI.',
useMenuForAI: 'Lo akojọ aṣayan ni oke ọpa lati wọle si Awọn eto AI.',
askToAddFeatures: 'Beere mi lati fi awọn ẹya kun, ṣatunkọ awọn faili, tabi kọ iṣẹ akanṣe rẹ...',
selectModelFirst: 'Jọwọ yan awoṣe lati bẹrẹ ibaraẹnisọrọ...',
sendMessage: 'Fi ifiranṣẹ ranṣẹ',
stopGeneration: 'Duro ṣiṣẹda',
running: 'N ṣiṣẹ',
// Project View Navigation
chat: 'Ibaraẹnisọrọ',
preview: 'Aṣaju wiwo',
code: 'Koodu',
backToPreview: 'Pada si Aṣaju wiwo',
// Preview Pane
projectPreview: 'Aṣaju wiwo Iṣẹ akanṣe',
buildProjectToSeePreview: 'Kọ iṣẹ akanṣe rẹ lati ri aṣaju wiwo nibi',
fileEditor: 'Atunkọ Faili',
selectFileFromExplorer: 'Yan faili lati oluṣawari lati ṣatunkọ',
openFileExplorer: 'Ṣi Oluṣawari Faili',
// File Editor
unsavedChanges: 'Awọn iyipada ti a ko fi pamọ',
saving: 'N fi pamọ...',
languageLabel: 'Ede',
// File Tree
searchFiles: 'Wa awọn faili...',
noFilesFound: 'Ko si awọn faili ti a ri',
noFilesFoundSearch: 'Ko si awọn faili ti o baamu wiwa rẹ',
// Git Dialog
gitRepositoryStatus: 'Ipo Repository Git',
repositoryStatusDescription: 'Wo ipo repository ati muṣọpọ pẹlu awọn repository latọna jijin',
repositoryInformation: 'Alaye Repository',
currentBranch: 'Ẹka lọwọlọwọ',
totalCommits: 'Lapapọ Awọn commit',
latestCommit: 'Commit tuntun julọ',
remotes: 'Awọn latọna jijin',
notGitRepository: 'Kii ṣe repository Git',
gitAuthentication: 'Ijẹrisi',
credentialsDescription: 'Awọn ẹri fun awọn iṣẹ titari/fa',
configured: 'Ti tunto',
noCredentials: 'Ko si awọn ẹri',
noCredentialsWarning: 'Ko si awọn ẹri ti a tunto fun {{provider}}. Awọn iṣẹ titari/fa le kuna fun awọn repository ikọkọ.',
configureCredentials: 'Tunto awọn ẹri',
syncStatus: 'Ipo Muṣọpọ',
pull: 'Fa',
push: 'Titari',
pulling: 'N fa...',
pushing: 'N titari...',
upToDate: 'Ti imudojuiwọn',
commitsAhead: 'Commit {{count}} ni iwaju | Awọn commit {{count}} ni iwaju',
commitsBehind: 'Commit {{count}} ni ẹhin | Awọn commit {{count}} ni ẹhin',
uncommittedChanges: 'Iyipada {{count}} ti a ko commit | Awọn iyipada {{count}} ti a ko commit',
noRemoteConfigured: 'Ko si latọna jijin ti a tunto',
workingDirectoryChanges: 'Awọn iyipada Itọsọna Iṣẹ',
filesWithChanges: 'Faili {{count}} pẹlu awọn iyipada | Awọn faili {{count}} pẹlu awọn iyipada',
workingDirectoryClean: 'Itọsọna iṣẹ mọ',
noUncommittedChanges: 'Ko si awọn iyipada ti a ko commit',
cannotPush: 'Ko le titari',
cannotPull: 'Ko le fa',
notGitRepoOrBranch: 'Kii ṣe repository git tabi ko si ẹka lọwọlọwọ',
noRemoteRepositories: 'Ko si awọn repository latọna jijin ti a tunto',
nothingToPush: 'Ko si nkankan lati titari',
noCommitsAhead: 'Ko si awọn commit ni iwaju latọna jijin. Kọkọ commit awọn iyipada rẹ.',
pushSuccessful: 'Titari ni aṣeyọri',
pushFailed: 'Titari kuna',
pullSuccessful: 'Fifa ni aṣeyọri',
pullFailed: 'Fifa kuna',
// AI Settings
aiSettingsDescriptionLong: 'Tunto awọn olupese AI nipa fifi awọn bọtini API rẹ kun. Awọn eto ni a fi pamọ laifọwọyi ati pe a tọju wọn ni agbegbe ninu awọn aṣawakiri rẹ.',
configuredProviders: 'Awọn Olupese Ti a Tunto',
addProvider: 'Fi Olupese kun',
getApiKey: 'Gba bọtini API',
getToken: 'Gba token',
enterApiKey: 'Tẹ bọtini API rẹ sinu',
enterToken: 'Tẹ token rẹ sinu',
enterCashuToken: 'Tẹ token Cashu sinu',
addCustomProvider: 'Fi Olupese Aṣa kun',
providerName: 'Orukọ Olupese',
baseUrl: 'URL Ipilẹ',
apiKey: 'Bọtini API',
authentication: 'Ijẹrisi',
addCustomProviderButton: 'Fi Olupese Aṣa kun',
providerExists: 'Olupese pẹlu orukọ yii ti wa tẹlẹ',
custom: 'Aṣa',
connecting: 'N so...',
connectToGitHub: 'So si GitHub',
loginToNostrRequired: 'Wọle si Nostr lati lo olupese yii',
goToNostrSettings: 'Lọ si Awọn eto Nostr',
// Git Settings
gitSettingsDescriptionLong: 'Tunto awọn ẹri Git fun ijẹrisi HTTP. Awọn eto ni a fi pamọ laifọwọyi ati pe a tọju wọn ni agbegbe ninu awọn aṣawakiri rẹ.',
configuredCredentials: 'Awọn Ẹri Ti a Tunto',
origin: 'Ipilẹṣẹ',
username: 'Orukọ olumulo',
password: 'Ọrọ igbaniwọle',
enterPassword: 'Tẹ ọrọ igbaniwọle/token rẹ sinu',
credentialsExist: 'Awọn ẹri fun ipilẹṣẹ yii ti wa tẹlẹ',
corsProxy: 'CORS Proxy',
corsProxyDescription: 'Olupin proxy CORS ti a lo fun gbogbo awọn iṣẹ Git pẹlu awọn repository latọna jijin. Ti nilo fun awọn iṣẹ Git ti o da lori aṣawakiri.',
// Data Settings
dataSettingsDescriptionLong: 'Gbe awọn faili jade ati ṣakoso data agbegbe.',
exportFiles: 'Gbe Awọn faili jade',
exportFilesDescription: 'Gba gbogbo awọn iṣẹ akanṣe ati awọn faili rẹ gẹgẹbi apo ZIP. Eyi pẹlu gbogbo awọn faili iṣẹ akanṣe, awọn eto, ati data ti a tọju ni agbegbe.',
exportAllFiles: 'Gbe Gbogbo Awọn faili jade',
exporting: 'N gbe jade...',
clearAllData: 'Nu Gbogbo Data',
clearAllDataDescription: 'Pa gbogbo data agbegbe rẹ lailai pẹlu awọn iṣẹ akanṣe, awọn eto, ati alaye cache. Iṣẹ yii ko le ṣe atunṣe.',
clearing: 'N nu...',
areYouSure: 'Ṣe o daju pupọ?',
clearDataWarning: 'Iṣẹ yii yoo pa gbogbo data agbegbe lati aṣawakiri yii lailai, pẹlu:',
allProjects: 'Gbogbo awọn iṣẹ akanṣe ati awọn faili wọn',
aiSettingsAndKeys: 'Awọn eto AI ati awọn bọtini API',
gitCredentialsSettings: 'Awọn ẹri Git ati awọn eto',
userPreferences: 'Awọn ayanfẹ olumulo ati awọn akori',
cachedData: 'Data cache ati alaye igba',
actionCannotBeUndone: 'Iṣẹ yii ko le ṣe atunṣe. Ronu lati gbe awọn faili rẹ jade ni akọkọ.',
yesClearAllData: 'Bẹẹni, nu gbogbo data',
used: 'Ti lo',
available: 'Wa',
usagePercentage: '{{percentage}}% ti lo',
usageUnavailable: 'Ipin lilo ko wa',
loadingStorageInfo: 'N gbe alaye ibi ipamọ...',
filesExportedSuccessfully: 'Awọn faili ti gbe jade ni aṣeyọri',
filesExportedDescription: 'Awọn faili iṣẹ akanṣe rẹ ti gba gẹgẹbi faili zip.',
failedToExportFiles: 'O kuna lati gbe awọn faili jade',
dataClearedSuccessfully: 'Data ti nu ni aṣeyọri',
dataClearedDescription: 'Gbogbo data agbegbe ti yọ kuro. N ṣe atunṣe si oju-iwe ile...',
failedToClearData: 'O kuna lati nu data',
// About Settings
aboutShakespeare: 'Nipa Shakespeare',
aboutShakespeareDescription: 'Alaye nipa Shakespeare.',
sourceCode: 'Koodu Orisun',
viewOnGitLab: 'Wo lori GitLab',
description: 'Apejuwe',
license: 'Iwe-aṣẹ',
loadingLicense: 'N gbe iwe-aṣẹ...',
failedToLoadLicense: 'O kuna lati gbe iwe-aṣẹ',
// 404 Page
pageNotFound: 'Yee! Oju-iwe ko ri',
returnToHome: 'Pada si Ile',
// Model Selector
selectOrEnterModel: 'Yan tabi tẹ awoṣe sinu...',
searchModels: 'Wa awọn awoṣe...',
enterCustomModel: 'Tẹ awoṣe aṣa sinu...',
manageProviders: 'Ṣakoso awọn olupese...',
noModelsFound: 'Ko si awọn awoṣe ti a ri.',
tryCustomModel: 'Gbiyanju lilo awoṣe aṣa dipo.',
recentlyUsed: 'Ti a Lo Laipẹ',
errorLoadingModels: 'Aṣiṣe Gbigbe Awọn awoṣe',
// Context and Cost
contextUsage: 'Lilo aaye oro: {{tokens}} / {{total}} awọn token ({{percentage}}%)',
totalCostSession: 'Lapapọ iye owo fun igba ibaraẹnisọrọ yii',
// File Status
added: 'ti fi kun',
deleted: 'ti paarẹ',
modified: 'ti ṣatunkọ',
staged: 'ti ṣetan',
untracked: 'ti a ko tọpa',
// Settings Layout
toggleSidebar: 'Yipada sidebar',
openSidebar: 'Ṣi sidebar',
// Nostr Settings
nostrSettingsDescriptionLong: 'Tunto awọn eto asopọ Nostr rẹ ati awọn ayanfẹ relay.',
nostrAccounts: 'Awọn Akọọlẹ Nostr',
noAccountsLoggedIn: 'Ko si awọn akọọlẹ ti o wọle. Fi akọọlẹ kun lati bẹrẹ.',
createAccount: 'Ṣẹda Akọọlẹ',
addExistingAccount: 'Fi Akọọlẹ Ti o Wa Tẹlẹ kun',
addAccount: 'Fi Akọọlẹ kun',
relayConfiguration: 'Iṣeto Relay',
selectedRelay: 'Relay Ti a Yan',
// Clone Page
cloneGitRepository: 'Clone repository Git si aaye iṣẹ Shakespeare rẹ',
pleaseEnterRepositoryUrl: 'Jọwọ tẹ URL repository sinu',
pleaseEnterValidGitUrl: 'Jọwọ tẹ URL repository Git to tọ tabi URI clone Nostr sinu (apeere: nostr://npub.../orukọ-repo)',
cloningRepository: 'N Clone Repository...',
nostrRepositoryImportedSuccessfully: 'Repository Nostr ti gbe wọle ni aṣeyọri',
repositoryClonedFromNostr: '"{{repoName}}" ti clone lati Nostr ati pe o ti ṣetan fun idagbasoke.',
repositoryImportedSuccessfully: 'Repository ti gbe wọle ni aṣeyọri',
repositoryClonedReady: '"{{repoName}}" ti clone ati pe o ti ṣetan fun idagbasoke.',
failedToImportRepository: 'O kuna lati gbe repository wọle',
repositoryNotFoundOnNostr: 'Repository ko ri lori nẹtiwọọki Nostr. Jọwọ ṣayẹwo URI ati gbiyanju lẹẹkansi.',
noCloneUrlsFound: 'Ikede repository ri ṣugbọn ko si awọn URL clone to wa.',
allCloneAttemptsFailed: 'Repository ri ṣugbọn gbogbo awọn URL clone kuna. Repository le ma wa.',
repositoryNotFound: 'Repository ko ri. Jọwọ ṣayẹwo URL ati gbiyanju lẹẹkansi.',
accessDenied: 'Wiwọle ni idinamọ. Repository le jẹ ikọkọ tabi nilo ijẹrisi.',
networkError: 'Aṣiṣe nẹtiwọọki. Jọwọ ṣayẹwo asopọ rẹ ati gbiyanju lẹẹkansi.',
}
},
ig: {
translation: {
// Navigation and Layout
preferences: 'Nhọrọ',
settings: 'Ntọala',
backToSettings: 'Laghachi na Ntọala',
help: 'Enyemaka',
anonymous: 'Onye na-amaghị aha',
// Authentication
logIn: 'Banye',
signUp: 'Debanye aha',
// Preferences Page
preferencesDescription: 'Jikwaa nhọrọ ngwa gị na ntọala ngosipụta.',
// Theme Section
theme: 'Isiokwu',
themeDescription: 'Họrọ n\'etiti ìhè, ọchịchịrị, ma ọ bụ nhọrọ isiokwu sistemu.',
// Language Section
language: 'Asụsụ',
languageDescription: 'Họrọ asụsụ ị chọrọ maka interface.',
// Language Options
english: 'Bekee',
portuguese: 'Portuguese',
chinese: 'Chinese',
hausa: 'Hausa',
yoruba: 'Yoruba',
igbo: 'Igbo',
systemLanguage: 'Sistemu',
// Theme Options
light: 'Ìhè',
dark: 'Ọchịchịrị',
system: 'Sistemu',
// Common UI Elements
save: 'Chekwaa',
cancel: 'Kagbuo',
close: 'Mechie',
open: 'Meghee',
edit: 'Dezie',
delete: 'Hichapụ',
create: 'Mepụta',
update: 'Melite',
loading: 'Na-ebu...',
error: 'Njehie',
success: 'Ihe ịga nke ọma',
warning: 'Ịdọ aka ná ntị',
info: 'Ozi',
add: 'Tinye',
remove: 'Wepụ',
retry: 'Nwaa ọzọ',
// Shakespeare Main Page
buildNostrApps: 'Wuo ngwa Nostr na AI',
whatToBuild: 'Gịnị ka ị chọrọ iwu?',
createProject: 'Mepụta Ọrụ',
generating: 'Na-emepụta...',
creating: 'Na-emepụta...',
chooseModel: 'Họrọ ụdịdị...',
selectModelToDescribe: "Biko họrọ ụdịdị n'okpuru, wee kọwaa ihe ị chọrọ iwu...",
examplePrompt: "ọmụmaatụ, Mepụta ahịa ngwá ọrụ ugbo maka ndị ọrụ ugbo mpaghara ịzụta na ire traktọ, ngwá ọrụ, na ngwa...",
// Settings Page
settingsDescription: 'Jikwaa ntọala ngwa gị na nhọrọ.',
aiSettings: 'Ntọala AI',
aiSettingsDescription: 'Hazie ndị na-enye AI na igodo API',
gitSettings: 'Ntọala Git',
gitSettingsDescription: 'Hazie nzere Git maka nkwenye HTTP',
nostrSettings: 'Ntọala Nostr',
nostrSettingsDescription: 'Hazie njikọ relay na nhọrọ Nostr',
dataSettings: 'Data',
dataSettingsDescription: 'Bupụta faịlụ na jikwaa data mpaghara',
aboutShakespeareSettings: 'Gbasara Shakespeare',
aboutShakespeareSettingsDescription: 'Ozi gbasara Shakespeare',
// Project Sidebar
newProject: 'Ọrụ Ọhụrụ',
importRepository: 'Bubata Repository',
noProjectsYet: 'Enwebeghị ọrụ ọ bụla',
createFirstProject: 'Mepụta ọrụ mbụ gị iji malite',
closeSidebar: 'Mechie sidebar',
collapseSidebar: 'Gbakọọ sidebar',
// Chat Interface
welcomeToShakespeare: 'Nnọọ na Shakespeare',
aiAssistantReady: 'Onye enyemaka mmepe AI gị adịla njikere inyere gị aka iwu, dezie, ma melite ọrụ gị.',
askMeFeatures: '💡 Rịọ m ka m tinye atụmatụ ọhụrụ',
requestEdits: '📝 Rịọ maka mmezi faịlụ na nkwalite',
getHelp: '🔧 Nweta enyemaka na debugging na optimization',
buildDeploy: '🚀 Wuo ma bufee ọrụ gị',
aiNotConfigured: 'Onye Enyemaka AI Ahazighị',
configureAI: 'Biko hazie ntọala AI gị iji malite iwu na enyemaka AI.',
useMenuForAI: 'Jiri menu dị n\'elu okporo iji nweta Ntọala AI.',
askToAddFeatures: 'Rịọ m ka m tinye atụmatụ, dezie faịlụ, ma ọ bụ wuo ọrụ gị...',
selectModelFirst: 'Biko họrọ ụdịdị iji malite ikwu okwu...',
sendMessage: 'Ziga ozi',
stopGeneration: 'Kwụsị mmepụta',
running: 'Na-agba ọsọ',
// Project View Navigation
chat: 'Nkata',
preview: 'Nlele',
code: 'Koodu',
backToPreview: 'Laghachi na Nlele',
// Preview Pane
projectPreview: 'Nlele Ọrụ',
buildProjectToSeePreview: 'Wuo ọrụ gị iji hụ nlele ebe a',
fileEditor: 'Onye Ndezie Faịlụ',
selectFileFromExplorer: 'Họrọ faịlụ site na explorer iji dezie',
openFileExplorer: 'Meghee File Explorer',
// File Editor
unsavedChanges: 'Mgbanwe ndị na-echekwaghị',
saving: 'Na-echekwa...',
languageLabel: 'Asụsụ',
// File Tree
searchFiles: 'Chọọ faịlụ...',
noFilesFound: 'Ahụghị faịlụ ọ bụla',
noFilesFoundSearch: 'Ahụghị faịlụ ọ bụla dabara na nchọgharị gị',
// Git Dialog
gitRepositoryStatus: 'Ọnọdụ Repository Git',
repositoryStatusDescription: 'Lee ọnọdụ repository wee jikọọ na repositories dị anya',
repositoryInformation: 'Ozi Repository',
currentBranch: 'Alaka Ugbu a',
totalCommits: 'Mkpokọta Commits',
latestCommit: 'Commit kacha ọhụrụ',
remotes: 'Ndị dị anya',
notGitRepository: 'Ọ bụghị repository Git',
gitAuthentication: 'Nkwenye',
credentialsDescription: 'Nzere maka ọrụ push/pull',
configured: 'Ahaziri',
noCredentials: 'Enweghị nzere',
noCredentialsWarning: 'Enweghị nzere ahaziri maka {{provider}}. Ọrụ push/pull nwere ike daa maka repositories nzuzo.',
configureCredentials: 'Hazie nzere',
syncStatus: 'Ọnọdụ Mmekọrịta',
pull: 'Dọta',
push: 'Kwanye',
pulling: 'Na-adọta...',
pushing: 'Na-akwanye...',
upToDate: 'Emelitela',
commitsAhead: 'Commit {{count}} n\'ihu | Commits {{count}} n\'ihu',
commitsBehind: 'Commit {{count}} n\'azụ | Commits {{count}} n\'azụ',
uncommittedChanges: 'Mgbanwe {{count}} na-atinyeghị | Mgbanwe {{count}} na-atinyeghị',
noRemoteConfigured: 'Enweghị onye dị anya ahaziri',
workingDirectoryChanges: 'Mgbanwe Directory Ọrụ',
filesWithChanges: 'Faịlụ {{count}} nwere mgbanwe | Faịlụ {{count}} nwere mgbanwe',
workingDirectoryClean: 'Directory ọrụ dị ọcha',
noUncommittedChanges: 'Enweghị mgbanwe na-atinyeghị',
cannotPush: 'Enweghị ike ịkwanye',
cannotPull: 'Enweghị ike ịdọta',
notGitRepoOrBranch: 'Ọ bụghị repository git ma ọ bụ enweghị alaka ugbu a',
noRemoteRepositories: 'Enweghị repositories dị anya ahaziri',
nothingToPush: 'Enweghị ihe ọ bụla ịkwanye',
noCommitsAhead: 'Enweghị commits n\'ihu nke onye dị anya. Buru ụzọ tinye mgbanwe gị.',
pushSuccessful: 'Nkwanye gara nke ọma',
pushFailed: 'Nkwanye dara',
pullSuccessful: 'Ndọta gara nke ọma',
pullFailed: 'Ndọta dara',
// AI Settings
aiSettingsDescriptionLong: 'Hazie ndị na-enye AI site na ịtinye igodo API gị. Ntọala na-echekwa onwe ya ma chekwaa ya na mpaghara na browser gị.',
configuredProviders: 'Ndị Na-enye Ahaziri',
addProvider: 'Tinye Onye Na-enye',
getApiKey: 'Nweta igodo API',
getToken: 'Nweta token',
enterApiKey: 'Tinye igodo API gị',
enterToken: 'Tinye token gị',
enterCashuToken: 'Tinye token Cashu',
addCustomProvider: 'Tinye Onye Na-enye Omenala',
providerName: 'Aha Onye Na-enye',
baseUrl: 'URL Ntọala',
apiKey: 'Igodo API',
authentication: 'Nkwenye',
addCustomProviderButton: 'Tinye Onye Na-enye Omenala',
providerExists: 'Onye na-enye nwere aha a adịlarị',
custom: 'Omenala',
connecting: 'Na-ejikọ...',
connectToGitHub: 'Jikọọ na GitHub',
loginToNostrRequired: 'Banye na Nostr iji jiri onye na-enye a',
goToNostrSettings: 'Gaa na Ntọala Nostr',
// Git Settings
gitSettingsDescriptionLong: 'Hazie nzere Git maka nkwenye HTTP. Ntọala na-echekwa onwe ya ma chekwaa ya na mpaghara na browser gị.',
configuredCredentials: 'Nzere Ahaziri',
origin: 'Mmalite',
username: 'Aha onye ọrụ',
password: 'Okwuntughe',
enterPassword: 'Tinye okwuntughe/token gị',
credentialsExist: 'Nzere maka mmalite a adịlarị',
corsProxy: 'CORS Proxy',
corsProxyDescription: 'Sava proxy CORS ejiri maka ọrụ Git niile na repositories dị anya. Achọrọ maka ọrụ Git dabere na browser.',
// Data Settings
dataSettingsDescriptionLong: 'Bupụta faịlụ ma jikwaa data mpaghara.',
exportFiles: 'Bupụta Faịlụ',
exportFilesDescription: 'Budata ọrụ gị niile na faịlụ dị ka mkpokọta ZIP. Nke a gụnyere faịlụ ọrụ niile, ntọala, na data echekwara na mpaghara.',
exportAllFiles: 'Bupụta Faịlụ Niile',
exporting: 'Na-ebupụta...',
clearAllData: 'Hichapụ Data Niile',
clearAllDataDescription: 'Hichapụ data mpaghara niile kpamkpam gụnyere ọrụ, ntọala, na ozi cache. Omume a enweghị ike ịmegharị.',
clearing: 'Na-ehichapụ...',
areYouSure: 'Ị ji n\'ezie kwenye?',
clearDataWarning: 'Omume a ga-ehichapụ data mpaghara niile site na browser a kpamkpam, gụnyere:',
allProjects: 'Ọrụ niile na faịlụ ha',
aiSettingsAndKeys: 'Ntọala AI na igodo API',
gitCredentialsSettings: 'Nzere Git na ntọala',
userPreferences: 'Nhọrọ onye ọrụ na isiokwu',
cachedData: 'Data cache na ozi oge',
actionCannotBeUndone: 'Omume a enweghị ike ịmegharị. Tụlee ibupụ faịlụ gị mbụ.',
yesClearAllData: 'Ee, hichapụ data niile',
used: 'Ejiri',
available: 'Dị',
usagePercentage: '{{percentage}}% ejiri',
usageUnavailable: 'Pasent ojiji adịghị',
loadingStorageInfo: 'Na-ebu ozi nchekwa...',
filesExportedSuccessfully: 'Ebupụtara faịlụ nke ọma',
filesExportedDescription: 'Ebudata faịlụ ọrụ gị dị ka faịlụ zip.',
failedToExportFiles: 'O dara ibupụta faịlụ',
dataClearedSuccessfully: 'Ehichapụrụ data nke ọma',
dataClearedDescription: 'Ewepụrụ data mpaghara niile. Na-atụgharị gaa na ibe ụlọ...',
failedToClearData: 'O dara ihichapụ data',
// About Settings
aboutShakespeare: 'Gbasara Shakespeare',
aboutShakespeareDescription: 'Ozi gbasara Shakespeare.',
sourceCode: 'Koodu Isi',
viewOnGitLab: 'Lee na GitLab',
description: 'Nkọwa',
license: 'Ikike',
loadingLicense: 'Na-ebu ikike...',
failedToLoadLicense: 'O dara ibu ikike',
// 404 Page
pageNotFound: 'Ewoo! Ahụghị ibe',
returnToHome: 'Laghachi n\'Ụlọ',
// Model Selector
selectOrEnterModel: 'Họrọ ma ọ bụ tinye ụdịdị...',
searchModels: 'Chọọ ụdịdị...',
enterCustomModel: 'Tinye ụdịdị omenala...',
manageProviders: 'Jikwaa ndị na-enye...',
noModelsFound: 'Ahụghị ụdịdị ọ bụla.',
tryCustomModel: 'Gbalịa iji ụdịdị omenala kama.',
recentlyUsed: 'Ejiri Na Nso Nso A',
errorLoadingModels: 'Njehie Na-ebu Ụdịdị',
// Context and Cost
contextUsage: 'Ojiji ọnọdụ: {{tokens}} / {{total}} tokens ({{percentage}}%)',
totalCostSession: 'Mkpokọta ọnụ ahịa maka oge nkata a',
// File Status
added: 'tinyere',
deleted: 'hichapụrụ',
modified: 'gbanwere',
staged: 'kwadoro',
untracked: 'na-esoghị',
// Settings Layout
toggleSidebar: 'Gbanwee sidebar',
openSidebar: 'Meghee sidebar',
// Nostr Settings
nostrSettingsDescriptionLong: 'Hazie ntọala njikọ Nostr gị na nhọrọ relay.',
nostrAccounts: 'Akaụntụ Nostr',
noAccountsLoggedIn: 'Enweghị akaụntụ banyere. Tinye akaụntụ iji malite.',
createAccount: 'Mepụta Akaụntụ',
addExistingAccount: 'Tinye Akaụntụ Dị Adị',
addAccount: 'Tinye Akaụntụ',
relayConfiguration: 'Nhazi Relay',
selectedRelay: 'Relay Ahọrọ',
// Clone Page
cloneGitRepository: 'Clone repository Git n\'ogige ọrụ Shakespeare gị',
pleaseEnterRepositoryUrl: 'Biko tinye URL repository',
pleaseEnterValidGitUrl: 'Biko tinye URL repository Git ziri ezi ma ọ bụ URI clone Nostr (ọmụmaatụ: nostr://npub.../aha-repo)',
cloningRepository: 'Na-eclone Repository...',
nostrRepositoryImportedSuccessfully: 'Ebubatara repository Nostr nke ọma',
repositoryClonedFromNostr: 'Eclonere "{{repoName}}" site na Nostr ma dịkwa njikere maka mmepe.',
repositoryImportedSuccessfully: 'Ebubatara repository nke ọma',
repositoryClonedReady: 'Eclonere "{{repoName}}" ma dịkwa njikere maka mmepe.',
failedToImportRepository: 'O dara ibubata repository',
repositoryNotFoundOnNostr: 'Ahụghị repository na netwọk Nostr. Biko lelee URI wee nwaa ọzọ.',
noCloneUrlsFound: 'Ahụrụ mkpọsa repository mana enweghị URL clone dị.',
allCloneAttemptsFailed: 'Ahụrụ repository mana URL clone niile dara. Repository nwere ike ọ dịghị.',
repositoryNotFound: 'Ahụghị repository. Biko lelee URL wee nwaa ọzọ.',
accessDenied: 'Ajụrụ ohere. Repository nwere ike bụrụ nke nzuzo ma ọ bụ chọrọ nkwenye.',
networkError: 'Njehie netwọk. Biko lelee njikọ gị wee nwaa ọzọ.',
}
}
};
+18
View File
@@ -0,0 +1,18 @@
import UriTemplate from 'uri-templates';
export function proxyUrl(template: string, url: string | URL): string {
const u = new URL(url);
return UriTemplate(template).fill({
href: u.href,
origin: u.origin,
protocol: u.protocol,
username: u.username,
password: u.password,
host: u.host,
hostname: u.hostname,
port: u.port,
pathname: u.pathname,
hash: u.hash,
search: u.search,
});
}
+15 -20
View File
@@ -11,6 +11,7 @@ import { useGitHubOAuth } from '@/hooks/useGitHubOAuth';
import { useIsMobile } from '@/hooks/useIsMobile';
import { useNavigate } from 'react-router-dom';
import type { GitCredential } from '@/contexts/GitSettingsContext';
import { PasswordInput } from '@/components/ui/password-input';
interface PresetProvider {
id: string;
@@ -191,9 +192,8 @@ export function GitSettings() {
</div>
<div className="grid gap-2">
<Label htmlFor={`${origin}-password`}>{t('password')}</Label>
<Input
<PasswordInput
id={`${origin}-password`}
type="password"
placeholder={t('enterPassword')}
value={credential?.password || ''}
onChange={(e) => handleUpdateCredential(origin, { password: e.target.value })}
@@ -260,9 +260,8 @@ export function GitSettings() {
</div>
) : (
<div className="flex gap-2">
<Input
<PasswordInput
placeholder={t('enterToken')}
type="password"
className="flex-1"
value={presetTokens[preset.id] || ''}
onChange={(e) => setPresetTokens(prev => ({
@@ -287,9 +286,8 @@ export function GitSettings() {
) : (
// Standard rendering for other providers
<div className="flex gap-2">
<Input
<PasswordInput
placeholder={t('enterToken')}
type="password"
className="flex-1"
value={presetTokens[preset.id] || ''}
onChange={(e) => setPresetTokens(prev => ({
@@ -346,9 +344,8 @@ export function GitSettings() {
</div>
<div className="grid gap-2">
<Label htmlFor="custom-password">{t('password')}</Label>
<Input
<PasswordInput
id="custom-password"
type="password"
placeholder={t('enterPassword')}
value={customPassword}
onChange={(e) => setCustomPassword(e.target.value)}
@@ -385,18 +382,16 @@ export function GitSettings() {
<h4 className="text-sm font-medium">{t('corsProxy')}</h4>
</AccordionTrigger>
<AccordionContent className="px-4 pb-4">
<div className="space-y-3">
<div className="grid gap-2">
<Input
id="cors-proxy"
placeholder="https://cors.isomorphic-git.org"
value={settings.corsProxy}
onChange={(e) => updateSettings({ corsProxy: e.target.value })}
/>
<p className="text-xs text-muted-foreground">
{t('corsProxyDescription')}
</p>
</div>
<div className="py-1 space-y-2">
<Input
id="cors-proxy"
placeholder="https://proxy.shakespeare.diy/?url={href}"
value={settings.corsProxy}
onChange={(e) => updateSettings({ corsProxy: e.target.value })}
/>
<p className="text-xs text-muted-foreground">
{t('corsProxyDescription')}
</p>
</div>
</AccordionContent>
</AccordionItem>
+32 -135
View File
@@ -13,18 +13,12 @@ import { Skeleton } from '@/components/ui/skeleton';
import { ArrowLeft, MessageSquare, Eye, Code, Menu } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { ActionsMenu } from '@/components/ActionsMenu';
import { useIsMobile } from '@/hooks/useIsMobile';
import { useFS } from '@/hooks/useFS';
import { useKeepAlive } from '@/hooks/useKeepAlive';
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
import { StarButton } from '@/components/StarButton';
import { buildProject } from "@/lib/build";
import { deployProject } from "@/lib/deploy";
import { useCurrentUser } from "@/hooks/useCurrentUser";
import { useAppContext } from "@/hooks/useAppContext";
import { useToast } from "@/hooks/useToast";
import { useBuildProject } from '@/hooks/useBuildProject';
export function ProjectView() {
const { projectId } = useParams<{ projectId: string }>();
@@ -33,23 +27,20 @@ export function ProjectView() {
const [isLoading, setIsLoading] = useState(true);
const [activeTab, setActiveTab] = useState<'preview' | 'code'>('preview');
const [mobileView, setMobileView] = useState<'chat' | 'preview' | 'code'>('chat');
const [isBuildLoading, setIsBuildLoading] = useState(false);
const [isDeployLoading, setIsDeployLoading] = useState(false);
const [isAILoading, setIsAILoading] = useState(false);
const [isProjectInfoOpen, setIsProjectInfoOpen] = useState(false);
const projectsManager = useProjectsManager();
const chatPaneRef = useRef<ChatPaneRef>(null);
const navigate = useNavigate();
const isMobile = useIsMobile();
const { fs } = useFS();
const { user } = useCurrentUser();
const { config } = useAppContext();
const { toast } = useToast();
const [isSidebarVisible, setIsSidebarVisible] = useState(!isMobile);
const build = useBuildProject(projectId!);
// Keep-alive functionality to prevent tab throttling during AI processing
const { updateMetadata } = useKeepAlive({
enabled: isAILoading || isBuildLoading || isDeployLoading,
enabled: isAILoading || build.isPending,
title: 'Shakespeare',
artist: project ? `Working on ${project.name}...` : 'Working...',
artwork: [
@@ -79,71 +70,17 @@ export function ProjectView() {
}, [loadProject]);
const runBuild = async () => {
if (isBuildLoading || !project) return;
setIsBuildLoading(true);
if (build.isPending || !project) return;
updateMetadata('Shakespeare', `Building ${project.name}...`);
try {
const result = await buildProject({
fs,
projectPath: `/projects/${project.id}`,
domParser: new DOMParser(),
});
console.log('Build completed:', result);
} catch (error) {
console.error('Build failed:', error);
} finally {
setIsBuildLoading(false);
}
};
const runDeploy = async () => {
if (isDeployLoading || !project) return;
// Check if user is logged in
if (!user || !user.signer) {
toast({
title: "Authentication required",
description: "Please log in to deploy your project.",
variant: "destructive",
});
return;
}
setIsDeployLoading(true);
updateMetadata('Shakespeare', `Deploying ${project.name}...`);
try {
const result = await deployProject({
projectId: project.id,
deployServer: config.deployServer,
fs,
projectPath: `/projects/${project.id}`,
signer: user.signer,
});
console.log('Project deployed:', result.url);
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');
} catch (error) {
console.error('Deploy failed:', error);
toast({
title: "Deployment failed",
description: error instanceof Error ? error.message : "An unexpected error occurred",
variant: "destructive",
});
} finally {
setIsDeployLoading(false);
}
await build.mutateAsync(undefined, {
onSuccess(result) {
console.log('Project built:', result);
},
onError(error) {
console.error('Build failed:', error);
},
});
};
const handleNewChat = () => {
@@ -225,13 +162,9 @@ export function ProjectView() {
projectId={project.id}
projectName={project.name}
onNewChat={handleNewChat}
onBuild={runBuild}
onDeploy={runDeploy}
isLoading={isAILoading}
isBuildLoading={isBuildLoading}
isDeployLoading={isDeployLoading}
isBuildLoading={build.isPending}
onFirstInteraction={handleFirstInteraction}
onProjectDeleted={handleProjectDeleted}
/>
</>
) : (
@@ -279,12 +212,10 @@ export function ProjectView() {
projectId={project.id}
onNewChat={handleNewChat}
onBuild={runBuild}
onDeploy={runDeploy}
onFirstInteraction={handleFirstInteraction}
onLoadingChange={handleAILoadingChange}
isLoading={isAILoading}
isBuildLoading={isBuildLoading}
isDeployLoading={isDeployLoading}
isBuildLoading={build.isPending}
/>
) : (
<div className="h-full p-4 space-y-4">
@@ -354,6 +285,7 @@ export function ProjectView() {
project={project}
open={isProjectInfoOpen}
onOpenChange={setIsProjectInfoOpen}
onProjectDeleted={handleProjectDeleted}
/>
)}
</div>
@@ -432,13 +364,9 @@ export function ProjectView() {
projectId={project.id}
projectName={project.name}
onNewChat={handleNewChat}
onBuild={runBuild}
onDeploy={runDeploy}
isLoading={isAILoading}
isBuildLoading={isBuildLoading}
isDeployLoading={isDeployLoading}
isBuildLoading={build.isPending}
onFirstInteraction={handleFirstInteraction}
onProjectDeleted={handleProjectDeleted}
/>
</>
) : (
@@ -459,12 +387,10 @@ export function ProjectView() {
projectId={project.id}
onNewChat={handleNewChat}
onBuild={runBuild}
onDeploy={runDeploy}
onFirstInteraction={handleFirstInteraction}
onLoadingChange={handleAILoadingChange}
isLoading={isAILoading}
isBuildLoading={isBuildLoading}
isDeployLoading={isDeployLoading}
isBuildLoading={build.isPending}
/>
) : (
<div className="h-full p-4 space-y-4">
@@ -483,49 +409,19 @@ export function ProjectView() {
{/* Preview/Code Panel */}
<ResizablePanel defaultSize={60} minSize={30}>
<div className="h-full flex flex-col">
{/* Preview Header */}
<div className="h-12 px-4 border-b flex-shrink-0">
<div className="flex items-center justify-between h-12">
<div className="flex space-x-2">
<Button
variant={activeTab === 'preview' ? 'default' : 'ghost'}
size="sm"
onClick={() => setActiveTab('preview')}
disabled={!project}
>
{t('preview')}
</Button>
<Button
variant={activeTab === 'code' ? 'default' : 'ghost'}
size="sm"
onClick={() => setActiveTab('code')}
className="gap-2"
disabled={!project}
>
{t('code')}
{activeTab !== 'code' && project && (
<GitStatusIndicator projectId={project.id} />
)}
</Button>
</div>
<div className="h-full">
{project ? (
<PreviewPane
projectId={project.id}
activeTab={activeTab}
onToggleView={() => setActiveTab(activeTab === 'preview' ? 'code' : 'preview')}
/>
) : (
<div className="h-full p-4 space-y-4">
<Skeleton className="h-8 w-32" />
<Skeleton className="h-full w-full" />
</div>
</div>
{/* Preview Content */}
<div className="flex-1 overflow-hidden">
{project ? (
<PreviewPane
projectId={project.id}
activeTab={activeTab}
/>
) : (
<div className="h-full p-4 space-y-4">
<Skeleton className="h-8 w-32" />
<Skeleton className="h-full w-full" />
</div>
)}
</div>
)}
</div>
</ResizablePanel>
</ResizablePanelGroup>
@@ -538,6 +434,7 @@ export function ProjectView() {
project={project}
open={isProjectInfoOpen}
onOpenChange={setIsProjectInfoOpen}
onProjectDeleted={handleProjectDeleted}
/>
)}
</div>
+9
View File
@@ -0,0 +1,9 @@
import type { NostrSigner } from '@nostrify/nostrify';
declare global {
interface Window {
nostr?: NostrSigner;
}
}
export {};