'use client';

import { useMemo } from 'react';
import { cn } from '@/lib/utils/cn';
import { meetingNotesHtml } from '../notes';

/**
 * QA #648: a meeting's notes as rich text (bold, italic, lists, links), as HubSpot shows them:
 * sanitized HTML, or older plain notes escaped with their line breaks. Nothing for no notes.
 */
export function MeetingNotes({ notes, className }: { notes: string; className?: string }) {
  const html = useMemo(() => meetingNotesHtml(notes), [notes]);
  return html ? (
    <div className={cn('md-rich-notes', className)} dangerouslySetInnerHTML={{ __html: html }} />
  ) : null;
}
