Files
gitlab-instance-0a899031_no…/app/components/InstantQaVipModal.tsx
2026-03-13 21:45:12 -05:00

81 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { useEffect } from "react";
import { triggerPay } from "@/app/lib/triggerPay";
import styles from "@/app/vip/components/vip.module.css";
type InstantQaVipModalProps = {
open: boolean;
onClose: () => void;
};
export function InstantQaVipModal({ open, onClose }: InstantQaVipModalProps) {
useEffect(() => {
if (open) document.body.style.overflow = "hidden";
else document.body.style.overflow = "";
return () => { document.body.style.overflow = ""; };
}, [open]);
useEffect(() => {
if (!open) return;
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape") onClose();
};
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [open, onClose]);
if (!open) return null;
const handleUnlock = () => {
onClose();
triggerPay();
};
return (
<div
className="fixed inset-0 z-50 flex items-center justify-center p-4"
role="dialog"
aria-modal="true"
aria-labelledby="qa-vip-modal-title"
>
<div
className="absolute inset-0 bg-black/60 backdrop-blur-sm"
onClick={onClose}
/>
<div
className="relative w-full max-w-[360px] rounded-2xl border border-[var(--border)] bg-[var(--card)] p-6 shadow-2xl animate__animated animate__fadeIn animate__faster"
onClick={(e) => e.stopPropagation()}
>
<div className="mb-4 flex items-center gap-3">
<span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--accent)]/20 text-xl">
💬
</span>
<h2 id="qa-vip-modal-title" className="text-lg font-semibold text-[var(--foreground)]" style={{ margin: 0 }}>
</h2>
</div>
<p className="mb-6 text-sm leading-relaxed text-[var(--muted-foreground)]">
</p>
<div className="flex flex-col gap-3">
<button
type="button"
onClick={handleUnlock}
className={`${styles.btnPrimary} ${styles.btnLarge} w-full`}
>
</button>
<button
type="button"
onClick={onClose}
className="w-full rounded-full border border-[var(--border)] py-2.5 text-sm text-[var(--muted-foreground)] transition hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
>
</button>
</div>
</div>
</div>
);
}