"use client"; import React, { useState, useEffect, useRef } from 'react'; import Header from './components/Header'; import AI from './components/AI'; import FAQ from './components/Faq'; // Ensure the import path is correct import Documentation from './components/Documentation'; // Ensure the import path is correct import History from './components/History'; import Models from './components/Models'; import Credits from './components/Credits'; import './styles/master.css'; const LandingPage: React.FC = () => { const [showDivs, setShowDivs] = useState(true); const [view, setView] = useState<'AI' | 'FAQ' | 'Documentation' | 'Credits'>('AI'); // Added 'Credits' here const conversationRef = useRef(null); useEffect(() => { const scrollToBottom = () => { const conversation = conversationRef.current; if (conversation) { conversation.scrollTop = conversation.scrollHeight; } }; scrollToBottom(); const observer = new MutationObserver(scrollToBottom); if (conversationRef.current) { observer.observe(conversationRef.current, { childList: true, subtree: true, }); } return () => { if (conversationRef.current) { observer.disconnect(); } }; }, []); const toggleDivs = () => { setShowDivs(prevState => !prevState); }; const handleViewChange = (view: 'AI' | 'FAQ' | 'Documentation' | 'Credits') => { // Added 'Credits' here as well setView(view); if (view !== 'AI') { setShowDivs(false); } }; return (
{showDivs && (
)}
{view === 'AI' && } {view === 'FAQ' && } {view === 'Documentation' && } {view === 'Credits' && } {/* Now Credits will render properly */}
); }; export default LandingPage;