Improve delete folder message

This commit is contained in:
Carlos Monastyrski
2025-08-13 16:13:38 -07:00
parent b0d24de008
commit bad934de48
2 changed files with 20 additions and 1 deletions
@@ -10,6 +10,7 @@ import {
ProjectPermissionActions,
ProjectPermissionSub,
useProjectPermission,
useSubscription,
useWorkspace
} from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
@@ -51,6 +52,7 @@ export const SelectionPanel = ({
usedBySecretSyncs = []
}: Props) => {
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
"bulkDeleteEntries",
@@ -101,6 +103,16 @@ export const SelectionPanel = ({
return "Do you want to delete the selected folders across environments?";
};
const getDeleteModalSubTitle = () => {
if (selectedFolderCount > 0) {
if (subscription?.pitRecovery) {
return "This folder and all its contents will be removed. You can reverse this action by rolling back to a previous commit.";
}
return "This folder and all its contents will be removed. Rolling back to a previous commit isn't available on your current plan. Upgrade to enable this feature.";
}
return undefined;
};
const handleBulkDelete = async () => {
let processedEntries = 0;
@@ -279,6 +291,7 @@ export const SelectionPanel = ({
isOpen={popUp.bulkDeleteEntries.isOpen}
deleteKey="delete"
title={getDeleteModalTitle()}
subTitle={getDeleteModalSubTitle()}
onChange={(isOpen) => handlePopUpToggle("bulkDeleteEntries", isOpen)}
onDeleteApproved={handleBulkDelete}
formContent={