import { useState } from 'react'; import { Settings, Save } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { useAppContext } from '@/hooks/useAppContext'; import { useToast } from '@/hooks/useToast'; interface AppSettingsDialogProps { children?: React.ReactNode; } export function AppSettingsDialog({ children }: AppSettingsDialogProps) { const { config, updateConfig } = useAppContext(); const { toast } = useToast(); const [open, setOpen] = useState(false); const [deployServer, setDeployServer] = useState(config.deployServer); const handleSave = () => { // Validate deploy server if (!deployServer.trim()) { toast({ title: "Invalid deploy server", description: "Deploy server cannot be empty.", variant: "destructive", }); return; } // Remove protocol if present const cleanDeployServer = deployServer.replace(/^https?:\/\//, ''); updateConfig((current) => ({ ...current, deployServer: cleanDeployServer, })); toast({ title: "Settings saved", description: "Your deployment settings have been updated.", }); setOpen(false); }; const handleCancel = () => { // Reset to current config setDeployServer(config.deployServer); setOpen(false); }; return ( {children || ( )} App Settings Configure your application preferences and deployment settings.
Deployment
setDeployServer(e.target.value)} placeholder="shakespeare.wtf" className="font-mono" />

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

); }