fix(delete-project): Add tooltip for delete project button when it has protection enabled

This commit is contained in:
carlosmonastyrski
2025-04-24 10:26:54 -03:00
parent 0e488d840f
commit c64e6310a6
@@ -3,7 +3,7 @@ import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions"; import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2"; import { Button, DeleteActionModal, Tooltip } from "@app/components/v2";
import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal"; import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal";
import { import {
ProjectPermissionActions, ProjectPermissionActions,
@@ -142,16 +142,22 @@ export const DeleteProjectSection = () => {
<div className="space-x-4"> <div className="space-x-4">
<ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}> <ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}>
{(isAllowed) => ( {(isAllowed) => (
<Button <Tooltip
isLoading={isDeleting} className="max-w-sm"
isDisabled={!isAllowed || isDeleting || currentWorkspace?.hasDeleteProtection} content="This project is protected from deletion. To delete it, disable delete protection first."
colorSchema="danger" isDisabled={!currentWorkspace?.hasDeleteProtection}
variant="outline_bg"
type="submit"
onClick={() => handlePopUpOpen("deleteWorkspace")}
> >
{`Delete ${currentWorkspace?.name}`} <Button
</Button> isLoading={isDeleting}
isDisabled={!isAllowed || isDeleting || currentWorkspace?.hasDeleteProtection}
colorSchema="danger"
variant="outline_bg"
type="submit"
onClick={() => handlePopUpOpen("deleteWorkspace")}
>
{`Delete ${currentWorkspace?.name}`}
</Button>
</Tooltip>
)} )}
</ProjectPermissionCan> </ProjectPermissionCan>
{!isOnlyAdminMember && ( {!isOnlyAdminMember && (