import type { FC } from 'react'; import { DropdownItem } from 'reactstrap'; import { Link } from 'react-router-dom'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBan as toggleOffIcon, faEdit as editIcon, faMinusCircle as deleteIcon, faPlug as connectIcon, } from '@fortawesome/free-solid-svg-icons'; import { faCircle as toggleOnIcon } from '@fortawesome/free-regular-svg-icons'; import { DropdownBtnMenu } from '../utils/DropdownBtnMenu'; import { useToggle } from '../utils/helpers/hooks'; import type { DeleteServerModalProps } from './DeleteServerModal'; import type { ServerWithId } from './data'; export interface ManageServersRowDropdownProps { server: ServerWithId; } interface ManageServersRowDropdownConnectProps extends ManageServersRowDropdownProps { setAutoConnect: (server: ServerWithId, autoConnect: boolean) => void; } export const ManageServersRowDropdown = ( DeleteServerModal: FC, ): FC => ({ server, setAutoConnect }) => { const [isMenuOpen, toggleMenu] = useToggle(); const [isModalOpen,, showModal, hideModal] = useToggle(); const serverUrl = `/server/${server.id}`; const { autoConnect: isAutoConnect } = server; const autoConnectIcon = isAutoConnect ? toggleOffIcon : toggleOnIcon; return ( Connect Edit server setAutoConnect(server, !isAutoConnect)}> {isAutoConnect ? 'Do not a' : 'A'}uto-connect Remove server ); };