import { useRef } from 'react' import PropTypes from 'prop-types' import { useTranslation } from 'react-i18next' import Icon from '../../../../shared/components/icon' import { useFileTreeMainContext } from '../../contexts/file-tree-main' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import MaterialIcon from '@/shared/components/material-icon' function FileTreeItemMenu({ id, name }) { const { t } = useTranslation() const { contextMenuCoords, setContextMenuCoords } = useFileTreeMainContext() const menuButtonRef = useRef() const isMenuOpen = Boolean(contextMenuCoords) function handleClick(event) { event.stopPropagation() if (!contextMenuCoords) { const target = menuButtonRef.current.getBoundingClientRect() setContextMenuCoords({ top: target.top + target.height / 2, left: target.right, }) } else { setContextMenuCoords(null) } } return (