import { isEmpty, values } from 'ramda'; import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap'; import { Link } from 'react-router-dom'; import { faPlus as plusIcon, faServer as serverIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { getServerId, SelectedServer, ServersMap } from './data'; export interface ServersDropdownProps { servers: ServersMap; selectedServer: SelectedServer; } const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProps) => { const serversList = values(servers); const renderServers = () => { if (isEmpty(serversList)) { return ( Add a server ); } return ( <> {serversList.map(({ name, id }) => ( {name} ))} Manage servers ); }; return ( Servers {renderServers()} ); }; export default ServersDropdown;