import { faChartPie as pieChartIcon, faEdit as editIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC } from 'react'; import { Link } from 'react-router-dom'; import { DropdownItem } from 'reactstrap'; import type { SelectedServer } from '../../servers/data'; import { getServerId } from '../../servers/data'; import { useFeature } from '../../utils/helpers/features'; import { useToggle } from '../../utils/helpers/hooks'; import { RowDropdownBtn } from '../../utils/RowDropdownBtn'; import { DEFAULT_DOMAIN } from '../../visits/reducers/domainVisits'; import type { Domain } from '../data'; import type { EditDomainRedirects } from '../reducers/domainRedirects'; import { EditDomainRedirectsModal } from './EditDomainRedirectsModal'; interface DomainDropdownProps { domain: Domain; editDomainRedirects: (redirects: EditDomainRedirects) => Promise; selectedServer: SelectedServer; } export const DomainDropdown: FC = ({ domain, editDomainRedirects, selectedServer }) => { const [isModalOpen, toggleModal] = useToggle(); const { isDefault } = domain; const canBeEdited = !isDefault || useFeature('defaultDomainRedirectsEdition', selectedServer); const withVisits = useFeature('domainVisits', selectedServer); const serverId = getServerId(selectedServer); return ( {withVisits && ( Visit stats )} Edit redirects ); };