diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 6ed5bfa7a6..5d0e543e17 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -14,6 +14,7 @@ "about_to_delete_the_following_projects": "", "about_to_delete_user_preamble": "", "about_to_enable_managed_users": "", + "about_to_leave_project": "", "about_to_leave_projects": "", "about_to_trash_projects": "", "accept": "", @@ -707,6 +708,7 @@ "leave_any_group_subscriptions": "", "leave_group": "", "leave_now": "", + "leave_project": "", "leave_projects": "", "left": "", "length_unit": "", diff --git a/services/web/frontend/js/features/token-access/components/leave-project-modal.tsx b/services/web/frontend/js/features/token-access/components/leave-project-modal.tsx new file mode 100644 index 0000000000..b4c716f928 --- /dev/null +++ b/services/web/frontend/js/features/token-access/components/leave-project-modal.tsx @@ -0,0 +1,53 @@ +import OLButton from '@/features/ui/components/ol/ol-button' +import OLModal, { + OLModalBody, + OLModalFooter, + OLModalHeader, +} from '@/features/ui/components/ol/ol-modal' +import Notification from '@/shared/components/notification' +import { Modal } from 'react-bootstrap' +import { useTranslation } from 'react-i18next' + +type LeaveProjectModalProps = { + showModal: boolean + handleCloseModal: () => void + handleLeaveAction: () => void +} +function LeaveProjectModal({ + showModal, + handleCloseModal, + handleLeaveAction, +}: LeaveProjectModalProps) { + const { t } = useTranslation() + + return ( + + + {t('leave_project')} + + +

{t('about_to_leave_project')}

+ +
+ + + {t('cancel')} + + handleLeaveAction()}> + {t('confirm')} + + +
+ ) +} + +export default LeaveProjectModal diff --git a/services/web/frontend/js/features/token-access/components/sharing-updates-root.tsx b/services/web/frontend/js/features/token-access/components/sharing-updates-root.tsx index df9a6e5430..2d30c34510 100644 --- a/services/web/frontend/js/features/token-access/components/sharing-updates-root.tsx +++ b/services/web/frontend/js/features/token-access/components/sharing-updates-root.tsx @@ -2,7 +2,7 @@ import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n' import { Trans, useTranslation } from 'react-i18next' import withErrorBoundary from '@/infrastructure/error-boundary' import { GenericErrorBoundaryFallback } from '@/shared/components/generic-error-boundary-fallback' -import { useCallback } from 'react' +import { useCallback, useState } from 'react' import getMeta from '@/utils/meta' import { postJSON } from '@/infrastructure/fetch-json' import { debugConsole } from '@/utils/debugging' @@ -10,7 +10,10 @@ import useAsync from '@/shared/hooks/use-async' import Notification from '@/shared/components/notification' import { sendMB } from '@/infrastructure/event-tracking' +import LeaveProjectModal from './leave-project-modal' + function SharingUpdatesRoot() { + const [showModal, setShowModal] = useState(false) const { isReady } = useWaitForI18n() const { t } = useTranslation() const { isLoading, isSuccess, isError, runAsync } = useAsync() @@ -58,6 +61,11 @@ function SharingUpdatesRoot() { return (
+ setShowModal(false)} + />
@@ -132,7 +140,7 @@ function SharingUpdatesRoot() { // eslint-disable-next-line react/jsx-key