import { useCallback, useState, ReactNode } from 'react' import { useTranslation } from 'react-i18next' import AccessibleModal from '../../../../shared/components/accessible-modal' import { Button, Modal } from 'react-bootstrap' import getMeta from '../../../../utils/meta' import { sendMB } from '../../../../infrastructure/event-tracking' function trackUpgradeClick() { sendMB('settings-upgrade-click') } type IntegrationLinkingWidgetProps = { logo: ReactNode title: string description: string helpPath: string hasFeature?: boolean statusIndicator?: ReactNode linked?: boolean linkPath: string unlinkPath: string unlinkConfirmationTitle: string unlinkConfirmationText: string disabled?: boolean } export function IntegrationLinkingWidget({ logo, title, description, helpPath, hasFeature, statusIndicator, linked, linkPath, unlinkPath, unlinkConfirmationTitle, unlinkConfirmationText, disabled, }: IntegrationLinkingWidgetProps) { const { t } = useTranslation() const [showModal, setShowModal] = useState(false) const handleUnlinkClick = useCallback(() => { setShowModal(true) }, []) const handleModalHide = useCallback(() => { setShowModal(false) }, []) return (
{description}{' '} {t('learn_more')}
{hasFeature && statusIndicator}{content}