import { IonItem, IonAvatar, IonLabel, IonIcon, IonToggle, IonReorder, IonButton } from "@ionic/react"; import { MdxProfile } from "../../../types"; import { getIconUrl } from "../../../utils/iframeTools/mdxHtmlTools"; import { bookOutline, checkmarkCircleOutline, constructOutline } from "ionicons/icons"; // Profile List Item Component interface ProfileListItemProps { profile: MdxProfile; onToggle?: (profile: MdxProfile) => void; onOpen?: (profile: MdxProfile) => void; onRebuildIndex?: (profile: MdxProfile) => void; showToggle?: boolean; showReorder?: boolean; showRebuildButton?: boolean; style?: React.CSSProperties; } export const ProfileListItem: React.FC = ({ profile, onToggle, onOpen, onRebuildIndex, showToggle = false, showReorder = false, showRebuildButton = false, style = {} }) => { return ( { if (showToggle) { onToggle?.(profile); } else { onOpen?.(profile); } }} > {profile.title} { // Fallback to icon if image fails to load e.currentTarget.style.display = 'none'; e.currentTarget.parentElement!.innerHTML = ` `; }} /> {profile.title} {!showToggle && profile.isActive && ( )} {showRebuildButton && ( { e.stopPropagation(); onRebuildIndex?.(profile); }} > )} {showToggle && ( { e.stopPropagation(); onToggle?.(profile); }} color="success" slot="end" /> )} {showReorder && ( )} ); };