import { faDotCircle as defaultDomainIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import type { FC } from 'react'; import { useEffect } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; import type { ShlinkDomainRedirects } from '../api-contract'; import type { Domain } from './data'; import { DomainDropdown } from './helpers/DomainDropdown'; import { DomainStatusIcon } from './helpers/DomainStatusIcon'; import type { EditDomainRedirects } from './reducers/domainRedirects'; interface DomainRowProps { domain: Domain; defaultRedirects?: ShlinkDomainRedirects; editDomainRedirects: (redirects: EditDomainRedirects) => Promise; checkDomainHealth: (domain: string) => void; } const Nr: FC<{ fallback?: string | null }> = ({ fallback }) => ( {!fallback && No redirect} {fallback && <>{fallback} (as fallback)} ); const DefaultDomain: FC = () => ( <> Default domain ); export const DomainRow: FC = ( { domain, editDomainRedirects, checkDomainHealth, defaultRedirects }, ) => { const { domain: authority, isDefault, redirects, status } = domain; useEffect(() => { checkDomainHealth(domain.domain); }, []); return ( {isDefault && } {authority} {redirects?.baseUrlRedirect ?? } {redirects?.regular404Redirect ?? } {redirects?.invalidShortUrlRedirect ?? } ); };