-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: modal and toast improvements #7
Conversation
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.
@anwarulislam I am having a few doubts here:
- The new
HoppModal
doesn't have a proper UI associated with it. I would assume that it should have a UI similar to the oldHoppSmartModal
. - Why do we need
InputDialog
as a separate component? Can it be clubbed withHoppModal
and toggled using props?
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.
@anwarulislam Please look into these comments.
Also, I noticed that we are having really long import statements in most components. I think we can perform an abstraction so that we can have better import hierarchy. We can tackle this in the future though.
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.
toast.success
, toast.error
seems to not be working. In the legacy toast story, clicking on the simple legacy toast button does not invoke a toaster.
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.
-
While testing out the
HoppModal
component behavior from the app, I noticed the modal gets displayed for the first time, but not for further attempts with the following error getting logged to the console.Tried it on the CollectionsAdd component, Ref.
The handler at the page level was updated as below.
// collections/index.vue import { useModals } from "@hoppscotch/ui" import CollectionsAdd from "./Add.vue" const { openModal } = useModals() const displayModalAdd = async (show: boolean) => { showModalAdd.value = show try { const { name: collectionName } = await openModal(CollectionsAdd, { show: showModalAdd.value, loadingState: modalLoadingState.value, }) addNewRootCollection(collectionName) } catch (_) { displayModalAdd(false) } if (!show) resetSelectedData() }
DialogHost
component is rendered at the top levelApp
component. -
Pressing the escape key anytime results in the following exception.
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.
The issue mentioned above with the HoppModal
component persists.
Create collection flow
-
The actions (save/cancel) don't give any feedback during the first attempt at opening the modal.
-
They start responding during further attempts.
-
Creating a collection and attempting to open the modal again results in the above exception.
hopp-modal-behavior.mov
3620593
to
063daeb
Compare
We merged this PR. And publishing them to the latest version. Marking new modal component as beta. We will test it thoroughly before making it alpha. |
Closes HFE-415
Two new components were added.
HoppToast
andHoppModal
.HoppToast
has legacy support for previous Toast integration withvue-toasted
.New Toast (vue-sonner) and Legacy Toast (vue-toasted)
Using Toast
toast
andToaster
from@hoppscotch/ui
.<Toaster />
in your template.toast.success
with a message and options.Using Legacy Toast
legacyToast
from@hoppscotch/ui
.<Toaster />
in your template.legacyToast.success
with a message and options.Using Modal
VuePromiseModalsPlugin
from@hoppscotch/ui
and use it inmain.ts
as pluginapp.use(VuePromiseModalsPlugin)
.useModals
,HoppModal
, andDialogHost
from@hoppscotch/ui
.<DialogHost />
in your template.useModals
to get theopenModal
function.openModal
with a component that usesHoppModal
. (HoppModal
is a UI wrapper for modals)Open a modal component
Create a new component that uses
HoppModal
and defineEmits to emit themodal-reject
event when the modal is closed.And then pass it to
openModal
: