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