Advertisement
Guest User

Untitled

a guest
Dec 17th, 2024
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use client";
  2.  
  3. import React from 'react';
  4. import { HighlightsPanel, TopicsPanel, SummaryPanel } from './panels';
  5. import { EntitiesPanel } from '@/components/entities/EntitiesPanel';
  6. import MapPanel from '@/components/maps/MapPanel';
  7. import type { Article } from '@/lib/types';
  8.  
  9. interface ArticleContentProps {
  10.   article: Article;
  11.   summaryOpen: boolean;
  12.   setSummaryOpen: (open: boolean) => void;
  13.   highlightsOpen: boolean;
  14.   setHighlightsOpen: (open: boolean) => void;
  15.   topicsOpen: boolean;
  16.   setTopicsOpen: (open: boolean) => void;
  17.   mapOpen: boolean;
  18.   setMapOpen: (open: boolean) => void;
  19.   entitiesOpen: boolean;
  20.   setEntitiesOpen: (open: boolean) => void;
  21. }
  22.  
  23. const ArticleContent = ({
  24.   article,
  25.   summaryOpen,
  26.   setSummaryOpen,
  27.   highlightsOpen,
  28.   setHighlightsOpen,
  29.   topicsOpen,
  30.   setTopicsOpen,
  31.   mapOpen,
  32.   setMapOpen,
  33.   entitiesOpen,
  34.   setEntitiesOpen,
  35. }: ArticleContentProps) => {
  36.   return (
  37.     <div className="w-full px-8">
  38.       {/* Header section */}
  39.       <div className="mb-8">
  40.         <h1 className="text-3xl font-bold mb-4 text-gray-900">
  41.           {article.headline || article.title}
  42.         </h1>
  43.  
  44.         {article.articleKicker && (
  45.           <div className="text-lg text-gray-600 mb-6">
  46.             {article.articleKicker}
  47.           </div>
  48.         )}
  49.  
  50.         <div className="flex items-center justify-between text-lg text-gray-700">
  51.           {article.author && (
  52.             <div className="font-bold">By {article.author}</div>
  53.           )}
  54.           <time dateTime={article.datePublished || article.date_created}>
  55.             {new Date(article.datePublished || article.date_created).toLocaleDateString("en-US", {
  56.               year: "numeric",
  57.               month: "long",
  58.               day: "numeric",
  59.             })}
  60.           </time>
  61.         </div>
  62.       </div>
  63.  
  64.       {/* Panels section */}
  65.       <div className="space-y-4 mb-8">
  66.         <TopicsPanel
  67.           isOpen={topicsOpen}
  68.           onClose={() => setTopicsOpen(false)}
  69.           article={article}
  70.         />
  71.  
  72.         <SummaryPanel
  73.           isOpen={summaryOpen}
  74.           onClose={() => setSummaryOpen(false)}
  75.           summary={article.mema_summary || null}
  76.         />
  77.  
  78.         <HighlightsPanel
  79.           isOpen={highlightsOpen}
  80.           onClose={() => setHighlightsOpen(false)}
  81.           articleTitle={article.headline || article.title}
  82.           highlights={article.highlights || []}
  83.         />
  84.  
  85.         <MapPanel
  86.           isOpen={mapOpen}
  87.           onClose={() => setMapOpen(false)}
  88.           article={article}
  89.         />
  90.  
  91.         <EntitiesPanel
  92.           isOpen={entitiesOpen}
  93.           onClose={() => setEntitiesOpen(false)}
  94.           article={article}
  95.         />
  96.       </div>
  97.  
  98.       {/* Article body section */}
  99.       <div id="article-body" className="prose max-w-none">
  100.         <div className="text-gray-800 text-lg leading-relaxed whitespace-pre-wrap">
  101.           {article.articleBody || article.content || (
  102.             <div className="text-gray-500 italic">
  103.               Article content not available
  104.             </div>
  105.           )}
  106.         </div>
  107.       </div>
  108.     </div>
  109.   );
  110. };
  111.  
  112. export default ArticleContent;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement