import { Eye, X } from 'lucide-react'
import { HOME_LAYOUT_META, type HomeLayout } from '@/lib/home/layouts'

// Shown only while an admin previews a design that isn't the saved one
// (/api/home-preview). Admin-facing, so English like the admin panel.
// Plain <a> on purpose (not next/link): the admin panel and the preview API
// route need a full page load, not client-side routing.
/* eslint-disable @next/next/no-html-link-for-pages */
export default function PreviewBar({ layout }: { layout: HomeLayout }) {
  return (
    <div className="fixed bottom-4 inset-x-0 z-[60] flex justify-center px-4 pointer-events-none">
      <div className="pointer-events-auto flex items-center gap-3 rounded-full bg-gray-900/95 py-2 ps-4 pe-2 text-sm text-white shadow-2xl backdrop-blur">
        <Eye size={16} className="shrink-0 text-primary-light" />
        <span>
          Previewing <strong>{HOME_LAYOUT_META[layout].name}</strong> design — only you can see this
        </span>
        <a
          href="/admin/dashboard/settings"
          className="hidden sm:inline rounded-full px-3 py-1.5 text-white/80 hover:bg-white/10 hover:text-white"
        >
          Settings
        </a>
        <a
          href="/api/home-preview?exit=1"
          className="inline-flex items-center gap-1 rounded-full bg-white px-3 py-1.5 font-semibold text-gray-900 hover:bg-gray-100"
        >
          <X size={14} />
          Exit
        </a>
      </div>
    </div>
  )
}
