-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10757ac
commit 872223f
Showing
11 changed files
with
220 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
packages/bruno-app/src/components/RequestTabs/RequestTab/ConfirmFolderClose/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from 'react'; | ||
import { IconAlertTriangle } from '@tabler/icons'; | ||
import Modal from 'components/Modal'; | ||
import { closeTabs } from 'providers/ReduxStore/slices/tabs'; | ||
import { useDispatch } from 'react-redux'; | ||
import { deleteFolderDraft } from 'providers/ReduxStore/slices/collections/index'; | ||
import { saveFolderRoot } from 'providers/ReduxStore/slices/collections/actions'; | ||
|
||
const ConfirmFolderClose = ({ onCancel, collection, folder, tab }) => { | ||
const dispatch = useDispatch(); | ||
|
||
return ( | ||
<Modal | ||
size="md" | ||
title="Unsaved changes" | ||
confirmText="Save and Close" | ||
cancelText="Close without saving" | ||
disableEscapeKey={true} | ||
disableCloseOnOutsideClick={true} | ||
closeModalFadeTimeout={150} | ||
handleCancel={onCancel} | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}} | ||
hideFooter={true} | ||
> | ||
<div className="flex items-center font-normal"> | ||
<IconAlertTriangle size={32} strokeWidth={1.5} className="text-yellow-600" /> | ||
<h1 className="ml-2 text-lg font-semibold">Hold on..</h1> | ||
</div> | ||
<div className="font-normal mt-4"> | ||
You have unsaved changes in folder <span className="font-semibold">{folder.name}</span>. | ||
</div> | ||
|
||
<div className="flex justify-between mt-6"> | ||
<div> | ||
<button className="btn btn-sm btn-danger" onClick={() => { | ||
dispatch(deleteFolderDraft({ collectionUid: collection.uid, folderUid: folder.uid })); | ||
dispatch( | ||
closeTabs({ | ||
tabUids: [tab.uid] | ||
}) | ||
); | ||
}}> | ||
Don't Save | ||
</button> | ||
</div> | ||
<div> | ||
<button className="btn btn-close btn-sm mr-2" onClick={onCancel}> | ||
Cancel | ||
</button> | ||
<button className="btn btn-secondary btn-sm" onClick={() => { | ||
dispatch(saveFolderRoot(collection.uid, folder.uid)); | ||
dispatch( | ||
closeTabs({ | ||
tabUids: [tab.uid] | ||
}) | ||
); | ||
}} | ||
> | ||
Save | ||
</button> | ||
</div> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ConfirmFolderClose; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.