import { useTranslation, Trans } from 'react-i18next' import useAsync from '@/shared/hooks/use-async' import { deleteJSON } from '@/infrastructure/fetch-json' import { OLModalBody, OLModalFooter } from '@/shared/components/ol/ol-modal' import OLButton from '@/shared/components/ol/ol-button' import Notification from '@/shared/components/notification' import { debugConsole } from '@/utils/debugging' import { ProjectSyncState, GitSyncModalStatus } from '../../types/git-sync-types' type GitSyncUnlinkModalProps = { handleHide: () => void setModalStatus: (modalStatus: GitSyncModalStatus) => void projectSyncState: ProjectSyncState projectId: string } const GitSyncUnlinkModal = ({ handleHide, setModalStatus, projectSyncState, projectId, }: GitSyncInitModalProps) => { const { t } = useTranslation() const { error, isLoading, runAsync, } = useAsync() const handleUnlink = () => { runAsync(deleteJSON(`/project/${projectId}/github-sync`)) .then(() => setModalStatus('need-export')) .catch(err => debugConsole.error(err?.data?.message || err?.message || err)) } return ( <>

{t('project_linked_to')}:  {projectSyncState.repoFullName}


{!error ? ( ) : ( : <> ]} /> ) : ( t('something_went_wrong_server') ) } /> )}
{t('confirm')} {t('cancel')}
) } export default GitSyncUnlinkModal