diff --git a/frontend/src/components/settings/NtfySettingsSection.tsx b/frontend/src/components/settings/NtfySettingsSection.tsx index 2d99d5e..05f2103 100644 --- a/frontend/src/components/settings/NtfySettingsSection.tsx +++ b/frontend/src/components/settings/NtfySettingsSection.tsx @@ -3,10 +3,12 @@ import { toast } from 'sonner'; import { AlertTriangle, Bell, + ChevronDown, Eye, EyeOff, Loader2, Send, + Settings2, X, } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -14,8 +16,8 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; +import { cn } from '@/lib/utils'; import api, { getErrorMessage } from '@/lib/api'; import type { Settings } from '@/types'; @@ -47,6 +49,10 @@ export default function NtfySettingsSection({ settings, updateSettings }: NtfySe const [isSaving, setIsSaving] = useState(false); const [isTestingNtfy, setIsTestingNtfy] = useState(false); + // Connection config is collapsed once server+topic are saved + const isConfigured = !!(settings?.ntfy_server_url && settings?.ntfy_topic); + const [configExpanded, setConfigExpanded] = useState(!isConfigured); + // Sync from settings on initial load useEffect(() => { if (!settings) return; @@ -62,6 +68,7 @@ export default function NtfySettingsSection({ settings, updateSettings }: NtfySe setTodoLeadDays(settings.ntfy_todo_lead_days ?? 0); setProjectsEnabled(settings.ntfy_projects_enabled ?? false); setProjectLeadDays(settings.ntfy_project_lead_days ?? 0); + setConfigExpanded(!(settings.ntfy_server_url && settings.ntfy_topic)); }, [settings?.id]); const ntfyHasToken = settings?.ntfy_has_token ?? false; @@ -93,6 +100,10 @@ export default function NtfySettingsSection({ settings, updateSettings }: NtfySe await updateSettings(updates); setNtfyToken(''); setTokenCleared(false); + // Collapse connection settings after successful save if configured + if (ntfyServerUrl.trim() && ntfyTopic.trim()) { + setConfigExpanded(false); + } toast.success('Notification settings saved'); } catch (error) { toast.error(getErrorMessage(error, 'Failed to save notification settings')); @@ -119,51 +130,56 @@ export default function NtfySettingsSection({ settings, updateSettings }: NtfySe }; return ( - - -
-
-
-
- Integrations - Push notifications via ntfy -
+
+ {/* ntfy sub-section header */} +
+
+
- - + +
- {/* Master toggle */} -
-
-

Enable Push Notifications

-

- Send alerts to your ntfy server for reminders, todos, and events -

-
- -
+ {ntfyEnabled && ( + <> + {/* Warning banner */} + {isMisconfigured && ( +
+
+ )} - {ntfyEnabled && ( - <> - - - {/* Warning banner */} - {isMisconfigured && ( -
-