import type { FC } from 'react'; import { useEffect } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faDotCircle as defaultDomainIcon } from '@fortawesome/free-solid-svg-icons'; import type { ShlinkDomainRedirects } from '../api/types'; import type { OptionalString } from '../utils/utils'; import type { SelectedServer } from '../servers/data'; import type { Domain } from './data'; import { DomainStatusIcon } from './helpers/DomainStatusIcon'; import { DomainDropdown } from './helpers/DomainDropdown'; import type { EditDomainRedirects } from './reducers/domainRedirects'; interface DomainRowProps { domain: Domain; defaultRedirects?: ShlinkDomainRedirects; editDomainRedirects: (redirects: EditDomainRedirects) => 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 ?? } ); };