import { FC } from 'react'; import { Button, UncontrolledTooltip } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBan as forbiddenIcon, faCheck as defaultDomainIcon, faEdit as editIcon, } from '@fortawesome/free-solid-svg-icons'; import { ShlinkDomain, ShlinkDomainRedirects } from '../api/types'; import { useToggle } from '../utils/helpers/hooks'; import { OptionalString } from '../utils/utils'; import { EditDomainRedirectsModal } from './helpers/EditDomainRedirectsModal'; interface DomainRowProps { domain: ShlinkDomain; defaultRedirects?: ShlinkDomainRedirects; editDomainRedirects: (domain: string, redirects: Partial) => Promise; } const Nr: FC<{ fallback: OptionalString }> = ({ fallback }) => ( {!fallback && No redirect} {fallback && <>{fallback} (as fallback)} ); const DefaultDomain: FC = () => ( <> Default domain ); export const DomainRow: FC = ({ domain, editDomainRedirects, defaultRedirects }) => { const [ isOpen, toggle ] = useToggle(); const { domain: authority, isDefault, redirects } = domain; const domainId = `domainEdit${authority.replace('.', '')}`; return ( {isDefault ? : ''} {authority} {redirects?.baseUrlRedirect ?? } {redirects?.regular404Redirect ?? } {redirects?.invalidShortUrlRedirect ?? } {isDefault && ( Redirects for default domain cannot be edited here.
Use config options or env vars.
)} ); };