import React, { useState, useEffect } from 'react'; import { ExternalLinkIcon } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { LearningMaterial } from '@/hooks/useLearnings'; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { ChevronRightIcon, BookOpenIcon, ShieldExclamationIcon, AcademicCapIcon } from '@heroicons/react/24/outline'; interface LearningSectionProps { learningData: LearningMaterial | null; } export const LearningSection: React.FC = ({ learningData }) => { const { t, i18n } = useTranslation(); const [expanded, setExpanded] = useState(false); useEffect(() => { if (learningData) { console.log('Learning data loaded:', { title: learningData.title, language: i18n.language, didYouKnow: learningData.didYouKnow?.substring(0, 30) + '...', referencesCount: learningData.references?.length }); } else { console.log('No learning data loaded'); } }, [learningData, i18n.language]); if (!learningData) return null; return (

{t('learning.header')}

{learningData.didYouKnow}

{expanded ? (

{t('learning.learnMore')}

{learningData.references.map((ref, index) => (
{ref.title}

{ref.summary}

Source: {ref.source} {t('learning.readArticle')}
))}
) : ( )}
); };