import React, { useContext, useEffect, useRef, useState } from 'react'; import { WebSettingsContext } from '../WebSettings'; import { Card, Collapse, Image } from 'react-bootstrap'; import { DocStringComponent } from './DocStringComponent'; import { ChevronDown, ChevronRight } from 'react-bootstrap-icons'; import { getIdFromFullAccessPath } from '../utils/stringUtils'; import { LevelName } from './NotificationsComponent'; interface ImageComponentProps { name: string; parentPath: string; value: string; readOnly: boolean; docString: string; format: string; addNotification: (message: string, levelname?: LevelName) => void; } export const ImageComponent = React.memo((props: ImageComponentProps) => { const { name, parentPath, value, docString, format, addNotification } = props; const renderCount = useRef(0); const [open, setOpen] = useState(true); const fullAccessPath = [parentPath, name].filter((element) => element).join('.'); const id = getIdFromFullAccessPath(fullAccessPath); const webSettings = useContext(WebSettingsContext); let displayName = name; if (webSettings[fullAccessPath] && webSettings[fullAccessPath].displayName) { displayName = webSettings[fullAccessPath].displayName; } useEffect(() => { renderCount.current++; }); useEffect(() => { addNotification(`${parentPath}.${name} changed.`); }, [props.value]); return (
Render count: {renderCount.current}
)}No image set in the backend.
) : (