RippleWorkers / src /components /dashboard /PageRequirementModal.tsx
damndeepesh
Initialize project with LavinMQ integration and Docker support
c7fbc2e
Raw History Blame Contribute Delete
4.51 kB
"use client";
import { useEffect, useState } from "react";
import { X, ExternalLink, AlertTriangle } from "lucide-react";
export default function PageRequirementModal({ hasAccounts }: { hasAccounts: boolean }) {
const [isOpen, setIsOpen] = useState(false);
useEffect(() => {
// Show only if NO accounts are connected AND it's the first time seeing this help (or strictly only if needed)
const hasSeenModal = localStorage.getItem("ripple_page_help_seen");
// ONLY show if missing accounts. If they have accounts, this requirement is met, so don't show.
if (!hasAccounts && !hasSeenModal) {
setIsOpen(true);
}
}, [hasAccounts]);
const handleDismiss = () => {
setIsOpen(false);
localStorage.setItem("ripple_page_help_seen", "true");
};
if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm">
<div className="bg-white dark:bg-zinc-900 rounded-2xl w-full max-w-lg shadow-2xl border border-gray-200 dark:border-zinc-800 animate-in fade-in zoom-in-95 duration-200">
<div className="p-6">
<div className="flex items-start justify-between mb-4">
<div className="flex items-center gap-3">
<div className="p-2 bg-amber-100 dark:bg-amber-900/30 rounded-lg text-amber-600 dark:text-amber-500">
<AlertTriangle size={24} />
</div>
<h2 className="text-xl font-bold text-gray-900 dark:text-white">
Important Requirement
</h2>
</div>
<button
onClick={handleDismiss}
className="p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"
>
<X size={20} />
</button>
</div>
<div className="space-y-4 text-gray-600 dark:text-gray-300">
<p>
To connect your Instagram, Meta <span className="font-semibold text-gray-900 dark:text-white">requires</span> it to be linked to a Facebook Page.
</p>
<div className="p-4 bg-gray-50 dark:bg-zinc-800 rounded-xl border border-gray-100 dark:border-zinc-700">
<p className="text-sm">
If you don't have one, please <span className="font-medium text-indigo-600 dark:text-indigo-400">create a simple blank Page on Facebook</span> and link your Instagram to it. You don't need to use the Page for anything else.
</p>
</div>
<ul className="space-y-2 text-sm">
<li className="flex gap-2">
<span className="text-green-500">✓</span>
Only takes 30 seconds
</li>
<li className="flex gap-2">
<span className="text-green-500">✓</span>
Enables Auto-Posting & Analytics
</li>
</ul>
</div>
<div className="mt-8 flex gap-3 justify-end">
<button
onClick={handleDismiss}
className="px-4 py-2 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors"
>
I understand
</button>
<a
href="https://www.facebook.com/pages/create"
target="_blank"
rel="noopener noreferrer"
className="px-5 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg transition-colors flex items-center gap-2"
>
Create Page <ExternalLink size={14} />
</a>
</div>
</div>
</div>
</div>
);
}