Move nsite project settings into a dedicated edit modal

Replaces the inline nsite config form in the deploy popover with a
NsiteSettingsDialog that owns the full .nsite/config.json: title,
description, version history toggle, and (under an "Advanced"
collapsible) relays and Blossom servers.

When a project has no .nsite/config.json yet, the deploy popover
auto-seeds one from the selected nsite provider so the summary card
appears immediately and deploy works out of the box. The Deploy
button now reads relays/servers/title/description/dTag/version
history directly from .nsite/config.json; only the gateway still
comes from the provider since it is host-level, not manifest-level.

The summary card hides the version-history state — it stays
accessible via the settings modal only.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
hzrd149andClaude Opus 4.7 committed 2026-05-15 13:29:53 -05:00
1 parent d1e71184e6
commit a588509ec6
2 files changed
+366 -179

No files matched your search

+140 -179
View File
@@ -23,7 +23,7 @@ import { PRESET_DEPLOY_PROVIDERS } from '@/lib/deployProviderPresets';
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 { NsiteSettingsDialog } from '@/components/deploy/NsiteSettingsDialog';
import { CloudflareDeployForm } from '@/components/deploy/CloudflareDeployForm';
import { DenoDeployForm } from '@/components/deploy/DenoDeployForm';
import { RailwayDeployForm } from '@/components/deploy/RailwayDeployForm';
@@ -39,6 +39,7 @@ import { RailwayAdapter } from '@/lib/deploy/RailwayAdapter';
import { readNsiteVfsConfig, writeNsiteVfsConfig } from '@/lib/nsiteConfig';
import type { NsiteVfsConfig } from '@/lib/nsiteConfig';
import { projectNameToDTag } from '@/lib/utils/nsite';
import type { NsiteProvider } from '@/contexts/DeploySettingsContext';
/**
* Normalize a URL string to ensure it has a protocol
@@ -104,11 +105,25 @@ interface ShakespeareFormData {
subdomain: string;
}
interface NsiteFormData {
siteTitle: string;
siteDescription: string;
dTag: string;
publishSnapshotOnDeploy: boolean;
/**
* Build a complete NsiteVfsConfig from provider defaults — used when the
* project has no .nsite/config.json yet. The dTag is derived from the
* project name so the very first deploy already has a stable identifier.
*/
async function buildSeedNsiteConfig(
nsiteProvider: NsiteProvider,
projectName: string,
): Promise<NsiteVfsConfig> {
const dTag = await projectNameToDTag(projectName);
return {
relays: nsiteProvider.relayUrls,
servers: nsiteProvider.blossomServers,
id: dTag,
title: projectName,
fallback: '/index.html',
gatewayHostnames: [nsiteProvider.gateway],
publishSnapshotOnDeploy: false,
};
}
interface NetlifyFormData {
@@ -155,12 +170,13 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const [error, setError] = useState<string | null>(null);
const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true);
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
// .nsite/config.json state — loaded once on mount. Source of truth for all
// per-project site settings (relays, servers, title, etc.). Editable via the
// NsiteSettingsDialog. When the project has no config yet, we auto-seed one
// from the selected nsite provider so deploy works out of the box.
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
const [nsiteVfsConfigLoading, setNsiteVfsConfigLoading] = useState(true);
// When a .nsite/config.json already exists, hide the full form and show a summary instead.
// The user can click "Edit" to expand it.
const [nsiteShowFullForm, setNsiteShowFullForm] = useState(false);
const [nsiteSettingsOpen, setNsiteSettingsOpen] = useState(false);
useEffect(() => {
if (!projectId) {
@@ -168,23 +184,9 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
return;
}
const projectPath = `${projectsPath}/${projectId}`;
setNsiteVfsConfigLoading(true);
readNsiteVfsConfig(fs, projectPath)
.then((cfg) => {
setNsiteVfsConfig(cfg);
// If a config already exists, seed the form from it and stay in summary mode.
// If not, show the full form so the user can configure for the first time.
if (cfg) {
setNsiteForm({
siteTitle: cfg.title ?? '',
siteDescription: cfg.description ?? '',
dTag: (cfg.id != null && cfg.id !== '') ? cfg.id : '',
publishSnapshotOnDeploy: cfg.publishSnapshotOnDeploy ?? false,
});
setNsiteShowFullForm(false);
} else {
setNsiteShowFullForm(true);
}
})
.then((cfg) => setNsiteVfsConfig(cfg))
.finally(() => setNsiteVfsConfigLoading(false));
}, [fs, projectsPath, projectId]);
@@ -192,12 +194,6 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({
subdomain: projectId,
});
const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({
siteTitle: '',
siteDescription: '',
dTag: '',
publishSnapshotOnDeploy: false,
});
const [netlifyForm, setNetlifyForm] = useState<NetlifyFormData>({
siteId: '',
siteName: '',
@@ -236,6 +232,46 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const selectedProvider = settings.providers.find(p => p.id === selectedProviderId);
// Auto-seed .nsite/config.json from the provider when:
// - an nsite provider is selected,
// - the load effect has finished,
// - and the project has no config yet.
// This means a fresh project immediately surfaces a summary card with sane
// defaults and the user can edit anytime via the settings dialog.
useEffect(() => {
if (!projectId) return;
if (nsiteVfsConfigLoading) return;
if (nsiteVfsConfig) return;
if (selectedProvider?.type !== 'nsite') return;
const projectPath = `${projectsPath}/${projectId}`;
let cancelled = false;
buildSeedNsiteConfig(selectedProvider, projectName || projectId)
.then(async (cfg) => {
if (cancelled) return;
try {
await writeNsiteVfsConfig(fs, projectPath, cfg);
if (cancelled) return;
setNsiteVfsConfig(cfg);
} catch (err) {
console.warn('Failed to auto-seed .nsite/config.json:', err);
}
});
return () => {
cancelled = true;
};
}, [
projectId,
projectsPath,
nsiteVfsConfig,
nsiteVfsConfigLoading,
selectedProvider,
fs,
projectName,
]);
const handleDeploy = async () => {
if (!selectedProvider) return;
@@ -268,22 +304,28 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
throw new Error('You must be logged in to deploy to nsite.');
}
if (!nsiteVfsConfig) {
throw new Error('nsite settings are not configured for this project yet.');
}
const sourceUrl = await resolveNsiteSourceUrl(
await git.getRemoteURL(projectPath, 'origin')
);
// Source of truth is .nsite/config.json — provider only contributes the
// gateway (host-level, not a manifest field).
adapter = new NsiteAdapter({
fs,
nostr,
signer: user.signer,
gateway: nsiteProvider.gateway,
relayUrls: nsiteProvider.relayUrls,
blossomServers: nsiteProvider.blossomServers,
siteTitle: nsiteForm.siteTitle || undefined,
siteDescription: nsiteForm.siteDescription || undefined,
relayUrls: nsiteVfsConfig.relays,
blossomServers: nsiteVfsConfig.servers,
siteTitle: nsiteVfsConfig.title || undefined,
siteDescription: nsiteVfsConfig.description || undefined,
sourceUrl,
siteIdentifier: nsiteForm.dTag || undefined,
publishSnapshotOnDeploy: nsiteForm.publishSnapshotOnDeploy,
siteIdentifier: (nsiteVfsConfig.id != null && nsiteVfsConfig.id !== '') ? nsiteVfsConfig.id : undefined,
publishSnapshotOnDeploy: nsiteVfsConfig.publishSnapshotOnDeploy ?? false,
});
} else if (selectedProvider.type === 'netlify') {
const netlifyProvider = selectedProvider;
@@ -392,29 +434,23 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
type: 'nsite',
url: result.url,
data: {
siteTitle: nsiteForm.siteTitle || undefined,
siteDescription: nsiteForm.siteDescription || undefined,
dTag: nsiteForm.dTag || undefined,
siteTitle: nsiteVfsConfig?.title || undefined,
siteDescription: nsiteVfsConfig?.description || undefined,
dTag: nsiteVfsConfig?.id || undefined,
},
});
// Write .nsite/config.json for nsyte CLI interoperability.
// This file is safe to commit — it never contains the nsec.
const nsiteProvider = selectedProvider;
const newNsiteVfsConfig: NsiteVfsConfig = {
relays: nsiteProvider.relayUrls,
servers: nsiteProvider.blossomServers,
id: nsiteForm.dTag || undefined,
title: nsiteForm.siteTitle || undefined,
description: nsiteForm.siteDescription || undefined,
fallback: '/index.html',
gatewayHostnames: [nsiteProvider.gateway],
publishSnapshotOnDeploy: nsiteForm.publishSnapshotOnDeploy,
};
await writeNsiteVfsConfig(fs, projectPath, newNsiteVfsConfig);
// Update in-memory state so summary view reflects new values immediately
setNsiteVfsConfig(newNsiteVfsConfig);
setNsiteShowFullForm(false);
// Refresh .nsite/config.json's gatewayHostnames so the file reflects
// the most recent provider the project actually deployed through.
// All other fields are already authoritative on disk.
if (nsiteVfsConfig) {
const refreshed: NsiteVfsConfig = {
...nsiteVfsConfig,
gatewayHostnames: [selectedProvider.gateway],
};
await writeNsiteVfsConfig(fs, projectPath, refreshed);
setNsiteVfsConfig(refreshed);
}
} else if (selectedProvider.type === 'netlify') {
await updateProjectSettings(selectedProviderId, {
type: 'netlify',
@@ -522,14 +558,12 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
setError(null);
// Reset forms
setShakespeareForm({ subdomain: projectId });
setNsiteForm({ siteTitle: '', siteDescription: '', dTag: '', publishSnapshotOnDeploy: false });
setNetlifyForm({ siteId: '', siteName: '' });
setVercelForm({ projectName: projectName || projectId, teamId: '' });
setCloudflareForm({ projectName: projectName || projectId });
setDenoDeployForm({ projectName: projectName || projectId });
setRailwayForm({ workspaceId: '', projectId: '', environmentId: '', serviceId: '', projectName: projectName || projectId });
// Return to summary mode so next open shows the compact view (if config exists)
setNsiteShowFullForm(false);
setNsiteSettingsOpen(false);
onClose();
};
@@ -541,56 +575,12 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
setIsShakespeareFormValid(isValid);
}, []);
const handleNsiteSiteTitleChange = useCallback((siteTitle: string) => {
setNsiteForm(prev => ({ ...prev, siteTitle }));
// Derive the dTag from the title so the user never has to think about it.
// Falls back to projectName when the title is blank.
projectNameToDTag(siteTitle || projectName).then(dTag => {
setNsiteForm(prev => ({ ...prev, dTag }));
});
}, [projectName]);
const handleNsiteSiteDescriptionChange = useCallback((siteDescription: string) => {
setNsiteForm(prev => ({ ...prev, siteDescription }));
}, []);
const handleNsitePublishSnapshotOnDeployChange = useCallback(async (publishSnapshotOnDeploy: boolean) => {
setNsiteForm(prev => ({ ...prev, publishSnapshotOnDeploy }));
// Persist immediately so the choice survives closing the dialog without
// deploying. We assemble the full config from the currently-selected
// provider + form values so the file is valid even on first toggle
// (before any deploy has run).
const handleNsiteSettingsSave = useCallback(async (cfg: NsiteVfsConfig) => {
if (!projectId) return;
if (selectedProvider?.type !== 'nsite') return;
const projectPath = `${projectsPath}/${projectId}`;
const cfg: NsiteVfsConfig = {
relays: selectedProvider.relayUrls,
servers: selectedProvider.blossomServers,
id: nsiteForm.dTag || undefined,
title: nsiteForm.siteTitle || undefined,
description: nsiteForm.siteDescription || undefined,
fallback: '/index.html',
gatewayHostnames: [selectedProvider.gateway],
publishSnapshotOnDeploy,
};
try {
await writeNsiteVfsConfig(fs, projectPath, cfg);
setNsiteVfsConfig(cfg);
} catch (err) {
console.warn('Failed to persist publishSnapshotOnDeploy to .nsite/config.json:', err);
}
}, [
projectId,
projectsPath,
selectedProvider,
fs,
nsiteForm.dTag,
nsiteForm.siteTitle,
nsiteForm.siteDescription,
]);
await writeNsiteVfsConfig(fs, projectPath, cfg);
setNsiteVfsConfig(cfg);
}, [projectId, projectsPath, fs]);
const handleNetlifySiteChange = useCallback((siteId: string, siteName: string) => {
setNetlifyForm({ siteId, siteName });
@@ -638,79 +628,39 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
}
if (selectedProvider.type === 'nsite') {
// While the .nsite/config.json load is still in flight, render nothing to avoid flicker
if (nsiteVfsConfigLoading) return null;
// While the .nsite/config.json load + auto-seed is still in flight,
// render nothing to avoid flicker.
if (nsiteVfsConfigLoading || !nsiteVfsConfig) return null;
// Summary view: shown when .nsite/config.json already exists and user hasn't clicked Edit
if (nsiteVfsConfig && !nsiteShowFullForm) {
const relayCount = nsiteVfsConfig.relays?.length ?? 0;
const serverCount = nsiteVfsConfig.servers?.length ?? 0;
return (
<div className="space-y-3">
<div className="rounded-md border bg-muted/30 p-3 space-y-2 text-sm">
{nsiteVfsConfig.title && (
<div className="flex justify-between">
<span className="text-muted-foreground">Title</span>
<span className="font-medium">{nsiteVfsConfig.title}</span>
</div>
)}
<div className="flex justify-between">
<span className="text-muted-foreground">Relays</span>
<span className="font-medium">{relayCount} configured</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Blossom servers</span>
<span className="font-medium">{serverCount} configured</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Version history</span>
<span className="font-medium">{nsiteVfsConfig.publishSnapshotOnDeploy ? 'Enabled' : 'Disabled'}</span>
</div>
</div>
<button
type="button"
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
onClick={() => setNsiteShowFullForm(true)}
>
Edit site settings
</button>
</div>
);
}
// Full config form: shown on first deploy or when user clicks "Edit site settings"
const savedConfig = projectSettings.providers[selectedProviderId];
const legacy = savedConfig?.type === 'nsite' ? savedConfig.data : undefined;
// .nsite/config.json wins; .git/shakespeare/deploy.json is the legacy fallback
const savedSiteTitle = nsiteVfsConfig?.title ?? legacy?.siteTitle;
const savedSiteDescription = nsiteVfsConfig?.description ?? legacy?.siteDescription;
const savedPublishSnapshotOnDeploy = nsiteVfsConfig?.publishSnapshotOnDeploy ?? false;
const relayCount = nsiteVfsConfig.relays?.length ?? 0;
const serverCount = nsiteVfsConfig.servers?.length ?? 0;
return (
<div className="space-y-3">
<NsiteDeployForm
key={selectedProviderId}
projectName={projectName || projectId}
savedNsec={legacy?.nsec}
savedSiteTitle={savedSiteTitle}
savedSiteDescription={savedSiteDescription}
savedPublishSnapshotOnDeploy={savedPublishSnapshotOnDeploy}
onSiteTitleChange={handleNsiteSiteTitleChange}
onSiteDescriptionChange={handleNsiteSiteDescriptionChange}
onPublishSnapshotOnDeployChange={handleNsitePublishSnapshotOnDeployChange}
/>
{nsiteVfsConfig && (
<button
type="button"
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
onClick={() => setNsiteShowFullForm(false)}
>
Back to summary
</button>
)}
<div className="rounded-md border bg-muted/30 p-3 space-y-2 text-sm">
{nsiteVfsConfig.title && (
<div className="flex justify-between">
<span className="text-muted-foreground">Title</span>
<span className="font-medium">{nsiteVfsConfig.title}</span>
</div>
)}
<div className="flex justify-between">
<span className="text-muted-foreground">Relays</span>
<span className="font-medium">{relayCount} configured</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Blossom servers</span>
<span className="font-medium">{serverCount} configured</span>
</div>
</div>
<button
type="button"
className="text-xs text-muted-foreground underline hover:text-foreground transition-colors"
onClick={() => setNsiteSettingsOpen(true)}
>
Edit site settings
</button>
</div>
);
}
@@ -817,6 +767,16 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
return (
<div className="space-y-4">
{nsiteVfsConfig && (
<NsiteSettingsDialog
open={nsiteSettingsOpen}
onOpenChange={setNsiteSettingsOpen}
projectName={projectName || projectId}
initialConfig={nsiteVfsConfig}
onSave={handleNsiteSettingsSave}
/>
)}
<div>
<h3 className="font-semibold mb-1">Deploy your project</h3>
<p className="text-sm text-muted-foreground">
@@ -1003,7 +963,8 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
(selectedProvider.type === 'shakespeare' && !user) ||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
(selectedProvider.type === 'nsite' && !user) ||
(selectedProvider.type === 'nsite' && !nsiteForm.dTag) ||
(selectedProvider.type === 'nsite' && !nsiteVfsConfig) ||
(selectedProvider.type === 'nsite' && (!nsiteVfsConfig?.relays?.length || !nsiteVfsConfig?.servers?.length)) ||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||
(selectedProvider.type === 'cloudflare' && !cloudflareForm.projectName) ||
(selectedProvider.type === 'deno' && !denoDeployForm.projectName) ||
@@ -0,0 +1,226 @@
import { useEffect, useState } from 'react';
import { ChevronDown } from 'lucide-react';
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 { Textarea } from '@/components/ui/textarea';
import { Checkbox } from '@/components/ui/checkbox';
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from '@/components/ui/collapsible';
import { UrlListEditor } from '@/components/UrlListEditor';
import { projectNameToDTag } from '@/lib/utils/nsite';
import type { NsiteVfsConfig } from '@/lib/nsiteConfig';
interface NsiteSettingsDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
/** Used to default the title when blank */
projectName: string;
/** Current persisted config — controls initial field values */
initialConfig: NsiteVfsConfig;
/** Called with the new config when the user clicks Save. May throw. */
onSave: (cfg: NsiteVfsConfig) => Promise<void>;
}
/**
* Per-project nsite settings editor.
*
* Edits the full `.nsite/config.json` for a project: title, description,
* relays, blossom servers, and the "publish version history" flag. The `d`
* tag identifier is auto-derived from the title on save and never surfaced
* in the UI.
*
* The `gatewayHostnames` and `fallback` fields are preserved untouched so
* provider/CLI-managed metadata isn't clobbered.
*/
export function NsiteSettingsDialog({
open,
onOpenChange,
projectName,
initialConfig,
onSave,
}: NsiteSettingsDialogProps) {
const [title, setTitle] = useState(initialConfig.title ?? '');
const [description, setDescription] = useState(initialConfig.description ?? '');
const [relays, setRelays] = useState<string[]>(initialConfig.relays ?? []);
const [servers, setServers] = useState<string[]>(initialConfig.servers ?? []);
const [publishSnapshotOnDeploy, setPublishSnapshotOnDeploy] = useState(
initialConfig.publishSnapshotOnDeploy ?? false,
);
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
const [advancedOpen, setAdvancedOpen] = useState(false);
// Reset local state whenever the dialog re-opens with a different config
// (e.g. after a save from another tab, or when switching projects).
useEffect(() => {
if (!open) return;
setTitle(initialConfig.title ?? '');
setDescription(initialConfig.description ?? '');
setRelays(initialConfig.relays ?? []);
setServers(initialConfig.servers ?? []);
setPublishSnapshotOnDeploy(initialConfig.publishSnapshotOnDeploy ?? false);
setError(null);
setAdvancedOpen(false);
}, [open, initialConfig]);
const hasRelays = relays.length > 0;
const hasServers = servers.length > 0;
const canSave = hasRelays && hasServers && !saving;
const handleSave = async () => {
if (!canSave) return;
setSaving(true);
setError(null);
try {
const effectiveTitle = title.trim() || projectName;
const dTag = await projectNameToDTag(effectiveTitle);
const cfg: NsiteVfsConfig = {
...initialConfig,
relays,
servers,
id: dTag,
title: title.trim() || undefined,
description: description.trim() || undefined,
fallback: initialConfig.fallback ?? '/index.html',
publishSnapshotOnDeploy,
};
await onSave(cfg);
onOpenChange(false);
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to save settings');
} finally {
setSaving(false);
}
};
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-lg max-h-[85vh] overflow-y-auto">
<DialogHeader>
<DialogTitle>nsite settings</DialogTitle>
<DialogDescription>
Per-project configuration for this nsite deployment. Saved to <code>.nsite/config.json</code>.
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-2">
{/* Title */}
<div className="space-y-2">
<Label htmlFor="nsite-settings-title">Site Title</Label>
<Input
id="nsite-settings-title"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder={projectName}
/>
<p className="text-xs text-muted-foreground">
Shown by nsite gateways and directories. Defaults to the project name when blank.
</p>
</div>
{/* Description */}
<div className="space-y-2">
<Label htmlFor="nsite-settings-description">
Description <span className="text-muted-foreground font-normal">(optional)</span>
</Label>
<Textarea
id="nsite-settings-description"
value={description}
onChange={(e) => setDescription(e.target.value)}
placeholder="A short description of this site…"
rows={3}
/>
</div>
{/* Version history */}
<div className="space-y-2">
<div className="flex items-start space-x-2">
<Checkbox
id="nsite-settings-publish-snapshot"
checked={publishSnapshotOnDeploy}
onCheckedChange={(checked) =>
setPublishSnapshotOnDeploy(checked === true)
}
className="mt-0.5"
/>
<div className="space-y-1 leading-none">
<Label
htmlFor="nsite-settings-publish-snapshot"
className="text-sm font-medium cursor-pointer"
>
Publish version history
</Label>
<p className="text-xs text-muted-foreground">
Publishes a version each time the app is deployed. This allows users to use older versions of the app.
</p>
</div>
</div>
</div>
{/* Advanced: relays + blossom servers */}
<Collapsible open={advancedOpen} onOpenChange={setAdvancedOpen}>
<CollapsibleTrigger asChild>
<button
type="button"
className="flex items-center gap-2 w-full text-sm text-muted-foreground hover:text-foreground transition-colors py-2 border-t"
>
<ChevronDown
className={`h-4 w-4 transition-transform ${advancedOpen ? 'rotate-180' : ''}`}
/>
<span>Advanced</span>
</button>
</CollapsibleTrigger>
<CollapsibleContent>
<div className="space-y-4 pt-2">
<UrlListEditor
label="Relays"
items={relays}
onChange={setRelays}
protocol="wss"
placeholder="relay.ditto.pub"
required
/>
<UrlListEditor
label="Blossom Servers"
items={servers}
onChange={setServers}
protocol="https"
placeholder="blossom.ditto.pub"
required
/>
</div>
</CollapsibleContent>
</Collapsible>
{error && (
<p className="text-sm text-destructive">{error}</p>
)}
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={saving}>
Cancel
</Button>
<Button onClick={handleSave} disabled={!canSave}>
{saving ? 'Saving…' : 'Save'}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}