import React from 'react'; import { CurrentView, NewsArticle } from '../types'; import { SECTION_IDS, NEWS_ARTICLE_DETAIL_CONTENT } from '../constants'; // Removed mockNews import Button from './Button'; import { ArrowUturnLeftIcon, ChevronRightIcon } from './icons'; import ItemDetailNavigation from './ItemDetailNavigation'; import NewsCard from './NewsCard'; import GalleryComponent from './GalleryComponent'; // Import GalleryComponent interface NewsArticleDetailProps { itemId: string; allNews: NewsArticle[]; setCurrentView: (view: CurrentView) => void; setSelectedItemId: (id: string | null) => void; } const NewsArticleDetail: React.FC = ({ itemId, allNews, setCurrentView, setSelectedItemId }) => { const article = allNews.find(p => p.id === itemId); const handleBackClick = () => { setCurrentView('newsAll'); setSelectedItemId(null); }; const handleNavigateItem = (newItemId: string) => { setSelectedItemId(newItemId); }; const handleShowAllKeepReading = (e: React.MouseEvent) => { e.preventDefault(); setCurrentView('newsAll'); setSelectedItemId(null); }; if (!article) { return (

{NEWS_ARTICLE_DETAIL_CONTENT.notFoundTitle}

); } const currentIndex = allNews.findIndex(p => p.id === itemId); const previousArticle = currentIndex > 0 ? allNews[currentIndex - 1] : undefined; const nextArticle = currentIndex < allNews.length - 1 ? allNews[currentIndex + 1] : undefined; const relatedArticles = allNews .filter(p => p.id !== itemId) .slice(0, 3); return (
{article.imageUrl && (
{article.title}
)}

{article.title}

{article.category} {article.date}
{article.description &&

{article.description}

} {typeof article.fullContent === 'string' ? (
) : ( article.fullContent )}
{article.gallery && article.gallery.length > 0 && ( )}
{relatedArticles.length > 0 && (

{NEWS_ARTICLE_DETAIL_CONTENT.keepReadingTitle || "Другие новости"}

{NEWS_ARTICLE_DETAIL_CONTENT.viewAllButtonText || `Все ${NEWS_ARTICLE_DETAIL_CONTENT.itemTypePlural}`}
{relatedArticles.map(relatedArticle => ( ))}
)}
); }; export default NewsArticleDetail;