mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
DeployPopover
This commit is contained in:
5 files changed
+258
-325
No files matched your search
@@ -10,17 +10,11 @@ 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, Bug, Copy, Check, Play, Loader2, MenuIcon, Code, Rocket, X, Terminal, Expand, Shrink } from 'lucide-react';
|
||||
import { FolderOpen, ArrowLeft, Bug, Copy, Check, Loader2, Code, X, Terminal, Expand, Shrink } from 'lucide-react';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
|
||||
import { BrowserAddressBar } from '@/components/ui/browser-address-bar';
|
||||
import { type DeviceMode } from '@/components/ui/device-toggle';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
@@ -29,7 +23,6 @@ import {
|
||||
import { cn } from '@/lib/utils';
|
||||
import { FileTree } from './FileTree';
|
||||
import { FileEditor } from './FileEditor';
|
||||
import { DeployDialog } from '@/components/DeployDialog';
|
||||
import { Terminal as TerminalComponent } from '@/components/Terminal';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { useAppContext } from '@/hooks/useAppContext';
|
||||
@@ -89,7 +82,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
const [navigationHistory, setNavigationHistory] = useState<string[]>(['/']);
|
||||
const [historyIndex, setHistoryIndex] = useState(0);
|
||||
|
||||
const [deployDialogOpen, setDeployDialogOpen] = useState(false);
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
const [deviceMode, setDeviceMode] = useState<DeviceMode>('laptop');
|
||||
const previewContainerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -106,14 +98,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [shouldBuild, setShouldBuild] = useState(false);
|
||||
|
||||
const handleBuildProject = useCallback(() => {
|
||||
buildProject(undefined, {
|
||||
onError: (error) => {
|
||||
console.error('Build failed:', error);
|
||||
}
|
||||
});
|
||||
}, [buildProject]);
|
||||
|
||||
// Handle "build" URL parameter on initial load
|
||||
useEffect(() => {
|
||||
if (searchParams.has('build')) {
|
||||
@@ -130,9 +114,13 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
useEffect(() => {
|
||||
if (shouldBuild && isPreviewable && !isBuildLoading) {
|
||||
setShouldBuild(false);
|
||||
handleBuildProject();
|
||||
buildProject(undefined, {
|
||||
onError: (error) => {
|
||||
console.error('Build failed:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [isBuildLoading, isPreviewable, handleBuildProject, shouldBuild]);
|
||||
}, [isBuildLoading, isPreviewable, buildProject, shouldBuild]);
|
||||
|
||||
const loadFileContent = useCallback(async (filePath: string) => {
|
||||
// Skip loading media files - they can't be edited as text
|
||||
@@ -502,7 +490,11 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
// Automatically trigger a rebuild after saving a file
|
||||
if (isPreviewable) {
|
||||
console.log('File saved, triggering rebuild...');
|
||||
handleBuildProject();
|
||||
buildProject(undefined, {
|
||||
onError: (error) => {
|
||||
console.error('Build failed:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to save file:', error);
|
||||
@@ -608,47 +600,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
);
|
||||
};
|
||||
|
||||
const Menu = () => {
|
||||
const isAnyLoading = isBuildLoading;
|
||||
|
||||
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 sm:w-48 z-[9999]">
|
||||
<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>
|
||||
<DropdownMenuItem
|
||||
onClick={() => setDeployDialogOpen(true)}
|
||||
disabled={isAnyLoading}
|
||||
className="gap-2"
|
||||
>
|
||||
<Rocket className="h-4 w-4" />
|
||||
Deploy
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-full">
|
||||
<Tabs value={activeTab} className="h-full">
|
||||
@@ -705,7 +656,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
</Button>
|
||||
)}
|
||||
<ConsoleDropdown />
|
||||
<Menu />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -733,27 +683,9 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
<div className="h-full w-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">
|
||||
<p className="text-muted-foreground">
|
||||
{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>
|
||||
)}
|
||||
@@ -953,16 +885,6 @@ export function PreviewPane({ projectId, activeTab, onToggleView, projectName, o
|
||||
)}
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
{/* Deploy Dialog */}
|
||||
{projectName && (
|
||||
<DeployDialog
|
||||
projectId={projectId}
|
||||
projectName={projectName}
|
||||
open={deployDialogOpen}
|
||||
onOpenChange={setDeployDialogOpen}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useState } from 'react';
|
||||
import { Rocket } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { DeploySteps } from './DeploySteps';
|
||||
|
||||
interface DeployPopoverProps {
|
||||
projectId: string;
|
||||
projectName: string;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function DeployPopover({ projectId, projectName, className, disabled }: DeployPopoverProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className={cn("h-8 w-8 p-0", className)}
|
||||
aria-label="Deploy project"
|
||||
disabled={disabled}
|
||||
>
|
||||
<Rocket className="size-5 text-muted-foreground" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className="w-96"
|
||||
onOpenAutoFocus={(e) => e.preventDefault()}
|
||||
>
|
||||
<DeploySteps
|
||||
projectId={projectId}
|
||||
projectName={projectName}
|
||||
onClose={() => setOpen(false)}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
@@ -2,13 +2,6 @@ import { useState, useEffect, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Rocket, ExternalLink, AlertCircle, Settings, Cloud } from 'lucide-react';
|
||||
import { ExternalFavicon } from '@/components/ExternalFavicon';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -93,11 +86,10 @@ function renderProviderIcon(provider: DeployProvider, size = 14) {
|
||||
return <Rocket size={size} />;
|
||||
}
|
||||
|
||||
interface DeployDialogProps {
|
||||
interface DeployStepsProps {
|
||||
projectId: string;
|
||||
projectName: string;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
interface ShakespeareFormData {
|
||||
@@ -126,7 +118,7 @@ interface DenoDeployFormData {
|
||||
projectName: string;
|
||||
}
|
||||
|
||||
export function DeployDialog({ projectId, projectName, open, onOpenChange }: DeployDialogProps) {
|
||||
export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProps) {
|
||||
const { t } = useTranslation();
|
||||
const { settings } = useDeploySettings();
|
||||
const { settings: projectSettings, updateSettings: updateProjectSettings } = useProjectDeploySettings(projectId);
|
||||
@@ -164,21 +156,19 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
||||
projectName: projectName || projectId,
|
||||
});
|
||||
|
||||
// Load project settings when dialog opens
|
||||
// Load project settings when component mounts
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
// First, try to use the currentProvider from project settings
|
||||
if (projectSettings.currentProvider && settings.providers.some(p => p.id === projectSettings.currentProvider)) {
|
||||
setSelectedProviderId(projectSettings.currentProvider);
|
||||
} else {
|
||||
// Otherwise, find the first configured provider in project settings
|
||||
const providerIds = Object.keys(projectSettings.providers);
|
||||
if (providerIds.length > 0) {
|
||||
setSelectedProviderId(providerIds[0]);
|
||||
}
|
||||
// First, try to use the currentProvider from project settings
|
||||
if (projectSettings.currentProvider && settings.providers.some(p => p.id === projectSettings.currentProvider)) {
|
||||
setSelectedProviderId(projectSettings.currentProvider);
|
||||
} else {
|
||||
// Otherwise, find the first configured provider in project settings
|
||||
const providerIds = Object.keys(projectSettings.providers);
|
||||
if (providerIds.length > 0) {
|
||||
setSelectedProviderId(providerIds[0]);
|
||||
}
|
||||
}
|
||||
}, [open, projectSettings, settings.providers]);
|
||||
}, [projectSettings, settings.providers]);
|
||||
|
||||
const selectedProvider = settings.providers.find(p => p.id === selectedProviderId);
|
||||
|
||||
@@ -368,7 +358,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
||||
setVercelForm({ projectName: projectName || projectId, teamId: '' });
|
||||
setCloudflareForm({ projectName: projectName || projectId });
|
||||
setDenoDeployForm({ projectName: projectName || projectId });
|
||||
onOpenChange(false);
|
||||
onClose();
|
||||
};
|
||||
|
||||
const handleShakespeareSubdomainChange = useCallback((subdomain: string) => {
|
||||
@@ -508,200 +498,198 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleClose}>
|
||||
<DialogContent className="sm:max-w-[500px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Rocket className="h-5 w-5" />
|
||||
Deploy Project
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
Deploy your project to a hosting platform
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<h3 className="font-semibold text-lg flex items-center gap-2">
|
||||
<Rocket className="h-5 w-5" />
|
||||
Deploy Project
|
||||
</h3>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Deploy your project to a hosting platform
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{deployResult ? (
|
||||
<div className="space-y-4">
|
||||
<Alert>
|
||||
<Rocket className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
Your project has been successfully deployed!
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
{deployResult ? (
|
||||
<div className="space-y-4">
|
||||
<Alert>
|
||||
<Rocket className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
Your project has been successfully deployed!
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>Deployed URL</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
value={deployResult.url}
|
||||
readOnly
|
||||
className="flex-1"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => window.open(deployResult.url, '_blank')}
|
||||
>
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button onClick={handleClose}>
|
||||
{t('close')}
|
||||
<div className="space-y-2">
|
||||
<Label>Deployed URL</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
value={deployResult.url}
|
||||
readOnly
|
||||
className="flex-1"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => window.open(deployResult.url, '_blank')}
|
||||
>
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{settings.providers.length === 0 ? (
|
||||
<div className="py-8 px-4">
|
||||
<div className="max-w-md mx-auto space-y-6 text-center">
|
||||
{/* Icon */}
|
||||
<div className="flex justify-center">
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 bg-primary/10 rounded-full blur-xl"></div>
|
||||
<div className="relative bg-gradient-to-br from-primary/20 to-primary/5 p-6 rounded-2xl border border-primary/20">
|
||||
<Cloud className="h-12 w-12 text-primary" />
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button onClick={handleClose}>
|
||||
{t('close')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{settings.providers.length === 0 ? (
|
||||
<div className="py-8 px-4">
|
||||
<div className="max-w-md mx-auto space-y-6 text-center">
|
||||
{/* Icon */}
|
||||
<div className="flex justify-center">
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 bg-primary/10 rounded-full blur-xl"></div>
|
||||
<div className="relative bg-gradient-to-br from-primary/20 to-primary/5 p-6 rounded-2xl border border-primary/20">
|
||||
<Cloud className="h-12 w-12 text-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Heading */}
|
||||
<div className="space-y-2">
|
||||
<h3 className="text-xl font-semibold">Choose Your Deployment Platform</h3>
|
||||
<p className="text-sm text-muted-foreground leading-relaxed">
|
||||
Deploy your Shakespeare projects to any hosting provider. Configure your preferred platform to get started.
|
||||
</p>
|
||||
</div>
|
||||
{/* Heading */}
|
||||
<div className="space-y-2">
|
||||
<h3 className="text-xl font-semibold">Choose Your Deployment Platform</h3>
|
||||
<p className="text-sm text-muted-foreground leading-relaxed">
|
||||
Deploy your Shakespeare projects to any hosting provider. Configure your preferred platform to get started.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* CTA */}
|
||||
<div className="pt-2">
|
||||
<Button
|
||||
asChild
|
||||
size="lg"
|
||||
className="w-full"
|
||||
onClick={handleClose}
|
||||
>
|
||||
<Link to="/settings/deploy">
|
||||
<Settings className="h-4 w-4 mr-2" />
|
||||
Configure Deployment Provider
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
{/* CTA */}
|
||||
<div className="pt-2">
|
||||
<Button
|
||||
asChild
|
||||
size="lg"
|
||||
className="w-full"
|
||||
onClick={handleClose}
|
||||
>
|
||||
<Link to="/settings/deploy">
|
||||
<Settings className="h-4 w-4 mr-2" />
|
||||
Configure Deployment Provider
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label>Select Provider</Label>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{settings.providers.map((provider) => (
|
||||
<button
|
||||
key={provider.id}
|
||||
type="button"
|
||||
onClick={() => setSelectedProviderId(provider.id)}
|
||||
className={cn(
|
||||
"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-all",
|
||||
"border-2 hover:scale-105 active:scale-95",
|
||||
selectedProviderId === provider.id
|
||||
? "bg-primary text-primary-foreground border-primary shadow-sm"
|
||||
: "bg-background text-foreground border-border hover:border-primary/50"
|
||||
)}
|
||||
>
|
||||
{renderProviderIcon(provider, 14)}
|
||||
<span>{provider.name}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label>Select Provider</Label>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{settings.providers.map((provider) => (
|
||||
<button
|
||||
key={provider.id}
|
||||
type="button"
|
||||
onClick={() => setSelectedProviderId(provider.id)}
|
||||
className={cn(
|
||||
"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-all",
|
||||
"border-2 hover:scale-105 active:scale-95",
|
||||
selectedProviderId === provider.id
|
||||
? "bg-primary text-primary-foreground border-primary shadow-sm"
|
||||
: "bg-background text-foreground border-border hover:border-primary/50"
|
||||
)}
|
||||
>
|
||||
{renderProviderIcon(provider, 14)}
|
||||
<span>{provider.name}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{selectedProvider && selectedProviderId && (() => {
|
||||
const savedConfig = projectSettings.providers[selectedProviderId];
|
||||
const url = savedConfig?.url;
|
||||
{selectedProvider && selectedProviderId && (() => {
|
||||
const savedConfig = projectSettings.providers[selectedProviderId];
|
||||
const url = savedConfig?.url;
|
||||
|
||||
if (url) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Label>Last Deployment</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
value={url}
|
||||
readOnly
|
||||
className="flex-1 text-muted-foreground"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => window.open(url, '_blank')}
|
||||
title="Visit last deployment"
|
||||
>
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
if (url) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Label>Last Deployment</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
value={url}
|
||||
readOnly
|
||||
className="flex-1 text-muted-foreground"
|
||||
/>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => window.open(url, '_blank')}
|
||||
title="Visit last deployment"
|
||||
>
|
||||
<ExternalLink className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
|
||||
{selectedProvider && renderProviderFields()}
|
||||
{selectedProvider && renderProviderFields()}
|
||||
|
||||
{selectedProvider?.type === 'shakespeare' && !user && (
|
||||
<Alert>
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
You must be logged in with Nostr to use Shakespeare Deploy.{' '}
|
||||
<Link
|
||||
to="/settings/nostr"
|
||||
className="underline hover:no-underline"
|
||||
onClick={handleClose}
|
||||
>
|
||||
Go to Nostr Settings
|
||||
</Link>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
{selectedProvider?.type === 'shakespeare' && !user && (
|
||||
<Alert>
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
You must be logged in with Nostr to use Shakespeare Deploy.{' '}
|
||||
<Link
|
||||
to="/settings/nostr"
|
||||
className="underline hover:no-underline"
|
||||
onClick={handleClose}
|
||||
>
|
||||
Go to Nostr Settings
|
||||
</Link>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={handleDeploy}
|
||||
disabled={
|
||||
!selectedProvider ||
|
||||
isDeploying ||
|
||||
(selectedProvider.type === 'shakespeare' && !user) ||
|
||||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
|
||||
(selectedProvider.type === 'nsite' && !nsiteForm.nsec) ||
|
||||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
|
||||
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
|
||||
(selectedProvider.type === 'deno' && !denoDeployForm.projectName)
|
||||
}
|
||||
className="w-full"
|
||||
>
|
||||
{isDeploying ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Deploying...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Rocket className="h-4 w-4 mr-2" />
|
||||
Deploy
|
||||
</>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={handleDeploy}
|
||||
disabled={
|
||||
!selectedProvider ||
|
||||
isDeploying ||
|
||||
(selectedProvider.type === 'shakespeare' && !user) ||
|
||||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
|
||||
(selectedProvider.type === 'nsite' && !nsiteForm.nsec) ||
|
||||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
|
||||
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
|
||||
(selectedProvider.type === 'deno' && !denoDeployForm.projectName)
|
||||
}
|
||||
className="w-full"
|
||||
>
|
||||
{isDeploying ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Deploying...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Rocket className="h-4 w-4 mr-2" />
|
||||
Deploy
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4,3 +4,5 @@ export { VercelDeployForm } from './VercelDeployForm';
|
||||
export { NsiteDeployForm } from './NsiteDeployForm';
|
||||
export { CloudflareDeployForm } from './CloudflareDeployForm';
|
||||
export { DenoDeployForm } from './DenoDeployForm';
|
||||
export { DeployPopover } from './DeployPopover';
|
||||
export { DeploySteps } from './DeploySteps';
|
||||
+10
-33
@@ -20,15 +20,15 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/components/ui/alert-dialog';
|
||||
import { ArrowLeft, MessageSquare, Eye, Code, Menu, Rocket, Loader2 } from 'lucide-react';
|
||||
import { ArrowLeft, MessageSquare, Eye, Code, Menu, Loader2 } from 'lucide-react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
import { ProjectTitleMenu } from '@/components/ProjectTitleMenu';
|
||||
import { GitHistoryDialog } from '@/components/ai/GitHistoryDialog';
|
||||
import { DeployDialog } from '@/components/DeployDialog';
|
||||
import { DuplicateProjectDialog } from '@/components/DuplicateProjectDialog';
|
||||
import { GitStatusIndicator } from '@/components/GitStatusIndicator';
|
||||
import { GitSyncButton } from '@/components/git-sync';
|
||||
import { DeployPopover } from '@/components/deploy';
|
||||
import { useBuildProject } from '@/hooks/useBuildProject';
|
||||
import { useIsProjectPreviewable } from '@/hooks/useIsProjectPreviewable';
|
||||
import { useConsoleError } from '@/hooks/useConsoleError';
|
||||
@@ -50,7 +50,6 @@ export function ProjectView() {
|
||||
const [isAILoading, setIsAILoading] = useState(false);
|
||||
const [isProjectDetailsOpen, setIsProjectDetailsOpen] = useState(false);
|
||||
const [gitHistoryOpen, setGitHistoryOpen] = useState(false);
|
||||
const [deployDialogOpen, setDeployDialogOpen] = useState(false);
|
||||
const [duplicateDialogOpen, setDuplicateDialogOpen] = useState(false);
|
||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
@@ -307,16 +306,11 @@ export function ProjectView() {
|
||||
projectId={project.id}
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => setDeployDialogOpen(true)}
|
||||
<DeployPopover
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
disabled={isAnyLoading}
|
||||
className="h-8 w-8"
|
||||
aria-label="Deploy project"
|
||||
>
|
||||
<Rocket className="size-5 text-muted-foreground" />
|
||||
</Button>
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -449,12 +443,6 @@ export function ProjectView() {
|
||||
open={gitHistoryOpen}
|
||||
onOpenChange={setGitHistoryOpen}
|
||||
/>
|
||||
<DeployDialog
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
open={deployDialogOpen}
|
||||
onOpenChange={setDeployDialogOpen}
|
||||
/>
|
||||
<DuplicateProjectDialog
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
@@ -567,16 +555,11 @@ export function ProjectView() {
|
||||
projectId={project.id}
|
||||
className="h-8 w-8"
|
||||
/>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => setDeployDialogOpen(true)}
|
||||
<DeployPopover
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
disabled={isAnyLoading}
|
||||
className="h-8 w-8"
|
||||
aria-label="Deploy project"
|
||||
>
|
||||
<Rocket className="size-5 text-muted-foreground" />
|
||||
</Button>
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@@ -654,12 +637,6 @@ export function ProjectView() {
|
||||
open={gitHistoryOpen}
|
||||
onOpenChange={setGitHistoryOpen}
|
||||
/>
|
||||
<DeployDialog
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
open={deployDialogOpen}
|
||||
onOpenChange={setDeployDialogOpen}
|
||||
/>
|
||||
<DuplicateProjectDialog
|
||||
projectId={project.id}
|
||||
projectName={project.name}
|
||||
|
||||
Reference in new issue
Block a user