| 1 |
import React from "react"; |
| 2 |
import { createPortal } from "react-dom"; |
| 3 |
import { |
| 4 |
Crown, |
| 5 |
X, |
| 6 |
Sparkles, |
| 7 |
CheckCircle2, |
| 8 |
ArrowRight, |
| 9 |
Zap, |
| 10 |
Play, |
| 11 |
} from "lucide-react"; |
| 12 |
import { __ } from "../../lib/i18n"; |
| 13 |
import { |
| 14 |
Card, |
| 15 |
CardContent, |
| 16 |
CardHeader, |
| 17 |
CardTitle, |
| 18 |
CardDescription, |
| 19 |
} from "../ui/card"; |
| 20 |
import { Button } from "../ui/button"; |
| 21 |
|
| 22 |
interface PremiumUpgradeDialogProps { |
| 23 |
open: boolean; |
| 24 |
onClose: () => void; |
| 25 |
moduleName?: string; |
| 26 |
purchaseUrl?: string; |
| 27 |
moduleDescription?: string; |
| 28 |
} |
| 29 |
|
| 30 |
export const PremiumUpgradeDialog: React.FC<PremiumUpgradeDialogProps> = ({ |
| 31 |
open, |
| 32 |
onClose, |
| 33 |
moduleName, |
| 34 |
purchaseUrl, |
| 35 |
moduleDescription, |
| 36 |
}) => { |
| 37 |
if (!open) return null; |
| 38 |
|
| 39 |
return createPortal( |
| 40 |
<div |
| 41 |
className="fixed top-0 left-0 right-0 bottom-0 m-0 bg-black/60 backdrop-blur-sm flex items-center justify-center px-4 pb-4" |
| 42 |
style={{ |
| 43 |
zIndex: 999999, |
| 44 |
position: "fixed", |
| 45 |
top: 0, |
| 46 |
left: 0, |
| 47 |
right: 0, |
| 48 |
bottom: 0, |
| 49 |
}} |
| 50 |
> |
| 51 |
<div className="relative w-full max-w-5xl"> |
| 52 |
{/* Subtle premium glow */} |
| 53 |
<div className="absolute -inset-0.5 bg-gradient-to-r from-orange-500/20 via-orange-400/20 to-orange-500/20 rounded-2xl blur-2xl"></div> |
| 54 |
|
| 55 |
<Card className="relative w-full shadow-2xl border border-orange-300/80 dark:border-orange-700/50 bg-white dark:bg-slate-900 overflow-hidden max-h-[90vh] flex flex-col"> |
| 56 |
{/* Premium accent bar */} |
| 57 |
<div className="absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-orange-500 via-orange-400 to-orange-500"></div> |
| 58 |
|
| 59 |
<CardHeader className="relative pb-4 pt-6 border-b border-gray-200 dark:border-gray-800 flex-shrink-0 bg-gradient-to-b from-orange-50/30 to-transparent dark:from-orange-950/20"> |
| 60 |
<div className="flex items-start justify-between"> |
| 61 |
<div className="flex items-start gap-4"> |
| 62 |
<div className="w-12 h-12 rounded-full bg-gradient-to-br from-orange-500 to-orange-600 flex items-center justify-center flex-shrink-0"> |
| 63 |
<Crown className="w-6 h-6 text-white" /> |
| 64 |
</div> |
| 65 |
<div> |
| 66 |
<CardTitle className="text-xl font-bold text-gray-900 dark:text-white"> |
| 67 |
{moduleName |
| 68 |
? `${moduleName} - Premium Feature` |
| 69 |
: "Premium Feature"} |
| 70 |
</CardTitle> |
| 71 |
<CardDescription className="text-gray-600 dark:text-gray-400 mt-1"> |
| 72 |
{moduleDescription || |
| 73 |
"This feature requires Yatra Pro to unlock powerful premium capabilities."} |
| 74 |
</CardDescription> |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
<Button |
| 78 |
variant="ghost" |
| 79 |
size="sm" |
| 80 |
onClick={onClose} |
| 81 |
className="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200" |
| 82 |
> |
| 83 |
<X className="w-4 h-4" /> |
| 84 |
</Button> |
| 85 |
</div> |
| 86 |
</CardHeader> |
| 87 |
|
| 88 |
<CardContent className="flex-1 overflow-hidden pt-6 px-6 pb-6"> |
| 89 |
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6 h-full"> |
| 90 |
{/* Left Side - Module Description */} |
| 91 |
<div className="flex flex-col overflow-y-auto pr-3"> |
| 92 |
<div className="space-y-4"> |
| 93 |
<div> |
| 94 |
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2"> |
| 95 |
<Zap className="w-4 h-4 text-orange-500" /> |
| 96 |
{__("What This Module Does", "yatra")} |
| 97 |
</h3> |
| 98 |
<p className="text-gray-600 dark:text-gray-400 leading-relaxed"> |
| 99 |
{moduleDescription || |
| 100 |
__( |
| 101 |
"This premium module adds advanced functionality to your Yatra booking system, helping you grow your business and streamline operations.", |
| 102 |
"yatra", |
| 103 |
)} |
| 104 |
</p> |
| 105 |
</div> |
| 106 |
|
| 107 |
{/* Feature List */} |
| 108 |
<div> |
| 109 |
<h4 className="font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2"> |
| 110 |
<Sparkles className="w-4 h-4 text-orange-500" /> |
| 111 |
{__("Key Features", "yatra")} |
| 112 |
</h4> |
| 113 |
<ul className="space-y-2 text-sm text-gray-600 dark:text-gray-400"> |
| 114 |
<li className="flex items-start gap-2"> |
| 115 |
<CheckCircle2 className="w-4 h-4 text-green-500 flex-shrink-0 mt-0.5" /> |
| 116 |
<span> |
| 117 |
{__("Advanced analytics and reporting", "yatra")} |
| 118 |
</span> |
| 119 |
</li> |
| 120 |
<li className="flex items-start gap-2"> |
| 121 |
<CheckCircle2 className="w-4 h-4 text-green-500 flex-shrink-0 mt-0.5" /> |
| 122 |
<span> |
| 123 |
{__("Automated workflows and notifications", "yatra")} |
| 124 |
</span> |
| 125 |
</li> |
| 126 |
<li className="flex items-start gap-2"> |
| 127 |
<CheckCircle2 className="w-4 h-4 text-green-500 flex-shrink-0 mt-0.5" /> |
| 128 |
<span> |
| 129 |
{__("Enhanced customer management tools", "yatra")} |
| 130 |
</span> |
| 131 |
</li> |
| 132 |
<li className="flex items-start gap-2"> |
| 133 |
<CheckCircle2 className="w-4 h-4 text-green-500 flex-shrink-0 mt-0.5" /> |
| 134 |
<span> |
| 135 |
{__("Priority support and updates", "yatra")} |
| 136 |
</span> |
| 137 |
</li> |
| 138 |
</ul> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
|
| 143 |
{/* Right Side - Video Preview */} |
| 144 |
<div className="flex flex-col"> |
| 145 |
<div> |
| 146 |
<h4 className="font-semibold text-gray-900 dark:text-white mb-3 flex items-center gap-2"> |
| 147 |
<Play className="w-4 h-4 text-orange-500" /> |
| 148 |
{__("See It In Action", "yatra")} |
| 149 |
</h4> |
| 150 |
<div className="aspect-video bg-gray-100 dark:bg-gray-800 rounded-lg flex items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600"> |
| 151 |
<div className="text-center"> |
| 152 |
<Play className="w-12 h-12 text-gray-400 mx-auto mb-2" /> |
| 153 |
<p className="text-sm text-gray-500 dark:text-gray-400"> |
| 154 |
{__("Click to watch demo video", "yatra")} |
| 155 |
</p> |
| 156 |
</div> |
| 157 |
</div> |
| 158 |
</div> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
</CardContent> |
| 162 |
|
| 163 |
<div className="border-t border-gray-200 dark:border-gray-800 p-6 bg-gray-50 dark:bg-gray-900/50"> |
| 164 |
<div className="flex flex-col sm:flex-row items-center justify-between gap-4"> |
| 165 |
<div className="text-center sm:text-left"> |
| 166 |
<p className="text-sm text-gray-600 dark:text-gray-400"> |
| 167 |
Upgrade to Yatra Pro and unlock this feature today |
| 168 |
</p> |
| 169 |
</div> |
| 170 |
<Button |
| 171 |
className="bg-gradient-to-r from-orange-600 to-orange-500 hover:from-orange-700 hover:to-orange-600 text-white px-6 py-2 font-medium shadow-lg hover:shadow-xl transition-all duration-200 group" |
| 172 |
onClick={() => |
| 173 |
window.open( |
| 174 |
purchaseUrl || "https://wpyatra.com/pricing", |
| 175 |
"_blank", |
| 176 |
) |
| 177 |
} |
| 178 |
> |
| 179 |
<Sparkles className="w-4 h-4 mr-2 group-hover:rotate-12 transition-transform" /> |
| 180 |
{__("Upgrade to Pro", "yatra")} |
| 181 |
<ArrowRight className="w-4 h-4 group-hover:translate-x-1 transition-transform" /> |
| 182 |
</Button> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
</Card> |
| 186 |
</div> |
| 187 |
</div>, |
| 188 |
document.body, |
| 189 |
); |
| 190 |
}; |
| 191 |
|