import React, { useMemo } from 'react';
import { useMapActions, useMapInteraction } from '@/contexts/MapContexts.tsx';
import { useTranslation } from '@/hooks/useI18n.tsx';
import { useOrganizations } from '@/hooks/useOrganizations.ts';
import { ExternalLink } from 'lucide-react';
import { Building2 } from 'lucide-react';
import Button from '@/components/ui/Button.tsx';
import Separator from '@/components/ui/Separator.tsx';
import HistoricalContextAI from '@/components/map/HistoricalContextAI.tsx';
const InfoLine = ({ label, value }: { label: string; value?: string | React.ReactNode }) => {
if (!value) return null;
return (
<>
{label}
{value}
>
);
};
const HistoricalSidebarPreview = () => {
const { organizations } = useOrganizations();
const { t } = useTranslation();
const { selectedLandmark: landmark } = useMapInteraction();
const { handleViewOrganization: onViewOrganization } = useMapActions();
const relatedOrg = useMemo(() => {
if (!landmark?.relatedOrgId) return null;
return organizations.find((org) => org.ID === landmark.relatedOrgId) || null;
}, [landmark, organizations]);
if (!landmark) return null;
return (
{landmark.imageUrl ? (

{
(e.target as HTMLImageElement).style.display = 'none';
}}
/>
) : (
)}
{landmark.period}
{landmark.name}
{t('mapSidebar.locationAndStatus')}
{relatedOrg && (
<>
-
{t('mapSidebar.relatedOrganization')}
-
{relatedOrg.Name}
>
)}
{t('mapSidebar.historicalContext')}
{landmark.historicalNotes && landmark.historicalNotes.length > 0 && (
{landmark.historicalNotes.map((note, i) => (
- {note}
))}
}
/>
)}
);
};
export default HistoricalSidebarPreview;