diff --git a/src/components/DeployDialog.tsx b/src/components/DeployDialog.tsx index f63a1e9a..1f78788e 100644 --- a/src/components/DeployDialog.tsx +++ b/src/components/DeployDialog.tsx @@ -124,6 +124,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep const [isDeploying, setIsDeploying] = useState(false); const [deployResult, setDeployResult] = useState<{ url: string } | null>(null); const [error, setError] = useState(null); + const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true); // Provider-specific form data const [shakespeareForm, setShakespeareForm] = useState({ @@ -294,6 +295,10 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep setShakespeareForm({ subdomain }); }, []); + const handleShakespeareValidationChange = useCallback((isValid: boolean) => { + setIsShakespeareFormValid(isValid); + }, []); + const handleNsiteNsecChange = useCallback((nsec: string) => { setNsiteForm({ nsec }); }, []); @@ -317,6 +322,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep host={shakespeareProvider.host} projectId={projectId} onSubdomainChange={handleShakespeareSubdomainChange} + onValidationChange={handleShakespeareValidationChange} /> ); } @@ -495,6 +501,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep !selectedProvider || isDeploying || (selectedProvider.type === 'shakespeare' && !user) || + (selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) || (selectedProvider.type === 'nsite' && !nsiteForm.nsec) || (selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) } diff --git a/src/components/deploy/ShakespeareDeployForm.tsx b/src/components/deploy/ShakespeareDeployForm.tsx index e52274e6..0fad1261 100644 --- a/src/components/deploy/ShakespeareDeployForm.tsx +++ b/src/components/deploy/ShakespeareDeployForm.tsx @@ -1,24 +1,35 @@ import { useState, useEffect } from 'react'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; +import { AlertCircle } from 'lucide-react'; interface ShakespeareDeployFormProps { host?: string; projectId: string; onSubdomainChange: (subdomain: string) => void; + onValidationChange?: (isValid: boolean) => void; } export function ShakespeareDeployForm({ host = 'shakespeare.wtf', projectId, onSubdomainChange, + onValidationChange, }: ShakespeareDeployFormProps) { const [subdomain, setSubdomain] = useState(projectId); + // Validate subdomain: no periods allowed (only single-level subdomains) + const hasPeriod = subdomain.includes('.'); + const isValid = subdomain.trim() !== '' && !hasPeriod; + useEffect(() => { onSubdomainChange(subdomain); }, [subdomain, onSubdomainChange]); + useEffect(() => { + onValidationChange?.(isValid); + }, [isValid, onValidationChange]); + const fullDomain = subdomain ? `${subdomain}.${host}` : `${projectId}.${host}`; return ( @@ -30,7 +41,14 @@ export function ShakespeareDeployForm({ value={subdomain} onChange={(e) => setSubdomain(e.target.value)} placeholder={projectId} + className={hasPeriod ? 'border-destructive' : ''} /> + {hasPeriod && ( +
+ + Subdomain cannot contain periods. Use hyphens instead (e.g., "nostr-radar"). +
+ )}

Will deploy to: {fullDomain}