All files / src/app/(site)/unsubscribe-success page.tsx

0% Statements 0/87
100% Branches 0/0
0% Functions 0/1
0% Lines 0/87

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88                                                                                                                                                                               
/**
 * Unsubscribe Success Page
 *
 * Displayed after a successful email unsubscribe action.
 */

import { Metadata } from 'next';
import Link from 'next/link';
import { Icon } from '@/components/ui/icons';

export const metadata: Metadata = {
  title: 'Unsubscribed Successfully | Elite Events',
  description: 'You have been successfully unsubscribed from our emails.',
  robots: 'noindex, nofollow'
};

interface UnsubscribeSuccessPageProps {
  searchParams: Promise<{ type?: string }>;
}

const typeMessages: Record<string, { title: string; description: string }> = {
  all: {
    title: 'Unsubscribed from marketing emails',
    description: "You will no longer receive promotional emails from us. You'll still receive essential order and account updates."
  },
  promotions: {
    title: 'Unsubscribed from promotions',
    description: 'You will no longer receive promotional offers and sales notifications.'
  },
  newsletters: {
    title: 'Unsubscribed from newsletters',
    description: 'You will no longer receive our newsletter updates.'
  },
  productAlerts: {
    title: 'Unsubscribed from product alerts',
    description: 'You will no longer receive back-in-stock or price drop notifications.'
  }
};

export default async function UnsubscribeSuccessPage({ searchParams }: UnsubscribeSuccessPageProps) {
  const resolvedParams = await searchParams;
  const type = resolvedParams.type || 'all';
  const message = typeMessages[type] || typeMessages.all;

  return (
    <div className="min-h-[60vh] flex items-center justify-center px-4">
      <div className="max-w-md w-full text-center">
        {/* Success icon */}
        <div className="mx-auto w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6">
          <Icon name="check" size={32} className="text-green-600 dark:text-green-400" />
        </div>

        {/* Title */}
        <h1 className="text-2xl font-bold text-gray-900 dark:text-white mb-3">
          {message.title}
        </h1>

        {/* Description */}
        <p className="text-gray-600 dark:text-gray-400 mb-8">
          {message.description}
        </p>

        {/* Actions */}
        <div className="space-y-4">
          <p className="text-sm text-gray-500 dark:text-gray-500">
            Changed your mind? You can update your preferences anytime.
          </p>

          <div className="flex flex-col sm:flex-row gap-3 justify-center">
            <Link
              href="/my-account?tab=account-details"
              className="inline-flex items-center justify-center px-6 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium"
            >
              Manage Preferences
            </Link>
            <Link
              href="/"
              className="inline-flex items-center justify-center px-6 py-2.5 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors font-medium"
            >
              Return Home
            </Link>
          </div>
        </div>
      </div>
    </div>
  );
}