import { FC, Fragment } from 'react'; import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { ServerData } from '../data'; interface DuplicatedServersModalProps { duplicatedServers: ServerData[]; isOpen: boolean; onDiscard: () => void; onSave: () => void; } export const DuplicatedServersModal: FC = ( { isOpen, duplicatedServers, onDiscard, onSave }, ) => { const hasMultipleServers = duplicatedServers.length > 1; return ( Duplicated server{hasMultipleServers && 's'}

{hasMultipleServers ? 'The next servers already exist:' : 'There is already a server with:'}

    {duplicatedServers.map(({ url, apiKey }, index) => !hasMultipleServers ? (
  • URL: {url}
  • API key: {apiKey}
  • ) :
  • {url} - {apiKey}
  • )}
{hasMultipleServers ? 'Do you want to ignore duplicated servers' : 'Do you want to save this server anyway'}?
); };