← back to Goodquestion

src/components/historical/HistoricalContext.tsx

56 lines

'use client'

import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { BookOpen } from 'lucide-react'
import { HistoricalTimeline } from './HistoricalTimeline'
import { TrajectoryCharts } from './TrajectoryCharts'
import type { HistoricalContext as HistoricalContextType } from '@/types/swot'

interface HistoricalContextProps {
  context: HistoricalContextType | null
}

export function HistoricalContext({ context }: HistoricalContextProps) {
  if (!context) {
    return (
      <Card>
        <CardContent className="py-8">
          <p className="text-center text-muted-foreground">
            No historical context data available
          </p>
        </CardContent>
      </Card>
    )
  }

  return (
    <div className="space-y-6">
      {/* Summary */}
      <Card>
        <CardHeader>
          <CardTitle className="flex items-center gap-2">
            <BookOpen className="h-5 w-5" />
            Historical Context: {context.areaName}
          </CardTitle>
        </CardHeader>
        <CardContent>
          <div className="prose prose-sm max-w-none">
            <p className="text-muted-foreground leading-relaxed whitespace-pre-line">
              {context.summary}
            </p>
          </div>
        </CardContent>
      </Card>

      {/* Timeline */}
      <HistoricalTimeline events={context.keyEvents} />

      {/* Trajectory Charts */}
      <div>
        <h3 className="text-2xl font-bold mb-4">Economic Trajectory Analysis</h3>
        <TrajectoryCharts trajectories={context.trajectories} />
      </div>
    </div>
  )
}