import { useCallback, useState, ReactNode } from 'react' import { useTranslation } from 'react-i18next' import OLBadge from '@/features/ui/components/ol/ol-badge' import getMeta from '../../../../utils/meta' import { sendMB } from '../../../../infrastructure/event-tracking' import OLButton from '@/features/ui/components/ol/ol-button' import OLModal, { OLModalBody, OLModalFooter, OLModalHeader, OLModalTitle, } from '@/features/ui/components/ol/ol-modal' function trackUpgradeClick(integration: string) { sendMB('settings-upgrade-click', { integration }) } function trackLinkingClick(integration: string) { sendMB('link-integration-click', { integration, location: 'Settings' }) } 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}