import React, { useState, useEffect } from 'react'; import { Book, Gift, Briefcase, Users, TrendingUp, DollarSign, Award, ChevronDown, ChevronUp, CheckCircle, Calculator, ArrowRight, Edit3, Wallet, Volume2, StopCircle, PlayCircle, AlertTriangle, RefreshCcw, Star, PieChart, UserPlus } from 'lucide-react'; const App = () => { const [activeRank, setActiveRank] = useState(0); // --- Audio State --- const [isSpeaking, setIsSpeaking] = useState(false); const [currentSection, setCurrentSection] = useState(null); const [hasAudioSupport, setHasAudioSupport] = useState(true); // --- Calculator States --- const [calcRank, setCalcRank] = useState(1); // Default Retailer const [booksSold, setBooksSold] = useState(1); const [saleValue, setSaleValue] = useState(1999); // MRP const [profitShareValue, setProfitShareValue] = useState(1000); // CP // --- Multi-Leg Gap States --- const [myGapRank, setMyGapRank] = useState(5); // Default Master // लेग इनपुट्स (Member रैंक 0 से शुरू) const [legInputs, setLegInputs] = useState<{[key: number]: { members: number, qtyPerMember: number }}>({ 0: { members: 0, qtyPerMember: 0 }, // Member 1: { members: 0, qtyPerMember: 0 }, // Retailer 2: { members: 0, qtyPerMember: 0 }, // Super Retailer 3: { members: 0, qtyPerMember: 0 }, // Distributor 4: { members: 0, qtyPerMember: 0 }, // Super Distributor 5: { members: 0, qtyPerMember: 0 } // Master Distributor }); // --- Data --- const features = [ { icon: , title: "100% कैश बैक (Cashback)", desc: "बुक प्राइस (₹1999) का 100% कैशबैक! इसका उपयोग Htm Career Councling, Web Development, Digital marketing, और Htm Pay Mobile Application मे Utilities Services में किया जा सकता है। और भविष्य में स्कूल ऐडमिशन, मेडिसिन, ओपीडी, शॉपिंग आदि में भी।" }, { icon: , title: "लेखक रॉयल्टी गिफ्ट", desc: "बुक सेल होने पर पाठकों को क्रमानुसार 'राइटर रॉयल्टी गिफ्ट' मिलता है। जो पहले आएगा, वह पहले पाएगा।" }, { icon: , title: "रोजगार के अवसर", desc: "बुक पाठकों को विभिन्न कंपनियों की वैकेंसी, जॉब इंटरव्यू और Freelance Work की जानकारी व्हाट्सएप के माध्यम से दी जाती है।" }, { icon: , title: "FREE फ्रेंचाइजी कोड", desc: "हिंदुस्तान के किसी भी कोने से घर बैठे बिज़नेस करने का मौका। फ्री फ्रेंचाइजी कोड के साथ अपना नेटवर्क बनाएं।" }, { icon: , title: "स्पेशल बिज़नेस ट्रेनिंग", desc: "30 से 40 मिनट की फ्री ऑनलाइन ज़ूम मीटिंग ट्रेनिंग, जिसमें बिज़नेस को बढ़ाने के तरीके सिखाए जाते हैं।" } ]; // Added Member Rank at ID 0 const ranks = [ { id: 0, title: "Member", fullTitle: "Member (Fresher)", criteria: "0 - 4 बुक्स (Buy / Sale)", commission: 0, details: "शुरुआती रैंक। अभी कोई कमीशन नहीं। 5 बुक्स सेल करके या खरीदकर 'Retailer' बनें और 12.5% कमीशन अनलॉक करें।" }, { id: 1, title: "Retailer", fullTitle: "Retailer Franchise", criteria: "5 Book Buy / Sale", commission: 12.5, details: "डायरेक्ट सेल पर 12.5% आय। मेंबर्स (Members) की सेल पर 12.5% गैप कमीशन।" }, { id: 2, title: "Super Retailer", fullTitle: "Super Retailer", criteria: "25 Book Buy / Sale या 5 Retailers", commission: 25, details: "डायरेक्ट सेल पर 25% आय। रिटेलर से 12.5% और मेंबर से 25% का गैप कमीशन।" }, { id: 3, title: "Distributor", fullTitle: "Distributor", criteria: "125 Book Buy / Sale या 5 Super Retailers", commission: 37.5, details: "डायरेक्ट सेल पर 37.5% आय। सुपर रिटेलर से 12.5%, रिटेलर से 25% और मेंबर से 37.5% का गैप कमीशन।" }, { id: 4, title: "Super Dist.", fullTitle: "Super Distributor", criteria: "250 Book Buy / Sale या 5 Distributors", commission: 50, details: "डायरेक्ट सेल पर 50% आय। डिस्ट्रीब्यूटर से 12.5%, सुपर रिटेलर से 25%, रिटेलर से 37.5% और मेंबर से 50% का गैप।" }, { id: 5, title: "Master Dist.", fullTitle: "Master Distributor", criteria: "500 Book Buy / Sale या 5 Super Distributors", commission: 62.5, details: "डायरेक्ट सेल पर 62.5% आय। सुपर डिस्ट्रीब्यूटर से 12.5%, डिस्ट्रीब्यूटर से 25%, सुपर रिटेलर से 37.5%, रिटेलर से 50% और मेंबर से 62.5% का गैप। (मास्टर के नीचे मास्टर होने पर 10% रॉयल्टी)।" } ]; // --- Voice Assistant Logic --- useEffect(() => { if (typeof window !== 'undefined' && 'speechSynthesis' in window) { setHasAudioSupport(true); } else { setHasAudioSupport(false); } return () => { if (typeof window !== 'undefined' && 'speechSynthesis' in window) { window.speechSynthesis.cancel(); } } }, []); const stopSpeaking = () => { if (typeof window !== 'undefined' && 'speechSynthesis' in window) { window.speechSynthesis.cancel(); } setIsSpeaking(false); setCurrentSection(null); }; const speakText = (text: string, sectionName: string) => { if (!hasAudioSupport) return; if (isSpeaking && currentSection === sectionName) { stopSpeaking(); return; } try { window.speechSynthesis.cancel(); const utterance = new SpeechSynthesisUtterance(text); utterance.lang = 'hi-IN'; utterance.rate = 0.9; utterance.onstart = () => { setIsSpeaking(true); setCurrentSection(sectionName); }; utterance.onend = () => { setIsSpeaking(false); setCurrentSection(null); }; window.speechSynthesis.speak(utterance); } catch (error) { console.error("Speak failed:", error); setIsSpeaking(false); } }; const fullPlanScript = ` मैं किताब नहीं कमाई हूँ, फ्रेंचाइजी बिज़नेस मॉडल में आपका स्वागत है। यह एचटीएम ग्रुप्स द्वारा प्रस्तुत एक शानदार बिज़नेस अवसर है। इस बुक की कीमत 1999 रुपये है। इसे खरीदने के पांच बड़े फायदे हैं: 100% कैशबैक, रॉयल्टी गिफ्ट, रोजगार, फ्री फ्रेंचाइजी कोड और ट्रेनिंग। `; // --- Calculations --- // 1. Direct Income (On Profit Share Value, No Deduction) const calculateDirectIncome = () => { const commissionPercent = ranks[calcRank].commission; // Use Profit Share Value (CP) for calculation const gross = (profitShareValue * commissionPercent / 100) * booksSold; return { gross, net: gross }; }; // 2. Multi-Leg Gap (On Profit Share Value, No Deduction) const calculateTotalGapIncome = () => { let totalGross = 0; let totalBooks = 0; let breakdown: any[] = []; const myRankObj = ranks[myGapRank]; ranks.forEach(downlineRank => { const input = legInputs[downlineRank.id]; const qty = (input.members || 0) * (input.qtyPerMember || 0); if (qty > 0) { let income = 0; let rate = 0; let type = "Gap"; if (myGapRank === 5 && downlineRank.id === 5) { // Royalty Logic: 10% of Downline's Income (on CP) // Downline Master earns 62.5% of CP const downlineIncome = (profitShareValue * 62.5 / 100) * qty; income = downlineIncome * 0.10; rate = 10; type = "Royalty"; } else if (downlineRank.id < myGapRank) { // Normal Gap Logic (on CP) rate = myRankObj.commission - downlineRank.commission; income = (profitShareValue * rate / 100) * qty; type = `${rate.toFixed(1)}% Gap`; } else { // No Gap income = 0; type = "No Gap"; } totalBooks += qty; if (income > 0) { totalGross += income; breakdown.push({ rank: downlineRank.title, qty, type, amount: income }); } } }); return { totalGross, totalNet: totalGross, totalBooks, breakdown }; }; const directData = calculateDirectIncome(); const gapData = calculateTotalGapIncome(); const handleLegInputChange = (rankId: number, field: 'members' | 'qtyPerMember', val: string) => { const num = parseInt(val) || 0; setLegInputs(prev => ({ ...prev, [rankId]: { ...prev[rankId], [field]: num } })); }; const resetCalculator = () => { setLegInputs({ 0: { members: 0, qtyPerMember: 0 }, 1: { members: 0, qtyPerMember: 0 }, 2: { members: 0, qtyPerMember: 0 }, 3: { members: 0, qtyPerMember: 0 }, 4: { members: 0, qtyPerMember: 0 }, 5: { members: 0, qtyPerMember: 0 } }); }; return (
{/* --- Floating Audio Controller --- */} {hasAudioSupport && (
{isSpeaking && (
🔊 Speaking...
)}
)} {/* --- HERO SECTION (Original Design) --- */}
{/* Top Badge */}
BEST SELLING BUSINESS BOOK
{/* Main Title */}

Main Kitaab Nahin
Kamaee Hoon

{/* Sub Title */}

Franchise Business Model Explain

{/* Divider */}
{/* Author / Company */}

By HTM GROUPS

{/* Price Card */}

One Time Investment

₹{saleValue} /-

{/* Hero Audio Button */} {hasAudioSupport && ( )}
{/* --- BENEFITS SECTION --- */}

इस बुक को खरीदने के 5 बड़े लाभ

{hasAudioSupport && ( )}
{features.map((feature, index) => (
{feature.icon}

{feature.title}

{feature.desc}

))}
{/* --- RANKS ACCORDION (With Member 0%) --- */}

Franchise Business Ranks

{ranks.map((rank) => (
{activeRank === rank.id && (

Criteria: {rank.criteria}

Benefits: {rank.details}

)}
))}
{/* --- INCOME CALCULATOR --- */}

Income Calculator

{/* Global Value Setting */}
setSaleValue(Number(e.target.value))} className="w-full bg-gray-900 text-white p-3 pl-8 rounded-lg border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-400 text-center font-bold" />
CP setProfitShareValue(Number(e.target.value))} className="w-full bg-gray-900 text-white p-3 pl-8 rounded-lg border border-yellow-500/50 focus:outline-none focus:ring-2 focus:ring-yellow-400 text-center font-bold" />

Note: All Commissions & Royalties are calculated on Profit Share Value (CP).

{/* 1. Direct Income Calculator */}

Direct Sales Income

setBooksSold(Number(e.target.value))} className="w-full bg-gray-700 text-white p-3 rounded-lg border border-gray-600 focus:outline-none focus:ring-2 focus:ring-yellow-400" />

Net Direct Income

₹{directData.net.toFixed(0)}

{/* 2. MULTI-LEG GAP CALCULATOR */}

Team Gap Income

{/* My Rank Selection */}
{/* Input Table for Legs */}
Rank
Gap/Roy
Members
Qty/Mem
{ranks.map((rank) => { const isDisabled = rank.id > myGapRank; const inputData = legInputs[rank.id]; const totalQty = (inputData.members || 0) * (inputData.qtyPerMember || 0); return (
{/* Rank Name */}

{rank.title}

{rank.commission}% Slab

{/* Gap % Display */}
{myGapRank === 5 && rank.id === 5 ? ( 10%
Royalty
) : rank.id < myGapRank ? ( {(ranks[myGapRank].commission - rank.commission).toFixed(1)}%
Gap
) : ( 0%
Gap
)}
{/* Members Input */}
0 ? inputData.members : ''} onChange={(e) => handleLegInputChange(rank.id, 'members', e.target.value)} disabled={isDisabled} className="w-full bg-gray-900 border border-gray-600 rounded p-1.5 text-center text-white text-sm focus:ring-2 focus:ring-green-400 disabled:opacity-30 disabled:cursor-not-allowed" />
{/* Qty/Member Input */}
0 ? inputData.qtyPerMember : ''} onChange={(e) => handleLegInputChange(rank.id, 'qtyPerMember', e.target.value)} disabled={isDisabled} className="w-full bg-gray-900 border border-gray-600 rounded p-1.5 text-center text-white text-sm focus:ring-2 focus:ring-green-400 disabled:opacity-30 disabled:cursor-not-allowed" />
); })}
{/* Gap Income Result */}
Total Team Sales (Books)
{gapData.totalBooks}

Total Gap Income

₹{gapData.totalNet.toFixed(0)}

* महत्वपूर्ण नोट: नेट इनकम आपको 5% टीडीएस और 5% Admin चार्ज काटकर बैंक मे ट्रांसफर कर दी जाएगी।

{/* Footer */}
); }; export default App;