import { useState } from 'react'; import { Bell, BellOff, Loader2, Check } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { LoginArea } from '@/components/auth/LoginArea'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useNewsletterSubscription } from '@/hooks/useNewsletterSubscription'; import { useToast } from '@/hooks/useToast'; import { cn } from '@/lib/utils'; /** * Opt-in / opt-out of the SkateSpots newsletter mailbox. When subscribed, new * issues surface in the notification bell's "News" tab. Logged-out users see a * login prompt instead. */ export function NewsletterSubscribeButton({ className }: { className?: string }) { const { user } = useCurrentUser(); const { isSubscribed, isLoading, setSubscribed, isUpdating } = useNewsletterSubscription(); const { toast } = useToast(); const [justSubscribed, setJustSubscribed] = useState(false); if (!user) { return (
Log in with Nostr to get new drops in your mailbox.