import React, { useState } from 'react'; import { AgeVerificationModal } from './AgeVerificationModal'; interface ContentRatingToggleProps { contentRating: 'sfw' | 'mature'; onRatingChange: (rating: 'sfw' | 'mature') => void; disabled?: boolean; } /** * Content Rating Toggle * * A prominent toggle switch in the header that controls SFW/Mature mode. * Switching to Mature requires age verification. */ export const ContentRatingToggle: React.FC = ({ contentRating, onRatingChange, disabled = false, }) => { const [showVerification, setShowVerification] = useState(false); const isMature = contentRating === 'mature'; const handleToggle = () => { if (disabled) return; if (isMature) { // Switching back to SFW - no verification needed onRatingChange('sfw'); } else { // Switching to Mature - show verification setShowVerification(true); } }; const handleVerified = () => { setShowVerification(false); onRatingChange('mature'); }; return ( <>
{showVerification && ( setShowVerification(false)} /> )} ); };