-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: draft for collection and folder #3740
Open
pooja-bruno
wants to merge
15
commits into
usebruno:main
Choose a base branch
from
pooja-bruno:add/draft-for-collection-and-folder-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+564
−154
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
34ea352
add: document save button
pooja-bruno 96766b6
add: save btn in file and folder docs
pooja-bruno d3fd0eb
adding save button for folder and collection
pooja-bruno f3a49cb
adding: collection draft
pooja-bruno 10757ac
add: collection closing modal
pooja-bruno 872223f
add: folder draft
pooja-bruno 22f5c5a
Merge branch 'usebruno:main' into add/document-save-button
pooja-bruno ee08fca
add folder condition in collectionChangeFileEvent and some fixes
pooja-bruno 5cf12ae
fixes
pooja-bruno 84b565f
rm: document button changes
pooja-bruno 2dfc7e9
fix
pooja-bruno bdf9b15
small fixes
pooja-bruno 94f155a
rm
pooja-bruno 57ae4ee
Merge branch 'main' into add/draft-for-collection-and-folder-2
pooja-bruno 41acf1e
rm: console
pooja-bruno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
71 changes: 71 additions & 0 deletions
71
packages/bruno-app/src/components/RequestTabs/RequestTab/ConfirmCollectionClose/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,71 @@ | ||
import React from 'react'; | ||
import { IconAlertTriangle } from '@tabler/icons'; | ||
import Modal from 'components/Modal'; | ||
import { useDispatch } from 'react-redux'; | ||
import { deleteCollectionDraft } from 'providers/ReduxStore/slices/collections/index'; | ||
import { closeTabs } from 'providers/ReduxStore/slices/tabs'; | ||
import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/actions'; | ||
|
||
const ConfirmCollectionClose = ({ onCancel, collection, 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 request Collection. | ||
</div> | ||
|
||
<div className="flex justify-between mt-6"> | ||
<div> | ||
<button className="btn btn-sm btn-danger" onClick={() => { | ||
dispatch(deleteCollectionDraft({ collectionUid: collection.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(saveCollectionRoot(collection.uid)) | ||
dispatch( | ||
closeTabs({ | ||
tabUids: [tab.uid] | ||
}) | ||
); | ||
}}> | ||
Save | ||
</button> | ||
</div> | ||
</div> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ConfirmCollectionClose; |
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; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there is a lot of repetition across
ConfirmCollectionClose
, ConfirmFolderClose, and
ConfirRequestClose`This is fine. Lets not try to modularise this.
A good read - https://overreacted.io/the-wet-codebase/