import React, { useState, useEffect } from 'react'; import { Dialog, DialogContent } from './dialog'; import { Button } from './Button'; import { FiFileText, FiCheck, FiX, FiShield, FiChevronDown, } from 'react-icons/fi'; import Typography from './Typography'; import { useLegalStore } from '../../stores/legalStore'; import { processMarkdown } from '../../utils/markdownProcessor'; import { motion, AnimatePresence } from 'framer-motion'; import { TERMS_OF_SERVICE } from '../../constants/legal'; interface TermsModalProps { open: boolean; onOpenChange: (open: boolean) => void; onAccept: () => void; onDecline: () => void; } /** * Terms of Service modal component for displaying and accepting terms */ export const TermsModal: React.FC = ({ open, onOpenChange, onAccept, onDecline, }) => { const [hasScrolledToBottom, setHasScrolledToBottom] = useState(false); const { legalAcceptance } = useLegalStore(); const termsContent = TERMS_OF_SERVICE; const isLoading = false; const handleScroll = (e: React.UIEvent) => { const element = e.currentTarget; const hasScrolledToEnd = element.scrollHeight - element.scrollTop <= element.clientHeight + 10; setHasScrolledToBottom(hasScrolledToEnd); }; const handleAccept = () => { onAccept(); onOpenChange(false); }; const handleDecline = () => { onDecline(); onOpenChange(false); }; return ( {/* Clean header */}
Terms of Service Please review and accept the terms to continue
{isLoading ? (
Loading Terms of Service...
) : ( <>
{!hasScrolledToBottom && ( Scroll to read the complete terms )} )}
{legalAcceptance.termsAccepted && ( Previously accepted )}
); };