diff --git a/services/proxy.ts b/services/proxy.ts index cc26d7c9..e8fe6721 100644 --- a/services/proxy.ts +++ b/services/proxy.ts @@ -13,7 +13,7 @@ export default { status: 200, headers: { "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS", + "Access-Control-Allow-Methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS", "Access-Control-Allow-Headers": "*", // Or specify specific headers "Access-Control-Max-Age": "86400", // Cache preflight for 24 hours } @@ -32,7 +32,7 @@ export default { const response = new Response(targetResponse.body, targetResponse); response.headers.set("Access-Control-Allow-Origin", "*"); - response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,OPTIONS"); + response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS"); response.headers.set("Access-Control-Allow-Headers", "*"); return response; diff --git a/src/components/AIMessageItem.tsx b/src/components/AIMessageItem.tsx index f2c6294b..b922e283 100644 --- a/src/components/AIMessageItem.tsx +++ b/src/components/AIMessageItem.tsx @@ -219,19 +219,19 @@ export const AIMessageItem = memo(({ // Special rendering for tools const renderSpecialContent = () => { - if (toolName === 'text_editor_write' && toolArgs.file_text) { + if (toolName === 'text_editor_write' && typeof toolArgs.file_text === 'string') { return (
- {toolArgs.file_text as string} + {toolArgs.file_text}
); } - if (toolName === 'text_editor_str_replace' && toolArgs.old_str && toolArgs.new_str) { - const oldLines = (toolArgs.old_str as string).split('\n'); - const newLines = (toolArgs.new_str as string).split('\n'); + if (toolName === 'text_editor_str_replace' && typeof toolArgs.old_str === 'string' && typeof toolArgs.new_str === 'string') { + const oldLines = toolArgs.old_str.split('\n'); + const newLines = toolArgs.new_str.split('\n'); return (
diff --git a/src/components/ActionsMenu.tsx b/src/components/ActionsMenu.tsx index 040fcd4d..77015443 100644 --- a/src/components/ActionsMenu.tsx +++ b/src/components/ActionsMenu.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -13,10 +14,12 @@ import { History, Folder, Rocket, + Copy, } from 'lucide-react'; import { GitHistoryDialog } from '@/components/ai/GitHistoryDialog'; import { GitDialog } from '@/components/GitDialog'; import { DeployDialog } from '@/components/DeployDialog'; +import { DuplicateProjectDialog } from '@/components/DuplicateProjectDialog'; interface ActionsMenuProps { projectId: string; @@ -39,9 +42,11 @@ export function ActionsMenu({ disabled = false, onFirstInteraction: _onFirstInteraction, }: ActionsMenuProps) { + const { t } = useTranslation(); const [gitHistoryOpen, setGitHistoryOpen] = useState(false); const [gitDialogOpen, setGitDialogOpen] = useState(false); const [deployDialogOpen, setDeployDialogOpen] = useState(false); + const [duplicateDialogOpen, setDuplicateDialogOpen] = useState(false); const isAnyLoading = isLoading || isBuildLoading; @@ -98,6 +103,15 @@ export function ActionsMenu({ Deploy + setDuplicateDialogOpen(true)} + disabled={isAnyLoading} + className="gap-2" + > + + {t('duplicateProject')} + + + + ); } \ No newline at end of file diff --git a/src/components/DeployDialog.tsx b/src/components/DeployDialog.tsx index 1f78788e..8c8dbd88 100644 --- a/src/components/DeployDialog.tsx +++ b/src/components/DeployDialog.tsx @@ -27,13 +27,15 @@ import { useFS } from '@/hooks/useFS'; import { useFSPaths } from '@/hooks/useFSPaths'; import { useAppContext } from '@/hooks/useAppContext'; import { useNostr } from '@nostrify/react'; -import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, DeployAdapter } from '@/lib/deploy'; +import { ShakespeareAdapter, NetlifyAdapter, VercelAdapter, NsiteAdapter, CloudflareAdapter, DenoDeployAdapter, DeployAdapter } from '@/lib/deploy'; import { Link } from 'react-router-dom'; -import type { DeployProvider, ShakespeareDeployProvider, NetlifyProvider, VercelProvider } from '@/contexts/DeploySettingsContext'; +import type { DeployProvider, ShakespeareDeployProvider, NetlifyProvider, VercelProvider, CloudflareProvider, DenoDeployProvider } from '@/contexts/DeploySettingsContext'; import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm'; import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm'; import { VercelDeployForm } from '@/components/deploy/VercelDeployForm'; import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm'; +import { CloudflareDeployForm } from '@/components/deploy/CloudflareDeployForm'; +import { DenoDeployForm } from '@/components/deploy/DenoDeployForm'; /** * Helper function to get provider URL for favicon @@ -58,6 +60,18 @@ function getProviderUrl(provider: DeployProvider): string | null { } return 'https://vercel.com'; + case 'cloudflare': + if (provider.baseURL) { + return provider.baseURL; + } + return 'https://cloudflare.com'; + + case 'deno': + if (provider.baseURL) { + return provider.baseURL; + } + return 'https://deno.com'; + case 'nsite': return null; @@ -110,6 +124,14 @@ interface VercelFormData { teamId: string; } +interface CloudflareFormData { + projectName: string; +} + +interface DenoDeployFormData { + projectName: string; +} + export function DeployDialog({ projectId, projectName, open, onOpenChange }: DeployDialogProps) { const { t } = useTranslation(); const { settings } = useDeploySettings(); @@ -141,6 +163,12 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep projectName: projectName || projectId, teamId: '', }); + const [cloudflareForm, setCloudflareForm] = useState({ + projectName: projectName || projectId, + }); + const [denoDeployForm, setDenoDeployForm] = useState({ + projectName: projectName || projectId, + }); // Load project settings when dialog opens useEffect(() => { @@ -230,6 +258,42 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep projectName: vercelForm.projectName || undefined, corsProxy: vercelProvider.proxy ? config.corsProxy : undefined, }); + } else if (selectedProvider.type === 'cloudflare') { + const cloudflareProvider = selectedProvider as CloudflareProvider; + if (!cloudflareProvider.apiKey) { + throw new Error('Cloudflare API key is required'); + } + if (!cloudflareProvider.accountId) { + throw new Error('Cloudflare account ID is required'); + } + + adapter = new CloudflareAdapter({ + fs, + apiKey: cloudflareProvider.apiKey, + accountId: cloudflareProvider.accountId, + baseURL: cloudflareProvider.baseURL, + baseDomain: cloudflareProvider.baseDomain, + projectName: cloudflareForm.projectName || undefined, + corsProxy: cloudflareProvider.proxy ? config.corsProxy : undefined, + }); + } else if (selectedProvider.type === 'deno') { + const denoProvider = selectedProvider as DenoDeployProvider; + if (!denoProvider.apiKey) { + throw new Error('Deno Deploy access token is required'); + } + if (!denoProvider.organizationId) { + throw new Error('Deno Deploy organization ID is required'); + } + + adapter = new DenoDeployAdapter({ + fs, + apiKey: denoProvider.apiKey, + organizationId: denoProvider.organizationId, + baseDomain: denoProvider.baseDomain, + baseURL: denoProvider.baseURL, + projectName: denoDeployForm.projectName || undefined, + corsProxy: denoProvider.proxy ? config.corsProxy : undefined, + }); } else { throw new Error('Unknown provider type'); } @@ -269,6 +333,20 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep projectId: vercelForm.projectName || undefined, }, }); + } else if (selectedProvider.type === 'cloudflare') { + await updateProjectSettings(selectedProviderId, { + type: 'cloudflare', + data: { + projectName: cloudflareForm.projectName || undefined, + }, + }); + } else if (selectedProvider.type === 'deno') { + await updateProjectSettings(selectedProviderId, { + type: 'deno', + data: { + projectName: denoDeployForm.projectName || undefined, + }, + }); } setDeployResult(result); @@ -288,6 +366,8 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep setNsiteForm({ nsec: '' }); setNetlifyForm({ siteId: '', siteName: '' }); setVercelForm({ projectName: projectName || projectId, teamId: '' }); + setCloudflareForm({ projectName: projectName || projectId }); + setDenoDeployForm({ projectName: projectName || projectId }); onOpenChange(false); }; @@ -311,6 +391,14 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep setVercelForm({ projectName, teamId }); }, []); + const handleCloudflareProjectChange = useCallback((projectName: string) => { + setCloudflareForm({ projectName }); + }, []); + + const handleDenoDeployProjectChange = useCallback((projectName: string) => { + setDenoDeployForm({ projectName }); + }, []); + const renderProviderFields = () => { if (!selectedProvider) return null; @@ -373,6 +461,46 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep ); } + if (selectedProvider.type === 'cloudflare') { + const cloudflareProvider = selectedProvider as CloudflareProvider; + const savedConfig = projectSettings.providers[selectedProviderId]; + const savedProjectName = savedConfig?.type === 'cloudflare' ? savedConfig.data.projectName : undefined; + + return ( + + ); + } + + if (selectedProvider.type === 'deno') { + const denoProvider = selectedProvider as DenoDeployProvider; + const savedConfig = projectSettings.providers[selectedProviderId]; + const savedProjectName = savedConfig?.type === 'deno' ? savedConfig.data.projectName : undefined; + + return ( + + ); + } + return null; }; @@ -503,7 +631,9 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep (selectedProvider.type === 'shakespeare' && !user) || (selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) || (selectedProvider.type === 'nsite' && !nsiteForm.nsec) || - (selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) + (selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) || + (selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) || + (selectedProvider.type === 'deno' && !denoDeployForm.projectName) } > {isDeploying ? ( diff --git a/src/components/DiscoverPluginsDialog.tsx b/src/components/DiscoverPluginsDialog.tsx new file mode 100644 index 00000000..70f30b03 --- /dev/null +++ b/src/components/DiscoverPluginsDialog.tsx @@ -0,0 +1,249 @@ +import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Search, Download, Loader2, Check, Package, LogIn } from 'lucide-react'; +import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Card, CardContent } from '@/components/ui/card'; +import { Skeleton } from '@/components/ui/skeleton'; +import { useDiscoverPlugins } from '@/hooks/useDiscoverPlugins'; +import { usePlugins } from '@/hooks/usePlugins'; +import { useAuthor } from '@/hooks/useAuthor'; +import { useToast } from '@/hooks/useToast'; +import { useCurrentUser } from '@/hooks/useCurrentUser'; +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { genUserName } from '@/lib/genUserName'; +import { Link } from 'react-router-dom'; +import type { NostrMetadata } from '@nostrify/nostrify'; + +interface DiscoverPluginsDialogProps { + open: boolean; + onOpenChange: (open: boolean) => void; +} + +export function DiscoverPluginsDialog({ open, onOpenChange }: DiscoverPluginsDialogProps) { + const { t } = useTranslation(); + const { user } = useCurrentUser(); + const { data: plugins, isLoading } = useDiscoverPlugins(); + const [searchQuery, setSearchQuery] = useState(''); + + // Filter plugins based on search query + const filteredPlugins = plugins?.filter((plugin) => { + const query = searchQuery.toLowerCase(); + return ( + plugin.name.toLowerCase().includes(query) || + plugin.description.toLowerCase().includes(query) || + plugin.id.toLowerCase().includes(query) + ); + }); + + return ( + + + + + + {t('discoverPlugins')} + + + {t('discoverPluginsDescription')} + + + +
+ {/* Search Input */} +
+ + setSearchQuery(e.target.value)} + className="pl-9" + /> +
+ + {/* Plugins List */} +
+ {!user && ( + + +
+ +
+

{t('loginRequired')}

+

+ {t('loginToDiscoverPlugins')} +

+
+ +
+
+
+ )} + + {user && isLoading && ( + <> + {[...Array(3)].map((_, i) => ( + + +
+ +
+ + + +
+
+
+
+ ))} + + )} + + {user && !isLoading && filteredPlugins?.length === 0 && ( + + +
+ +
+

+ {searchQuery ? t('noPluginsFound') : t('noPluginsFromNetwork')} +

+

+ {searchQuery + ? t('tryDifferentSearch') + : t('noPluginsFromNetworkDescription') + } +

+
+
+
+
+ )} + + {user && !isLoading && filteredPlugins?.map((plugin) => ( + + ))} +
+
+
+
+ ); +} + +interface PluginCardProps { + plugin: { + id: string; + name: string; + description: string; + cloneUrl?: string; + webUrl?: string; + author: string; + }; +} + +function PluginCard({ plugin }: PluginCardProps) { + const { t } = useTranslation(); + const { toast } = useToast(); + const author = useAuthor(plugin.author); + const { clonePlugin, plugins: installedPlugins } = usePlugins(); + const metadata: NostrMetadata | undefined = author.data?.metadata; + + const isInstalled = installedPlugins.includes(plugin.id); + const isInstalling = clonePlugin.isPending && clonePlugin.variables?.pluginName === plugin.id; + + const handleInstall = async () => { + if (!plugin.cloneUrl) { + toast({ + title: t('noCloneUrl'), + description: t('noCloneUrlDescription'), + variant: 'destructive', + }); + return; + } + + try { + await clonePlugin.mutateAsync({ + gitUrl: plugin.cloneUrl, + pluginName: plugin.id, + }); + toast({ + title: t('pluginInstalled'), + description: t('pluginInstalledDescription', { name: plugin.name }), + }); + } catch (error) { + toast({ + title: t('pluginInstallFailed'), + description: error instanceof Error ? error.message : String(error), + variant: 'destructive', + }); + } + }; + + const displayName = metadata?.name ?? genUserName(plugin.author); + const profileImage = metadata?.picture; + + return ( + + + {/* Plugin Header with Author Info */} +
+ + + {displayName.slice(0, 2).toUpperCase()} + +
+
+

{plugin.name}

+ {isInstalled && ( + + + {t('installed')} + + )} +
+

+ {t('by')} {displayName} +

+
+
+ + {/* Plugin Description */} + {plugin.description && ( +

+ {plugin.description} +

+ )} + + {/* Action Button */} + +
+
+ ); +} diff --git a/src/components/DuplicateProjectDialog.test.tsx b/src/components/DuplicateProjectDialog.test.tsx new file mode 100644 index 00000000..aaab0c9d --- /dev/null +++ b/src/components/DuplicateProjectDialog.test.tsx @@ -0,0 +1,137 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; +import { render, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { DuplicateProjectDialog } from './DuplicateProjectDialog'; +import { TestApp } from '@/test/TestApp'; + +// Mock the navigate function +const mockNavigate = vi.fn(); +vi.mock('react-router-dom', async () => { + const actual = await vi.importActual('react-router-dom'); + return { + ...actual, + useNavigate: () => mockNavigate, + }; +}); + +describe('DuplicateProjectDialog', () => { + beforeEach(() => { + mockNavigate.mockClear(); + }); + + it('renders dialog when open', () => { + render( + + {}} + /> + + ); + + expect(screen.getByRole('dialog')).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Duplicate Project' })).toBeInTheDocument(); + expect(screen.getByText('Create a copy of this project with a new name')).toBeInTheDocument(); + }); + + it('does not render dialog when closed', () => { + render( + + {}} + /> + + ); + + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); + }); + + it('shows default project name with -copy suffix', () => { + render( + + {}} + /> + + ); + + const input = screen.getByLabelText('New Project Name'); + expect(input).toHaveValue('Test Project-copy'); + }); + + it('allows changing the project name', async () => { + const user = userEvent.setup(); + + render( + + {}} + /> + + ); + + const input = screen.getByLabelText('New Project Name'); + await user.clear(input); + await user.type(input, 'My New Project'); + + expect(input).toHaveValue('My New Project'); + }); + + it('disables duplicate button when name is empty', async () => { + const user = userEvent.setup(); + + render( + + {}} + /> + + ); + + const input = screen.getByLabelText('New Project Name'); + const duplicateButton = screen.getByRole('button', { name: /Duplicate Project/i }); + + // Clear the input + await user.clear(input); + + // Button should be disabled when input is empty + expect(duplicateButton).toBeDisabled(); + }); + + it('closes dialog when cancel button is clicked', async () => { + const user = userEvent.setup(); + const onOpenChange = vi.fn(); + + render( + + + + ); + + const cancelButton = screen.getByRole('button', { name: /Cancel/i }); + await user.click(cancelButton); + + await waitFor(() => { + expect(onOpenChange).toHaveBeenCalledWith(false); + }); + }); +}); diff --git a/src/components/DuplicateProjectDialog.tsx b/src/components/DuplicateProjectDialog.tsx new file mode 100644 index 00000000..1fb56331 --- /dev/null +++ b/src/components/DuplicateProjectDialog.tsx @@ -0,0 +1,119 @@ +import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { useNavigate } from 'react-router-dom'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { useProjectsManager } from '@/hooks/useProjectsManager'; +import { useToast } from '@/hooks/useToast'; +import { useQueryClient } from '@tanstack/react-query'; + +interface DuplicateProjectDialogProps { + projectId: string; + projectName: string; + open: boolean; + onOpenChange: (open: boolean) => void; +} + +export function DuplicateProjectDialog({ + projectId, + projectName, + open, + onOpenChange, +}: DuplicateProjectDialogProps) { + const { t } = useTranslation(); + const navigate = useNavigate(); + const { toast } = useToast(); + const projectsManager = useProjectsManager(); + const queryClient = useQueryClient(); + const [newName, setNewName] = useState(`${projectName}-copy`); + const [isLoading, setIsLoading] = useState(false); + + const handleDuplicate = async () => { + if (!newName.trim()) { + return; + } + + setIsLoading(true); + + try { + const duplicatedProject = await projectsManager.duplicateProject(projectId, newName); + + // Invalidate projects query to refresh the list + await queryClient.invalidateQueries({ queryKey: ['projects'] }); + + toast({ + title: t('projectDuplicated'), + description: t('projectDuplicatedDescription'), + }); + + // Close dialog + onOpenChange(false); + + // Navigate to the new project + navigate(`/project/${duplicatedProject.id}`); + } catch (error) { + console.error('Failed to duplicate project:', error); + toast({ + title: t('failedToDuplicateProject'), + description: error instanceof Error ? error.message : String(error), + variant: 'destructive', + }); + } finally { + setIsLoading(false); + } + }; + + return ( + + + + {t('duplicateProject')} + + {t('duplicateProjectDescription')} + + +
+
+ + setNewName(e.target.value)} + placeholder={`${projectName}-copy`} + disabled={isLoading} + onKeyDown={(e) => { + if (e.key === 'Enter' && newName.trim()) { + handleDuplicate(); + } + }} + /> +
+
+ + + + +
+
+ ); +} diff --git a/src/components/ModelSelector.tsx b/src/components/ModelSelector.tsx index 115fe9ce..b32d9ccc 100644 --- a/src/components/ModelSelector.tsx +++ b/src/components/ModelSelector.tsx @@ -56,12 +56,36 @@ export const ModelSelector = memo(function ModelSelector({ // Create a Set of recently used model IDs for efficient lookup const recentlyUsedSet = useMemo(() => new Set(recentlyUsedModels), [recentlyUsedModels]); + // Determine if we should show the "Recently Used" section + const shouldShowRecentlyUsed = useMemo(() => { + // If no recently used models, don't show the section + if (recentlyUsedModels.length === 0) { + return false; + } + + // If there are 5 or more total provider models, always show recently used + if (models.length >= 5) { + return true; + } + + // If less than 5 total provider models, check if all recently used models + // are contained within the available provider models + const availableModelIds = new Set(models.map(model => model.fullId)); + const allRecentlyUsedAreAvailable = recentlyUsedModels.every(model => + availableModelIds.has(model) + ); + + // Hide recently used section if all recently used models are already available + return !allRecentlyUsedAreAvailable; + }, [recentlyUsedModels, models]); + // Group models by provider, excluding models that are in the recently used section + // (only exclude them if the recently used section is actually being shown) const modelsByProvider = useMemo(() => { const groups: Record = {}; for (const model of models) { - // Skip models that are already shown in recently used - if (recentlyUsedSet.has(model.fullId)) { + // Only skip models that are in recently used if we're showing the recently used section + if (shouldShowRecentlyUsed && recentlyUsedSet.has(model.fullId)) { continue; } @@ -71,7 +95,7 @@ export const ModelSelector = memo(function ModelSelector({ groups[model.provider].push(model); } return groups; - }, [models, recentlyUsedSet]); + }, [models, recentlyUsedSet, shouldShowRecentlyUsed]); // Get provider display name and baseURL for a given provider ID const getProviderInfo = useMemo(() => { @@ -100,29 +124,6 @@ export const ModelSelector = memo(function ModelSelector({ }; }, [value, getProviderInfo, models]); - // Determine if we should show the "Recently Used" section - const shouldShowRecentlyUsed = useMemo(() => { - // If no recently used models, don't show the section - if (recentlyUsedModels.length === 0) { - return false; - } - - // If there are 5 or more total provider models, always show recently used - if (models.length >= 5) { - return true; - } - - // If less than 5 total provider models, check if all recently used models - // are contained within the available provider models - const availableModelIds = new Set(models.map(model => model.fullId)); - const allRecentlyUsedAreAvailable = recentlyUsedModels.every(model => - availableModelIds.has(model) - ); - - // Hide recently used section if all recently used models are already available - return !allRecentlyUsedAreAvailable; - }, [recentlyUsedModels, models]); - // Check if the current model is free const isCurrentModelFree = useMemo(() => { if (!value) return false; diff --git a/src/components/NostrSync.tsx b/src/components/NostrSync.tsx index d637ad0e..e8a6c7fd 100644 --- a/src/components/NostrSync.tsx +++ b/src/components/NostrSync.tsx @@ -2,6 +2,7 @@ import { useEffect } from 'react'; import { useNostr } from '@nostrify/react'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useAppContext } from '@/hooks/useAppContext'; +import { useContacts } from '@/hooks/useContacts'; /** * NostrSync - Syncs user's Nostr data @@ -15,6 +16,9 @@ export function NostrSync() { const { user } = useCurrentUser(); const { config, updateConfig } = useAppContext(); + // Prewarm user's follow list + useContacts(user?.pubkey); + useEffect(() => { if (!user) return; diff --git a/src/components/PluginsSection.tsx b/src/components/PluginsSection.tsx index 09e7492e..3818d662 100644 --- a/src/components/PluginsSection.tsx +++ b/src/components/PluginsSection.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { Puzzle, Plus, Trash2, RefreshCw, Loader2, Check } from 'lucide-react'; +import { Puzzle, Plus, Trash2, RefreshCw, Loader2, Check, Compass } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -8,12 +8,14 @@ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/ import { usePlugins } from '@/hooks/usePlugins'; import { usePluginGitInfo } from '@/hooks/usePluginGitInfo'; import { useToast } from '@/hooks/useToast'; +import { DiscoverPluginsDialog } from '@/components/DiscoverPluginsDialog'; export function PluginsSection() { const { t } = useTranslation(); const { toast } = useToast(); const { plugins, skills, clonePlugin, syncPlugin, deletePlugin } = usePlugins(); const [gitUrl, setGitUrl] = useState(''); + const [showDiscoverDialog, setShowDiscoverDialog] = useState(false); const handleAddPlugin = async () => { if (!gitUrl.trim()) return; @@ -79,9 +81,20 @@ export function PluginsSection() {
{/* Plugins Header */}
-
- -

{t('plugins')}

+
+
+ +

{t('plugins')}

+
+

{t('pluginsDescription')} @@ -160,6 +173,12 @@ export function PluginsSection() { + + {/* Discover Plugins Dialog */} +

); } diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index a24e9115..8434a701 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -708,6 +708,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
{hasBuiltProject ? (