'use client';

import { useTranslations } from 'next-intl';
import { openConsentBanner } from '@/lib/analytics/consent';

// "Cookie settings" in the footers: reopens the consent banner. Hidden
// unless the storefront root carries data-cookie-consent="on" (set by the
// layout only when the banner is in use), so it never shows a dead link.
export default function CookieSettingsLink({ className = '' }: { className?: string }) {
  const t = useTranslations('CookieConsent');
  return (
    <button
      type="button"
      onClick={openConsentBanner}
      className={`hidden [[data-cookie-consent=on]_&]:inline underline-offset-2 hover:underline ${className}`}
    >
      {t('settings')}
    </button>
  );
}
