import React, { useMemo } from 'react'; import { getSectorDisplay } from '@/constants.tsx'; import { useMapActions, useMapInteraction } from '@/contexts/MapContexts.tsx'; import { useTranslation } from '@/hooks/useI18n.tsx'; import { mapBackendSectorToTranslationKey } from '@/lib/sector-mapper.ts'; import Button from '@/components/ui/Button.tsx'; import VerifiedBadge from '@/components/ui/VerifiedBadge.tsx'; const SidebarPreview: React.FC = () => { const { t } = useTranslation(); const { selectedOrg } = useMapInteraction(); const { handleViewOrganization } = useMapActions(); if (!selectedOrg) return null; const sectorDisplay = getSectorDisplay(selectedOrg.Sector); return (
{selectedOrg.LogoURL ? ( {`${selectedOrg.Name} { // Hide broken images gracefully (e.target as HTMLImageElement).style.display = 'none'; }} /> ) : ( sector && (
{React.cloneElement(sectorDisplay.icon, { className: 'h-8 w-8 text-primary-foreground', })}
) )}

{selectedOrg.Name}

{sector && (

{t(sectorDisplay.nameKey)}

)} {selectedOrg.Address && (

{selectedOrg.Address}

)} {selectedOrg.Verified && (
)}

{selectedOrg.Description}

); }; export default React.memo(SidebarPreview);