import React, { useState, useEffect } from 'react';
import { Navbar } from './components/Navbar';
import { HeroHeader } from './components/HeroHeader';
import { TableOfContents } from './components/TableOfContents';
import { ArticleView } from './components/ArticleView';
import { SeoAuditDrawer } from './components/SeoAuditDrawer';
import { CopyExportModal } from './components/CopyExportModal';
import { ARTICLE_SECTIONS, SEO_DATA } from './data/articleData';
import {
ArrowUp,
Copy,
Sparkles,
ShieldCheck,
FileText,
Check,
Heart,
ExternalLink
} from 'lucide-react';
export default function App() {
const [affiliateLink, setAffiliateLink] = useState('https://warriorplus.com/o2/a/your-link-here');
const [activeSection, setActiveSection] = useState('intro');
const [scrollProgress, setScrollProgress] = useState(0);
const [showSeoDrawer, setShowSeoDrawer] = useState(false);
const [showCopyModal, setShowCopyModal] = useState(false);
const [toastMessage, setToastMessage] = useState
(null);
// Track scroll progress and active section
useEffect(() => {
const handleScroll = () => {
const totalScroll = document.documentElement.scrollTop;
const windowHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight;
const scroll = `${(totalScroll / windowHeight) * 100}`;
setScrollProgress(Number(scroll));
// Check which section is in view
const sectionElements = ARTICLE_SECTIONS.map(s => document.getElementById(s.id));
const scrollPosition = window.scrollY + 200;
for (let i = sectionElements.length - 1; i >= 0; i--) {
const el = sectionElements[i];
if (el && el.offsetTop <= scrollPosition) {
setActiveSection(ARTICLE_SECTIONS[i].id);
break;
}
}
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}, []);
const handleSelectSection = (id: string) => {
setActiveSection(id);
const element = document.getElementById(id);
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
};
const showToast = (msg: string) => {
setToastMessage(msg);
setTimeout(() => setToastMessage(null), 3000);
};
const handleScrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
};
return (
{/* Scroll Progress Bar */}
{/* Top Navbar */}
{
setAffiliateLink(link);
showToast("Affiliate link updated across all buttons!");
}}
onOpenSeoDrawer={() => setShowSeoDrawer(true)}
onOpenCopyModal={() => setShowCopyModal(true)}
activeReadingSection={activeSection}
/>
{/* Toast Notification */}
{toastMessage && (
{toastMessage}
)}
{/* Main Content Layout */}
{/* Editorial Hero Header */}
{/* 2-Column Reader Layout */}
{/* Left Column: Floating Table of Contents (Desktop) */}
{/* Right Column: Comprehensive Article View */}
{/* Floating Action Buttons */}
setShowCopyModal(true)}
className="hidden sm:flex items-center gap-1.5 px-4 py-2.5 rounded-full bg-emerald-600 hover:bg-emerald-700 text-white font-bold text-xs shadow-xl hover:shadow-emerald-600/30 transition transform hover:-translate-y-0.5 active:scale-95"
>
Copy Article (~3,520 Words)
{/* Modals & Drawers */}
setShowSeoDrawer(false)}
/>
setShowCopyModal(false)}
affiliateLink={affiliateLink}
/>
{/* Footer & FTC Affiliate Disclosure */}
);
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন