/** * Modal odpowiedzialny za prezentację i eksport analizy artykułu do formatu PDF. * * Odpowiada za: * - wyświetlenie podglądu raportu analitycznego w oknie modalnym, * - przekazanie danych artykułu do generatora PDF, * - obsługę stanu ładowania pełnej treści artykułu, * - inicjację i zakończenie procesu eksportu. */ "use client"; import React from 'react'; import PDFGenerator from './PDFGenerator'; import { Article } from '../lib/fetchNews'; import type { Lang } from '../lib/types'; interface PDFModalProps { article: Article; language: Lang; sentimentLabel: string; sentimentColor: string; fullContent: string; isLoadingContent: boolean; showPDF: boolean; onClose: () => void; onExportStart: () => void; onExportEnd: () => void; } export default function PDFModal({ article, language, sentimentLabel, sentimentColor, fullContent, isLoadingContent, showPDF, onClose, onExportStart, onExportEnd }: PDFModalProps) { if (!showPDF) return null; const T = (pl: string, no: string, en: string) => language === "pl" ? pl : language === "no" ? no : en; return (

{T("Eksport PDF", "PDF-eksport", "PDF Export")} - {article.title}

{article.title}

{T("Źródło", "Kilde", "Source")}:
{article.source}
{T("Data publikacji", "Publiseringsdato", "Publication date")}:
{article.published}
{T("Sentyment", "Sentimentanalyse", "Sentiment")}:
{sentimentLabel}
{T("Prawd. Fake News", "Sannsynlighet falske nyheter", "Fake News Prob.")}:
{typeof article.fake_probability === "number" ? `${article.fake_probability.toFixed(2)}%` : "N/A"}

{T("Pełna treść artykułu", "Fullstendig artikkelinnhold", "Full Article Content")}

{isLoadingContent ? (

{T("Pobieranie pełnej treści...", "Laster inn fullstendig innhold...", "Loading full content...")}

) : (
{fullContent || article.summary || article.description || T("Brak dostępnej treści", "Ingen innhold tilgjengelig", "No content available")}
)} {(fullContent && fullContent.length > 0) && (
ℹ️ {T( "Treść pobrana automatycznie z oryginalnego źródła", "Innhold automatisk hentet fra original kilde", "Content automatically fetched from original source" )}
)}
{article.link && (

{T("Link do oryginalnego artykułu", "Original artikkellenke", "Original Article Link")}

)}

{T("Wygenerowano przez ThruScan Analysis", "Generert av ThruScan Analysis", "Generated by ThruScan Analysis")}

{new Date().toLocaleDateString(language === "pl" ? "pl-PL" : language === "no" ? "no-NO" : "en-US", { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })}

); }